3.5.2.5. Database

File: classes/Database.php
The abstract Database class defines the EWE interface to whatever database is being used. By default, this is the MySQL database. The default database class is MySQL_Database which overides all methods in the base class.

3.5.2.5.1. connect_errno

Format: result = connect_errno()
Example: $err = $db->connect_errno();

This method returns the error number for a failed database connection.

3.5.2.5.2. connect_error

Format: result = connect_error()
Example: $err = $db->connect_error();

This method returns the error text for a failed database connection.

3.5.2.5.3. data_seek

Format: result = data_seek(resultset,index))
where "resultset" is a result set and "index" is the zero-based index to seek to within that set.
Example: $result = $db->data_seek($res,$index);

This method seeks to the specified index within a result set such that the next fetch will retrive that row.

3.5.2.5.4. error

Format: result = error()
Example: $err = $db->error();

This method returns the error caused by the last database operation.

3.5.2.5.5. fastquery

Format: result = fastquery(sql)
Example: $result = $db->fastquery($sql);

This method performs a query with no overhead, such as logging. It is intended to only be used within the class methods. Normally the query method should be used.

3.5.2.5.6. fetch_assoc

Format: result = fetch_assoc(resultset)
where "resultset" is the returned result set from a query.
Example: $row = $db->fetch_assoc($res);

This method returns the next row from the specified result set.

3.5.2.5.7. insert_id

Format: result = insert_id()
Example: $row = $db->insert_id();

This method returns the ID of the last insert operation.

3.5.2.5.8. num_rows

Format: result = num_rows(resultset)
where "resultset" is the returned result set from a query.
Example: $num = $db->num_rows($res);

This method returns the number of rows in the specified result set.

3.5.2.5.9. query

Format: result = query(sql,site=0)
where "sql" is the SQL statement to execute and "site" is the site to perform the operation on. "site" is reserved for future use and should always be 0, or omitted.
Example: $num = $db->query($sql,$site=0);

This method returns a result set based on the specified SQL command.

3.5.2.5.10. real_escape_string

Format: result = real_escape_string(str)
where "str" is the string to escape.
Example: $str = $db->real_escape_string($str);

This method returns the passed string in a form that has special characters escaped for use in SQL statements for this database.