implement insert_id for mysqli prepare
This commit is contained in:
parent
277a5ad1df
commit
1f26360289
@ -98,4 +98,7 @@ class Connection extends ConnectionAbstr{
|
||||
*/
|
||||
public function commit(){
|
||||
return $this->connection->commit();}
|
||||
|
||||
public function insert_id(){
|
||||
return $this->connection->insert_id();}
|
||||
}
|
||||
@ -130,4 +130,7 @@ class ConnectionAMQP extends ConnectionAbstr {
|
||||
*/
|
||||
public function trans(){
|
||||
throw new \Exception('Could not start Transaction: not implemented');}
|
||||
|
||||
public function insert_id(){
|
||||
throw new \Exception('Not implemented');}
|
||||
}
|
||||
@ -119,4 +119,8 @@ class ConnectionMYS extends ConnectionAbstr {
|
||||
if(!\mysqli_begin_transaction($this->connection,MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT)){
|
||||
throw new \Exception('Could not start Transaction: '.\mysqli_error($this->connection));}
|
||||
return true;}
|
||||
|
||||
public function insert_id(){
|
||||
return \mysqli_insert_id($this->connection);
|
||||
}
|
||||
}
|
||||
@ -119,4 +119,7 @@ class ConnectionPG extends ConnectionAbstr {
|
||||
*/
|
||||
public function exec($query) {
|
||||
throw new \Exception('Could not start Transaction: not implemented');}
|
||||
|
||||
public function insert_id(){
|
||||
throw new \Exception('Not implemented');}
|
||||
}
|
||||
@ -107,4 +107,7 @@ class ConnectionSQLite extends ConnectionAbstr {
|
||||
*/
|
||||
public function trans(){
|
||||
throw new \Exception('Could not start Transaction: not implemented');}
|
||||
|
||||
public function insert_id(){
|
||||
throw new \Exception('Not implemented');}
|
||||
}
|
||||
@ -82,7 +82,7 @@ class QP {
|
||||
* @param DBINFO $dbinfo Database Info or Null for Default DB
|
||||
* @return bool Returns true or false (or Result if used incorrectly)
|
||||
*/
|
||||
public static function QI($params,$dbinfo = null){
|
||||
public static function QI($params,$return_id = false,$dbinfo = null){
|
||||
$qq = self::QQ($params,$dbinfo);
|
||||
return $qq->affectedRows() != (0||null);}
|
||||
return $return_id ? $qq->insert_id() : $qq->affectedRows() != (0||null);}
|
||||
}
|
||||
@ -80,6 +80,7 @@ class QQ {
|
||||
* @param DBINFO $dbinfo Database Info or Null for Default DB
|
||||
* @return bool Returns true or false (or Result if used incorrectly)
|
||||
*/
|
||||
public static function QI($dbinfo = null){
|
||||
return self::QQ($dbinfo);}
|
||||
public static function QI($return_id = false,$dbinfo = null){
|
||||
$qq = self::QQ($dbinfo);
|
||||
return $return_id ? $qq->insert_id() : $qq->affectedRows() != (0||null);}
|
||||
}
|
||||
@ -107,4 +107,8 @@ class ResultMysqliPrepare extends \SYSTEM\DB\Result{
|
||||
*/
|
||||
public function seek($row_number){
|
||||
return \mysqli_stmt_data_seek($this->res,$row_number);}
|
||||
|
||||
public function insert_id(){
|
||||
return $this->connection->insert_id();
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user