Skip to content

Commit

Permalink
Fixing a bug in the SQLite layer (and MySQLi, though it wasnt causing…
Browse files Browse the repository at this point in the history
… a problem there for some reason) that caused ->result() to not return false even when it fails.
  • Loading branch information
reines committed Jun 25, 2010
1 parent 5840d8e commit af8ff9a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
7 changes: 5 additions & 2 deletions include/dblayer/mysqli.php
Expand Up @@ -94,10 +94,13 @@ function result($query_id = 0, $row = 0, $col = 0)
{
if ($query_id)
{
if ($row)
@mysqli_data_seek($query_id, $row);
if ($row !== 0 && @mysqli_data_seek($query_id, $row) === false)
return false;

$cur_row = @mysqli_fetch_row($query_id);
if ($cur_row === false)
return false;

return $cur_row[$col];
}
else
Expand Down
7 changes: 5 additions & 2 deletions include/dblayer/mysqli_innodb.php
Expand Up @@ -107,10 +107,13 @@ function result($query_id = 0, $row = 0, $col = 0)
{
if ($query_id)
{
if ($row)
@mysqli_data_seek($query_id, $row);
if ($row !== 0 && @mysqli_data_seek($query_id, $row) === false)
return false;

$cur_row = @mysqli_fetch_row($query_id);
if ($cur_row === false)
return false;

return $cur_row[$col];
}
else
Expand Down
7 changes: 5 additions & 2 deletions include/dblayer/sqlite.php
Expand Up @@ -127,10 +127,13 @@ function result($query_id = 0, $row = 0, $col = 0)
{
if ($query_id)
{
if ($row != 0)
@sqlite_seek($query_id, $row);
if ($row !== 0 && @sqlite_seek($query_id, $row) === false)
return false;

$cur_row = @sqlite_current($query_id);
if ($cur_row === false)
return false;

return $cur_row[$col];
}
else
Expand Down

0 comments on commit af8ff9a

Please sign in to comment.