当前位置: 首页>>代码示例>>PHP>>正文


PHP Connection::execute方法代码示例

本文整理汇总了PHP中Connection::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::execute方法的具体用法?PHP Connection::execute怎么用?PHP Connection::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Connection的用法示例。


在下文中一共展示了Connection::execute方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testExecute

 /**
  * @param Connection $db
  * @depends testConnect
  */
 public function testExecute(Connection $db)
 {
     $table = uniqid('table_');
     $db->execute("CREATE TABLE {$table} (id int, display varchar(100));");
     for ($i = 1; $i < 5; $i++) {
         $value = md5($i);
         $db->execute("INSERT INTO {$table} VALUES (:id, :value);", array($i, $value));
     }
     return array($table, $db);
 }
开发者ID:dario1985,项目名称:adodb,代码行数:14,代码来源:ConnectionTest.php

示例2: execute

 public function execute($params = null)
 {
     if (is_null($params)) {
         $params = $this->params;
     }
     $sql = $this->connection->execute($this->sql, $params);
     $data = new Data($this->fetchAllAssoc($sql));
     $meta = $this->parseMeta($this->connection->execute('SHOW META'));
     return new Result($data, $meta, $sql);
 }
开发者ID:aldump,项目名称:symfony2-sphinx-bundle,代码行数:10,代码来源:Query.php

示例3: remcat

function remcat()
{
    global $_REQUEST, $login, $pass, $server, $db, $nb;
    $cat = trim(strip_tags($_REQUEST['cat']));
    $cat = strtr($cat, ' ', '');
    if (strlen($cat) == 0) {
        echo '<p class="error"><strong>Error:</strong> You must provide a category name.</p>';
    } else {
        $con = new Connection($login, $pass, $server, $db);
        $con->execute("DELETE FROM sptbl_spam_categories WHERE category_id='" . $con->escapeStr($cat) . "'");
        $con->execute("DELETE FROM sptbl_spam_references WHERE category_id='" . $con->escapeStr($cat) . "'");
        $con->execute("DELETE FROM sptbl_spam_wordfreqs WHERE category_id='" . $con->escapeStr($cat) . "'");
        $nb->updateProbabilities();
        echo "<p class='success'>The category has been just removed.</p>";
    }
}
开发者ID:ACSAUruguay,项目名称:helpdesk,代码行数:16,代码来源:navebaysinfilter.php

示例4: remcat

function remcat()
{
    global $_REQUEST, $login, $pass, $server, $db, $nb;
    $cat = trim(strip_tags($_REQUEST['cat']));
    $cat = strtr($cat, ' ', '');
    if (strlen($cat) == 0) {
        echo '<p class="erreur"><strong>Erreur:</strong> Vous devez donner un nom de catégorie.</p>';
    } else {
        $con = new Connection($login, $pass, $server, $db);
        $con->execute("DELETE FROM nb_categories WHERE category_id='" . $con->escapeStr($cat) . "'");
        $con->execute("DELETE FROM nb_references WHERE category_id='" . $con->escapeStr($cat) . "'");
        $con->execute("DELETE FROM nb_wordfreqs WHERE category_id='" . $con->escapeStr($cat) . "'");
        $nb->updateProbabilities();
        echo "<p class='succes'>La catégorie vient d'être supprimée.</p>";
    }
}
开发者ID:nagaexe,项目名称:PHP-Naive-Bayesian-Filter,代码行数:16,代码来源:index.php

示例5: execute

 /**
  * Execute the query and return the number of rows affected
  *
  * @return int
  */
 public function execute()
 {
     return $this->connection->execute($this->getQuery());
 }
开发者ID:phrodo,项目名称:database,代码行数:9,代码来源:Query.php

示例6: Connection

DISCLAIMED. IN NO EVENT SHALL ADRIAN KOSMACZEWSKI BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// The binary plist and the SOAP formatters require huge amounts of memory!
ini_set('memory_limit', '128M');
require_once 'data/database.php';
require_once 'formatters/formatterfactory.php';
// Get all the data from the database
$limit = $_GET["limit"];
if (!$limit) {
    $limit = "50";
}
// Before calling mysql_real_escape_string() you have to connect to the DB...!
$conn = new Connection();
$conn->open();
$query = "SELECT * FROM data ORDER BY RAND() LIMIT " . mysql_real_escape_string($limit);
$data = $conn->execute($query);
$conn->close();
// Depending the "format" parameter in the query string,
// output the data in different formats
$format = mysql_real_escape_string($_GET["format"]);
$formatter = FormatterFactory::createFormatter($format);
$formatter->setData($data);
header('Content-type: ' . $formatter->getContentType());
$output = $formatter->formatData();
echo $output;
开发者ID:rotten4pple,项目名称:iPhoneWebServicesClient,代码行数:31,代码来源:index.php

示例7: prepareEmptyDatabaseTable

 private function prepareEmptyDatabaseTable()
 {
     $this->connection->execute('CREATE TABLE IF NOT EXISTS test_table (id INTEGER PRIMARY KEY);)');
 }
开发者ID:bytepark,项目名称:lib-migration,代码行数:4,代码来源:PdoSqliteMemoryTest.php

示例8: _createTables

    /**
     * Creates tables for testing listTables/describe()
     *
     * @param Connection $connection
     * @return void
     */
    protected function _createTables($connection)
    {
        $this->_needsConnection();
        $schema = new SchemaCollection($connection);
        $result = $schema->listTables();
        if (in_array('schema_articles', $result) && in_array('schema_authors', $result)) {
            return;
        }
        $table = <<<SQL
CREATE TABLE schema_authors (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name VARCHAR(50),
bio TEXT,
created DATETIME
)
SQL;
        $connection->execute($table);
        $table = <<<SQL
CREATE TABLE schema_articles (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title VARCHAR(20) DEFAULT 'testing',
body TEXT,
author_id INT(11) NOT NULL,
published BOOLEAN DEFAULT 0,
created DATETIME,
CONSTRAINT "title_idx" UNIQUE ("title", "body")
CONSTRAINT "author_idx" FOREIGN KEY ("author_id") REFERENCES "schema_authors" ("id") ON UPDATE CASCADE ON DELETE RESTRICT
);
SQL;
        $connection->execute($table);
        $connection->execute('CREATE INDEX "created_idx" ON "schema_articles" ("created")');
    }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:38,代码来源:SqliteSchemaTest.php

示例9: fireSql

 /**
  * @param $sql
  *
  * @return bool|DBResultSet
  */
 private function fireSql($sql)
 {
     $sql .= ';';
     if (!is_null($this->decodeFunction)) {
         $sql = call_user_func($this->decodeFunction, $sql);
     }
     return $this->_conn->execute($sql);
 }
开发者ID:GruppoMeta,项目名称:Movio,代码行数:13,代码来源:Connection.php

示例10: execute

function execute($query)
{
    $conn = new Connection();
    $conn->open();
    $recordset = $conn->execute($query);
    $conn->close();
    return $recordset;
}
开发者ID:rotten4pple,项目名称:iPhoneWebServicesClient,代码行数:8,代码来源:database.php


注:本文中的Connection::execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。