summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJaime Perez Crespo <jaime.perez@uninett.no>2016-06-02 11:53:07 +0200
committerJaime Perez Crespo <jaime.perez@uninett.no>2016-06-02 11:53:07 +0200
commitdbc3cbf0266ba325fe70eabad9e73e14cf0e58ef (patch)
treeb0f3b44ad6518f98e5d35d96392084c2da795838 /lib
parent6b529186438722868a15c1538151b55768027a3a (diff)
downloadsimplesamlphp-dbc3cbf0266ba325fe70eabad9e73e14cf0e58ef.zip
simplesamlphp-dbc3cbf0266ba325fe70eabad9e73e14cf0e58ef.tar.gz
simplesamlphp-dbc3cbf0266ba325fe70eabad9e73e14cf0e58ef.tar.bz2
Use LONGTEXT instead of the TEXT data type in MySQL to avoid size constraints in the latter. This resolves #399.
Diffstat (limited to 'lib')
-rw-r--r--lib/SimpleSAML/Store/SQL.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/SimpleSAML/Store/SQL.php b/lib/SimpleSAML/Store/SQL.php
index 9a3666a..534f2ea 100644
--- a/lib/SimpleSAML/Store/SQL.php
+++ b/lib/SimpleSAML/Store/SQL.php
@@ -95,7 +95,12 @@ class SimpleSAML_Store_SQL extends SimpleSAML_Store {
return;
}
- $query = 'CREATE TABLE ' . $this->prefix . '_kvstore (_type VARCHAR(30) NOT NULL, _key VARCHAR(50) NOT NULL, _value TEXT NOT NULL, _expire TIMESTAMP, PRIMARY KEY (_key, _type))';
+ $text_t = 'TEXT';
+ if ($this->driver === 'mysql') {
+ // TEXT data type has size constraints that can be hit at some point, so we use LONGTEXT instead
+ $text_t = 'LONGTEXT';
+ }
+ $query = 'CREATE TABLE ' . $this->prefix . '_kvstore (_type VARCHAR(30) NOT NULL, _key VARCHAR(50) NOT NULL, _value '.$text_t.' NOT NULL, _expire TIMESTAMP, PRIMARY KEY (_key, _type))';
$this->pdo->exec($query);
$query = 'CREATE INDEX ' . $this->prefix . '_kvstore_expire ON ' . $this->prefix . '_kvstore (_expire)';