Skip to content

Commit 74fdd75

Browse files
authored
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.
1 parent f95a6c0 commit 74fdd75

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

session/database.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ Microsoft SQL Server
417417
418418
CREATE TABLE sessions (
419419
sess_id VARCHAR(128) NOT NULL PRIMARY KEY,
420-
sess_data VARBINARY(MAX) NOT NULL,
420+
sess_data NVARCHAR(MAX) NOT NULL,
421421
sess_lifetime INTEGER NOT NULL,
422422
sess_time INTEGER NOT NULL
423423
);

0 commit comments

Comments
 (0)