Dotclear 2.24
Loading...
Searching...
No Matches
cursor Class Reference

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)
 

Detailed Description

DBLayer Cursor.

This class implements facilities to insert or update in a table.

Constructor & Destructor Documentation

◆ __construct()

__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 ?>

See also
dbLayer::openCursor()
Parameters
dbLayer$conConnection object
string$tableTable name

References setTable().

Member Function Documentation

◆ setTable()

setTable ( string  $table)

Set table

Changes working table and resets data

Parameters
string$tableTable name

Referenced by __construct().

◆ setField()

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.

See also
__set()
Parameters
string$nameField name
mixed$valueField value

Referenced by __set().

◆ unsetField()

unsetField ( string  $name)

Unset field

Remove a field from data set.

Parameters
string$nameField name

Referenced by dcBlog\updComment().

◆ isField()

isField ( string  $name)

Field exists

Returns
boolean true if field named $name exists

◆ getField()

getField ( string  $name)

Field value

See also
__get()
Returns
mixed value for a field named $name

Referenced by __get().

◆ __set()

__set ( string  $name,
  $value 
)

Set Field

Magic alias for setField()

References setField().

◆ __get()

__get ( string  $name)

Field value

Magic alias for getField()

Returns
mixed value for a field named $n

References getField().

◆ clean()

clean ( )

Empty data set

Removes all data from data set

Referenced by dcCore\indexAllComments(), dcCore\indexAllPosts(), and dcSpamFilters\isSpam().

◆ getInsert()

getInsert ( )

Get insert query

Returns the generated INSERT query

Returns
string

Referenced by insert().

◆ getUpdate()

getUpdate ( string  $where)

Get update query

Returns the generated UPDATE query

Parameters
string$whereWHERE condition
Returns
string

Referenced by update().

◆ insert()

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()

update ( string  $where)

Execute update query

Executes the generated UPDATE query

Parameters
string$whereWHERE condition

References getUpdate().

Referenced by dcCore\indexAllComments(), dcCore\indexAllPosts(), and dcCore\updBlog().


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