Dotclear 2.24
|
DBLayer Cursor. More...
Public Member Functions | |
__construct (dbLayer $con, string $table) | |
setTable (string $table) | |
setField (string $name, $value) | |
unsetField (string $name) | |
isField (string $name) | |
getField (string $name) | |
__set (string $name, $value) | |
__get (string $name) | |
clean () | |
getInsert () | |
getUpdate (string $where) | |
insert () | |
update (string $where) | |
DBLayer Cursor.
This class implements facilities to insert or update in a table.
__construct | ( | dbLayer | $con, |
string | $table | ||
) |
Constructor
Init cursor object on a given table. Note that you can init it with openCursor()
method of your connection object.
Example: <?php $cur = $con->openCursor('table'); $cur->field1 = 1; $cur->field2 = 'foo'; $cur->insert(); // Insert field ...
$cur->update('WHERE field3 = 4'); // ... or update field ?>
dbLayer | $con | Connection object |
string | $table | Table name |
References setTable().
setTable | ( | string | $table | ) |
Set table
Changes working table and resets data
string | $table | Table name |
Referenced by __construct().
setField | ( | string | $name, |
$value | |||
) |
Set field
Set value $value to a field named $name. Value could be an string, an integer, a float, a null value or an array.
If value is an array, its first value will be interpreted as a SQL command. String values will be automatically escaped.
string | $name | Field name |
mixed | $value | Field value |
Referenced by __set().
unsetField | ( | string | $name | ) |
Unset field
Remove a field from data set.
string | $name | Field name |
Referenced by dcBlog\updComment().
isField | ( | string | $name | ) |
Field exists
getField | ( | string | $name | ) |
__set | ( | string | $name, |
$value | |||
) |
__get | ( | string | $name | ) |
Field value
Magic alias for getField()
References getField().
clean | ( | ) |
Empty data set
Removes all data from data set
Referenced by dcCore\indexAllComments(), dcCore\indexAllPosts(), and dcSpamFilters\isSpam().
getInsert | ( | ) |
getUpdate | ( | string | $where | ) |
Get update query
Returns the generated UPDATE query
string | $where | WHERE condition |
Referenced by update().
insert | ( | ) |
Execute insert query
Executes the generated INSERT query
References getInsert().
Referenced by dcCore\addBlog(), dcBlog\addComment(), dcLog\addLog(), dcNotices\addNotice(), and dcCore\addUser().
update | ( | string | $where | ) |
Execute update query
Executes the generated UPDATE query
string | $where | WHERE condition |
References getUpdate().
Referenced by dcCore\indexAllComments(), dcCore\indexAllPosts(), and dcCore\updBlog().