summaryrefslogtreecommitdiff
path: root/it_dbi.class
diff options
context:
space:
mode:
authorChristian Weber2007-09-17 17:13:14 +0000
committerChristian Weber2007-09-17 17:13:14 +0000
commita345bc8f0691f49b06d8af45d10c09e6ecfbfe6f (patch)
tree3204c79d99650baaeb7239b9b1a38b08bfb58bed /it_dbi.class
parenta5a9f6822e3508ee6d0c28b872a4f260cd29bfa2 (diff)
downloaditools-a345bc8f0691f49b06d8af45d10c09e6ecfbfe6f.tar.gz
itools-a345bc8f0691f49b06d8af45d10c09e6ecfbfe6f.tar.bz2
itools-a345bc8f0691f49b06d8af45d10c09e6ecfbfe6f.zip
Add function get_field_info()
Diffstat (limited to 'it_dbi.class')
-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 */
?>