Browse Source

finding error

pull/122/head
Zbynek Rybicka 6 years ago committed by Jeremy Nagel
parent
commit
125c5ecadb
  1. 4
      lib/util/data.helper.js
  2. 37
      lib/xsql.js

4
lib/util/data.helper.js

@ -146,6 +146,10 @@ exports.getSchemaQuery = function() {
); );
}; };
exports.getRoutines = function () {
return 'select routine_name from information_schema.routines'
}
exports.getChartQuery = function() { exports.getChartQuery = function() {
return "select ? as ??, count(*) as _count from ?? where ?? between ? and ? "; return "select ? as ??, count(*) as _count from ?? where ?? between ? and ? ";
}; };

37
lib/xsql.js

@ -50,17 +50,23 @@ class Xsql {
} }
} }
self.iterateToCacheTables(results) self.iterateToCacheTables(results)
self.iterateToCacheTablePks(results) self.iterateToCacheTablePks(results)
self.iterateToCacheTableColumns(results) self.iterateToCacheTableColumns(results)
self.iterateToCacheTableFks(results) self.iterateToCacheTableFks(results)
self.iterateToCacheRoutines(results) self.iterateToCacheRoutines(results)
// osx mysql server has limitations related to open_tables // osx mysql server has limitations related to open_tables
self.pool.query("FLUSH TABLES", [], (err, results) => { self.pool.query('FLUSH TABLES', [], (err, results) => {
cbk(null, null); self.pool.query(dataHelp.getRoutines(), [this.sqlConfig.database], (err, results) => {
}); if (err) {
} cbk(err, results)
} else {
self.iterateToCacheRoutines(results)
cbk(null, null)
}
})
})
} }
); );
} }
@ -82,6 +88,15 @@ class Xsql {
} }
} }
iterateToCacheRoutines(routineResults) {
for (let i = 0; i < routineResults.length; i++) {
const routine = routineResults[i]
const routineName = routine['routine_name']
this.metaDb.routines[routineName] = {}
}
console.log(JSON.stringify(this.metaDb))
}
iterateToCacheTableColumns(schemaResults) { iterateToCacheTableColumns(schemaResults) {
for (let i = 0; i < schemaResults.length; ++i) { for (let i = 0; i < schemaResults.length; ++i) {
let schemaRow = schemaResults[i]; let schemaRow = schemaResults[i];

Loading…
Cancel
Save