Example #1
0
 /**
  * Constructor
  *
  * @param array $config The config array
  */
 public function __construct($config = [])
 {
     $defaults = ['classes' => ['select' => 'Lead\\Sql\\Statement\\Sqlite\\Select', 'insert' => 'Lead\\Sql\\Statement\\Sqlite\\Insert', 'update' => 'Lead\\Sql\\Statement\\Sqlite\\Update', 'delete' => 'Lead\\Sql\\Statement\\Sqlite\\Delete', 'create table' => 'Lead\\Sql\\Statement\\CreateTable', 'drop table' => 'Lead\\Sql\\Statement\\DropTable'], 'operators' => [':union' => ['builder' => 'set'], ':union all' => ['builder' => 'set'], ':except' => ['builder' => 'set']]];
     $config = Set::merge($defaults, $config);
     parent::__construct($config);
     $this->type('id', ['use' => 'integer']);
     $this->type('serial', ['use' => 'integer', 'serial' => true]);
     $this->type('string', ['use' => 'varchar', 'length' => 255]);
     $this->type('text', ['use' => 'text']);
     $this->type('integer', ['use' => 'integer']);
     $this->type('boolean', ['use' => 'boolean']);
     $this->type('float', ['use' => 'real']);
     $this->type('decimal', ['use' => 'decimal', 'precision' => 2]);
     $this->type('date', ['use' => 'date']);
     $this->type('time', ['use' => 'time']);
     $this->type('datetime', ['use' => 'timestamp']);
     $this->type('binary', ['use' => 'blob']);
     $this->map('boolean', 'boolean');
     $this->map('blob', 'binary');
     $this->map('date', 'date');
     $this->map('integer', 'integer');
     $this->map('decimal', 'decimal', ['precision' => 2]);
     $this->map('real', 'float');
     $this->map('text', 'text');
     $this->map('time', 'time');
     $this->map('timestamp', 'datetime');
     $this->map('varchar', 'string');
 }
Example #2
0
 /**
  * Constructor
  *
  * @param array $config The config array
  */
 public function __construct($config = [])
 {
     $defaults = ['classes' => ['select' => 'Lead\\Sql\\Statement\\MySql\\Select', 'insert' => 'Lead\\Sql\\Statement\\MySql\\Insert', 'update' => 'Lead\\Sql\\Statement\\MySql\\Update', 'delete' => 'Lead\\Sql\\Statement\\MySql\\Delete', 'create table' => 'Lead\\Sql\\Statement\\CreateTable', 'drop table' => 'Lead\\Sql\\Statement\\DropTable'], 'operators' => ['#' => ['format' => '%s ^ %s'], ':union' => ['builder' => 'set'], ':union all' => ['builder' => 'set'], ':minus' => ['builder' => 'set'], ':except' => ['name' => 'MINUS', 'builder' => 'set']]];
     $config = Set::merge($defaults, $config);
     parent::__construct($config);
     $this->type('id', ['use' => 'int']);
     $this->type('serial', ['use' => 'int', 'serial' => true]);
     $this->type('string', ['use' => 'varchar', 'length' => 255]);
     $this->type('text', ['use' => 'text']);
     $this->type('integer', ['use' => 'int']);
     $this->type('boolean', ['use' => 'boolean']);
     $this->type('float', ['use' => 'float']);
     $this->type('decimal', ['use' => 'decimal', 'precision' => 2]);
     $this->type('date', ['use' => 'date']);
     $this->type('time', ['use' => 'time']);
     $this->type('datetime', ['use' => 'datetime']);
     $this->type('binary', ['use' => 'blob']);
     $this->map('bigint', 'integer');
     $this->map('bit', 'string');
     $this->map('blob', 'string');
     $this->map('char', 'string');
     $this->map('date', 'date');
     $this->map('datetime', 'datetime');
     $this->map('decimal', 'decimal');
     $this->map('double', 'float');
     $this->map('float', 'float');
     $this->map('geometry', 'string');
     $this->map('geometrycollection', 'string');
     $this->map('int', 'integer');
     $this->map('linestring', 'string');
     $this->map('longblob', 'string');
     $this->map('longtext', 'string');
     $this->map('mediumblob', 'string');
     $this->map('mediumint', 'integer');
     $this->map('mediumtext', 'string');
     $this->map('multilinestring', 'string');
     $this->map('multipolygon', 'string');
     $this->map('multipoint', 'string');
     $this->map('point', 'string');
     $this->map('polygon', 'string');
     $this->map('smallint', 'integer');
     $this->map('text', 'string');
     $this->map('time', 'string');
     $this->map('timestamp', 'datetime');
     $this->map('tinyblob', 'string');
     $this->map('tinyint', 'boolean', ['length' => 1]);
     $this->map('tinyint', 'integer');
     $this->map('tinytext', 'string');
     $this->map('varchar', 'string');
     $this->map('year', 'string');
 }
