本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例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));
}
示例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);