From 9050e15621523ed306fda50d24f5fe79eaa3ddb0 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 21 Apr 2007 18:08:41 +0000 Subject: - Patch #137479 by dww: added db_column_exits(). (Yay, the servers are snappy on Saturday evening.) --- includes/database.mysqli.inc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'includes/database.mysqli.inc') diff --git a/includes/database.mysqli.inc b/includes/database.mysqli.inc index 5e829fbd3..04f8cc9aa 100644 --- a/includes/database.mysqli.inc +++ b/includes/database.mysqli.inc @@ -401,6 +401,13 @@ function db_table_exists($table) { return db_num_rows(db_query("SHOW TABLES LIKE '{". db_escape_table($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. -- cgit v1.2.3