summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_dbi.class13
1 files changed, 13 insertions, 0 deletions
diff --git a/it_dbi.class b/it_dbi.class
index 16fe7dc..161dbce 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -599,6 +599,19 @@ function delete($query = null)
return $result;
}
+/**
+ * Return information about a table's fields as array (Field => array(Field,Type,Null,Key,Default,Extra,Length))
+ */
+function get_field_info()
+{
+ $result = array();
+ for ($res = $this->query('SHOW COLUMNS FROM ' . $this->_table); $field = mysql_fetch_assoc($res);)
+ $result[$field['Field']] = $field + array('Length' => intval(it::match('\d+', $field['Type'])));
+
+ return $result;
+}
+
+
} /* End class it_dbi */
?>