cvs: pear /MDB/MDB fbsql.php

From: Date: Fri, 27 Dec 2002 18:34:52 +0000
Subject: cvs: pear /MDB/MDB fbsql.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-7968@lists.php.net to get a copy of this message
fmk Fri Dec 27 13:34:52 2002 EDT Modified files: /pear/MDB/MDB fbsql.php Log: Fixing ending ; required by FrontBase Fixing LIMIT clause., it is called TOP in FrontBase Index: pear/MDB/MDB/fbsql.php diff -u pear/MDB/MDB/fbsql.php:1.1 pear/MDB/MDB/fbsql.php:1.2 --- pear/MDB/MDB/fbsql.php:1.1 Thu Dec 26 16:38:04 2002 +++ pear/MDB/MDB/fbsql.php Fri Dec 27 13:34:52 2002 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@dybnet.de> | // +----------------------------------------------------------------------+ // -// $Id: fbsql.php,v 1.1 2002/12/26 21:38:04 fmk Exp $ +// $Id: fbsql.php,v 1.2 2002/12/27 18:34:52 fmk Exp $ // require_once 'MDB/Common.php'; @@ -229,16 +229,16 @@ } if ($this->connection) { if ($auto_commit) { - $result = $this->query('COMMIT;'); + $result = $this->query('COMMIT'); if (MDB::isError($result)) { return $result; } - $result = $this->query('SET COMMIT TRUE;'); + $result = $this->query('SET COMMIT TRUE'); if (MDB::isError($result)) { return $result; } } else { - $result = $this->query('SET COMMIT FALSE;'); + $result = $this->query('SET COMMIT FALSE'); if (MDB::isError($result)) { return $result; } @@ -272,7 +272,7 @@ return $this->raiseError(MDB_ERROR, '', '', 'Commit transactions: transaction changes are being auto commited'); } - return ($this->query('COMMIT;')); + return ($this->query('COMMIT')); } // }}} @@ -299,7 +299,7 @@ return $this->raiseError(MDB_ERROR, '', '', 'Rollback transactions: transactions can not be rolled back when changes are auto commited'); } - return ($this->query('ROLLBACK;')); + return ($this->query('ROLLBACK')); } // }}} @@ -431,10 +431,8 @@ return $result; } if($limit > 0) { - if ($ismanip) { - $query .= " LIMIT $limit"; - } else { - $query .= " LIMIT $first,$limit"; + if (!$ismanip) { + eregi_replace("SELECT", "SELECT TOP($first,$limit)", $query)"; } } @@ -444,6 +442,8 @@ } } + // Add ; to the end of the query. This is required by FrontBase + $query .= ";"; if ($result = fbsql_query($query, $this->connection)) { if ($ismanip) { $this->affected_rows = fbsql_affected_rows($this->connection); @@ -1258,7 +1258,7 @@ function nextId($seq_name, $ondemand = TRUE) { $sequence_name = $this->getSequenceName($seq_name); - $result = $this->query("INSERT INTO $sequence_name (sequence) VALUES (NULL);"); + $result = $this->query("INSERT INTO $sequence_name (sequence) VALUES (NULL)"); if ($ondemand && MDB::isError($result) && $result->getCode() == MDB_ERROR_NOSUCHTABLE) { @@ -1275,7 +1275,7 @@ } } $value = intval(fbsql_insert_id()); - $res = $this->query("DELETE FROM $sequence_name WHERE sequence < $value;"); + $res = $this->query("DELETE FROM $sequence_name WHERE sequence < $value"); if (MDB::isError($res)) { $this->warnings[] = 'Next ID: could not delete previous sequence table values'; } @@ -1296,7 +1296,7 @@ function currId($seq_name) { $sequence_name = $this->getSequenceName($seq_name); - $result = $this->query("SELECT MAX(sequence) FROM $sequence_name;", 'integer'); + $result = $this->query("SELECT MAX(sequence) FROM $sequence_name", 'integer'); if (MDB::isError($result)) { return $result; }

« previous php.pear.cvs (#7968) next »