switch(cfg.DBTYPE) {
case "MySQL":
query_tables = "SHOW TABLES";
- query_describe_table = "DESCRIBE '%s'";
+ query_describe_table = "DESCRIBE `%s`";
break;
case 'PostgreSQL':
"LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace " +
"WHERE c.relkind IN ('r','') AND n.nspname NOT IN ('pg_catalog', 'pg_toast')" +
"AND pg_catalog.pg_table_is_visible(c.oid) ";
-
+ query_describe_table = "SELECT " +
+ "attname , typname FROM pg_attribute , pg_type WHERE " +
+ "typrelid=attrelid AND typname = '%s' ";
break;
var readers = [];
tables.forEach(function(table) {
//print(table);
- var schema = Gda.execute_select_command(cnc, "DESCRIBE `" + table+'`').fetchAll();
+ var schema = Gda.execute_select_command(cnc,
+ query_describe_table.replace(/%s/, table) ).fetchAll();
+
+
var reader = [];
var colmodel = [];
var combofields= [ { name : 'id', type: 'int' } ]; // technically the primary key..
var firstTxtCol = '';
- //print(JSON.stringify(schema, null,4));
+ print(JSON.stringify(schema, null,4));
schema.forEach(function(e) {
var type = e.Type.match(/([^(]+)\(([^\)]+)\)/);