Browse Source

fix "unbuffered queries" bug (issue #75)

pull/40/head
Michael Save 12 years ago
parent
commit
28392a12d3
  1. 3
      README.md
  2. 7
      inc/database.php

3
README.md

@ -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

7
inc/database.php

@ -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);

Loading…
Cancel
Save