Class: atkMockDb
Source Location: /db/class.atkmockdb.inc
Class atkMockDb
Method Summary
| int |
connect() |
Connect to the database. |
| array |
getrows() |
Get all rows that are the result of a certain specified query |
| int |
nextid() |
returns nextid When the sequence isn't set the value 1 is returned. |
| void |
query() |
Parse and execute a query. |
| void |
setResult() |
Set the result for the query (to mock executing a query) |
Methods
void clearQueryHistory(
)
|
|
Clear the query history.
Connect to the database.
API Tags:
| Return: | Connection status |
| Abstract: | |
Redefinition of:
- atkDb::connect()
- Connect to the database.
Retrieve the query history.
array getrows(
string
$query, [int
$offset = -1], [int
$limit = -1]
)
|
|
Get all rows that are the result of a certain specified query
Note: This is not an efficient way to retrieve records, as this will load all records into one array into memory. If you retrieve a lot of records, you might hit the memory_limit and your script will die.
Parameters:
|
string |
$query: |
the query |
|
int |
$offset: |
The offset to use |
|
int |
$limit: |
The limit to use |
API Tags:
Redefinition of:
- atkDb::getrows()
- Get all rows that are the result of a certain specified query
int nextid(
string
$sequence
)
|
|
returns nextid When the sequence isn't set the value 1 is returned.
Parameters:
API Tags:
Redefinition of:
- atkDb::nextid()
- Get the next sequence number of a certain sequence.
void query(
string
$query, [int
$offset = -1], [int
$limit = -1]
)
|
|
Parse and execute a query.
If the query is a select query, the rows can be retrieved using the next_record() method.
Parameters:
|
string |
$query: |
The SQL query to execute |
|
int |
$offset: |
Retrieve the results starting at the specified record number. Pass -1 or 0 to start at the first record. |
|
int |
$limit: |
Indicates how many rows to retrieve. Pass -1 to retrieve all rows. |
API Tags:
Redefinition of:
- atkDb::query()
- Parse and execute a query.
void setNextId(
string
$sequence, int
$nextid
)
|
|
Set the next id
Parameters:
|
string |
$sequence: |
|
|
int |
$nextid: |
|
void setRegexResult(
mixed
$result, string
$regex, [int
$offset = -1], [int
$limit = -1]
)
|
|
Set the regex result for the query
Parameters:
|
mixed |
$result: |
|
|
string |
$regex: |
|
|
int |
$offset: |
|
|
int |
$limit: |
|
void setResult(
mixed
$result, string
$query, [int
$offset = -1], [int
$limit = -1]
)
|
|
Set the result for the query (to mock executing a query)
Parameters:
|
mixed |
$result: |
|
|
string |
$query: |
|
|
int |
$offset: |
|
|
int |
$limit: |
|