From a345bc8f0691f49b06d8af45d10c09e6ecfbfe6f Mon Sep 17 00:00:00 2001 From: Christian Weber Date: Mon, 17 Sep 2007 17:13:14 +0000 Subject: Add function get_field_info() --- it_dbi.class | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 */ ?> -- cgit v1.2.3