/** * @group sqlite * */ public function testColumns() { $columns = $this->ssql->createSQry()->columnsof('user'); $this->assertSame(count($columns), 2); $this->assertSame($columns[0]['name'], 'id'); $this->assertSame($columns[0]['pk'], true); $this->assertSame($columns[1]['name'], 'name'); $this->assertSame($columns[1]['pk'], false); }
/** * Create SSql instance and connect database with passed config. * * @param $config * @return SSql * @throws \RuntimeException when the parameter, config is not array type */ public static function connect($config) { if (is_null(self::$instance)) { self::$instance = new self(); if (is_array($config)) { self::$instance->setConfigFromArray($config); } else { throw new RuntimeException('config should be an array'); } } return self::$instance; }