Example #3
0
 /**
  * Constructor
  *
  * @param array $config The config array
  */
 public function __construct($config = [])
 {
     $defaults = ['classes' => ['select' => 'Lead\\Sql\\Statement\\PostgreSql\\Select', 'insert' => 'Lead\\Sql\\Statement\\PostgreSql\\Insert', 'update' => 'Lead\\Sql\\Statement\\PostgreSql\\Update', 'delete' => 'Lead\\Sql\\Statement\\PostgreSql\\Delete', 'create table' => 'Lead\\Sql\\Statement\\CreateTable', 'drop table' => 'Lead\\Sql\\Statement\\DropTable'], 'operators' => [':regexp' => ['format' => '%s ~ %s'], ':regexpi' => ['format' => '%s ~* %s'], ':not regexp' => ['format' => '%s !~ %s'], ':not regexpi' => ['format' => '%s !~* %s'], ':square root' => ['format' => '|/ %s'], ':cube root' => ['format' => '||/ %s'], ':fact' => ['format' => '!! %s'], '|/' => ['format' => '|/ %s'], '||/' => ['format' => '||/ %s'], '!!' => ['format' => '!! %s'], ':concat' => ['format' => '%s || %s'], ':pow' => ['format' => '%s ^ %s'], '@' => ['format' => '@ %s'], ':union' => ['builder' => 'set'], ':union all' => ['builder' => 'set'], ':except' => ['builder' => 'set'], ':except all' => ['builder' => 'set'], ':intersect' => ['builder' => 'set'], ':intersect all' => ['builder' => 'set']]];
     $config = Set::merge($defaults, $config);
     parent::__construct($config);
     $this->type('id', ['use' => 'integer']);
     $this->type('serial', ['use' => 'serial', 'serial' => true]);
     $this->type('string', ['use' => 'varchar', 'length' => 255]);
     $this->type('text', ['use' => 'text']);
     $this->type('integer', ['use' => 'integer']);
     $this->type('boolean', ['use' => 'boolean']);
     $this->type('float', ['use' => 'real']);
     $this->type('decimal', ['use' => 'numeric', 'precision' => 2]);
     $this->type('date', ['use' => 'date']);
     $this->type('time', ['use' => 'time']);
     $this->type('datetime', ['use' => 'timestamp']);
     $this->type('binary', ['use' => 'bytea']);
     $this->map('bit', 'string');
     $this->map('bool', 'boolean');
     $this->map('boolean', 'boolean');
     $this->map('box', 'string');
     $this->map('bytea', 'binary');
     $this->map('char', 'string');
     $this->map('character', 'string');
     $this->map('character varying', 'string');
     $this->map('cidr', 'string');
     $this->map('circle', 'string');
     $this->map('date', 'date');
     $this->map('decimal', 'string');
     $this->map('float4', 'float');
     $this->map('float8', 'float');
     $this->map('inet', 'string');
     $this->map('int2', 'integer');
     $this->map('int4', 'integer');
     $this->map('int8', 'integer');
     $this->map('integer', 'integer');
     $this->map('json', 'string');
     $this->map('lseg', 'string');
     $this->map('line', 'string');
     $this->map('macaddr', 'string');
     $this->map('numeric', 'decimal');
     $this->map('path', 'string');
     $this->map('polygon', 'string');
     $this->map('real', 'float');
     $this->map('serial', 'serial');
     $this->map('string', 'string');
     $this->map('text', 'string');
     $this->map('time', 'time');
     $this->map('time with time zone', 'time');
     $this->map('time without time zone', 'time');
     $this->map('timestamp', 'datetime');
     $this->map('timestamp with time zone', 'datetime');
     $this->map('timestamp without time zone', 'datetime');
     $this->map('timestamptz', 'datetime');
     $this->map('tsquery', 'string');
     $this->map('tsvector', 'string');
     $this->map('txid_snapshot', 'string');
     $this->map('uuid', 'string');
     $this->map('varbit', 'string');
     $this->map('varchar', 'string');
     $this->map('xml', 'string');
 }