Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
eZMySQLDB Class Reference

## Public Member Functions
| __construct ( $server, $db, $user, $password)
| isA ()
& | query ( $sql, $print=false, $debug=false)
| array_query (&$array, $sql, $min=0, $max=-1, $column=false)
| query_single (&$row, $sql, $column=false)
| array_query_append (&$array, $sql, $min=0, $max=-1, $column=false)
| dateToNative (&$date)
| lock ( $table)
| unlock ()
| begin ()
| commit ()
| rollback ()
| nextID ( $table, $field="ID")
| escapeString ( $str)
| close ()
| insertID ()
| printConnection ()
| counter ()

## Static Public Member Functions
| fieldName ( $str)

## Public Attributes
| $Server
| $DB
| $User
| $Password
| $Database
| $Error
| $Counter

## Detailed Description

! eZCommon The eZMySQLDB class provides database functions.

eZMySQLDB implementes MySQL specific database code.

Definition at line 36 of file ezmysqldb.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZMySQLDB::__construct | ( |  | $server,
|  |  | $db,
|  |  | $user,
|  |  | $password
| ) |  |

Definition at line 38 of file ezmysqldb.php.

References $db, $ini, $ret, $server, $user, exit, and Password.

## Member Function Documentation

## ◆ array_query()

eZMySQLDB::array_query | ( | & | $array,
|  |  | $sql,
|  |  | $min = `0`,
|  |  | $max = `-1`,
|  |  | $column = `false`
| ) |  |

Executes a SELECT query that returns multiple rows and puts the results into the passed array as an indexed associative array. The array is cleared first. The results start with the array start at 0, and the number of results can be found with the count() function. The minimum and maximum expected rows can be set by supplying $min and $max, default is to allow zero or more rows. If a string is supplied to $column it is used for extracting a specific column from the query into the resulting array, this is useful when you just want one column from the query and don't want to iterate over it afterwards to extract the column.

Definition at line 158 of file ezmysqldb.php.

References array_query_append().

## ◆ array_query_append()

eZMySQLDB::array_query_append | ( | & | $array,
|  |  | $sql,
|  |  | $min = `0`,
|  |  | $max = `-1`,
|  |  | $column = `false`
| ) |  |

Differs from the above function only by not creating av empty array, but simply appends to the array passed as an argument.

Definition at line 183 of file ezmysqldb.php.

References $i, $limit, $offset, $result, query(), and eZPBLog\writeWarning().

Referenced by array_query(), and query_single().

## ◆ begin()

eZMySQLDB::begin | ( |  | ) |

Starts a new transaction.

Definition at line 286 of file ezmysqldb.php.

References query().

## ◆ close()

eZMySQLDB::close | ( |  | ) |

Will close the database connection.

Definition at line 353 of file ezmysqldb.php.

## ◆ commit()

eZMySQLDB::commit | ( |  | ) |

Commits the transaction.

Definition at line 294 of file ezmysqldb.php.

References query().

## ◆ counter()

eZMySQLDB::counter | ( |  | ) |

Definition at line 375 of file ezmysqldb.php.

References $Counter.

## ◆ dateToNative()

eZMySQLDB::dateToNative | ( | & | $date | ) |

Definition at line 254 of file ezmysqldb.php.

References $date, $ret, and eZDate\addZero().

## ◆ escapeString()

eZMySQLDB::escapeString | ( |  | $str | ) |

Will escape a string so it's ready to be inserted in the database.

Definition at line 334 of file ezmysqldb.php.

References $str.

## ◆ fieldName()

eZMySQLDB::fieldName | ( |  | $str | ) |
| static

Will just return the field name.

Definition at line 345 of file ezmysqldb.php.

References $str.

## ◆ insertID()

eZMySQLDB::insertID | ( |  | ) |

Definition at line 361 of file ezmysqldb.php.

## ◆ isA()

eZMySQLDB::isA | ( |  | ) |

Returns the driver type.

Definition at line 83 of file ezmysqldb.php.

## ◆ lock()

eZMySQLDB::lock | ( |  | $table | ) |

Locks a table

Definition at line 270 of file ezmysqldb.php.

References query().

## ◆ nextID()

eZMySQLDB::nextID | ( |  | $table,
|  |  | $field = `"ID"`
| ) |  |

Returns the next value which can be used as a unique index value.

Remeber to lock the table before using this function and inserting the value.

Definition at line 312 of file ezmysqldb.php.

References $id, and $result.

## ◆ printConnection()

eZMySQLDB::printConnection | ( |  | ) |

Definition at line 367 of file ezmysqldb.php.

References Password.

## ◆ query()

& eZMySQLDB::query | ( |  | $sql,
|  |  | $print = `false`,
|  |  | $debug = `false`
| ) |  |

Execute a query on the global MySQL database link. If it returns an error, the script is halted and the attempted SQL query and MySQL error message are printed.

Definition at line 92 of file ezmysqldb.php.

References $debug, $result, and unlock().

Referenced by array_query_append(), begin(), commit(), lock(), rollback(), and unlock().

## ◆ query_single()

eZMySQLDB::query_single | ( | & | $row,
|  |  | $sql,
|  |  | $column = `false`
| ) |  |

Same as array_query() but expects to recieve 1 row only (no array), no more no less. $column is the same as in array_query().

Definition at line 168 of file ezmysqldb.php.

References $ret, $row, and array_query_append().

## ◆ rollback()

eZMySQLDB::rollback | ( |  | ) |

Cancels the transaction.

Definition at line 302 of file ezmysqldb.php.

References query().

## ◆ unlock()

eZMySQLDB::unlock | ( |  | ) |

Releases table locks.

Definition at line 278 of file ezmysqldb.php.

References query().

Referenced by query().

## Member Data Documentation

## ◆ $Counter

eZMySQLDB::$Counter

Definition at line 387 of file ezmysqldb.php.

Referenced by counter().

## ◆ $Database

eZMySQLDB::$Database

Definition at line 385 of file ezmysqldb.php.

## ◆ $DB

eZMySQLDB::$DB

Definition at line 382 of file ezmysqldb.php.

## ◆ $Error

eZMySQLDB::$Error

Definition at line 386 of file ezmysqldb.php.

## ◆ $Password

eZMySQLDB::$Password

Definition at line 384 of file ezmysqldb.php.

## ◆ $Server

eZMySQLDB::$Server

Definition at line 381 of file ezmysqldb.php.

## ◆ $User

eZMySQLDB::$User

Definition at line 383 of file ezmysqldb.php.

The documentation for this class was generated from the following file:

- ezmysqldb.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.