From 74fdd75b65cda79d6d34e8f46a27d06e4cecce89 Mon Sep 17 00:00:00 2001 From: Lukas Date: Tue, 12 Jan 2021 09:25:37 +0100 Subject: [PATCH] Change in table creation SQL for SQL Server I propose to change VARBINARY to NVARCHAR, because for the newest version of drivers and SQL Server 17 or newer this script creates a table which is not valid: PdoSessionHandler actually tries to insert string in sess_data not binary data. What's more: VARBINARY(max) is about 8kB long at most whereas NVARCHAR can contain up to 2GB of data. There is of course another way, suggested by ODBC error while trying to insert data to sessions created like shown: use convert during inserting, however I would not consider it a way. --- session/database.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/session/database.rst b/session/database.rst index 8766ab9f2a8..badd1412145 100644 --- a/session/database.rst +++ b/session/database.rst @@ -417,7 +417,7 @@ Microsoft SQL Server CREATE TABLE sessions ( sess_id VARCHAR(128) NOT NULL PRIMARY KEY, - sess_data VARBINARY(MAX) NOT NULL, + sess_data NVARCHAR(MAX) NOT NULL, sess_lifetime INTEGER NOT NULL, sess_time INTEGER NOT NULL );