phpDocumentor GloryLands
Database
[ class tree: GloryLands ] [ index: GloryLands ] [ all elements ]

Class: DBJet

Source Location: /engine/lib/db/db.php

Class DBJet

Class Overview

Basic database interface This class is further extended by the database jet selected. any kind of database can be used.

Basic database interface This class is further extended by the database jet selected. Using this method, any kind of database can be used.

Located in /engine/lib/db/db.php [line 43]



		
				Author(s):
		
API Tags:
Abstract:  

Methods

[ Top ]
Descendants
Child Class Description
mysql_jet MySQL Database Jet

[ Top ]
Method Summary
bool   check_select()   Check if the select query will return data
bool|resource   delete()   Delete a data row from the database
bool   empty_results()   Check if the resultset is empty
bool|array   fetch_array()   Fetch a row from the resultset
bool|array   fetch_array_all()   Fetch all the rows of the resultset
bool|array   fetch_array_all_ex()   Fetch all the rows from the resultset using an extended field
bool|array   fetch_array_ex()   Fetch a row from the resultset using an extended field
bool|array   fetch_value()   Fetch a single value from the resultset
int   get_error_message()   Get the last error message
bool|array   get_tables()   Get the names of all the tables in the database
bool|array   get_table_structure()   Get a table structure
void   init()   Initialize Database jet, using the configuration provided
bool|resource   insert()   Insert a new data row on the database
int   num_changed()   Get the number of changed rows in the resultset
int   num_pages()   Get the total ammount of pages that are used by the pager
int   num_rows()   Get the number of rows in the resultset
bool|array   paging_fetch_array()   Fetch a row from the resultset, using the paging mechanism
bool|array   paging_fetch_array_ex()   Fetch all the rows of the resultset, using the paging mechanism
void   paging_start()   Start the automated data pager The paging system allows you to group the results into pages, quickly and efficiently.
bool|resource   query()   Manually execute a complex SQL query
bool|array   query_and_get()   Perform an SQ query and return the first row
bool|resource   replace()   Replace a data row into the database
bool|resource   select()   Select a row from the database
bool|array   select_and_get()   Select data and fetch the first row
bool   set_row()   Set the current resultset pointer into a different row
bool|resource   update()   Update a row on the database

[ Top ]
Methods
check_select  [line 199]

  bool check_select( string $table, [array $index_data = false], [array $return_data = false], [array $order_by = false], [array $sort_order = false]  )

Check if the select query will return data

Check if the select query will return data

Parameters:
string   $table:  The name of the database table that the data resides on
array   $index_data:  [Optional] The indexing fields that define the rows to fetch (ex. [name] => 'user', [password] => '1234')
array   $return_data:  [Optional] The names of the fields that should be returned (if ommited, all of them)
array   $order_by:  [Optional] The name of the sorting field
array   $sort_order:  [Optional] The sort order: 'ASC' for ascending or 'DESC' for descending

API Tags:
Return:  Returns TRUE if data were received or FALSE if the result was empty
Access:  public


[ Top ]
delete  [line 67]

  bool|resource delete( string $table, [array $index_data = false]  )

Delete a data row from the database

Delete a data row from the database

Parameters:
string   $table:  The name of the table that contain the data
array   $index_data:  An array that holds the indexing information of the data being removed (Ex. [name] => 'user')

API Tags:
Return:  Returns false in case of error or the resultset of the executed query
Abstract:  
Access:  public


Redefined in descendants as:

[ Top ]
empty_results  [line 254]

  bool empty_results( )

Check if the resultset is empty

Check if the resultset is empty


API Tags:
Return:  Returns TRUE if the resultset is empty, or FALSE otherways
Access:  public


[ Top ]
fetch_array  [line 107]

  bool|array fetch_array( [int $mode = false], [int $resultset = false]  )

Fetch a row from the resultset

Fetch a row from the resultset

Parameters:
int   $mode:  [Optional] The returning array key format. Can be MYSQL_ASSOC for associative array, MYSQL_NUM, for indexed array, or MYSQL_BOTH
int   $resultset:  [Optional] The resultset to use. If not specified, the last action's resultset will be used.

API Tags:
Return:  Returns false in case of error or the data array if successfull
Abstract:  
Access:  public


Redefined in descendants as:

[ Top ]
fetch_array_all  [line 116]

  bool|array fetch_array_all( [int $mode = false], [int $resultset = false]  )

Fetch all the rows of the resultset

Fetch all the rows of the resultset

Parameters:
int   $mode:  [Optional] The returning array key format. Can be MYSQL_ASSOC for associative array, MYSQL_NUM, for indexed array, or MYSQL_BOTH
int   $resultset:  [Optional] The resultset to use. If not specified, the last action's resultset will be used.

API Tags:
Return:  Returns false in case of error or the data array if successfull
Abstract:  
Access:  public


Redefined in descendants as:

[ Top ]
fetch_array_all_ex  [line 293]

  bool|array fetch_array_all_ex( [int $mode = false], [int $resultset = false], [string $extrafield = 'extra']  )

Fetch all the rows from the resultset using an extended field

