[ Index ]
 

Code source de GeekLog 1.4.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/system/databases/ -> mysql.class.php (sommaire)

(pas de description)

Poids: 752 lignes (24 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

database:: (23 méthodes):
  _errorlog()
  _connect()
  database()
  setVerbose()
  setDisplayError()
  isVerbose()
  setErrorFunction()
  dbQuery()
  dbSave()
  dbDelete()
  dbChange()
  dbCount()
  dbCopy()
  dbNumRows()
  dbResult()
  dbNumFields()
  dbFieldName()
  dbAffectedRows()
  dbFetchArray()
  dbInsertId()
  dbError()
  dbLockTable()
  dbUnlockTable()


Classe: database  - X-Ref

This file is the mysql implementation of the Geeklog abstraction layer.
Unfortunately the Geeklog abstraction layer isn't 100% abstract because a few
key functions use MySQL's REPLACE INTO syntax which is not a SQL standard.
This issue will need to be resolved some time ...

_errorlog($msg)   X-Ref
Logs messages

Logs messages by calling the function held in $_errorlog_fn

param: string      $msg        Message to log

_connect()   X-Ref
Connects to the MySQL database server

This function connects to the MySQL server and returns the connection object

return: object      Returns connection object

database($dbhost,$dbname,$dbuser,$dbpass,$errorlogfn='',$charset='')   X-Ref
constructor for database

This initializes an instance of the database object

param: string      $dbhost     Database host
param: string      $dbname     Name of database
param: sring       $dbuser     User to make connection as
param: string      $pass       Password for dbuser
param: string      $errorlogfn Name of the errorlog function
param: string      $charset    character set to use

setVerbose($flag)   X-Ref
Turns debug mode on

Set this to true to see debug messages

param: boolean     $flag   true or false

setDisplayError($flag)   X-Ref
Turns detailed error reporting on

If set to true, this will display detailed error messages on the site.
Otherwise, it will only that state an error occurred without going into
details. The complete error message (including the offending SQL request)
is always available from error.log.

param: boolean     $flag   true or false

isVerbose()   X-Ref
Checks to see if debug mode is on

Returns value of $_verbose

return: boolean     true if in verbose mode otherwise false

setErrorFunction($functionname)   X-Ref
Sets the function this class should call to log debug messages

param: string      $functionname   Function name

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

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

param: string      $sql            SQL to be executed
param: boolean     $ignore_error   If 1 this function supresses any error messages
return: object      Returns results of query

dbSave($table,$fields,$values)   X-Ref
Saves information to the database

This will use a REPLACE INTO to save a record into the
database

param: string      $table      The table to save to
param: string      $fields     string  Comma demlimited list of fields to save
param: string      $values     Values to save to the database table

dbDelete($table,$id,$value)   X-Ref
Deletes data from the database

This will delete some data from the given table where id = value.  If
id and value are arrays then it will traverse the arrays setting
$id[curval] = $value[curval].

param: string          $table      Table to delete data from
param: array|string    $id         field name(s) to include in where clause
param: array|string    $value      field value(s) corresponding to field names
return: boolean     Returns true on success otherwise false

dbChange($table,$item_to_set,$value_to_set,$id,$value, $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 of unique ID field for table
param: string          $value_to_set   Value for id
param: array|string    $id             additional field name used in where clause
param: array|string    $value          additional values used in where clause
param: boolean         $supress_quotes if false it will not use '<value>' in where clause
return: boolean     Returns true on success otherwise false

dbCount($table,$id='',$value='')   X-Ref
Returns the number of records for a query that meets the given criteria

This will build a SELECT count(*) statement with the given criteria and
return the result

param: string          $table  Table to perform count on
param: array|string    $id     field name(s) of fields to use in where clause
param: array|string    $value  Value(s) to use in where clause
return: boolean     returns count on success otherwise false

dbCopy($table,$fields,$values,$tablefrom,$id,$value)   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 fields
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
return: boolean     Returns true on success otherwise false

dbNumRows($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 otherwise false (0)

dbResult($recordset,$row,$field=0)   X-Ref
Returns the contents of one cell from a MySQL 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 field content)

dbNumFields($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 number of rows from query

dbFieldName($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

dbAffectedRows($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     Number of rows affected by last query

dbFetchArray($recordset, $both = false)   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 array of current row from recordset

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

Returns the last auto_increment ID generated

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

dbError($sql='')   X-Ref
returns a database error string

Returns an database error message

param: string      $sql    SQL that may have caused the error
return: string      Text for error message

dbLockTable($table)   X-Ref
Lock a table

Locks a table for write operations

param: string      $table      Table to lock
return: void

dbUnlockTable($table)   X-Ref
Unlock a table

Unlocks a table after a dbLockTable (actually, unlocks all tables)

param: string      $table      Table to unlock (ignored)
return: void



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