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


PHP DBConnection::prepare方法代码示例

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


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

示例1: asSql

 /**
  * Returns the fragment SQL string
  *
  * @param   rdbms.DBConnection conn
  * @return  string
  * @throws  rdbms.SQLStateException
  */
 public function asSql(DBConnection $conn)
 {
     $s = '';
     foreach ($this->projections as $e) {
         $s .= 0 != strlen($e['alias']) ? $conn->prepare(', %c as %l', $e['projection']->asSql($conn), $e['alias']) : $conn->prepare(', %c', $e['projection']->asSql($conn));
     }
     return substr($s, 1);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:15,代码来源:ProjectionList.class.php

示例2: hasTasks

function hasTasks($m_id)
{
    $db = new DBConnection();
    $q = "call checktaskonmain(:mid)";
    $stmt = $db->prepare($q);
    //    $stmt->setFetchMode(PDO::FETCH_OBJ);
    $stmt->execute(array('mid' => $m_id));
    $havetask = $stmt->fetchColumn();
    return $havetask;
}
开发者ID:Kittykras,项目名称:planning,代码行数:10,代码来源:changeBtnTitleAs.php

示例3: getAssignedAssociateName

function getAssignedAssociateName($username)
{
    $db = new DBConnection();
    $q = "call getAssociate(:assigned)";
    $stmt = $db->prepare($q);
    //    $stmt->setFetchMode(PDO::FETCH_CLASS, 'User');
    $stmt->execute(array(':assigned' => $username));
    $associate = $stmt->fetch(PDO::FETCH_OBJ);
    return $associate->a_name;
}
开发者ID:Kittykras,项目名称:planning,代码行数:10,代码来源:customerHandler.php

示例4: getUserFromCookie

function getUserFromCookie()
{
    $db = new DBConnection();
    $q = "call getassociate(:username)";
    $stmt = $db->prepare($q);
    $userac = htmlEntities2($_COOKIE["UserName"]);
    //    $stmt->setFetchMode(PDO::FETCH_CLASS, 'User');
    $stmt->execute(array(':username' => $userac));
    $user = $stmt->fetch(PDO::FETCH_OBJ);
    $_SESSION["UserName"] = $user;
}
开发者ID:Kittykras,项目名称:planning,代码行数:11,代码来源:userHandler.php

示例5: htmlEntities2

require_once '../DBConnection.php';
function htmlEntities2($str)
{
    $text = str_replace("oe", "Ø", $str);
    $text = str_replace("aaa", "Å", $text);
    $text = str_replace("ae", "Æ", $text);
    //    window.alert(text);
    return $text;
}
try {
    $oldUser = htmlEntities2($_COOKIE["UserName"]);
    $newName = $_POST["newName"];
    $newUser = $_POST["newUser"];
    $newPwd = $_POST["newPwd"];
    $newPriv = $_POST["newPriv"];
    $newMail = $_POST["newMail"];
    $db = new DBConnection();
    $q = "call alterassociate(:oldUser, :newUser, :newPwd, :newName, :newPriv, :newMail);";
    $stmt = $db->prepare($q);
    $stmt->execute(array(':oldUser' => $oldUser, ':newName' => $newName, ':newUser' => $newUser, ':newPwd' => $newPwd, ':newPriv' => $newPriv, ':newMail' => $newMail));
    $count = $stmt->rowCount();
    if ($stmt != FALSE) {
        setcookie("UserName", $newUser, time() + 86400, "/planning/");
        header("location:" . $_COOKIE['previous']);
    } else {
        header("location:../../associateForm.php?edit&error");
    }
} catch (PDOException $e) {
    echo $e->getMessage();
}
开发者ID:Kittykras,项目名称:planning,代码行数:30,代码来源:alterAssociate.php

示例6: getExpFromTask

function getExpFromTask()
{
    $db = new DBConnection();
    $q = "call getexpenses(:id)";
    $stmt = $db->prepare($q);
    $stmt->setFetchMode(PDO::FETCH_OBJ);
    $stmt->execute(array(':id' => $_COOKIE["Task"]));
    $expenses = $stmt->fetchAll();
    return $expenses;
}
开发者ID:Kittykras,项目名称:planning,代码行数:10,代码来源:taskHandler.php

示例7: asSql

 /**
  * Returns the fragment SQL
  *
  * @param   rdbms.DBConnection conn
  * @param   rdbms.Peer peer
  * @return  string
  * @throws  rdbms.SQLStateException
  */
 public function asSql(DBConnection $conn)
 {
     return $conn->prepare($this->command, $this->field);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:12,代码来源:SimpleProjection.class.php

示例8: asSql

 /**
  * Returns the fragment SQL
  *
  * @param   rdbms.DBConnection conn
  * @return  string
  * @throws  rdbms.SQLStateException
  */
 public function asSql(DBConnection $conn)
 {
     return $conn->prepare($conn->getFormatter()->dialect->formatFunction($this), ...$this->args);
 }
开发者ID:xp-framework,项目名称:rdbms,代码行数:11,代码来源:SQLFunction.class.php

示例9: asSql

 /**
  * Returns the fragment SQL
  *
  * @param   rdbms.DBConnection conn
  * @param   rdbms.Peer peer
  * @return  string
  * @throws  rdbms.SQLStateException
  */
 public function asSql(DBConnection $conn, Peer $peer)
 {
     $lhs = $this->lhs instanceof SQLFragment ? $this->lhs : $peer->column($this->lhs);
     return $conn->prepare('%c between ' . $lhs->getType() . ' and ' . $lhs->getType(), $lhs, $this->lo, $this->hi);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:13,代码来源:BetweenExpression.class.php

示例10: getSelectQueryString

 /**
  * get the SELECT query
  *
  * @param   rdbms.DBConnection conn
  * @param   rdbms.Peer peer
  * @param   rdbms.join.Joinprocessor jp optional
  * @return  rdbms.ResultSet
  */
 public function getSelectQueryString(DBConnection $conn, Peer $peer, $jp = NULL)
 {
     if ($this->isJoin()) {
         $jp->setFetchmodes($this->fetchmode);
     }
     return $conn->prepare('select %c from %c %c', $this->projections($conn, $peer, $jp), $this->isJoin() ? $jp->getJoinString() : $peer->table, $this->toSQL($conn, $peer, $jp));
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:15,代码来源:Criteria.class.php

示例11: asSql

 /**
  * Returns the fragment SQL
  *
  * @param   rdbms.DBConnection conn
  * @param   rdbms.Peer peer
  * @return  string
  */
 public function asSql(DBConnection $conn, Peer $peer)
 {
     $lhs = $this->lhs instanceof SQLFragment ? $this->lhs : $peer->column($this->lhs);
     return $conn->prepare('%c ' . str_replace('?', $lhs->getType(), $this->op), $lhs, $this->value);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:12,代码来源:SimpleExpression.class.php

示例12: asSql

 /**
  * Returns the fragment SQL
  *
  * @param   rdbms.DBConnection conn
  * @param   rdbms.Peer peer
  * @return  string
  * @throws  rdbms.SQLStateException
  */
 public function asSql(DBConnection $conn, Peer $peer)
 {
     return $conn->prepare('not (%c)', $this->criterion->asSql($conn, $peer));
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:12,代码来源:NegationExpression.class.php

示例13: isset

 $stat = $_POST["stat"];
 $assi = $_POST["assi"];
 $timespen = $_POST["hour"] . ":" . $_POST["min"];
 $comment = $_POST["newComment"];
 $mailto = $_POST["mailto"];
 $press = isset($_POST['press']) && $_POST['press'] ? "true" : "false";
 $online = isset($_POST['online']) && $_POST['online'] ? "true" : "false";
 $pressdate = $_POST["pressdate"];
 if ($pressdate === "") {
     $pressdate = "0000-00-00";
 }
 $project = $_POST["mainid"];
 //    echo "mainid = ".$project;
 $db = new DBConnection();
 $q = "call altertask(:id, :cus, :title, :descr, :stat, :assi, :timespent, :pressdate, :press, :online, :mainid);";
 $stmt = $db->prepare($q);
 $stmt->execute(array(':id' => $id, ':cus' => $cus, ':title' => $title, ':descr' => $descr, ':stat' => $stat, ':assi' => $assi, ':timespent' => $timespen, ':pressdate' => $pressdate, ':press' => $press, ':online' => $online, ':mainid' => $project));
 $q2 = "call setmainprojektstate(:mainid)";
 $stmt2 = $db->prepare($q2);
 $stmt2->execute(array(':mainid' => $project));
 if ($comment != "") {
     $q = "call createcomment(:id, :comment, :user);";
     $stmt = $db->prepare($q);
     $stmt->execute(array(':id' => $id, ':comment' => $comment, ":user" => $user));
     if (isset($mailto)) {
         $mails = array();
         foreach ($mailto as $mail) {
             $q = "call getAssociate(:mailto)";
             $stmt = $db->prepare($q);
             $stmt->execute(array(':mailto' => $mail));
             $asmail = $stmt->fetch(PDO::FETCH_OBJ);
开发者ID:Kittykras,项目名称:planning,代码行数:31,代码来源:alterTask.php


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