Execute Execute(
String
$table, [String
$command = ''], [String
$id = '']
)
|
|
Constructor
Parameters:
|
String |
$table: |
The Table to query. Note: The name is scrampled |
|
String |
$command: |
The command to execute |
|
String |
$id: |
The primary key |
void buildInsert(
array
$row, array
$rows
)
|
|
Builds the key/value pairs for the INSERT/REPLACE query
Parameters:
|
array |
$row: |
The row of keys to use |
|
array |
$rows: |
One or more rows of values to use |
void buildRow(
array
$row
)
|
|
Builds the row for the INSERT/REPLACE query
Parameters:
|
array |
$row: |
The row of keys to use |
void buildUpdate(
array
$row
)
|
|
Builds the key/value pairs for UPDATE the query
Parameters:
|
array |
$row: |
The row of key value pairs to use |
boolean create(
String
$extSql, [String
$comment = ''], [String
$type = 'MyISAM']
)
|
|
Perform the query: CREATE table ( $extSql ) TYPE=MyISAM
Parameters:
|
String |
$extSql: |
The external definitions of fields |
|
String |
$comment: |
The Table comment |
|
String |
$type: |
The Table type |
API Tags:
| Return: | TRUE on success and FALSE on error |
boolean delete(
[mixed
$sid = ''], String
$name
)
|
|
Perform the query: DELETE FROM table WHERE ...
Parameters:
|
String |
$name: |
The table_name, if present, overrules the table_id |
API Tags:
| Return: | TRUE on success and FALSE on error |
Perform the query: DROP table IF EXISTS ...
API Tags:
| Return: | TRUE on success and FALSE on error |
int getCount(
[String
$key = ''], [String
$value = '']
)
|
|
Perform the query: SELECT count(table_id) FROM table [WHERE $key=$value] ...
Parameters:
|
String |
$key: |
Optional where key |
|
String |
$value: |
Optional where value |
API Tags:
| Return: | The number of rows, FALSE if failure |
Perform the query: SELECT last_insert_id();
API Tags:
| Return: | The last inserted auto increment value on succes, otherwise 0 on error |
Information Tags:
| Todo: | NOT Threadsafe !!! mySQL specific |
array getParams(
[array
$params = '']
)
|
|
Return the POST/GET params or the supplied request array
The search order is: $param > $_POST > $_GET
Parameters:
|
array |
$params: |
The params to use |
API Tags:
| Return: | The request array |
boolean insert(
[array
$params = ''], [int
$insert = DATABASE_EXECUTE_INSERT]
)
|
|
Perform the query: INSERT INTO table (keys) VALUES (values)...
Parameters:
|
array |
$params: |
An optionally key/value array, default $_POST |
|
int |
$insert: |
INSERT (default) or REPLACE |
API Tags:
| Return: | TRUE on success and FALSE on error |
void parse(
[boolean
$type = DATABASE_EXECUTE_INSERT], [array
$params = '']
)
|
|
Parses the $_POST in order to create the key/value pairs ...
Skip the keywords: PROJECT, PAGE, COMMAND and TABLE and ID The function does also handles multiple rows like add rows to basket
Parameters:
|
boolean |
$type: |
either Insert, Replace (FALSE) or Update (TRUE) |
|
array |
$params: |
An optionally key/value array, default $_POST |
String printError(
[String
$text = ''], [String
$sql = '']
)
|
|
Print an error message and other information
Parameters:
|
String |
$text: |
Error message to print |
|
String |
$sql: |
The sql query in question |
API Tags:
| Return: | The error message |
boolean replace(
[array
$params = '']
)
|
|
Perform the query: REPLACE INTO table (keys) VALUES (values)...
Parameters:
|
array |
$params: |
An optionally key/value array, default $_POST |
API Tags:
| Return: | TRUE on success and FALSE on error |
boolean skip(
String
$key, String
$value
)
|
|
Checks the key, value pairs, if part of the post query
Skip the keywords: COMMAND, TABLE, ID, PROJECT, PAGE, table_id
Parameters:
|
String |
$key: |
The key to check |
|
String |
$value: |
The value to check |
API Tags:
| Return: | TRUE, if continue for next search |
boolean update(
[array
$params = '']
)
|
|
Perform the query: UPDATE table SET ... WHERE ID=$id
Parameters:
|
array |
$params: |
An optionally key/value array, default $_POST |
API Tags:
| Return: | TRUE on success and FALSE on error |
boolean updateBasket(
[array
$params = '']
)
|
|
Perform specialized Basket query: UPDATE basket SET ... WHERE
- The Basket quantity field has the following format:
- <input type="text" name="quantity[$id]" value="$thedata" .../>
Parameters:
|
array |
$params: |
An optionally key/value array, default $_POST |
API Tags:
| Return: | TRUE on success and FALSE on error |