npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nos-sql-store

v3.0.1

Published

mssql session store for IBI Data's node starter

Downloads

39

Readme

nos-sql-store

SQL session store for IBI Data's node-starter

Requirements

You need to set up the sessions table and all stored procedures to keep it updated. Run the following script (edit your database name in the USE statement)

USE [<your_db_name_here>]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[sessions](
	[sid] [varchar](255) NOT NULL,
	[session] [varchar](max) NOT NULL,
	[expires] [datetime] NOT NULL,
PRIMARY KEY CLUSTERED
(
	[sid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author			Justin Williamson
-- Date:			4/15/2021
-- Description:		Sessions - all method
-- =============================================
CREATE PROCEDURE [dbo].[proc_sessions_all]
AS
BEGIN
	SET NOCOUNT ON;

	SELECT
		*
	FROM
		[sessions]


END


-- grant exec on [proc_sessions_all] to webuser
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author			Justin Williamson
-- Date:			4/15/2021
-- Description:		Sessions - clear method
-- =============================================
CREATE PROCEDURE [dbo].[proc_sessions_clear]
	@sid VARCHAR(255)
AS
BEGIN
	SET NOCOUNT ON;

	TRUNCATE TABLE [sessions]


END


-- grant exec on [proc_sessions_clear] to webuser
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author			Justin Williamson
-- Date:			4/15/2021
-- Description:		Sessions - destroy method
-- =============================================
CREATE PROCEDURE [dbo].[proc_sessions_destroy]
	@sid VARCHAR(255)
AS
BEGIN
	SET NOCOUNT ON;

	DELETE FROM [sessions] WHERE [sid] = @sid


END


-- grant exec on [proc_sessions_destroy] to webuser
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author			Justin Williamson
-- Date:			4/15/2021
-- Description:		Sessions - get method
-- =============================================
CREATE PROCEDURE [dbo].[proc_sessions_get]
	@sid VARCHAR(255)
AS
BEGIN
	SET NOCOUNT ON;

	SELECT TOP 1
		[session]
	FROM
		[sessions]
	WHERE
		[sid] = @sid


END


-- grant exec on [proc_sessions_get] to webuser
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author			Justin Williamson
-- Date:			4/15/2021
-- Description:		Sessions - length method
-- =============================================
CREATE PROCEDURE [dbo].[proc_sessions_length]
AS
BEGIN
	SET NOCOUNT ON;

	SELECT
		COUNT([sid]) AS howmany
	FROM
		[sessions]


END


-- grant exec on [proc_sessions_length] to webuser
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author			Justin Williamson
-- Date:			4/15/2021
-- Description:		Sessions - set method
-- =============================================
CREATE PROCEDURE [dbo].[proc_sessions_set]
	@sid VARCHAR(255),
	@session VARCHAR(MAX),
	@expires DATETIME
AS
BEGIN
	SET NOCOUNT ON;

	MERGE INTO [sessions] WITH (HOLDLOCK) S
	USING (VALUES(@sid, @session)) AS NS ([sid], [session]) ON (S.[sid] = NS.[sid])
	WHEN MATCHED THEN
		UPDATE SET
			S.[session] = @session,
			S.[expires] = @expires
	WHEN NOT MATCHED THEN
		INSERT ([sid], [session], [expires])
		VALUES (@sid, @session, @expires);

END


-- grant exec on [proc_sessions_set] to webuser
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author			Justin Williamson
-- Date:			4/15/2021
-- Description:		Sessions - touch method
-- =============================================
CREATE PROCEDURE [dbo].[proc_sessions_touch]
	@sid VARCHAR(255),
	@expires DATETIME
AS
BEGIN
	SET NOCOUNT ON;

	UPDATE [sessions] SET [expires] = @expires WHERE [sid] = @sid

END


-- grant exec on [proc_sessions_touch] to webuser
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author			Justin Williamson
-- Date:			4/15/2021
-- Description:		Sessions - delete all expired
-- =============================================
CREATE PROCEDURE [dbo].[proc_sessions_autoremove]
AS
BEGIN
	DELETE FROM [sessions] WHERE expires < GETDATE()
END


-- grant exec on [proc_sessions_autoremove] to webuser