Merge pull request #7 from strongloop/mysql-1.0.0
Remove synchronous versions of the discovery APIs
This commit is contained in:
commit
8452c0fdf1
|
@ -106,22 +106,6 @@ function mixinDiscovery(MySQL) {
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Discover the tables/views synchronously
|
||||
* @param {Object} options The options for discovery
|
||||
*/
|
||||
MySQL.prototype.discoverModelDefinitionsSync = function (options) {
|
||||
options = options || {};
|
||||
var sqlTables = queryTables(options);
|
||||
var tables = this.querySync(sqlTables);
|
||||
var sqlViews = queryViews(options);
|
||||
if (sqlViews) {
|
||||
var views = this.querySync(sqlViews);
|
||||
tables = tables.concat(views);
|
||||
}
|
||||
return tables;
|
||||
};
|
||||
|
||||
/*!
|
||||
* Normalize the arguments
|
||||
* @param table string, required
|
||||
|
@ -201,28 +185,6 @@ function mixinDiscovery(MySQL) {
|
|||
this.query(sql, callback);
|
||||
};
|
||||
|
||||
/**
|
||||
* Discover model properties from a table synchronously
|
||||
* @param {String} table The table name
|
||||
* @param {Object} options The options for discovery
|
||||
* @return {Object[]} The results
|
||||
*
|
||||
*/
|
||||
MySQL.prototype.discoverModelPropertiesSync = function (table, options) {
|
||||
var args = getArgs(table, options);
|
||||
var owner = args.owner;
|
||||
table = args.table;
|
||||
options = args.options;
|
||||
|
||||
|
||||
var sql = queryColumns(owner, table);
|
||||
var results = this.querySync(sql);
|
||||
results.map(function (r) {
|
||||
r.type = mysqlDataTypeToJSONType(r.dataType, r.dataLength);
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
/*!
|
||||
* Build the sql statement for querying primary keys of a given table
|
||||
* @param owner
|
||||
|
@ -263,22 +225,6 @@ function mixinDiscovery(MySQL) {
|
|||
this.query(sql, cb);
|
||||
};
|
||||
|
||||
/**
|
||||
* Discover primary keys synchronously for a given table
|
||||
* @param {String} table
|
||||
* @param {Object} options
|
||||
* @returns {*} The list of primary key descriptions
|
||||
*/
|
||||
MySQL.prototype.discoverPrimaryKeysSync = function (table, options) {
|
||||
var args = getArgs(table, options);
|
||||
var owner = args.owner;
|
||||
table = args.table;
|
||||
options = args.options;
|
||||
|
||||
var sql = queryForPrimaryKeys(owner, table);
|
||||
return this.querySync(sql);
|
||||
};
|
||||
|
||||
/*!
|
||||
* Build the sql statement for querying foreign keys of a given table
|
||||
* @param owner
|
||||
|
@ -320,22 +266,6 @@ function mixinDiscovery(MySQL) {
|
|||
this.query(sql, cb);
|
||||
};
|
||||
|
||||
/**
|
||||
* Discover foreign keys synchronously for a given table
|
||||
* @param {String} table The table name
|
||||
* @param {Object} options The options for discovery
|
||||
* @return {Object[]} The results
|
||||
*/
|
||||
MySQL.prototype.discoverForeignKeysSync = function (table, options) {
|
||||
var args = getArgs(table, options);
|
||||
var owner = args.owner;
|
||||
table = args.table;
|
||||
options = args.options;
|
||||
|
||||
var sql = queryForeignKeys(owner, table);
|
||||
return this.querySync(sql);
|
||||
};
|
||||
|
||||
/*!
|
||||
* Retrieves a description of the foreign key columns that reference the given table's primary key columns (the foreign keys exported by a table).
|
||||
* They are ordered by fkTableOwner, fkTableName, and keySeq.
|
||||
|
@ -379,22 +309,6 @@ function mixinDiscovery(MySQL) {
|
|||
this.query(sql, cb);
|
||||
};
|
||||
|
||||
/**
|
||||
* Discover foreign keys synchronously for a given table
|
||||
* @param {String} owner The DB owner/schema name
|
||||
* @param {Object} options The options for discovery
|
||||
* @returns {*}
|
||||
*/
|
||||
MySQL.prototype.discoverExportedForeignKeysSync = function (table, options) {
|
||||
var args = getArgs(table, options);
|
||||
var owner = args.owner;
|
||||
table = args.table;
|
||||
options = args.options;
|
||||
|
||||
var sql = queryExportedForeignKeys(owner, table);
|
||||
return this.querySync(sql);
|
||||
};
|
||||
|
||||
function mysqlDataTypeToJSONType(mysqlType, dataLength) {
|
||||
var type = mysqlType.toUpperCase();
|
||||
switch (type) {
|
||||
|
|
Loading…
Reference in New Issue