frobou / frobou-db-connect
Frobou PDO based Connection
1.0.20
2018-01-15 18:51 UTC
Requires
- php: >=5.4.0
- frobou/frobou-validator: *
- monolog/monolog: *
Requires (Dev)
- phpunit/phpunit: ^5.3
README
usage:
$config = new FrobouPdoConfig(json_decode(file_get_contents(__DIR__ . '/database.json')), true);
$this->con = new FrobouPdoConnection($config, true, $log);
//$ConnectionObject->action($query, 'table1 name (empty for default)');
$query = 'SELECT * FROM table1 limit 1';
$this->con->select($query, 'table1');
$query = 'SELECT * FROM table_default limit 1';
$this->con->select($query);
FrobouPdoConnection has transaction support
$this->con->beginTransaction();
$this->con->beginTransaction('table1');
$this->con->beginTransaction('table2');
$query = 'What INTO table (bla-bla-bla) VALUES (bla-bla-bla)';
$this->con->insert($query);
$this->con->update($query, 'table1');
$this->con->delete($query, 'table2');
if (!$this->con->commit()){
$this->con->rollback();
}
$this->con->commit('radius');
$this->con->commit('postfix');