/[cvs]/nfo/php/libs/com.newsblob.phphtmllib/widgets/data_list/PEARSQLDataListSource.inc
ViewVC logotype

Diff of /nfo/php/libs/com.newsblob.phphtmllib/widgets/data_list/PEARSQLDataListSource.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by jonen, Thu May 6 12:59:55 2004 UTC revision 1.4 by jonen, Thu May 6 16:27:50 2004 UTC
# Line 92  class PEARSQLDataListSource extends SQLD Line 92  class PEARSQLDataListSource extends SQLD
92                  $this->_result = $this->_db->query($this->_query);                  $this->_result = $this->_db->query($this->_query);
93                  if (DB::isError($this->_result)) {                  if (DB::isError($this->_result)) {
94                          $msg = $this->_result->getMessage();                          $msg = $this->_result->getMessage();
95                          user_error("PEARSQLDataListSource::do_query() - query failed : ".$msg);              $query = $this->_query;
96                            user_error("PEARSQLDataListSource::do_query($query) - query failed : ".$msg);
97              return false;              return false;
98                  } else {                  } else {
99              return true;              return true;
# Line 128  class PEARSQLDataListSource extends SQLD Line 129  class PEARSQLDataListSource extends SQLD
129                                  $clause = " LIMIT $offset, $limit ";                                  $clause = " LIMIT $offset, $limit ";
130                                  break;                                  break;
131                          case "db_pgsql":                          case "db_pgsql":
132                                  $clause = " LIMIT $limit, $offset ";                                  $clause = " LIMIT $limit OFFSET $offset ";
133                                  break;                                  break;
134                          default:                          default:
135                                  $clause = " LIMIT $offset, $limit ";                                  $clause = " LIMIT $offset, $limit ";
# Line 151  class PEARSQLDataListSource extends SQLD Line 152  class PEARSQLDataListSource extends SQLD
152       */       */
153      function count($tables, $where_clause='', $count_clause='*') {      function count($tables, $where_clause='', $count_clause='*') {
154                  $query = "select count(".$count_clause.") as COUNT from ".$tables." ".$where_clause;                  $query = "select count(".$count_clause.") as COUNT from ".$tables." ".$where_clause;
155          $result = $this->_db->query($query);          $result = $this->_db->getOne($query);
156                  if (DB::isError($result)) {                  if (DB::isError($result)) {
157                          $msg = $result->getMessage();                          $msg = $result->getMessage();
158                          user_error("PEARSQLDataListSource::count() - query failed : ".$msg);                          user_error("PEARSQLDataListSource::count() - query failed : ".$msg);
159              return 0;              return 0;
160                  } else {                  } else {
161              $value = $result->fetchRow(DB_FETCHMODE_ASSOC);              return $result;
             return ($value ? (int)$value["COUNT"] : NULL);  
162          }                        }              
163      }      }
164            

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed