/* private functions 
@function createTableColumn

generate column sql for CREATE TABLE

@param {ImmutableCoreModel} model
@param {string} name
@param {object} spec

@returns {string}

@throws {Error}
438879
function createTableColumn (model, name, spec) {
    // require spec to be object
    assert.ok(typeof spec === 'object', `${name} spec must be object`)
    // require valid type
    assert.ok(columnTypes[spec.type], `invalid type ${spec.type} for ${name}`)
    // build sql string
    var columnType = spec.type === 'id'
        ? (model.binaryIds ? 'BINARY(16)' : 'CHAR(32)')
        : columnTypes[spec.type]
    var sql = `${quoteName(name)} ${columnType}`
    // add unsigned flag if set
    if (spec.unsigned && (spec.type === 'int' || spec.type === 'smallint')) {
        sql += ' UNSIGNED'
    }
    // add not null if null specifically set to false
    if (spec.null === false) {
        sql += ' NOT NULL'
    }
    // add auto increment
    if (spec.auto) {
        sql += ' AUTO_INCREMENT PRIMARY KEY'
    }
    // add default value if set
    if (spec.default !== undefined) {
        // use 0/1 for boolean
        if (spec.type === 'boolean') {
            sql += ` DEFAULT ${spec.default ? 1 : 0}`
        }
        // otherwise use quoteNamed value
        else {
            sql += ` DEFAULT '${spec.default}'`
        }
    }
    // return sql string
    return sql
}
1092786
function (name, specs) {
        "use strict";
    
        var path = specs.path;
        var type = (specs.type) ? specs.type : 'control';
    
        Object.defineProperty(this, 'name', {
            'get': function () {
                return name;
            }
        });
    
        if (path.substr(0, 7) !== 'http://' || path.substr(0, 8) !== 'https://') {
    
            if (path.substr(0, 12) === 'application/') {
    
                // shift the "application" string
                path = path.split('/')
                path.shift();
                var componentPath = path.join('/');
                path = beyond.requireConfig.paths['application'] + '/' + componentPath + '/' + type + '.html';
    
            }
            else if (path.substr(0, 10) === 'libraries/') {
    
                var original = path;
    
                path = path.split('/');
    
                // shift the "libraries" string
                path.shift();
                // shift the library name
                var libraryName = path.shift();
    
                path = path.join('/');
    
                // search the library path
                var libraryPath = beyond.requireConfig.paths['libraries/' + libraryName];
                if (!libraryPath) {
                    console.warn('library ' + libraryName + ' does not exist, check the module "' + original + '"');
                    return;
                }
    
                path = libraryPath + '/' + path;
    
                var multilanguage = beyond.modules.multilanguage.get(original);
                if (multilanguage && multilanguage.indexOf(type) !== -1) {
                    path += '/' + type + '/' + beyond.params.language + '.html';
                }
                else {
                    path += '/' + type + '.html';
                }
    
            }
            else {
    
                var vendor;
                vendor = beyond.requireConfig.paths['libraries/vendor'];
                vendor = vendor + '/static/bower_components/';
    
                path = vendor + path;
    
            }
    
        }
    
        Object.defineProperty(this, 'path', {
            'get': function () {
                return path;
            }
        });
    
    
        var loaded;
        Object.defineProperty(this, 'loaded', {
            'get': function () {
                return !!loaded;
            }
        });
    
        var loading;
        Object.defineProperty(this, 'loading', {
            'get': function () {
                return !!loading;
            }
        });
    
        var callbacks = [];
    
        this.load = function (callback) {
    
            if (loaded) {
                callback();
                return;
            }
    
            callbacks.push(callback);
    
            if (loading) return;
    
            loading = true;
            window.Polymer.Base.importHref(path, function () {
    
                loading = false;
                loaded = true;
    
                for (var i in callbacks) {
                    callbacks[i]();
                }
                callbacks = [];
    
            });
    
        };
    
    }
31421
def columns(table_name, name = nil)#:nodoc:
      show_fields_from(table_name, name).map do |field|
        klass = \
          if field["Type"] =~ GEOMETRY_REGEXP
            ActiveRecord::ConnectionAdapters::SpatialMysqlColumn
          else
            ActiveRecord::ConnectionAdapters::MysqlColumn
          end
        klass.new(field['Field'], field['Default'], field['Type'], field['Null'] == "YES")
      end
    end
875966
public function createTable($name, Array $columns, $safe_create = false)
	{
		if( (! $safe_create) || ($safe_create && ! Schema::connection($this->connection)->hasTable('users')) )
		{
			// dtop table if exists
			if (Schema::connection($this->connection)->hasTable($name))
			{
				Schema::connection($this->connection)->drop($name);
			}
			
			Schema::connection($this->connection)->create($name, function($table) use ($columns)
			{
				foreach($columns as $name => $type)
				{
		    		$table->$type($name);
		    	}
			});
		}
	}
347859
function loadModel(modelSpecPath, name) {
  return plugin.myrmex.fire('beforeModelLoad', modelSpecPath, name)
  .spread(() => {
    // Because we use require() to get the spec, it could either be a JSON file
    // or the content exported by a node module
    // But because require() caches the content it loads, we clone the result to avoid bugs
    // if the function is called twice
    const modelSpec = _.cloneDeep(require(modelSpecPath));

    // Lasy loading because the plugin has to be registered in a Myrmex instance before requiring ./model
    const Model = require('./model');
    return Promise.resolve(new Model(name, modelSpec));
  })
  .then(model => {
    // This event allows to inject code to alter the model specification
    return plugin.myrmex.fire('afterModelLoad', model);
  })
  .spread((model) => {
    return Promise.resolve(model);
  });
}
117339
public Table createTable(String datasetName, String tableName, String fieldName) {
    // [START bigquery_create_table]
    TableId tableId = TableId.of(datasetName, tableName);
    // Table field definition
    Field field = Field.of(fieldName, LegacySQLTypeName.STRING);
    // Table schema definition
    Schema schema = Schema.of(field);
    TableDefinition tableDefinition = StandardTableDefinition.of(schema);
    TableInfo tableInfo = TableInfo.newBuilder(tableId, tableDefinition).build();
    Table table = bigquery.create(tableInfo);
    // [END bigquery_create_table]
    return table;
  }
40632
private StringBuilder createSelectQuery(Object rowId, EntityMetadata metadata, String tableName) {
        MetamodelImpl metaModel =
            (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(metadata.getPersistenceUnit());

        CQLTranslator translator = new CQLTranslator();

        String select_Query = translator.SELECTALL_QUERY;
        select_Query = StringUtils.replace(select_Query, CQLTranslator.COLUMN_FAMILY,
            translator.ensureCase(new StringBuilder(), tableName, false).toString());
        StringBuilder builder = new StringBuilder(select_Query);

        builder.append(CQLTranslator.ADD_WHERE_CLAUSE);
        onWhereClause(metadata, rowId, translator, builder, metaModel, metadata.getIdAttribute());
        builder.delete(builder.lastIndexOf(CQLTranslator.AND_CLAUSE), builder.length());

        return builder;
    }
1224355
function createTable(table, transaction) {
    return (transaction || db.knex).schema.hasTable(table)
        .then(function (exists) {
            if (exists) {
                return;
            }

            return (transaction || db.knex).schema.createTable(table, function (t) {
                var columnKeys = _.keys(schema[table]);
                _.each(columnKeys, function (column) {
                    return addTableColumn(table, t, column);
                });
            });
        });
}
719169
function (name_pattern, spec_pattern) {
            /*  step 1: match mandatory name  */
            if (typeof name_pattern === "string") {
                if (this.name() !== name_pattern)
                    return false;
            }
            else if (   typeof name_pattern === "object"
                     && name_pattern instanceof RegExp) {
                if (!(this.name().match(name_pattern)))
                    return false;
            }
            else
                throw _cs.exception("matches", "invalid name pattern");

            /*  step 2: match optional specification  */
            var spec = this.__spec;
            for (var key in spec_pattern) {
                if (!_cs.isown(spec_pattern, key))
                    continue;
                if (!_cs.isdefined(spec[key]))
                    return false;
                var value = spec_pattern[key];
                switch (typeof spec[key]) {
                    case "number":
                    case "boolean":
                        if (spec[key] !== value)
                            return false;
                        break;
                    case "string":
                        if (!(   (   typeof value === "string"
                                  && spec[key] === value)
                              || (   typeof value === "object"
                                  && value instanceof RegExp
                                  && !(spec[key].match(value)))))
                            return false;
                        break;
                }
            }
            return true;
        }
