summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Gass2013-01-30 15:01:56 +0000
committerNathan Gass2013-01-30 15:01:56 +0000
commitcf4545ccbb610a75a8b1385cfe3e1739d589cea0 (patch)
tree2fce172560ca6aa7b7872b9ecfdc40fab9095e83
parent0902a364fc9d9a76dae421d40fcf8ed995a5ce56 (diff)
downloaditools-cf4545ccbb610a75a8b1385cfe3e1739d589cea0.tar.gz
itools-cf4545ccbb610a75a8b1385cfe3e1739d589cea0.tar.bz2
itools-cf4545ccbb610a75a8b1385cfe3e1739d589cea0.zip
add parameter unbuffered for very large selects
-rw-r--r--it_dbi.class5
1 files changed, 3 insertions, 2 deletions
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)