Now search methods accept static calls
This commit is contained in:
@@ -4,11 +4,11 @@ namespace BBOrm;
|
||||
|
||||
class DBInstance {
|
||||
|
||||
public static function execute($sql, $intance = 'default', $data = null) {
|
||||
public static function execute($sql, $data = null, $intance = 'default') {
|
||||
if ($data) {
|
||||
self::query_prepare($sql, $data, $instance);
|
||||
} else {
|
||||
$con = Connections::get_connection('default');
|
||||
$con = Connections::get_connection($intance);
|
||||
$con->exec($sql);
|
||||
}
|
||||
}
|
||||
@@ -18,28 +18,28 @@ class DBInstance {
|
||||
return $con->lastInsertId();
|
||||
}
|
||||
|
||||
public static function query($sql, $instance = 'default', $data = null) {
|
||||
public static function query($sql, $data = null, $instance = 'default') {
|
||||
if ($data) {
|
||||
return self::query_prepare($sql, $data, $instance);
|
||||
} else {
|
||||
$con = Connections::get_connection('default');
|
||||
$con = Connections::get_connection($intance);
|
||||
return $con->query($sql, \PDO::FETCH_OBJ);
|
||||
}
|
||||
}
|
||||
|
||||
public static function query_one($sql, $instance = 'default', $data = null) {
|
||||
public static function query_one($sql, $data = null, $instance = 'default') {
|
||||
if ($data) {
|
||||
return self::query_prepare($sql, $data, $instance);
|
||||
} else {
|
||||
$con = Connections::get_connection('default');
|
||||
$con = Connections::get_connection($intance);
|
||||
return $con->query($sql, \PDO::FETCH_OBJ)->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
public static function query_prepare($sql, $arguments, $instance = 'default') {
|
||||
$con = Connections::get_connection('default');
|
||||
public static function query_prepare($sql, $data = Array(), $instance = 'default') {
|
||||
$con = Connections::get_connection($intance);
|
||||
$statement = $con->prepare($sql);
|
||||
$statement->execute($arguments);
|
||||
$statement->execute($data);
|
||||
return $statement->fetchAll(\PDO::FETCH_OBJ);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user