Rename dataSource() to avoid conflicts with the property
This commit is contained in:
parent
4df5a02676
commit
1970c99424
16
lib/sql.js
16
lib/sql.js
|
@ -28,7 +28,7 @@ BaseSQL.prototype.queryOne = function (sql, callback) {
|
||||||
* @param model The model name
|
* @param model The model name
|
||||||
* @returns {DataSource} The data source
|
* @returns {DataSource} The data source
|
||||||
*/
|
*/
|
||||||
BaseSQL.prototype.dataSource = function(model) {
|
BaseSQL.prototype.getDataSource = function(model) {
|
||||||
var m = this._models[model];
|
var m = this._models[model];
|
||||||
if(!m) {
|
if(!m) {
|
||||||
console.trace('Model not found: ' + model);
|
console.trace('Model not found: ' + model);
|
||||||
|
@ -42,7 +42,7 @@ BaseSQL.prototype.dataSource = function(model) {
|
||||||
* @returns {String} The table name
|
* @returns {String} The table name
|
||||||
*/
|
*/
|
||||||
BaseSQL.prototype.table = function (model) {
|
BaseSQL.prototype.table = function (model) {
|
||||||
var name = this.dataSource(model).tableName(model);
|
var name = this.getDataSource(model).tableName(model);
|
||||||
var dbName = this.dbName;
|
var dbName = this.dbName;
|
||||||
if(typeof dbName === 'function') {
|
if(typeof dbName === 'function') {
|
||||||
name = dbName(name);
|
name = dbName(name);
|
||||||
|
@ -57,7 +57,7 @@ BaseSQL.prototype.table = function (model) {
|
||||||
* @returns {String} The column name
|
* @returns {String} The column name
|
||||||
*/
|
*/
|
||||||
BaseSQL.prototype.column = function (model, property) {
|
BaseSQL.prototype.column = function (model, property) {
|
||||||
var name = this.dataSource(model).columnName(model, property);
|
var name = this.getDataSource(model).columnName(model, property);
|
||||||
var dbName = this.dbName;
|
var dbName = this.dbName;
|
||||||
if(typeof dbName === 'function') {
|
if(typeof dbName === 'function') {
|
||||||
name = dbName(name);
|
name = dbName(name);
|
||||||
|
@ -72,7 +72,7 @@ BaseSQL.prototype.column = function (model, property) {
|
||||||
* @returns {Object} The column metadata
|
* @returns {Object} The column metadata
|
||||||
*/
|
*/
|
||||||
BaseSQL.prototype.columnMetadata = function (model, property) {
|
BaseSQL.prototype.columnMetadata = function (model, property) {
|
||||||
return this.dataSource(model).columnMetadata(model, property);
|
return this.getDataSource(model).columnMetadata(model, property);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,7 +97,7 @@ BaseSQL.prototype.propertyName = function (model, column) {
|
||||||
* @returns {String} The id property name
|
* @returns {String} The id property name
|
||||||
*/
|
*/
|
||||||
BaseSQL.prototype.idName = function (model) {
|
BaseSQL.prototype.idName = function (model) {
|
||||||
return this.dataSource(model).idName(model);
|
return this.getDataSource(model).idName(model);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,7 +106,7 @@ BaseSQL.prototype.idName = function (model) {
|
||||||
* @returns {[String]} The id property names
|
* @returns {[String]} The id property names
|
||||||
*/
|
*/
|
||||||
BaseSQL.prototype.idNames = function (model) {
|
BaseSQL.prototype.idNames = function (model) {
|
||||||
return this.dataSource(model).idNames(model);
|
return this.getDataSource(model).idNames(model);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,7 +115,7 @@ BaseSQL.prototype.idNames = function (model) {
|
||||||
* @returns {String} The column name
|
* @returns {String} The column name
|
||||||
*/
|
*/
|
||||||
BaseSQL.prototype.idColumn = function (model) {
|
BaseSQL.prototype.idColumn = function (model) {
|
||||||
var name = this.dataSource(model).idColumnName(model);;
|
var name = this.getDataSource(model).idColumnName(model);;
|
||||||
var dbName = this.dbName;
|
var dbName = this.dbName;
|
||||||
if(typeof dbName === 'function') {
|
if(typeof dbName === 'function') {
|
||||||
name = dbName(name);
|
name = dbName(name);
|
||||||
|
@ -129,7 +129,7 @@ BaseSQL.prototype.idColumn = function (model) {
|
||||||
* @returns {String} the escaped id column name
|
* @returns {String} the escaped id column name
|
||||||
*/
|
*/
|
||||||
BaseSQL.prototype.idColumnEscaped = function (model) {
|
BaseSQL.prototype.idColumnEscaped = function (model) {
|
||||||
return this.escapeName(this.dataSource(model).idColumnName(model));
|
return this.escapeName(this.getDataSource(model).idColumnName(model));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue