Methods summary
public
|
#
get( mixed $ids = array() )
|
public
|
#
getByPost( integer|array $post_id )
Get post(s) categories
Parameters
- $post_id
integer|array $post_id
|
public
|
#
sort( mixed $id, mixed $sort )
|
public
|
|
public
boolean
|
#
deleteByField( string|array $field, integer|float|string|array $value = null )
Deletes records with specified values of specified fields.
Deletes records with specified values of specified fields.
Parameters
- $field
string|array $field Name of one field to be checked or associative array with multiple field
names as item keys and their values as item values.
- $value
integer|float|string|array $value Value or array of values to be checked in specified field. Applicable
only for single field name specified in $field parameter; ignored, if array is
specified in $field.
Returns
boolean Whether deleted successfully
Overrides
|
private
|
|
public
boolean|null|waDbResultUpdate
|
#
updateByField( string|array $field, string $value, array $data = null, string $options = null, boolean $return_object = false )
Updates the contents of records containing the specified field values. Method
accepts parameters in two different modes:
- for searching values in one field
- for searching values in several fields
Updates the contents of records containing the specified field values. Method
accepts parameters in two different modes:
- for searching values in one field
- for searching values in several fields
Parameters
- $field
string|array $field (single field) Name of the table field whose value needs to be updated.
(multiple fields) Associative array of table fields by whose values table
records must be searched.
- $value
string $value (single field) Existing value of the specified field, which needs to be
replaced with a new value. Instead of one searched value, you may specify an
array; in this case the specified field is updated for all records where field's
value matches one of array items.
- $data
array $data Associative array of new values to be updated for found records.
- $options
string $options Optional key words for SQL query UPDATE: LOW_PRIORITY or IGNORE.
- $return_object
boolean $return_object (single field) Flag requiring to return an instance of class
waDbResultUpdate to enable you to call its public methods to access response
received from database server. By default (false) method returns a Boolean value
identifying the successful query result, or null if incorrect parameters have
been passed.
Returns
Example
<pre> // Update by one field and one value
$this->updateByField('field_name', $value, $data, $options); // Update by one
field and multiple values $this->updateByField('field_name', array($value1,
$value2), $data, $options); // Update by multiple fields and values
$this->updateByField(array('field1' => $value1, 'field2' => $value2),
$data, $options); </pre>
Overrides
|
public
resource|integer|boolean
|
#
insert( array $data, integer $type = 0 )
Inserts a new record into the table.
Inserts a new record into the table.
Parameters
- $data
array $data Associative array of values with keys matching the names of table fields.
- $type
integer $type Execution mode for SQL query INSERT: 0: query is executed without
additional conditions (default mode) 1: query is executed with condition ON
DUPLICATE KEY UPDATE 2: query is executed with key word IGNORE
Returns
resource|integer|boolean Returns result object or id of newly added record (if id field has
AUTO_INCREMENT property) or true (if there are no data to be inserted)
Overrides
|