24 DbOperations::FOREIGN_KEY=>
'ALTER TABLE {tableName} ADD CONSTRAINT {fkName} FOREIGN KEY ({fkFieldName}) REFERENCES {referencesTableName} ({referencesFieldName}) ON DELETE {onDelete} ON UPDATE {onUpdate}',
26 DbOperations::AUTO_INC=>
'ALTER TABLE {tableName} MODIFY {fieldName} AUTO_INCREMENT, AUTO_INCREMENT={value}',
31 const PHP_TYPES = [
'string' =>
true,
'bool' =>
true,
'float' =>
true,
'int' => true ];
35 abstract public function query(
string $sql);
37 abstract public function queryAll(
string $sql,
int $fetchStyle =
null);
39 abstract public function queryColumn(
string $sql,
int $columnNumber =
null);
44 return $this->statements [\md5 ( $sql )] ??= $this->
getStatement ( $sql );
48 return $this->statements [$name] = $this->
getStatement ( $sql );
52 return $this->statements [$name] ??= $this->
getStatement ( $sql );
57 abstract public function connect(
string $dbType, $dbName, $serverName,
string $port,
string $user,
string $password, array $options);
59 abstract public function getDSN(
string $serverName,
string $port,
string $dbName,
string $dbType =
'mysql');
61 abstract public function execute(
string $sql);
80 abstract public function fetchColumn($statement, array $values =
null,
int $columnNumber =
null);
82 abstract public function fetchAll($statement, array $values =
null, $mode =
null);
84 abstract public function fetchOne($statement, array $values =
null, $mode =
null);
86 abstract public function fetchAllColumn($statement, array $values =
null,
string $column =
null);
106 abstract public function ping();
119 abstract public function getRowNum(
string $tableName,
string $pkName,
string $condition): int;
121 abstract public function groupConcat(
string $fields,
string $separator): string;
128 $this->statements = [ ];
129 $this->dbInstance =
null;
149 return "'" . \addslashes ( $value ) .
"'";
169 return $this->operations[$operation]??null;
178 throw new DBException(
'The setIsolation level is not implemented for this wrapper');
Ubiquity\db\providers$AbstractDbWrapper This class is part of Ubiquity.
executeStatement($statement, array $values=null)
fetchColumn($statement, array $values=null, int $columnNumber=null)
getDSN(string $serverName, string $port, string $dbName, string $dbType='mysql')
setIsolationLevel($isolationLevel)
setDbInstance($dbInstance)
getPHPType(string $dbType)
migrateOperation(string $operation)
Returns the SQL string for a migration operation.
getForeignKeys($tableName, $pkName, $dbName=null)
getStatement(string $sql)
_optPrepareAndExecute($sql, array $values=null, $one=false)
groupConcat(string $fields, string $separator)
connect(string $dbType, $dbName, $serverName, string $port, string $user, string $password, array $options)
bindValueFromStatement($statement, $parameter, $value)
Used by DAO.
queryColumn(string $sql, int $columnNumber=null)
prepareStatement(string $sql)
fetchAll($statement, array $values=null, $mode=null)
getRowNum(string $tableName, string $pkName, string $condition)
getFieldsInfos($tableName)
statementRowCount($statement)
quoteValue($value, $type=2)
fetchAllColumn($statement, array $values=null, string $column=null)
getPrimaryKeys($tableName)
static getAvailableDrivers()
getNamedStatement(string $name, ?string $sql=null)
fetchOne($statement, array $values=null, $mode=null)
_optExecuteAndFetch($statement, array $values=null, $one=false)
_getStatement(string $sql)
queryAll(string $sql, int $fetchStyle=null)
prepareNamedStatement(string $name, string $sql)