summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_dbi_postgres.class9
1 files changed, 9 insertions, 0 deletions
diff --git a/it_dbi_postgres.class b/it_dbi_postgres.class
index c26f5fc..2483ab9 100644
--- a/it_dbi_postgres.class
+++ b/it_dbi_postgres.class
@@ -54,6 +54,11 @@ function _tables($p = array())
return (array)$result;
}
+static function _convertbool($v)
+{
+ return $v == 't' ? true : false;
+}
+
function _get_field_defs()
{
list($table_name, $table_schema) = array_reverse(explode('.', $this->_p['table'], 2));
@@ -71,7 +76,11 @@ function _get_field_defs()
$res = $this->query('SELECT * FROM information_schema.columns AS t ' . $where);
while ($res && ($field = $this->_fetch_assoc($res)))
+ {
$result[$field['column_name']] = ['Field' => $field['column_name'], 'Type' => $field['data_type'], 'Extra' => it::match('^nextval\(', $field['column_default']) ? 'auto_increment' : '', 'Key' => $keys[$field['column_name']]];
+ if ($field['data_type'] == 'boolean')
+ $result[$field['column_name']] += ['_convertfunc' => 'it_dbi_postgres::_convertbool', '_escapefunc' => 'it_dbi::escape_bool'];
+ }
return $result;
}