Class AutoCRUD

Description

AutoCRUD Main Class

This class is used to create a new AutoCRUD object, and is used like this:

  1. $crud = new AutoCRUD;

Located in /autocrud.php (line 32)


	
			
Variable Summary
string $database
string $password
string $server
string $user
Method Summary
AutoCRUD AutoCRUD ([string $user = ''], [string $password = ''], [string $database = ''], [string $server = 'localhost'], [object $mysql = null])
void affected_rows ()
void close ()
mixed connect ([string $user = ''], [string $password = ''], [string $database = ''], [string $server = 'localhost'])
mixed generate ([$return $return = false])
string getTablePrefix ()
void halt (mixed $code, [mixed $msg = ''])
mixed include_crud (string $file)
void insert_id ()
bool isConnected ()
bool isSetup ()
void queries ()
void query (mixed $querystring)
void query_first (mixed $querystring)
void query_num ()
void quote (mixed $str)
void quoteInto (mixed $stack, mixed $needle)
void setTablePrefix (string $str)
void sql_query (mixed $querystring, [mixed $key = ''])
Variables
string $database (line 56)

Database Name

Can be used to set the name of the database you want to use instead of passing it as a function argument

  • access: public
string $password (line 48)

MySQL Password

Can be used to set the MySQL password instead of passing it as a function argument

  • access: public
string $server (line 64)

MySQL Host

Can be used to set the MySQL host instead of passing it as a function argument

  • access: public
string $user (line 40)

MySQL User

Can be used to set the MySQL user instead of passing it as a function argument

  • access: public
Methods
Constructor AutoCRUD (line 88)

It's possible to immediately pass the mysql info to the constructor to setup a connection

  • access: public
AutoCRUD AutoCRUD ([string $user = ''], [string $password = ''], [string $database = ''], [string $server = 'localhost'], [object $mysql = null])
  • string $user: the MySQL user
  • string $password: the password of the MySQL user
  • string $database: the name of the database you want to use
  • string $server: the MySQL host (usually localhost)
  • object $mysql: strictly used for testing purposes (to pass in Mock MySQL object)
affected_rows (line 278)

Raw MySQL function

Simply a shortcut to the raw MySQL function

void affected_rows ()
close (line 277)

Raw MySQL function

Simply a shortcut to the raw MySQL function

void close ()
connect (line 110)

Setups up a connection with the MySQL database

  • return: will either return true on success or an error object on failure
  • access: public
mixed connect ([string $user = ''], [string $password = ''], [string $database = ''], [string $server = 'localhost'])
  • string $user: the MySQL user
  • string $password: the password of the MySQL user
  • string $database: the name of the database you want to use
  • string $server: the MySQL host (usually localhost)
generate (line 201)

Used to create all the necessary CRUD objects for each table. This or the include_crud function must always be called before you can use the library

  • return: true on success, an error object on failure
  • access: public
mixed generate ([$return $return = false])
  • $return $return: should the library return the CRUD definitions or run them (thereby creating the CRUD objects)
getTablePrefix (line 189)

Returns the table prefix that has been set

  • return: the table prefix
  • access: public
string getTablePrefix ()
halt (line 279)

Raw MySQL function

Simply a shortcut to the raw MySQL function

void halt (mixed $code, [mixed $msg = ''])
include_crud (line 137)

Include an external CRUD definition file to create the CRUD objects. Can be used to increase performance of the AutoCRUD library, because the database itself isn't inspected at runtime.

  • return: will either return true on success or an error object on failure
  • access: public
mixed include_crud (string $file)
  • string $file: the path of the CRUD definition file
insert_id (line 272)

Raw MySQL function

Simply a shortcut to the raw MySQL function

void insert_id ()
isConnected (line 158)

Whether there is a connection or not

  • return: true when connected, false when not connected
  • access: public
bool isConnected ()
isSetup (line 168)

Whether CRUD objects have been setup or not

  • return: true when objects have been setup, false when they haven't been setup
  • access: public
bool isSetup ()
queries (line 274)

Raw MySQL function

Simply a shortcut to the raw MySQL function

void queries ()
query (line 269)

Raw MySQL function

Simply a shortcut to the raw MySQL function

void query (mixed $querystring)
query_first (line 271)

Raw MySQL function

Simply a shortcut to the raw MySQL function

void query_first (mixed $querystring)
query_num (line 273)

Raw MySQL function

Simply a shortcut to the raw MySQL function

void query_num ()
quote (line 275)

Raw MySQL function

Simply a shortcut to the raw MySQL function

void quote (mixed $str)
quoteInto (line 276)

Raw MySQL function

Simply a shortcut to the raw MySQL function

void quoteInto (mixed $stack, mixed $needle)
setTablePrefix (line 179)

When you are using table prefixes, set the prefix using this function, and the library will automatically create aliases for the tables without prefix

  • access: public
void setTablePrefix (string $str)
  • string $str: the table prefix
sql_query (line 270)

Raw MySQL function

Simply a shortcut to the raw MySQL function

void sql_query (mixed $querystring, [mixed $key = ''])

Documentation generated on Wed, 14 Jun 2006 14:08:41 +0200 by phpDocumentor 1.3.0RC4