Documentation

SQL extends Molecule
in package

AbstractYes

Virtual class for working with the database.

Tags
author

Vitex vitex@hippy.cz

Table of Contents

Properties

$connectionSettings  : array<string, string>
Connection settings properties.
$data  : array<string, mixed>
Auxiliary variable for data operations.
$database  : string
Current database name.
$keyColumn  : string
Key column for SQL operations.
$lastInsertID  : int
Value of the last inserted AutoIncrement column.
$lastMessage  : string
Last message received from the SQL server.
$lastQuery  : string
Last executed SQL Query.
$numRows  : int
Number of affected or returned rows by $this->LastQuery.
$report  : array<string, string>
Array containing information about basic SQL connection parameters.
$resultArray  : array<string, mixed>
Array containing the results of the last SQL command.
$sqlLink  : resource
SQL Handle.
$status  : bool
Connection status.
$tableName  : string
Name of the currently processed table.
$tableStructure  : array<string, string>
Array containing the structure of the SQL table.
$connectAllreadyUP  : bool
Indicator of connection settings - SET commands have been executed.
$errorNumber  : int
Last error number.

Methods

__construct()  : mixed
General database object.
__destruct()  : mixed
Closes the database connection.
__sleep()  : bool
Resets the last query when serializing.
arrayToSetQuery()  : string
From the $data array, creates a fragment of the SQL query for WHERE (the key column $this->keyColumn is skipped if $key is false).
connect()  : void
Connect to the database.
getColumnComma()  : string
Returns quotes for column names.
getInsertID()  : int
ID returned after INSERT.
getLastError()  : string
Returns the SQL error message.
getlastInsertID()  : int
Last generated ID.
getLastQuery()  : int
Last executed query.
getNumRows()  : int
Returns the number of rows returned or affected by the last SQL query.
isConnected()  : bool
Return connect status.
logSqlError()  : mixed
Do when SQL error occurs.
ping()  : bool
Test the possibility of connecting to the SQL server.
sanitizeQuery()  : string
Removes "dangerous" characters from the SQL query.
selectDB()  : bool
Default database selector.
setTable()  : void
setUp()  : bool
SetUp Object to be ready for connect.

Properties

$connectionSettings

Connection settings properties.

public array<string, string> $connectionSettings = []

$data

Auxiliary variable for data operations.

public array<string, mixed> $data = []

$database

Current database name.

public string $database = ''

$keyColumn

Key column for SQL operations.

public string $keyColumn = ''

$lastInsertID

Value of the last inserted AutoIncrement column.

public int $lastInsertID = 0

unsigned

$lastMessage

Last message received from the SQL server.

public string $lastMessage = ''

$lastQuery

Last executed SQL Query.

public string $lastQuery = ''

$numRows

Number of affected or returned rows by $this->LastQuery.

public int $numRows = 0

$report

Array containing information about basic SQL connection parameters.

public array<string, string> $report = ['LastMessage' => 'Please extend']

$resultArray

Array containing the results of the last SQL command.

public array<string, mixed> $resultArray = []

SQL Handle.

public resource $sqlLink

$status

Connection status.

public bool $status = false

$tableName

Name of the currently processed table.

public string $tableName = ''

$tableStructure

Array containing the structure of the SQL table.

public array<string, string> $tableStructure = []

$connectAllreadyUP

Indicator of connection settings - SET commands have been executed.

protected bool $connectAllreadyUP = false

$errorNumber

Last error number.

protected int $errorNumber

Methods

__construct()

General database object.

public __construct([mixed $options = [] ]) : mixed
Parameters
$options : mixed = []

__destruct()

Closes the database connection.

public __destruct() : mixed

__sleep()

Resets the last query when serializing.

public __sleep() : bool
Return values
bool

arrayToSetQuery()

From the $data array, creates a fragment of the SQL query for WHERE (the key column $this->keyColumn is skipped if $key is false).

public arrayToSetQuery(array<string|int, mixed> $data[, bool $key = true ]) : string

since version 1.0

Parameters
$data : array<string|int, mixed>
$key : bool = true
Return values
string

connect()

Connect to the database.

public connect() : void

getColumnComma()

Returns quotes for column names.

public getColumnComma() : string

since version 1.2

Return values
string

getInsertID()

ID returned after INSERT.

public getInsertID() : int
Return values
int

getLastError()

Returns the SQL error message.

public getLastError() : string
Return values
string

getlastInsertID()

Last generated ID.

public getlastInsertID() : int
Return values
int

ID

getLastQuery()

Last executed query.

public getLastQuery() : int
Return values
int

number of rows

getNumRows()

Returns the number of rows returned or affected by the last SQL query.

public getNumRows() : int
Return values
int

number of rows

isConnected()

Return connect status.

public isConnected() : bool
Return values
bool

logSqlError()

Do when SQL error occurs.

public logSqlError([bool $ignoreErrors = false ]) : mixed
Parameters
$ignoreErrors : bool = false

ping()

Test the possibility of connecting to the SQL server.

public ping([bool $succes = false ]) : bool
Parameters
$succes : bool = false
Return values
bool

sanitizeQuery()

Removes "dangerous" characters from the SQL query.

public sanitizeQuery(string $queryRaw) : string
Parameters
$queryRaw : string

SQL Query

Return values
string

SQL Query

selectDB()

Default database selector.

public selectDB([string $dbName = null ]) : bool
Parameters
$dbName : string = null
Return values
bool

setTable()

public setTable(string $tableName) : void
Parameters
$tableName : string

setUp()

SetUp Object to be ready for connect.

public setUp([array<string|int, mixed> $options = [] ]) : bool
Parameters
$options : array<string|int, mixed> = []

Object Options (company,url,user,password,evidence, prefix,defaultUrlParams,debug)

Return values
bool

        
On this page

Search results