本文整理汇总了PHP中Horde_Db_Adapter::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Db_Adapter::execute方法的具体用法?PHP Horde_Db_Adapter::execute怎么用?PHP Horde_Db_Adapter::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Db_Adapter
的用法示例。
在下文中一共展示了Horde_Db_Adapter::execute方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setScriptActive
/**
* Sets a script running on the backend.
*
* @param array $script The filter script information. Passed elements:
* - 'name': (string) the script name.
* - 'recipes': (array) the filter recipe objects.
* - 'script': (string) the filter script.
*
* @throws Ingo_Exception
*/
public function setScriptActive($script)
{
$this->_connect();
try {
foreach ($script['recipes'] as $recipe) {
$this->_db->execute($recipe['object']->generate());
}
} catch (Horde_Db_Exception $e) {
throw new Ingo_Exception($e);
}
}
示例2: execute
/**
* Executes the SQL statement in the context of this connection.
*
* @param string $sql SQL statement.
* @param mixed $arg1 Either an array of bound parameters or a query
* name.
* @param string $arg2 If $arg1 contains bound parameters, the query
* name.
*
* @return PDOStatement
* @throws Horde_Db_Exception
*/
public function execute($sql, $arg1 = null, $arg2 = null)
{
// Can't assume this will always be a read action, use _write.
$result = $this->_write->execute($sql, $arg1, $arg2);
$this->_lastQuery = $this->_write->getLastQuery();
// Once doing writes, keep using the write backend even for reads
// at least during the same request, to help against stale data.
$this->_read = $this->_write;
return $result;
}
示例3: rewind
/**
* Implementation of the rewind() method for iterator.
*/
public function rewind()
{
if ($this->_result) {
unset($this->_result);
}
$this->_current = null;
$this->_index = null;
$this->_eof = true;
$this->_result = $this->_adapter->execute($this->_sql, $this->_arg1, $this->_arg2);
$this->next();
}
示例4: getMany
public function getMany($num = 50)
{
$tasks = array();
$values = array();
$query = 'SELECT * FROM horde_queue_tasks where task_queue = ? ORDER BY task_id LIMIT ?';
$values[] = $this->_queue;
$values[] = $num;
try {
$rows = $this->_db->selectAll($query, $values);
} catch (Horde_Db_Exception $e) {
throw new Horde_Queue_Exception($e);
}
$query = 'DELETE FROM horde_queue_tasks WHERE task_id = ?';
foreach ($rows as $row) {
$tasks[] = unserialize($row['task_fields']);
// TODO: Evaluate if a single call for all IDs is faster for various scenarios
try {
$rows = $this->_db->execute($query, array($row['task_id']));
} catch (Horde_Db_Exception $e) {
throw new Horde_Queue_Exception($e);
}
}
return $tasks;
}
示例5: _createDataTable
/**
* Create table for submiting data.
*
* @return boolean True on success.
* @throws Ulaform_Exception
*/
protected function _createDataTable($form_params, $fields)
{
/* Generate SQL query. */
$columns = array();
foreach ($fields as $field) {
switch ($field['field_type']) {
case 'file':
case 'image':
// TODO: Use Horde_SQL
switch (Horde_String::lower($this->_db->adapterName())) {
case 'pgsql':
$columns[] = $field['field_name'] . ' TEXT';
break;
case 'mysql':
case 'mysqli':
$columns[] = $field['field_name'] . ' MEDIUMBLOB';
break;
default:
$columns[] = $field['field_name'] . ' BLOB';
break;
}
break;
case 'address':
case 'countedtext':
case 'description':
case 'html':
case 'longtext':
case 'set':
$columns[] = $field['field_name'] . ' TEXT';
break;
default:
$columns[] = $field['field_name'] . ' VARCHAR(255)';
break;
}
}
$sql = sprintf('CREATE TABLE %s (%s)', $form_params['table'], implode(', ', $columns));
/* Create table. */
try {
$this->_db->execute($sql);
} catch (Horde_Db_Exception $e) {
throw new Ulaform_Exception($e);
}
return true;
}
示例6: saveForum
/**
* Saves a forum, either creating one if no forum ID is given or updating
* an existing one.
*
* @param array $info The forum information to save consisting of:
* forum_id
* forum_author
* forum_parent_id
* forum_name
* forum_moderated
* forum_description
* forum_attachments
*
* @return integer The forum ID on success.
* @throws Agora_Exception
*/
public function saveForum($info)
{
if (empty($info['forum_id'])) {
if (empty($info['author'])) {
$info['author'] = $GLOBALS['registry']->getAuth();
}
$info['forum_id'] = $this->newForum($info['forum_name'], $info['author']);
}
$sql = 'UPDATE ' . $this->_forums_table . ' SET forum_name = ?, forum_parent_id = ?, ' . 'forum_description = ?, forum_moderated = ?, ' . 'forum_attachments = ?, forum_distribution_address = ? ' . 'WHERE forum_id = ?';
$values = array($this->convertToDriver($info['forum_name']), (int) $info['forum_parent_id'], $this->convertToDriver($info['forum_description']), (int) $info['forum_moderated'], isset($info['forum_attachments']) ? (int) $info['forum_attachments'] : abs($GLOBALS['conf']['forums']['enable_attachments']), isset($info['forum_distribution_address']) ? $info['forum_distribution_address'] : '', $info['forum_id']);
try {
$this->_db->execute($sql, $values);
} catch (Horde_Db_Exception $e) {
throw new Agora_Exception($e->getMessage());
}
$this->_updateCacheState(0);
$this->_cache->expire('agora_forum_' . $info['forum_id'], $GLOBALS['conf']['cache']['default_lifetime']);
return $info['forum_id'];
}