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; |
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 "; |
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 |
|
|