Minimalistic class for work with DB through factory-function.
Simple use. Short name of methods.
Main:
object db(null|array|string) - factory-function
accept:
array
JSON-encoded string
path to file (JSON-encoded)
NULL if used 'db_config'
TRUE (or resend options) reconnect to DB
return:
object instance
Methods:
bool function o() - status connection
bool|array q(string) - request to DB
return:
array - [data]
TRUE - Ok
FALSE - throw Exception
string function s(string) - safe input data (real escape string)
bool function c(string) - choice of encoding (collate)
int function f() - return number of fields in result from last query (SELECT)
int function r() - return number of rows in result from last query (SELECT) or affected records (INSERT, UPDATE, DELETE)
int function l() - return last insert id
int function i() - return counter (number of queries)
int function t() - return timer (total work time)
|