pluf/src/Pluf/DB.php File Reference


Classes

class  Pluf_DB

Functions

 Pluf_DB_getConnection ($extra=null)
 Pluf_DB_defaultTypecast ()
 Pluf_DB_IdentityFromDb ($val)
 Pluf_DB_IdentityToDb ($val, $db)
 Pluf_DB_SerializedFromDb ($val)
 Pluf_DB_SerializedToDb ($val, $db)
 Pluf_DB_CompressedFromDb ($val)
 Pluf_DB_CompressedToDb ($val, $db)
 Pluf_DB_BooleanFromDb ($val)
 Pluf_DB_BooleanToDb ($val, $db)
 Pluf_DB_IntegerFromDb ($val)
 Pluf_DB_IntegerToDb ($val, $db)
 Pluf_DB_PasswordToDb ($val, $db)

Function Documentation

Pluf_DB_BooleanFromDb ( val  ) 

Pluf_DB_BooleanToDb ( val,
db 
)

Pluf_DB_CompressedFromDb ( val  ) 

Pluf_DB_CompressedToDb ( val,
db 
)

Pluf_DB_defaultTypecast (  ) 

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_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.

Pluf_DB_IdentityFromDb ( val  ) 

Identity function.

Parameters:
mixed Value
Returns:
mixed Value

Pluf_DB_IdentityToDb ( val,
db 
)

Identity function.

Parameters:
mixed Value.
object Database handler.
Returns:
string Ready to use for SQL.

Pluf_DB_IntegerFromDb ( val  ) 

Pluf_DB_IntegerToDb ( val,
db 
)

Pluf_DB_PasswordToDb ( val,
db 
)

Pluf_DB_SerializedFromDb ( val  ) 

Pluf_DB_SerializedToDb ( val,
db 
)


Generated on Wed Feb 3 15:44:51 2010 for Pluf by  doxygen