Releases: virgiliopontes/mysqlwizard
Releases · virgiliopontes/mysqlwizard
Default configs and Transactions
- Possibility to create and control transactions;
$mysql = new MySQLWizard\MySQLWizard($database_sets);
$mysql->trans_start(); //from Start Transaction
$result = $mysql->insert($array);
if (!result) {
$mysql->trans_rollback();
}
$mysql->trans_commit();
- Possibility to change database connection port;
- Default parameters;
$database_sets= (object)array(
'host'=>'127.0.0.1', //HOST Address
'port'=>'3306', //HOST Port of MySQL
'user'=>'root', //Username from Connection on MySQL
'password'=>'', //Password from Connection on MySQL
'database'=>'teste', //Name of Database
'charset'=>'utf8', //Charset from connection
'country'=>'Brazil', //Case your location is Brazil
'echo_msg'=>false //Show message of Transactions status
);
$mysql = new MySQLWizard\MySQLWizard($database_sets);
General improvements
Update Methods
- Allow Insert NULL values and NOW() function;
$values = array(
'nome'=>'Virgilio',
'email'=>NULL,
'status'=>1,
'create_at'=>'NOW()'
);
$this->MySQLWizard->insert($values);
- Select all rows of table
$this->MySQLWizard->select();
- Allow select NULL values and with more one filter;
$filters = array(
'nome'=>'Virgilio',
'status'=>1
);
$this->MySQLWizard->select($filters);
- Adjusted Insert_Batch();
$values = array(
array(
'nome'=>'Virgilio',
'email'=>NULL,
'status'=>1,
'create_at'=>'NOW()'
),
array(
'nome'=>'Virgilio2',
'email'=>NULL,
'status'=>0,
'create_at'=>'NOW()'
),
);
$this->MySQLWizard->insert_batch($values);
- Adjusted for allow alter charset of connection on MySQL DB;
$database_sets = (object)array(
'host'=>'127.0.0.1',
'user'=>'root',
'password'=>'',
'database'=>'teste',
'charset'=>'utf8',
'country'=>'Brazil'
);
$mysql = new MySQLWizard\MySQLWizard($database_sets);
Initial
0.1 - Finzalização do exemplo;