[ Index ]
 

Code source de GeekLog 1.4.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/system/ -> lib-database.php (sommaire)

This is the high-level database layer for Geeklog (for the low-level stuff, see the system/databases directory). NOTE: As of Geeklog 1.3.5 you should not have to edit this file any more.

Poids: 526 lignes (18 kb)
Inclus ou requis: 1 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 21 fonctions

  DB_setdebug()
  DB_displayError()
  DB_query()
  DB_save()
  DB_delete()
  DB_getItem()
  DB_change()
  DB_count()
  DB_copy()
  DB_numRows()
  DB_result()
  DB_numFields()
  DB_fieldName()
  DB_affectedRows()
  DB_fetchArray()
  DB_insertId()
  DB_error()
  DB_createDatabaseStructures()
  DB_doDatabaseUpgrade()
  DB_lockTable()
  DB_unlockTable()

Fonctions
Fonctions qui ne font pas partie d'une Classe:

DB_setdebug($flag)   X-Ref
Turns debug mode on for the database library

Setting this to true will cause the database code to print out
various debug messages.  Setting it to false will supress the
messages (is false by default). NOTE: Gl developers have put many
useful debug messages into the mysql implementation of this.  If
you are using something other than MySQL and if the GL team did
not write it then you may or may not get something useful by turning
this on.

param: boolean     $flag       true or false

DB_displayError($flag)   X-Ref
Pas de description

DB_query($sql, $ignore_errors = 0)   X-Ref
Executes a query on the db server

This executes the passed SQL and returns the recordset or errors out

param: mixed   $sql            String or array of strings of SQL to be executed
param: int     $ignore_errors  If 1 this function supresses any error messages
return: object  Returns results from query

DB_save($table,$fields,$values,$return_page='')   X-Ref
Saves information to the database

This will use a REPLACE INTO to save a record into the
database. NOTE: this function is going to change in the near future
to remove dependency of REPLACE INTO. Please use DB_query if you can

param: string      $table          The table to save to
param: string      $fields         Comma demlimited list of fields to save
param: string      $values         Values to save to the database table
param: string      $return_page    URL to send user to when done

DB_delete($table,$id,$value,$return_page='')   X-Ref
Deletes data from the database

This will delete some data from the given table where id = value

param: string              $table          Table to delete data from
param: array|string        $id             field name(s) to use in where clause
param: array|string        $value          value(s) to use in where clause
param: string              $return_page    page to send user to when done

DB_getItem($table,$what,$selection='')   X-Ref
Gets a single item from the database

param: string      $table      Table to get item from
param: string      $what       field name to get
param: string      $selection  Where clause to use in SQL
return: mixed       Returns value sought

DB_change($table,$item_to_set,$value_to_set,$id='',$value='',$return_page='',$supress_quotes=false)   X-Ref
Changes records in a table

This will change the data in the given table that meet the given criteria and will
redirect user to another page if told to do so

param: string          $table              Table to perform change on
param: string          $item_to_set        field name to set
param: string          $value_to_set       Value to set abovle field to
param: array|string    $id                 field name(s) to use in where clause
param: array|string    $value              Value(s) to use in where clause
param: string          $return_page        page to send user to when done with change
param: boolean         $supress_quotes     whether or not to use single quotes in where clause

DB_count($table,$id='',$value='')   X-Ref
Count records in a table

This will return the number of records which meet the given criteria in the
given table.

param: string              $table      Table to perform count on
param: array|string        $id         field name(s) to use in where clause
param: array|string        $value      Value(s) to use in where clause
return: int     Returns row count from generated SQL

DB_copy($table,$fields,$values,$tablefrom,$id,$value,$return_page='')   X-Ref
Copies a record from one table to another (can be the same table)

This will use a REPLACE INTO...SELECT FROM to copy a record from one table
to another table.  They can be the same table.

param: string          $table          Table to insert record into
param: string          $fields         Comma delmited list of fields to copy over
param: string          $values         Values to store in database field
param: string          $tablefrom      Table to get record from
param: array|string       $id             Field name(s) to use in where clause
param: array|string    $value          Value(s) to use in where clause
param: string          $return_page    Page to send user to when done

DB_numRows($recordset)   X-Ref
Retrieves the number of rows in a recordset

This returns the number of rows in a recordset

param: object     $recordset      The recordset to operate one
return: int         Returns number of rows returned by a previously executed query

DB_result($recordset,$row,$field)   X-Ref
Retrieves the contents of a field

This returns the contents of a field from a result set

param: object      $recordset      The recordset to operate on
param: int         $row            row to get data from
param: string      $field          field to return
return: (depends on the contents of the field)

DB_numFields($recordset)   X-Ref
Retrieves the number of fields in a recordset

This returns the number of fields in a recordset

param: object     $recordset       The recordset to operate on
return: int         Returns the number fields in a result set

DB_fieldName($recordset,$fnumber)   X-Ref
Retrieves returns the field name for a field

Returns the field name for a given field number

param: object      $recordset      The recordset to operate on
param: int         $fnumber        field number to return the name of
return: string      Returns name of specified field

DB_affectedRows($recordset)   X-Ref
Retrieves returns the number of effected rows for last query

Retrieves returns the number of effected rows for last query

param: object      $recordset      The recordset to operate on
return: int         returns numbe of rows affected by previously executed query

DB_fetchArray($recordset, $both = true)   X-Ref
Retrieves record from a recordset

Gets the next record in a recordset and returns in array

param: object      $recordset      The recordset to operate on
param: boolean     $both           get both assoc and numeric indices
return: Array      Returns data for a record in an array

DB_insertId($link_identifier = '')   X-Ref
Returns the last ID inserted

Returns the last auto_increment ID generated

param: resources   $link_identifier    identifier for opened link
return: int                             Returns the last ID auto-generated

DB_error()   X-Ref
returns a database error string

Returns an database error message

return: string  Returns database error message

DB_createDatabaseStructures()   X-Ref
Creates database structures for fresh installation

This may not be used by Geeklog currently

return: boolean     returns true on success otherwise false

DB_doDatabaseUpgrade($current_gl_version)   X-Ref
Executes the sql upgrade script(s)

param: string      $current_gl_version     version of geeklog to upgrade from
return: boolean     returns true on success otherwise false

DB_lockTable($table)   X-Ref
Lock a table

Locks a table for write operations

param: string      $table      Table to lock
return: void

DB_unlockTable($table)   X-Ref
Unlock a table

Unlocks a table after DB_lockTable

param: string      $table      Table to unlock
return: void



Généré le : Wed Nov 21 12:27:40 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics