Example #1
0
 /**
  * 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);
 }
 function ServerInfo()
 {
     $arr['description'] = ADOConnection::GetOne("select version()");
     $arr['version'] = ADOConnection::_findvers($arr['description']);
     return $arr;
 }
 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;
 }
 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;
 }
Example #5
0
 function _insertid()
 {
     return ADOConnection::GetOne('VALUES IDENTITY_VAL_LOCAL()');
 }
Example #6
0
 function _insertid()
 {
     return ADOConnection::GetOne('SELECT last_insert_rowid()');
 }
 function _insertid()
 {
     // See #8385 for more details.
     // original: return ADOConnection::GetOne('VALUES IDENTITY_VAL_LOCAL()');
     return ADOConnection::GetOne('SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1');
 }
Example #8
0
 function _insertid()
 {
     //removed it because of bug...
     //gjergji 18.02.2009
     //	$result = mysqli_insert_id($this->_connectionID);
     // if ($result == -1){
     //     if ($this->debug) ADOConnection::outp("mysqli_insert_id() failed : "  . $this->ErrorMsg());
     // }
     // return $result;
     return ADOConnection::GetOne('SELECT LAST_INSERT_ID()');
 }
Example #9
0
 function getOne()
 {
     $this->limit(1);
     return $this->db->GetOne($this->__toString(), $this->params);
 }
Example #10
0
 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;
 }
Example #11
0
 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;
 }
 /**
  * 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;
 }