當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。