>> YANA 4 PHP Framework >> Docs For Class DbCreator

Class DbCreator

Description

«decorator» database Creator

This decorator class is intended to create SQL DDL from YANA Framework - database structure files.

For this task it provides functions which create specific DDL for various DBS.

  • since: 2.8.6
  • access: public

Located in /includes/class_dbcreator.php

Object
   |
   --DbCreator
Method Summary

Methods

create a new instance
DbCreator DbCreator (
string &$structure
)
List of parameters:
Name Type Description
&$structure string a structure resource
Description:

This class requires an object of class StructureFile as input.

Example of Usage:

  1.  $dbc new DbCreatornew StructureFile('guestbook'));
  2.  $array_of_stmts $dbc->createMySQL();
  3.  // This will output the result as text
  4.   print implode("\n",$array_of_stmts);
  5.  // This will send the statements to the database
  6.   $db new DbStream('guestbook');
  7.  foreach ($array_of_stmts as $stmt)
  8.  {
  9.     $db->query($stmt);
  10.  }

  • todo: sort table definitions by foreign keys, so referenced tables are created before the references (scheduled for: v3.0)
create SQL for IBM DB2
array createDB2 ()
Description:

Returns a numeric array of SQL statements. Each element is a single statement. If you want to send the result to a SQL file you should "implode()" the array to a string.

  • access: public
create SQL for MS Access
array createMSAccess ()
Description:

Same as DbCreator::createMSSQL()

create SQL for MS SQL Server
array createMSSQL ()
Description:

Returns a numeric array of SQL statements. Each element is a single statement. If you want to send the result to a SQL file you should "implode()" the array to a string.

  • access: public
create SQL for MySQL
array createMySQL ()
Description:

Returns a numeric array of SQL statements. Each element is a single statement. If you want to send the result to a SQL file you should "implode()" the array to a string.

  • access: public
create SQL for Oracle
array createOracleDB ()
Description:

Returns a numeric array of SQL statements. Each element is a single statement. If you want to send the result to a SQL file you should "implode()" the array to a string.

  • access: public
create SQL for PostgreSQL
array createPostgreSQL ()
Description:

Returns a numeric array of SQL statements. Each element is a single statement. If you want to send the result to a SQL file you should "implode()" the array to a string.

  • access: public
inherited from base classes

Inherited From Object

Documentation generated on Sun, 11 Mar 2007 15:02:26 +0100 by phpDocumentor 1.3.1

yana author: Thomas MeyerHomepage: www.yanaframework.net