fix "unbuffered queries" bug (issue #75)

This commit is contained in:
Michael Save committed 2012-08-27 21:37:21 +10:00
1 parent 6229b82a43
commit 28392a12d3
2 files changed
+7 -3

No files matched your search

+2 -1
View File
@@ -13,7 +13,8 @@ Requirements
2. [mbstring](http://www.php.net/manual/en/mbstring.installation.php) 2. [mbstring](http://www.php.net/manual/en/mbstring.installation.php)
(--enable-mbstring) (--enable-mbstring)
3. [PHP-GD](http://php.net/manual/en/book.image.php) 3. [PHP-GD](http://php.net/manual/en/book.image.php)
4. [PHP-PDO](http://php.net/manual/en/book.pdo.php) with appropriate <del>[driver for your database](http://www.php.net/manual/en/pdo.drivers.php)</del> (only MySQL is supported at the moment) 4. [PHP-PDO](http://php.net/manual/en/book.pdo.php)
(only MySQL is supported at the moment)
We try to make sure Tinyboard is compatible with all major web servers and We try to make sure Tinyboard is compatible with all major web servers and
operating systems. Tinyboard does not include an Apache ```.htaccess``` file nor does operating systems. Tinyboard does not include an Apache ```.htaccess``` file nor does
+5 -2
View File
@@ -49,8 +49,11 @@ function sql_open() {
if (!empty($config['db']['dsn'])) if (!empty($config['db']['dsn']))
$dsn .= ';' . $config['db']['dsn']; $dsn .= ';' . $config['db']['dsn'];
try { try {
$options = Array(PDO::ATTR_TIMEOUT => $config['db']['timeout']); $options = array(
$options = Array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'); PDO::ATTR_TIMEOUT => $config['db']['timeout'],
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true
);
if ($config['db']['persistent']) if ($config['db']['persistent'])
$options[PDO::ATTR_PERSISTENT] = true; $options[PDO::ATTR_PERSISTENT] = true;
return $pdo = new PDO($dsn, $config['db']['user'], $config['db']['password'], $options); return $pdo = new PDO($dsn, $config['db']['user'], $config['db']['password'], $options);