summaryrefslogtreecommitdiff
path: root/includes/database.mysqli.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-08-12 15:55:36 +0000
committerDries Buytaert <dries@buytaert.net>2007-08-12 15:55:36 +0000
commitb134b023e11902ceae12f3ab861da1f0a2fdbdbd (patch)
treefc0f0be2b23f047dd692e615e3671318f6d60f4d /includes/database.mysqli.inc
parent4e6068baf2c4dcb776efbdeb16621ffbdfa42c0f (diff)
downloadbrdo-b134b023e11902ceae12f3ab861da1f0a2fdbdbd.tar.gz
brdo-b134b023e11902ceae12f3ab861da1f0a2fdbdbd.tar.bz2
- Patch #163191 by hswong3i: removed db_num_rows() for compatibility with Oracle and DB2. Also a performance improvement.
Diffstat (limited to 'includes/database.mysqli.inc')
-rw-r--r--includes/database.mysqli.inc23
1 files changed, 4 insertions, 19 deletions
diff --git a/includes/database.mysqli.inc b/includes/database.mysqli.inc
index 38c3ce572..b51502a75 100644
--- a/includes/database.mysqli.inc
+++ b/includes/database.mysqli.inc
@@ -190,20 +190,6 @@ function db_fetch_array($result) {
}
/**
- * Determine how many result rows were found by the preceding query.
- *
- * @param $result
- * A database query result resource, as returned from db_query().
- * @return
- * The number of result rows.
- */
-function db_num_rows($result) {
- if ($result) {
- return mysqli_num_rows($result);
- }
-}
-
-/**
* Return an individual result field from the previous query.
*
* Only use this function if exactly one field is being selected; otherwise,
@@ -294,9 +280,8 @@ function db_query_range($query) {
* so that they can be properly escaped to avoid SQL injection attacks.
*
* Note that if you need to know how many results were returned, you should do
- * a SELECT COUNT(*) on the temporary table afterwards. db_num_rows() and
- * db_affected_rows() do not give consistent result across different database
- * types in this case.
+ * a SELECT COUNT(*) on the temporary table afterwards. db_affected_rows() does
+ * not give consistent result across different database types in this case.
*
* @param $query
* A string containing a normal SELECT SQL query.
@@ -382,14 +367,14 @@ function db_unlock_tables() {
* Check if a table exists.
*/
function db_table_exists($table) {
- return db_num_rows(db_query("SHOW TABLES LIKE '{". db_escape_table($table) ."}'"));
+ return db_fetch_object(db_query("SHOW TABLES LIKE '{". db_escape_table($table) ."}'")) ? TRUE : FALSE;
}
/**
* Check if a column exists in the given table.
*/
function db_column_exists($table, $column) {
- return db_num_rows(db_query("SHOW COLUMNS FROM {%s} LIKE '%s'", $table, $column));
+ return db_fetch_object(db_query("SHOW COLUMNS FROM {%s} LIKE '%s'", $table, $column)) ? TRUE : FALSE;
}
/**