/** * @return PHPUnit_Extensions_Database_DB_IDatabaseConnection */ public function getConnection() { $pdo = DB::getConnection('sqlite::memory:', null, null); //basicObject schema $pdo->exec('DROP TABLE IF EXISTS BasicObject'); $pdo->exec('CREATE TABLE BasicObject ( bo_id INTEGER PRIMARY KEY AUTOINCREMENT, bo_string VARCHAR(30) NOT NULL)'); static::$conn =& $pdo; //return return $this->createDefaultDBConnection(static::$conn); }
/** * @return PHPUnit_Extensions_Database_DB_IDatabaseConnection */ public function getConnection() { $pdo = DB::getConnection('sqlite::memory:', null, null); //TypesObject schema $pdo->exec('DROP TABLE IF EXISTS TypesObject'); $pdo->exec('CREATE TABLE TypesObject ( to_id INTEGER PRIMARY KEY AUTOINCREMENT, to_string VARCHAR(30) NOT NULL, to_int INTEGER NOT NULL, to_float REAL NOT NULL, to_bool INTEGER NOT NULL, to_timestamp INTEGER NOT NULL, to_datetime VARCHAR(30) NOT NULL, to_datetime_cformat VARCHAR(30) NOT NULL )'); static::$conn =& $pdo; //return return $this->createDefaultDBConnection(static::$conn); }
public static function configureDB($dsn, $username, $password) { static::$conn = DB::getConnection($dsn, $username, $password); }