1284561
function schema (args) {
    // get args object
    args = requireValidOptionalObject(args)
    // get colunmn and index information from database
    return Promise.all([
        this.mysql().query(sql.describe(this)),
        this.mysql().query(sql.showCreateTable(this)),
        this.mysql().query(sql.showIndexes(this)),
    ])
    // build schema from database response
    .then(res => {
        // get columns and indexes from describe and show index queries
        var columns = res[0][0]
        var createTable = res[1][0]
        var indexes = res[2][0]
        // schema data
        var schema = {
            columns: {},
            indexes: [],
        }
        // get first and only create table record
        createTable = _.get(createTable, "[0]['Create Table']", '')
        // get engine and charset from create table sql
        var engine = createTable.match(/ENGINE=(\w+)/)
        schema.engine = engine && engine[1] || ''
        var charset = createTable.match(/DEFAULT CHARSET=(\w+)/)
        schema.charset = charset && charset[1] || ''
        // build column data
        _.each(columns, dbColumn => {
            var column = schema.columns[dbColumn.Field] = {}
            // check unsigned
            if (dbColumn.Type.match(/unsigned$/)) {
                column.unsigned = true
                dbColumn.Type = dbColumn.Type.replace(/ unsigned/, '')
            }
            // char id column
            if (dbColumn.Type === 'char(32)') {
                // model must not be set for binary ids
                assert.ok(this.binaryIds === false, 'binaryIds must be disabled for char id columns')
                // set type
                column.type = 'id'
            }
            // binary id column
            else if (dbColumn.Type === 'binary(16)') {
                // model must be set for binary ids
                assert.ok(this.binaryIds === true, 'binaryIds must be enabled for binary id columns')
                // set type
                column.type = 'id'
            }
            // all other column types
            else  {
                // require valid type
                assert.ok(sql.columnTypesInverse[dbColumn.Type], 'unrecognized column type '+dbColumn.Type)
                // map database to internal type
                column.type = sql.columnTypesInverse[dbColumn.Type]
            }
            // is column nullable
            if (dbColumn.Null === 'NO') {
                column.null = false
            }
            // set default if not null
            if (dbColumn.Default) {
                column.default = dbColumn.Default
                // convert boolean
                if (column.type === 'boolean') {
                    column.default = column.default === '1' ? true : false
                }
            }
        })
        // map of indexes by key name since keys may cover multiple columns
        var indexesByKey = {}
        // build map of indexes by key name
        _.each(indexes, dbIndex => {
            // create entry for index if it does not already exist
            if (!indexesByKey[dbIndex.Key_name]) {
                indexesByKey[dbIndex.Key_name] = {
                    columns: {}
                }
            }
            // get entry for index
            var index = indexesByKey[dbIndex.Key_name]
            // add column with sequence in index
            index.columns[dbIndex.Column_name] = parseInt(dbIndex.Seq_in_index)
            // add unique flag if true
            if (dbIndex.Non_unique === '0') {
                index.unique = true
            }
        })
        // add indexes to schema
        _.each(indexesByKey, (index, name) => {
            var indexColumns = _.keys(index.columns)
            // multi-column index
            if (indexColumns.length > 1) {
                // sort index columns by the Seq_in_index value - these may
                // always be in order so this may not be needed
                indexColumns = _.sortBy(indexColumns, indexColumn => index.columns[indexColumn])
                // create schema index entry
                var schemaIndex = {
                    columns: indexColumns,
                }
                // set unique flag
                if (index.unique) {
                    schemaIndex.unique = true
                }
                // add index to schema
                schema.indexes.push(schemaIndex)
            }
            // single column index
            else {
                // get first and only column
                var indexColumn = indexColumns[0]
                // PRIMARY KEY
                if (name === 'PRIMARY') {
                    schema.columns[indexColumn].primary = true
                }
                // unique index
                else if (index.unique) {
                    schema.columns[indexColumn].unique = true
                }
                // non-unique index
                else {
                    schema.columns[indexColumn].index = true
                }
            }
        })
        // resolve with schema
        return schema
    })
    .catch(err => {
        // reject on anything besides a table does not exist error
        // if table does not exist resolve with undefined
        if (err.errno !== 1146) {
            throw err
        }
    })
}
477414
public Table createTable(String tableName,
            List<KeySchemaElement> keySchema,
            List<AttributeDefinition> attributeDefinitions,
            ProvisionedThroughput provisionedThroughput) {
        return createTable(new CreateTableRequest()
            .withTableName(tableName)
            .withKeySchema(keySchema)
            .withAttributeDefinitions(attributeDefinitions)
            .withProvisionedThroughput(provisionedThroughput));
    }
