Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d327bae

Browse filesBrowse files
committed
feature symfony#4557 Update pdo_session_storage.rst (spbentz)
This PR was submitted for the master branch but it was merged into the 2.6 branch instead (closes symfony#4557). Discussion ---------- Update pdo_session_storage.rst Changes after the 2.6.0 release keeping the names of the values as they where. Commits ------- 3e51551 Update pdo_session_storage.rst
2 parents 38163f0 + 3e51551 commit d327bae
Copy full SHA for d327bae

File tree

Expand file treeCollapse file tree

1 file changed

+26
-21
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+26
-21
lines changed

‎cookbook/configuration/pdo_session_storage.rst

Copy file name to clipboardExpand all lines: cookbook/configuration/pdo_session_storage.rst
+26-21Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ configuration format of your choice):
2626
2727
parameters:
2828
pdo.db_options:
29-
db_table: session
30-
db_id_col: session_id
31-
db_data_col: session_value
32-
db_time_col: session_time
29+
db_table: session
30+
db_id_col: session_id
31+
db_data_col: session_data
32+
db_time_col: session_time
33+
db_lifetime_col: session_lifetime
3334
3435
services:
3536
pdo:
@@ -56,8 +57,9 @@ configuration format of your choice):
5657
<parameter key="pdo.db_options" type="collection">
5758
<parameter key="db_table">session</parameter>
5859
<parameter key="db_id_col">session_id</parameter>
59-
<parameter key="db_data_col">session_value</parameter>
60+
<parameter key="db_data_col">session_data</parameter>
6061
<parameter key="db_time_col">session_time</parameter>
62+
<parameter key="db_lifetime_col">session_lifetime</parameter>
6163
</parameter>
6264
</parameters>
6365
@@ -93,10 +95,11 @@ configuration format of your choice):
9395
));
9496
9597
$container->setParameter('pdo.db_options', array(
96-
'db_table' => 'session',
97-
'db_id_col' => 'session_id',
98-
'db_data_col' => 'session_value',
99-
'db_time_col' => 'session_time',
98+
'db_table' => 'session',
99+
'db_id_col' => 'session_id',
100+
'db_data_col' => 'session_data',
101+
'db_time_col' => 'session_time',
102+
'db_lifetime_col' => 'session_lifetime',
100103
));
101104
102105
$pdoDefinition = new Definition('PDO', array(
@@ -114,9 +117,10 @@ configuration format of your choice):
114117
$container->setDefinition('session.handler.pdo', $storageDefinition);
115118
116119
* ``db_table``: The name of the session table in your database
117-
* ``db_id_col``: The name of the id column in your session table (VARCHAR(255) or larger)
118-
* ``db_data_col``: The name of the value column in your session table (TEXT or CLOB)
120+
* ``db_id_col``: The name of the id column in your session table (VARCHAR(128))
121+
* ``db_data_col``: The name of the value column in your session table (BLOB)
119122
* ``db_time_col``: The name of the time column in your session table (INTEGER)
123+
* ``db_lifetime_col``: The name of the lifetime column in your session table (INTEGER)
120124

121125
Sharing your Database Connection Information
122126
--------------------------------------------
@@ -168,11 +172,11 @@ following (MySQL):
168172
.. code-block:: sql
169173
170174
CREATE TABLE `session` (
171-
`session_id` varchar(255) NOT NULL,
172-
`session_value` text NOT NULL,
173-
`session_time` int(11) NOT NULL,
174-
PRIMARY KEY (`session_id`)
175-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
175+
`session_id` VARBINARY(128) NOT NULL PRIMARY KEY,
176+
`session_data` BLOB NOT NULL,
177+
`session_time` INTEGER UNSIGNED NOT NULL,
178+
`session_lifetime` MEDIUMINT NOT NULL
179+
) COLLATE utf8_bin, ENGINE = InnoDB;
176180
177181
PostgreSQL
178182
~~~~~~~~~~
@@ -182,10 +186,10 @@ For PostgreSQL, the statement should look like this:
182186
.. code-block:: sql
183187
184188
CREATE TABLE session (
185-
session_id character varying(255) NOT NULL,
186-
session_value text NOT NULL,
187-
session_time integer NOT NULL,
188-
CONSTRAINT session_pkey PRIMARY KEY (session_id)
189+
session_id VARCHAR(128) NOT NULL PRIMARY KEY,
190+
session_data BYTEA NOT NULL,
191+
session_time INTEGER NOT NULL,
192+
session_lifetime INTEGER NOT NULL
189193
);
190194
191195
Microsoft SQL Server
@@ -197,8 +201,9 @@ For MSSQL, the statement might look like the following:
197201
198202
CREATE TABLE [dbo].[session](
199203
[session_id] [nvarchar](255) NOT NULL,
200-
[session_value] [ntext] NOT NULL,
204+
[session_data] [ntext] NOT NULL,
201205
[session_time] [int] NOT NULL,
206+
[session_lifetime] [int] NOT NULL,
202207
PRIMARY KEY CLUSTERED(
203208
[session_id] ASC
204209
) WITH (

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.