[Phphtmllib-devel] phphtmllib/widgets/data_list PEARSQLDataListSource.inc,1.8,1.9
Status: Beta
Brought to you by:
hemna
From: <cu...@us...> - 2004-03-08 03:31:15
|
Update of /cvsroot/phphtmllib/phphtmllib/widgets/data_list In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7114 Modified Files: PEARSQLDataListSource.inc Log Message: minor modifications to jumpstart postgresql usage Index: PEARSQLDataListSource.inc =================================================================== RCS file: /cvsroot/phphtmllib/phphtmllib/widgets/data_list/PEARSQLDataListSource.inc,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- PEARSQLDataListSource.inc 29 Apr 2003 06:38:05 -0000 1.8 +++ PEARSQLDataListSource.inc 8 Mar 2004 03:15:08 -0000 1.9 @@ -92,7 +92,8 @@ $this->_result = $this->_db->query($this->_query); if (DB::isError($this->_result)) { $msg = $this->_result->getMessage(); - user_error("PEARSQLDataListSource::do_query() - query failed : ".$msg); + $query = $this->_query; + user_error("PEARSQLDataListSource::do_query($query) - query failed : ".$msg); return false; } else { return true; @@ -128,7 +129,7 @@ $clause = " LIMIT $offset, $limit "; break; case "db_pgsql": - $clause = " LIMIT $limit, $offset "; + $clause = " LIMIT $limit OFFSET $offset "; break; default: $clause = " LIMIT $offset, $limit "; @@ -151,14 +152,13 @@ */ function count($tables, $where_clause='', $count_clause='*') { $query = "select count(".$count_clause.") as COUNT from ".$tables." ".$where_clause; - $result = $this->_db->query($query); + $result = $this->_db->getOne($query); if (DB::isError($result)) { $msg = $result->getMessage(); user_error("PEARSQLDataListSource::count() - query failed : ".$msg); return 0; } else { - $value = $result->fetchRow(DB_FETCHMODE_ASSOC); - return ($value ? (int)$value["COUNT"] : NULL); + return $result; } } |