adjust meta data queries for mysql

This commit is contained in:
Sven Klemm 2018-10-19 15:05:49 +02:00
parent aae21a631e
commit 8ce7e113d9

View File

@ -79,14 +79,14 @@ export class MysqlMetaQuery {
query += ' AND table_name = ' + this.quoteIdentAsLiteral(parts[1]); query += ' AND table_name = ' + this.quoteIdentAsLiteral(parts[1]);
return query; return query;
} else { } else {
query = ' table_name = ' + this.quoteIdentAsLiteral(table); query = 'table_schema = database() AND table_name = ' + this.quoteIdentAsLiteral(table);
return query; return query;
} }
} }
buildTableQuery() { buildTableQuery() {
return "SELECT table_name FROM information_schema.tables WHERE table_schema <> 'information_schema' ORDER BY table_name"; return 'SELECT table_name FROM information_schema.tables WHERE table_schema = database() ORDER BY table_name';
} }
buildColumnQuery(type?: string) { buildColumnQuery(type?: string) {
@ -95,7 +95,7 @@ export class MysqlMetaQuery {
switch (type) { switch (type) {
case 'time': { case 'time': {
query += " AND data_type IN ('timestamp','datetime','bigint','int','float')"; query += " AND data_type IN ('timestamp','datetime','bigint','int','double','float')";
break; break;
} }
case 'metric': { case 'metric': {
@ -103,8 +103,7 @@ export class MysqlMetaQuery {
break; break;
} }
case 'value': { case 'value': {
query += query += " AND data_type IN ('bigint','int','smallint','mediumint','tinyint','double','decimal','float')";
" AND data_type IN ('bigint','int','float','smallint', 'mediumint', 'tinyint', 'double', 'decimal', 'float')";
query += ' AND column_name <> ' + this.quoteIdentAsLiteral(this.target.timeColumn); query += ' AND column_name <> ' + this.quoteIdentAsLiteral(this.target.timeColumn);
break; break;
} }