1108023
def compile_create_table(qualified_name: str, column_statement: str,
                         primary_key_statement: str) -> str:
    """"""

    statement = """
                CREATE TABLE {table} ({columns} {primary_keys});
                """.format(table=qualified_name,
                           columns=column_statement,
                           primary_keys=primary_key_statement)
    return statement
1144615
private <S extends Model> String buildInsertSQL(S model, List<Object> columnValues) {
        SQLParams sqlParams = SQLParams.builder()
                .model(model)
                .columnValues(columnValues)
                .modelClass(this.modelClass)
                .tableName(this.tableName)
                .pkName(this.primaryKeyColumn)
                .build();

        return Anima.of().dialect().insert(sqlParams);
    }
309074
def create_table(dbcon, name, columns):
    
    try:
        colString = ", ".join(["{} {}".format(colName, colType) for colName, colType in columns])
        dbcon.execute("CREATE TABLE '{name}'({args})".format(name=name, args=colString))
        return True
    except sqlite3.OperationalError as e:
        return False
959548
function Model (name, schema, options) {
  if (typeof(name) != "string") throw "model name must be provided and a string";
  if (arguments.length==1) { options = {}; schema = {} };
  if (arguments.length==2) { options = schema; schema = {} };

  var self = function Document(raw) { return document.Document.call(this, self, raw) }; // Call the Document builder
  _.extend(self, Model.prototype); // Ugly but works - we need to return a function but still inherit prototype
  var emitter = new events.EventEmitter();
  emitter.setMaxListeners(0);
  for (var prop in emitter) self[prop] = emitter[prop];

  self.modelName = name;
  self.schema = schemas.normalize(Object.assign({}, schema)); // Normalize to allow for short-hands
  self.filename = path.normalize(options.filename || path.join(Model.dbPath || ".", name+".db"));
  self.options  = _.extend({}, Model.defaults, options);

  // Indexed by field name, dot notation can be used
  // _id is always indexed and since _ids are generated randomly the underlying
  // binary is always well-balanced
  self.indexes = {};
  self.indexes._id = new Index({ fieldName: '_id', unique: true });
  schemas.indexes(schema).forEach(function(idx) { self.ensureIndex(idx) });

  // Concurrency control for 1) index building and 2) pulling objects from LevelUP
  self._pipe = new bagpipe(1);
  self._pipe.pause();
  self._retrQueue = new bagpipe(LEVELUP_RETR_CONCURRENCY);
  self._retrQueue._locked = {}; self._retrQueue._locks = {}; // Hide those in ._retrQueue
  self._methods = {};

  if (self.options.autoLoad) self.initStore();

  return self;
}
483522
function parameters(spec, paramType) {
  spec = lodash.cloneDeep(spec);

  var schema = {
    type: 'object',
    properties: {},
    required: [],
  };

  spec.parameters.forEach(function(parameter) {
    // only get rules for current paramType
    if (parameter.paramType !== paramType) return;

    // create current property
    var property = schema.properties[parameter.name] = {
      type: parameter.type,
    };

    switch (parameter.type) {
    case 'integer':
      property.type = parameter.type;

      ['minimum', 'maximum'].forEach(function(key) {
        if (parameter.hasOwnProperty(key)) {
          property[key] = parseInt(parameter[key], 10);
        }
      });

      break;
    case 'number':
      property.type = parameter.type;

      break;
    case 'string':
      property.type = parameter.type;

      if (parameter.hasOwnProperty('minimum')) {
        property.minLength = parseInt(parameter.minimum, 10);
      }

      if (parameter.hasOwnProperty('maximum')) {
        property.maxLength = parseInt(parameter.maximum, 10);
      }

      if (parameter.hasOwnProperty('format')) {
        property.format = parameter.format;
      }

      break;
    case 'boolean':
      property.type = parameter.type;

      break;
    case 'array':
      property.type = parameter.type;
      property.items = parameter.items;

      if (parameter.uniqueItems) property.uniqueItems = true;

      if (parameter.hasOwnProperty('minItems')) {
        property.minItems = parameter.minItems;
      }

      if (parameter.hasOwnProperty('maxItems')) {
        property.maxItems = parameter.maxItems;
      }

      break;
    default:
      if (paramType === 'body') {
        property.$ref = parameter.type;
        lodash.keys(property).forEach(function(key) {
          if (key !== '$ref') delete property[key];
        });
      } else {
        throw new Error('unknown type: ' + parameter.type);
      }
    }

    if (Array.isArray(parameter.enum)) {
      property.enum = parameter.enum;
    }

    var hasDefault = parameter.hasOwnProperty('defaultValue');

    if (hasDefault) {
      property.default = parameter.defaultValue;
    }

    // path rules are implicitly required
    if (!hasDefault && (parameter.required || paramType === 'path')) {
      schema.required.push(parameter.name);
    }

    // convert to items if allowMultiple
    if (parameter.allowMultiple &&
        constants.allowMultiple.indexOf(parameter.paramType) >= 0) {
      var schemaProperty = schema.properties[parameter.name] = {
        type: 'array',
        items: property,
      };

      if (parameter.uniqueItems) schemaProperty.uniqueItems = true;

      if (parameter.hasOwnProperty('minItems')) {
        schemaProperty.minItems = parameter.minItems;
      }

      if (parameter.hasOwnProperty('maxItems')) {
        schemaProperty.maxItems = parameter.maxItems;
      }
    }
  });

  if (!schema.required.length) delete schema.required;

  if (lodash.isEmpty(schema.properties)) return;

  return schema;
}
1207564
function buildWhereModel (name, value, alias) {
    // skip updefined values
    if (value === undefined) {
        return
    }
    // get id columns for model
    var idColumn = this.model.columnName('id')
    var originalIdColumn = this.model.columnName('originalId')
    // model column belongs to
    var model
    // column spec
    var spec
    // isDeleted where clause
    if (name === 'isDeleted') {
        // if value is null do nothing
        if (value === null) {
            return
        }
        // change column name to real column name (d)
        name = 'd'
    }
    // join column where clause
    if (name.match(/\./)) {
        var [prefix, column] = name.split('.')
        // prefix is for join
        if (this.joinRelations[prefix]) {
            // get join
            var join = this.joinRelations[prefix]
            // get relation
            var relation = this.model.relation(prefix)
            // set model for where clause
            model = relation.model
            // get column name from relation model
            name = model.columnName(column, true)
            // get spec
            spec = model.columns[name]
            // get alias
            alias = join.relationAlias
        }
        // error
        else {
            throw new Error('invalid column name in where '+name)
        }
    }
    // where clause for column on primary model table
    else {
        // model is base model
        model = this.model
        // validate column name - throw error
        name = this.model.columnName(name, true)
        // get column spec
        spec = this.model.columns[name]
        // if value is set for only the first column then need to add join to
        // select the record that matches the value
        if (spec.firstOnly) {
            // get new alias for primary table
            alias = this.newAlias(this.table)
            // add join
            this.join.push( this.joinSql(this.table, alias, originalIdColumn, this.alias, originalIdColumn) )
        }
    }
    // if optional alias is not set then get table alias for model name
    if (!alias) {
        alias = this.getAlias(model.name)
    }
    // flag set to true if this is negated statement
    var isNot = false
    // every where statement will begin with the alias and column name
    var whereSql = `${alias}.${this.quoteName(name)}`
    // if value is a string then do a simple column = :value
    if (typeof value === 'string' || typeof value === 'number') {
        // get param name for value placeholder
        var paramName = this.newParam(name)
        // set value for param placeholder
        this.params[paramName] = value
        // create sql
        whereSql += spec.type === 'id' && this.model.binaryIds
            ? ` = UNHEX(:${paramName})`
            : ` = :${paramName}`
    }
    // if value is boolean then do column = 1|0
    else if (spec.type === 'boolean' && typeof value === 'boolean') {
        // get param name for value placeholder
        var paramName = this.newParam(name)
        // create sql
        whereSql += ` = ${value ? 1 : 0}`
    }
    // if value is array then do IN () query
    else if (Array.isArray(value)) {
        var placeholders = _.map(value, v => {
            // get param name for each placeholder
            var paramName = this.newParam(name)
            // set value for param placeholder
            this.params[paramName] = v
            // create placeholder
            return spec.type === 'id' && this.model.binaryIds
                ? `UNHEX(:${paramName})`
                : `:${paramName}`
        })
        // create sql
        whereSql += ` IN(${placeholders.join(', ')})`
    }
    // if value is null then do IF NULL
    else if (value === null) {
        // create sql
        whereSql += ' IS NULL'
    }
    // if value is object then it should be a match type and value
    else if (typeof value === 'object') {
        // get keys of object
        var keys = _.keys(value)
        // there should be only one key
        assert.equal(keys.length, 1, 'statement must have one comparison operator in where '+name)
        // get operator
        var operator = keys[0]
        // get value
        var operatorValue = value[operator]
        var operatorValueType = typeof operatorValue
        // validate operator value
        if (operatorValueType === 'object' && operator !== 'in' && operator !== 'between' && operator !== 'not') {
            // if value is array change the type from object to array
            if (Array.isArray(operatorValue)) {
                operatorValueType = 'array'
            }
            // throw error
            throw new Error(`${model.name} query error: invalid value type '${operatorValueType}' for operator '${operator}'`)
        }
        // if operator is not then need to get next level deeper
        if (operator === 'not') {
            // if value is null than do IF NULL
            if (operatorValue === null) {
                // create sql
                whereSql += ' IS NOT NULL'
                // add sql to list of where clauses
                this.where.push(whereSql)
                // TODO: refactor this
                return
            }
            else {
                // get keys of not object
                keys = _.keys(operatorValue)
                // there should be only one key
                assert.equal(keys.length, 1, 'statement must have one comparison operator in where '+name)
                // get operator
                operator = keys[0]
                // get value
                operatorValue = operatorValue[operator]
                // set flag to negate statement
                isNot = true
            }
        }
        // LIKE :value
        if (operator === 'like') {
            // get param name for value placeholder
            var paramName = this.newParam(name)
            // set value for param placeholder
            this.params[paramName] = operatorValue
            // create sql
            whereSql += ` LIKE :${paramName}`
        }
        // > : value
        else if (operator === 'gt') {
            // get param name for value placeholder
            var paramName = this.newParam(name)
            // set value for param placeholder
            this.params[paramName] = operatorValue
            // create sql
            whereSql += ` > :${paramName}`
        }
        // >= : value
        else if (operator === 'gte') {
            // get param name for value placeholder
            var paramName = this.newParam(name)
            // set value for param placeholder
            this.params[paramName] = operatorValue
            // create sql
            whereSql += ` >= :${paramName}`
        }
        // < : value
        else if (operator === 'lt') {
            // get param name for value placeholder
            var paramName = this.newParam(name)
            // set value for param placeholder
            this.params[paramName] = operatorValue
            // create sql
            whereSql += ` < :${paramName}`
        }
        // <= : value
        else if (operator === 'lte') {
            // get param name for value placeholder
            var paramName = this.newParam(name)
            // set value for param placeholder
            this.params[paramName] = operatorValue
            // create sql
            whereSql += ` <= :${paramName}`
        }
        else if (operator === 'between') {
            assert.ok(Array.isArray(operatorValue), 'between value must be array in where '+name)
            assert.equal(operatorValue.length, 2, 'between array must have 2 elements in where '+name)
            // get param name for value placeholder
            var paramName1 = this.newParam(name)
            // set value for param placeholder
            this.params[paramName1] = operatorValue[0]
            // get param name for value placeholder
            var paramName2 = this.newParam(name)
            // set value for param placeholder
            this.params[paramName2] = operatorValue[1]
            // create sql
            whereSql += ` BETWEEN :${paramName1} AND :${paramName2}`
        }
        else if (operator === 'in') {
            assert.ok(Array.isArray(operatorValue), 'in value must be array in where '+name)
            // get placeholder for each in value
            var placeholders = _.map(operatorValue, v => {
                // get param name for each placeholder
                var paramName = this.newParam(name)
                // set value for param placeholder
                this.params[paramName] = v
                // create placeholder
                return spec.type === 'id' && this.model.binaryIds
                    ? `UNHEX(:${paramName})`
                    : `:${paramName}`
            })
            // create sql
            whereSql += ` IN(${placeholders.join(', ')})`
        }
        // = : value
        else if (operator === 'eq') {
            // get param name for value placeholder
            var paramName = this.newParam(name)
            // set value for param placeholder
            this.params[paramName] = operatorValue
            // create sql
            whereSql += spec.type === 'id' && this.model.binaryIds
                ? ` = UNHEX(:${paramName})`
                : ` = :${paramName}`
        }
        // operator type not supported
        else {
            throw new Error('invalid operator '+operator+' in where '+name)
        }
    }
    // query type not supported
    else {
        throw new Error('invalid value type '+typeof value+' in where '+name)
    }

    // if this is NOT statement then wrap in negation
    if (isNot) {
        whereSql = '!('+whereSql+')'
    }

    // add sql to list of where clauses
    this.where.push(whereSql)
}