- status: open --> open-fixed
The scripts eats up memory counting rows of large tables. I made a fix in the SQLiteToGrid.php:
Here is the changes:
if (eregi('^SELECT \* FROM', $this->query)) {
$q = eregi_replace('^SELECT \* FROM','SELECT COUNT(*) as count FROM', $this->query);
if ($this->SQLiteConnId->query($q)) {
$this->nbRecordQuery = $this->SQLiteConnId->fetch_single();
}
}
else {
$tabResult = $this->SQLiteConnId->array_query($this->query);
$this->nbRecordQuery = count($tabResult);
}
Here is where:
function _countRecord(){
if(!isset($this->nbRecordQuery)){
if($this->SQLiteConnId->getVersion()==2) {
$qCount = preg_match('/^\s*(UPDATE|DELETE|INSERT|ALTER|JOIN|GROUP|LIMIT|PRAGMA)\s/i', $this->query);
} else {
$qCount = false;
}
if($qCount){
if($this->SQLiteConnId->query($this->queryCount)){
$this->nbRecordQuery = $this->SQLiteConnId->fetch_single();
} else $this->_sendError($GLOBALS['traduct']->get(117));
} else {
if (eregi('^SELECT \* FROM', $this->query)) {
$q = eregi_replace('^SELECT \* FROM','SELECT COUNT(*) as count FROM', $this->query);
if ($this->SQLiteConnId->query($q)) {
$this->nbRecordQuery = $this->SQLiteConnId->fetch_single();
}
}
else {
$tabResult = $this->SQLiteConnId->array_query($this->query);
$this->nbRecordQuery = count($tabResult);
}
}
}
return $this->nbRecordQuery;
}
From, Pestuz