summaryrefslogtreecommitdiff
path: root/includes/database.mysql.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/database.mysql.inc')
-rw-r--r--includes/database.mysql.inc7
1 files changed, 7 insertions, 0 deletions
diff --git a/includes/database.mysql.inc b/includes/database.mysql.inc
index 4617ca125..72f3a4c7a 100644
--- a/includes/database.mysql.inc
+++ b/includes/database.mysql.inc
@@ -422,6 +422,13 @@ function db_table_exists($table) {
}
/**
+ * 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));
+}
+
+/**
* Wraps the given table.field entry with a DISTINCT(). The wrapper is added to
* the SELECT list entry of the given query and the resulting query is returned.
* This function only applies the wrapper if a DISTINCT doesn't already exist in