Fetch all the rows from the resultset using an extended field The extended field is a field in the resultset that contains PHP serialized data. Theese data will be automatically expanded and inserted in the returning array

Parameters:
int   $mode:  [Optional] The returning array key format. Can be MYSQL_ASSOC for associative array, MYSQL_NUM, for indexed array, or MYSQL_BOTH
int   $resultset:  [Optional] The resultset to use. If not specified, the last action's resultset will be used.
string   $extrafield:  [Optional] The name of the extra field (defaults to 'extra')

API Tags:
Return:  Returns false in case of error or the data array if successfull
Access:  public


[ Top ]
fetch_array_ex  [line 270]

  bool|array fetch_array_ex( [int $mode = false], [int $resultset = false], [string $extrafield = 'extra']  )

Fetch a row from the resultset using an extended field

Fetch a row from the resultset using an extended field The extended field is a field in the resultset that contains PHP serialized data. Theese data will be automatically expanded and inserted in the returning array

Parameters:
int   $mode:  [Optional] The returning array key format. Can be MYSQL_ASSOC for associative array, MYSQL_NUM, for indexed array, or MYSQL_BOTH
int   $resultset:  [Optional] The resultset to use. If not specified, the last action's resultset will be used.
string   $extrafield:  [Optional] The name of the extra field (defaults to 'extra')

API Tags:
Return:  Returns false in case of error or the data array if successfull
Access:  public


[ Top ]
fetch_value  [line 124]

  bool|array fetch_value( [int $resultset = false]  )

Fetch a single value from the resultset

Fetch a single value from the resultset

Parameters:
int   $resultset:  [Optional] The resultset to use. If not specified, the last action's resultset will be used.

API Tags:
Return:  Returns false in case of error or the data array if successfull
Abstract:  
Access:  public


Redefined in descendants as:
  • mysql_jet::fetch_value() : Return the first value of the first row of the requested query, using a specified resultset

[ Top ]
get_error_message  [line 147]

  int get_error_message( [bool $formatted = true]  )

Get the last error message

Get the last error message

Parameters:
bool   $formatted:  If TRUE, the message will be properly, HTML formatted

API Tags:
Return:  Returns the HTML or text result
Abstract:  
Access:  public


Redefined in descendants as:

[ Top ]
get_tables  [line 156]

  bool|array get_tables( )

Get the names of all the tables in the database

Get the names of all the tables in the database


API Tags:
Return:  Returns the database tables as array, or FALSE on error
Abstract:  
Access:  public


Redefined in descendants as:

[ Top ]
get_table_structure  [line 163]

  bool|array get_table_structure( $table  )

Get a table structure

Get a table structure

Parameters:
   $table: 

API Tags:
Return:  Returns the table structure as an associative array, with key each field's name
Abstract:  
Access:  public


Redefined in descendants as:

[ Top ]
init  [line 49]

  void init( array $config  )

Initialize Database jet, using the configuration provided

Initialize Database jet, using the configuration provided

Parameters:
array   $config:  The Jet configuration (Structure depends on the Jet)

API Tags:
Abstract:  
Access:  public


Redefined in descendants as:

[ Top ]
insert  [line 58]

  bool|resource insert( string $table, array $data  )

Insert a new data row on the database

Insert a new data row on the database

Parameters:
string   $table:  The name of the table that will receive the new row
array   $data:  An array that contains the field names (as keys) and the field values to add

API Tags:
Return:  Returns false in case of error or the resultset of the executed query
Abstract:  
Access:  public


Redefined in descendants as:

[ Top ]
num_changed  [line 139]

  int num_changed( )

Get the number of changed rows in the resultset

Get the number of changed rows in the resultset


API Tags:
Return:  Returns the number of the rows that were changed, on the last resultset
Abstract:  
Access:  public


Redefined in descendants as:

[ Top ]
num_pages  [line 361]

  int num_pages( )

Get the total ammount of pages that are used by the pager

Get the total ammount of pages that are used by the pager


API Tags:
Return:  The number of pages
Access:  public


[ Top ]
num_rows  [line 132]

  int num_rows( [int $resultset = false]  )

Get the number of rows in the resultset

Get the number of rows in the resultset

Parameters:
int   $resultset:  [Optional] The resultset to use. If not specified, the last action's resultset will be used.

API Tags:
Return:  Returns the number of the rows in the resultset
Abstract:  
Access:  public


Redefined in descendants as:

[ Top ]
paging_fetch_array  [line 372]

  bool|array paging_fetch_array( [int $mode = false], [int $resultset = false]  )

Fetch a row from the resultset, using the paging mechanism

Fetch a row from the resultset, using the paging mechanism

Parameters:
int   $mode:  [Optional] The returning array key format. Can be MYSQL_ASSOC for associative array, MYSQL_NUM, for indexed array, or MYSQL_BOTH
int   $resultset:  [Optional] The resultset to use. If not specified, the last action's resultset will be used.

API Tags:
Return:  Returns false in case of error or when reached the end or the data array if successfull
Access:  public


