Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sync: function (method, model, options) {
var sql = new cdb.SQL({
user: this._configModel.get('user_name'),
sql_api_template: this._configModel.get('sql_api_template'),
api_key: this._configModel.get('api_key')
});
sql.execute(getQueryForGeometryType(this._geometryType)).done(function (data) {
options.success && options.success(data);
}).error(function (errors) {
// console.log("errors:" + errors);
});
},
sync: function (method, model, options) {
var sql = new cdb.SQL({
user: this._configModel.get('user_name'),
sql_api_template: this._configModel.get('sql_api_template'),
api_key: this._configModel.get('api_key')
});
sql.execute(getQueryForGeometryType(this._geometryType)).done(function (data) {
options.success && options.success(data);
}).error(function (errors) {
// console.log("errors:" + errors);
});
},
_getPgStats: function (table, callback) {
var userModel = this.userModel;
var self = this;
if (this.tables[table]) {
if (!_.isEmpty(this.tables[table])) {
callback(this.tables[table]);
} else {
this.queue[table].push(callback);
}
} else {
this.tables[table] = {};
this.queue[table] = [callback];
var schema = userModel.getSchemaName();
var sql = new CDB.SQL({
user: this.configModel.get('user_name'),
sql_api_template: this.configModel.get('sql_api_template'),
api_key: this.configModel.get('api_key')
});
sql.execute(
'with a as (select reltuples from pg_class where relname = \'' + table + '\'), b as (select * from pg_stats where tablename = \'' + table + '\' and schemaname = \'' + schema + '\') select * from a,b',
null,
{
rows_per_page: 40,
page: 0
}
).done(function (data) {
data = data || {};
var rows = data.rows.map(function (r) {
var count = r.reltuples;
_fetchColumns: function () {
if (!this.model.get('attribute')) {
return;
}
if (this._query) {
this._setViewStatus('loading');
var sql = new cdb.SQL({
user: this._configModel.get('user_name'),
sql_api_template: this._configModel.get('sql_api_template'),
api_key: this._configModel.get('api_key')
});
sql.execute(
queryTemplate({
sql: this._query,
column: this.model.get('attribute'),
max_values: MAX_VALUES + 1
}),
null,
{
success: this._onQueryDone.bind(this),
error: function () {
this._setViewStatus('error');
_fetchColumns: function () {
if (!this.model.get('attribute')) {
return;
}
if (this._query) {
this._setViewStatus('loading');
var sql = new CDB.SQL({
user: this._configModel.get('user_name'),
sql_api_template: this._configModel.get('sql_api_template'),
api_key: this._configModel.get('api_key')
});
sql.execute(
queryTemplate({
sql: this._query,
column: this.model.get('attribute'),
max_values: MAX_VALUES + 1
}),
null,
{
success: this._onQueryDone.bind(this),
error: function () {
this._setViewStatus('error');
initialize: function (attrs, options) {
checkAndBuildOpts(options, REQUIRED_OPTS, this);
this._querySchemaModel = this._nodeDefModel.querySchemaModel;
var configModel = options.configModel;
this.SQL = new cdb.SQL({
user: configModel.get('user_name'),
sql_api_template: configModel.get('sql_api_template'),
api_key: configModel.get('api_key')
});
BaseModel.prototype.initialize.call(this, attrs, options);
},
initialize: function (models, options) {
if (!options || !options.configModel) throw new Error('configModel is required');
var configModel = options.configModel;
this.SQL = new cdb.SQL({
user: configModel.get('user_name'),
sql_api_template: configModel.get('sql_api_template'),
api_key: configModel.get('api_key')
});
this._state = 'unfetched';
this._ready = 'notready';
},
initialize: function (attrs, options) {
checkAndBuildOpts(options, REQUIRED_OPTS, this);
this._querySchemaModel = this._nodeDefModel.querySchemaModel;
var configModel = options.configModel;
this.SQL = new cdb.SQL({
user: configModel.get('user_name'),
sql_api_template: configModel.get('sql_api_template'),
api_key: configModel.get('api_key')
});
BaseModel.prototype.initialize.call(this, attrs, options);
},
init: function (configModel) {
this.SQL = new cdb.SQL({
user: configModel.get('user_name'),
sql_api_template: configModel.get('sql_api_template'),
api_key: configModel.get('api_key')
});
},
initialize: function (models, options) {
checkAndBuildOpts(options, REQUIRED_OPTS, this);
this._country = options.country || 'NULL';
this._querySchemaModel = this._layerDefinitionModel.getAnalysisDefinitionNodeModel().querySchemaModel;
var configModel = options.configModel;
this.SQL = new cdb.SQL({
user: configModel.get('user_name'),
sql_api_template: configModel.get('sql_api_template'),
api_key: configModel.get('api_key')
});
this._state = 'unfetched';
},