Skip to content

Commit 93169c7

Browse files
committed
minor #14823 Change in table creation SQL for SQL Server (Arkasian)
This PR was merged into the 4.4 branch. Discussion ---------- 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. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `5.x` for features of unreleased versions). --> Commits ------- 74fdd75 Change in table creation SQL for SQL Server
2 parents 7c6a9da + 74fdd75 commit 93169c7

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)