[ Top ]
paging_fetch_array_ex  [line 385]

  bool|array paging_fetch_array_ex( [int $mode = false], [int $resultset = false], [ $extrafield = 'extra']  )

Fetch all the rows of the resultset, using the paging mechanism

Fetch all the rows of the resultset, using the paging mechanism

Parameters:
int   $mode:  [Optional] The returning array key format. Can be MYSQL_ASSOC for associative array, MYSQL_NUM, for indexed array, or MYSQL_BOTH
int   $resultset:  [Optional] The resultset to use. If not specified, the last action's resultset will be used.
   $extrafield: 

API Tags:
Return:  Returns false in case of error or when reached the end or the data array if successfull
Access:  public


[ Top ]
paging_start  [line 339]

  void paging_start( int $page, int $rows_per_page, [int $resultset = false]  )

Start the automated data pager The paging system allows you to group the results into pages, quickly and efficiently.

Start the automated data pager The paging system allows you to group the results into pages, quickly and efficiently. In order to use the paging system, you should first call the paging_start() function and then use the paging_fetch_array() function instead of fetch_array()

Parameters:
int   $page:  The active page (Starts from 0)
int   $rows_per_page:  The maximum numbers of rows that will be allowed on each page
int   $resultset:  [Optional] The resultset to use. If not specified, the last action's resultset will be used.

API Tags:
Access:  public


[ Top ]
query  [line 176]

  bool|resource query( string $text  )

Manually execute a complex SQL query

Manually execute a complex SQL query This function should be avoided when possible, because there could be jets that do not support SQL quering!

Parameters:
string   $text:  The query to execute

API Tags:
Return:  Returns false in case of error or the resultset of the executed query
Abstract:  
Access:  public


Redefined in descendants as:

[ Top ]
query_and_get  [line 238]

  bool|array query_and_get( string $text  )

Perform an SQ query and return the first row

Perform an SQ query and return the first row This function should be avoided when possible, because there could be jets that do not support SQL quering!

Parameters:
string   $text:  The query to execute

API Tags:
Return:  Returns false in case of error or the data array if successfull
Access:  public


[ Top ]
replace  [line 76]

  bool|resource replace( string $table, array $data  )

Replace a data row into the database

Replace a data row into the database

Parameters:
string   $table:  The name of the table that will receive the data
array   $data:  An array that contains the field names and values. If one or more field names are indexing keys, they will define the row that will be updated.

API Tags:
Return:  Returns false in case of error or the resultset of the executed query
Abstract:  
Access:  public


Redefined in descendants as:

[ Top ]
select  [line 88]

  bool|resource select( string $table, [array $index_data = false], [array $return_data = false], [array $order_by = false], [array $sort_order = false]  )

Select a row from the database

Select a row from the database

Parameters:
string   $table:  The name of the database table that the data resides on
array   $index_data:  [Optional] The indexing fields that define the rows to fetch (ex. [name] => 'user', [password] => '1234')
array   $return_data:  [Optional] The names of the fields that should be returned (if ommited, all of them)
array   $order_by:  [Optional] The name of the sorting field
array   $sort_order:  [Optional] The sort order: 'ASC' for ascending or 'DESC' for descending

API Tags:
Return:  Returns false in case of error or the resultset of the executed query
Abstract:  
Access:  public


Redefined in descendants as:

[ Top ]
select_and_get  [line 218]

  bool|array select_and_get( string $table, [array $index_data = false], [array $return_data = false], [array $order_by = false], [array $sort_order = false]  )

Select data and fetch the first row

Select data and fetch the first row

Parameters:
string   $table:  The name of the database table that the data resides on
array   $index_data:  [Optional] The indexing fields that define the rows to fetch (ex. [name] => 'user', [password] => '1234')
array   $return_data:  [Optional] The names of the fields that should be returned (if ommited, all of them)
array   $order_by:  [Optional] The name of the sorting field
array   $sort_order:  [Optional] The sort order: 'ASC' for ascending or 'DESC' for descending

API Tags:
Return:  Returns false in case of error or the data array if successfull
Access:  public


[ Top ]
set_row  [line 185]

  bool set_row( int $position, [int $resultset = false]  )

Set the current resultset pointer into a different row

Set the current resultset pointer into a different row

Parameters:
int   $position:  The new position
int   $resultset:  [Optional] The resultset to use. If not specified, the last action's resultset will be used.

API Tags:
Return:  Returns false in case of error or TRUE if successfull
Abstract:  
Access:  public


Redefined in descendants as:

[ Top ]
update  [line 98]

  bool|resource update( string $table, array $index_data, array $new_data  )

Update a row on the database

Update a row on the database

Parameters:
string   $table:  The name of the database table that the data resides on
array   $index_data:  The indexing fields that define the row(s) to update (ex. [name] => 'user', [password] => '1234')
array   $new_data:  The new data

API Tags:
Return:  Returns false in case of error or the resultset of the executed query
Abstract:  
Access:  public


Redefined in descendants as:

[ Top ]

Documentation generated on Tue, 13 Oct 2009 23:48:49 +0300 by phpDocumentor 1.4.1