From cf4545ccbb610a75a8b1385cfe3e1739d589cea0 Mon Sep 17 00:00:00 2001 From: Nathan Gass Date: Wed, 30 Jan 2013 15:01:56 +0000 Subject: add parameter unbuffered for very large selects --- it_dbi.class | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'it_dbi.class') diff --git a/it_dbi.class b/it_dbi.class index 8210b04..3d4f2a9 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -37,6 +37,7 @@ class it_dbi 'classprefix' => "", 'getfieldinfo' => true, # do not read schema. only select() allowed 'localized_defaultlanguage' => "de", # Localize fields with this suffix, e.g. copy title_de to title on read + 'unbuffered' => false, # use mysql_unbuffered_query (WARNING this is not at all equivalent to normal it_dbi WARNING) ); var $_key; # Key of currently loaded record or null (public readonly) @@ -455,7 +456,7 @@ function query($query, $p = array()) debug("{$p['user']}@{$p['server']}:{$p['db']}" . '.' . get_class($this) . "::query(\"$query\")", 4); - if (!($result = mysql_query($query, $this->_link)) && $p['safety']) + if (!($result = ($p['unbuffered'] ? mysql_unbuffered_query($query, $this->_link) : mysql_query($query, $this->_link))) && $p['safety']) { $errno = mysql_errno($this->_link); if (($p['safety'] < 2) && ($errno == 1062)) # Duplicate entry @@ -465,7 +466,7 @@ function query($query, $p = array()) { it::log('sqllog', "it_dbi(): reconnecting mysql_connect {$p['server']}, {$p['db']}"); $this->_connect(array('reconnect' => true)); - $result = mysql_query($query, $this->_link); + $result = $p['unbuffered'] ? mysql_unbuffered_query($query, $this->_link) : mysql_query($query, $this->_link); } if (!$result) -- cgit v1.2.3