Data
in package
uses
TraitCache, TraitSQL
Class responsible for database operations including select, insert, update, and delete.
Table of Contents
Properties
Methods
- __construct() : mixed
- bind() : SqlInParams
- Convenience alias for sqlInParams() – reads nicer at call sites.
- checkExist() : int
- Prueft, ob DB-Eintrag bereits vorhanden. Gibt ID zurueck oder 0, wenn nicht existent
- cntRecordsPrepared() : int
- Sehr alte Funktion, die simpel die Anzahl ermitteln soll Wenn kein sql-where, dann cache 30sec
- doQueryPrepared() : int
- Returns id on default or row count if $count is true
- getByWherePrepared() : string|int|float|array<string|int, mixed>
- Holt feld(er) einer row aus tabelle anhand einer where-bedingung
- getCacheInstance() : Cache
- getField() : mixed
- Get field of a table by the recordID
- getIdArrPrepared() : array<string|int, mixed>
- getRecord() : array<string|int, mixed>
- Get record or field(s) of record by id
- getRowAssocPrepared() : array<string|int, mixed>
- getRowResult() : int|float|string
- getRowsPrepared() : array<string|int, mixed>
- getSQLInstance() : SQL
- getValPrepared() : string|int|float
- sqlInParams() : SqlInParams
- Factory method for SqlInParams.
- sqlParts() : SqlParts
- Factory method for SqlParts.
- where() : SqlParts
- Convenience alias for sqlParts() – reads nicer at call sites.
- addLimitOne() : string
- fetchIds() : array<string|int, mixed>
- fetchResult() : PDOStatement|false
Properties
$cache
public
Cache
$cache
$sql
private
SQL
$sql
Methods
__construct()
public
__construct() : mixed
bind()
Convenience alias for sqlInParams() – reads nicer at call sites.
public
bind() : SqlInParams
Return values
SqlInParamscheckExist()
Prueft, ob DB-Eintrag bereits vorhanden. Gibt ID zurueck oder 0, wenn nicht existent
public
checkExist(string $strTable, array<string|int, mixed> $saField) : int
Parameters
- $strTable : string
- $saField : array<string|int, mixed>
Return values
int —- id
cntRecordsPrepared()
Sehr alte Funktion, die simpel die Anzahl ermitteln soll Wenn kein sql-where, dann cache 30sec
public
cntRecordsPrepared(string $tableName[, array<string|int, mixed> $where = [] ][, int $nCache = 0 ]) : int
Parameters
- $tableName : string
- $where : array<string|int, mixed> = []
- $nCache : int = 0
Return values
intdoQueryPrepared()
Returns id on default or row count if $count is true
public
doQueryPrepared(string $sql[, array<string|int, mixed> $params = [] ][, bool $count = false ]) : int
Parameters
- $sql : string
- $params : array<string|int, mixed> = []
- $count : bool = false
Return values
intgetByWherePrepared()
Holt feld(er) einer row aus tabelle anhand einer where-bedingung
public
getByWherePrepared(array<string|int, mixed> $sqlData) : string|int|float|array<string|int, mixed>
"select $strField from $strTable $strWhere"
$sqlData = [ 'table' => 'user_to_buddy', 'field' => 'id', # kann auch * sein oder mehrere Felder 'where' => 'where user_id = :user_id and buddy_id = :buddy_id', 'params' => ['user_id' => $this->user->nUserID, 'buddy_id' => $nPublicUserID] ];
Parameters
- $sqlData : array<string|int, mixed>
Return values
string|int|float|array<string|int, mixed>getCacheInstance()
public
getCacheInstance() : Cache
Return values
CachegetField()
Get field of a table by the recordID
public
getField(string $strTable, string $strField, int $intID[, bool $bCache = false ]) : mixed
Parameters
- $strTable : string
- $strField : string
- $intID : int
- $bCache : bool = false
getIdArrPrepared()
public
getIdArrPrepared(string $sql[, array<string|int, mixed> $params = [] ][, string $key = 'id' ]) : array<string|int, mixed>
Parameters
- $sql : string
- $params : array<string|int, mixed> = []
- $key : string = 'id'
Return values
array<string|int, mixed>getRecord()
Get record or field(s) of record by id
public
getRecord(string $strTable, int $intID[, array<string|int, mixed> $saField = [] ]) : array<string|int, mixed>
Parameters
- $strTable : string
- $intID : int
- $saField : array<string|int, mixed> = []
Return values
array<string|int, mixed>getRowAssocPrepared()
public
getRowAssocPrepared(string $sql[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
- $sql : string
- $params : array<string|int, mixed> = []
Return values
array<string|int, mixed>getRowResult()
public
getRowResult(array<string|int, mixed> $return[, string $field = '' ][, int $rowCnt = 0 ]) : int|float|string
Parameters
- $return : array<string|int, mixed>
- $field : string = ''
- $rowCnt : int = 0
Return values
int|float|stringgetRowsPrepared()
public
getRowsPrepared(string $sql[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
- $sql : string
- $params : array<string|int, mixed> = []
Return values
array<string|int, mixed>getSQLInstance()
public
getSQLInstance() : SQL
Return values
SQLgetValPrepared()
public
getValPrepared(string $sql[, array<string|int, mixed> $params = [] ]) : string|int|float
Parameters
- $sql : string
- $params : array<string|int, mixed> = []
Return values
string|int|floatsqlInParams()
Factory method for SqlInParams.
public
sqlInParams() : SqlInParams
Return values
SqlInParamssqlParts()
Factory method for SqlParts.
public
sqlParts() : SqlParts
Return values
SqlPartswhere()
Convenience alias for sqlParts() – reads nicer at call sites.
public
where() : SqlParts
Return values
SqlPartsaddLimitOne()
private
addLimitOne(string $sql) : string
Parameters
- $sql : string
Return values
stringfetchIds()
private
fetchIds(PDOStatement|bool $result, string $key) : array<string|int, mixed>
Parameters
- $result : PDOStatement|bool
- $key : string
Return values
array<string|int, mixed>fetchResult()
private
fetchResult(string $sql[, array<string|int, mixed> $params = [] ]) : PDOStatement|false
Parameters
- $sql : string
- $params : array<string|int, mixed> = []