core/src/PlufDB.php

Classes

Pluf_DB مدیریت پایگاه داده سیستم

Functions

Pluf_DB_getConnection()

Pluf_DB_getConnection(  $extra = null) 

Get the default DB connection.

The default database connection is defined in the configuration file through the following configuration variables:

  • db_login : Login to connect to the database
  • db_password : Password to the database
  • db_server : Name of the server
  • db_database : Name of the database
  • db_table_prefix : Prefix for the table names
  • db_version : Version of the database engine
  • db_engine : Engine for exampe 'MySQL', 'SQLite'

Once the first connection is created the following calls to Pluf::db() are getting the same connection.

Parameters

$extra

Pluf_DB_defaultTypecast()

Pluf_DB_defaultTypecast() : array

Returns an array of default typecast and quoting for the database ORM.

Foreach field type you need to provide an array with 2 functions, the from_db, the to_db.

$value = from_db($value); $escaped_value = to_db($value, $dbobject);

$escaped_value is ready to be put in the SQL, that is if this is a string, the value is quoted and escaped for example with SQLite: 'my string'' is escaped' or with MySQL 'my string\' is escaped' the starting ' and ending ' are included!

Returns

array —

Default typecast.

Pluf_DB_IdentityFromDb()

Pluf_DB_IdentityFromDb(  $val) : mixed

Identity function.

Parameters

$val

Returns

mixed —

Value

Pluf_DB_IdentityToDb()

Pluf_DB_IdentityToDb(  $val,   $db) : string

Identity function.

Parameters

$val
$db

Returns

string —

Ready to use for SQL.

Pluf_DB_SerializedFromDb()

Pluf_DB_SerializedFromDb(  $val) 

Parameters

$val

Pluf_DB_SerializedToDb()

Pluf_DB_SerializedToDb(  $val,   $db) 

Parameters

$val
$db

Pluf_DB_CompressedFromDb()

Pluf_DB_CompressedFromDb(  $val) 

Parameters

$val

Pluf_DB_CompressedToDb()

Pluf_DB_CompressedToDb(  $val,   $db) 

Parameters

$val
$db

Pluf_DB_BooleanFromDb()

Pluf_DB_BooleanFromDb(  $val) 

Parameters

$val

Pluf_DB_BooleanToDb()

Pluf_DB_BooleanToDb(  $val,   $db) 

Parameters

$val
$db

Pluf_DB_IntegerFromDb()

Pluf_DB_IntegerFromDb(  $val) 

Parameters

$val

Pluf_DB_IntegerToDb()

Pluf_DB_IntegerToDb(  $val,   $db) 

Parameters

$val
$db

Pluf_DB_FloatFromDb()

Pluf_DB_FloatFromDb(  $val) 

Parameters

$val

Pluf_DB_FloatToDb()

Pluf_DB_FloatToDb(  $val,   $db) 

Parameters

$val
$db

Pluf_DB_PasswordToDb()

Pluf_DB_PasswordToDb(  $val,   $db) 

Parameters

$val
$db

Pluf_DB_SlugToDB()

Pluf_DB_SlugToDB(  $val,   $db) 

Parameters

$val
$db

Pluf_DB_GeometryFromDb()

Pluf_DB_GeometryFromDb(Object  $val) : string

Parameters

Object $val

Returns

string

Pluf_DB_GeometryToDb()

Pluf_DB_GeometryToDb(\unknown  $val, \unknown  $db) : string

Convert text to geometry

Parameters

\unknown $val
\unknown $db

Returns

string