本文整理汇总了PHP中ADOConnection::GetOne方法的典型用法代码示例。如果您正苦于以下问题:PHP ADOConnection::GetOne方法的具体用法?PHP ADOConnection::GetOne怎么用?PHP ADOConnection::GetOne使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ADOConnection
的用法示例。
在下文中一共展示了ADOConnection::GetOne方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeRight
/**
* Remove right
*
* @param array $params
* @return void
*/
public function removeRight(array $params)
{
$rightId = (int) $params['right_id'];
// get permission
$sql = 'SELECT right_define_name
FROM ' . self::RIGHTS . "\n WHERE right_id = {$rightId}";
$permission = $this->db->GetOne($sql);
// remove acl rules
try {
list($resource, ) = PermissionToAcl::translate($permission);
} catch (\InvalidArgumentException $e) {
return;
}
$sql = 'DELETE
FROM ' . self::RULES . "\n WHERE resource = '{$resource}'";
$this->db->Execute($sql);
// remove right
$sql = 'DELETE
FROM ' . self::RIGHTS . "\n WHERE right_id = {$rightId}";
$this->db->Execute($sql);
}
示例2: ServerInfo
function ServerInfo()
{
$arr['description'] = ADOConnection::GetOne("select version()");
$arr['version'] = ADOConnection::_findvers($arr['description']);
return $arr;
}
示例3: GetOne
function GetOne($sql, $inputarr = false)
{
global $ADODB_GETONE_EOF;
if ($this->compat323 == false && strncasecmp($sql, 'sele', 4) == 0) {
$rs = $this->SelectLimit($sql, 1, -1, $inputarr);
if ($rs) {
$rs->Close();
if ($rs->EOF) {
return $ADODB_GETONE_EOF;
}
return reset($rs->fields);
}
} else {
return ADOConnection::GetOne($sql, $inputarr);
}
return false;
}
示例4: GetOne
function GetOne($sql, $inputarr = false)
{
if (strncasecmp($sql, 'sele', 4) == 0) {
$rs =& $this->SelectLimit($sql, 1, -1, $inputarr);
if ($rs) {
$rs->Close();
if ($rs->EOF) {
return false;
}
return reset($rs->fields);
}
} else {
return ADOConnection::GetOne($sql, $inputarr);
}
return false;
}
示例5: _insertid
function _insertid()
{
return ADOConnection::GetOne('VALUES IDENTITY_VAL_LOCAL()');
}
示例6: getOne
function getOne()
{
$this->limit(1);
return $this->db->GetOne($this->__toString(), $this->params);
}
示例7: _insertid
function _insertid()
{
/*
* mysqli_insert_id does not return the last_insert_id
* if called after execution of a stored procedure
* so we execute this instead.
*/
return ADOConnection::GetOne('SELECT LAST_INSERT_ID()');
$result = @mysqli_insert_id($this->_connectionID);
if ($result == -1) {
if ($this->debug) {
ADOConnection::outp("mysqli_insert_id() failed : " . $this->ErrorMsg());
}
}
return $result;
}
示例8: _insertid
function _insertid()
{
/*
* mysqli_insert_id does not return the last_insert_id
* if called after execution of a stored procedure
* so we execute this instead.
*/
$result = false;
if ($this->useLastInsertStatement) {
$result = ADOConnection::GetOne('SELECT LAST_INSERT_ID()');
} else {
$result = @mysqli_insert_id($this->_connectionID);
}
if ($result == -1) {
if ($this->debug) {
ADOConnection::outp("mysqli_insert_id() failed : " . $this->ErrorMsg());
}
}
/*
* reset prepared statement flags
*/
$this->usePreparedStatement = false;
$this->useLastInsertStatement = false;
return $result;
}
示例9: setOraclePassword
/**
* Set the Oracle password for a user, if they have an Oracle account. Since we cannot
* use variable binding, validate the username and password before we pass them to
* the script
*
* @param $database \b ADOConnection an adodb connection
* @param $username \b string username
* @param $password \b string the new password
*/
public static function setOraclePassword(ADOConnection $database, $username, $password)
{
$username = strtoupper($username);
// do not proceed if user does not have an account in this database
if (!$database->GetOne("SELECT 1 FROM dba_users WHERE username = :u", array('u' => $username))) {
return false;
}
if (!self::validateOraclePassword($password)) {
throw new Exception('Invalid password');
}
if (!self::validateOracleUsername($username)) {
throw new Exception('Invalid username');
}
$password = str_replace('"', '\\"', $password);
$database->Execute("ALTER USER {$username} IDENTIFIED BY \"{$password}\"");
if ($database->ErrorNo() > 0) {
throw new Exception("Database error:" . $database->ErrorMsg());
}
return true;
}