logo-radria.gif
   
Blog Download Documentation Forum Tasks Home
Blog Download Documentation Forum Tasks Home
barside-right.gif
barside-left.gif
logo-sql.gif





Database connection Object

sqlConnect

The sqlConnect object is usually created in the config file with the name $conx and used all over the application. Exemple of the config file :

  $conx = new sqlConnect("root", "en34b25") ;
  $conx->setHostname("localhost") ;
  $conx->setDatabase("testpackage") ;
  // Directory where Radria is located
  $conx->setBaseDirectory($cfg_local_mydbdir) ;
  // Directory where the project is located unless your config.php file is outside of your project tree. The project directory should be "./"
  $conx->setProjectDirectory("./") ;
  $conx->start()

The sqlConnect function creates a connection to the database and stores the project directory. It is used throughout the application. Most Radria applications need an sqlConnect object even if you don't use a database. Example of a sqlConnect object without using the database :

  $conx = new sqlConnect() ;
  // Directory where pas is located
  $conx->setBaseDirectory($cfg_local_mydbdir) ;
  // Directory where the project is located unless your config.php file is outside your project tree is should be "./"
  $conx->setProjectDirectory("./") ;

In this case the $conx is used to get directory information like base PAS directory and project directory.

Record Database Changes

It records all the SQL Queries for that $connection object.

Another very used feature is the backup sync : $conx→setBackupSync(true);

This flag will be sent to the sqlQuery object which will record all the queries sent to the database in two files.

  • backupsync.data.sql stores all of the queries that manipulate data.
  • backupsync.struct.sql stores all the queries that manipulate database schema structure.

This is used by SiteManager to synchronize remote databases. It can also be used in production environments to log queries at the application level.

 
core/sqlconnect.txt · Last modified: 2007/10/25 17:38 by 76.169.240.49
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki