當前位置: 首頁>>代碼示例>>PHP>>正文


PHP odbc_error函數代碼示例

本文整理匯總了PHP中odbc_error函數的典型用法代碼示例。如果您正苦於以下問題:PHP odbc_error函數的具體用法?PHP odbc_error怎麽用?PHP odbc_error使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了odbc_error函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: changeUserPassword

 public function changeUserPassword($userName, $userOldPassword, $userNewPassword, $portalID)
 {
     VDSN;
     $conn = odbc_connect(VDSN, USER, PW) or die('ODBC Error:: ' . odbc_error() . ' :: ' . odbc_errormsg() . ' :: ' . VDSN);
     //test for user name
     if ($conn) {
         $sql = "SELECT '1' outputFlag FROM Portal_User WHERE User_Name = '" . $userName . "' AND Portal_ID = '" . $portalID . "'";
         $rs = odbc_exec($conn, $sql);
         $row = odbc_fetch_row($rs);
         if ($row == null) {
             odbc_close($conn);
             return "You have entered an invalid user name; please try again.";
         }
     }
     //test for password
     if ($conn) {
         $sql = "SELECT '1' FROM Users WHERE User_Name = '" . $userName . "' AND User_Password = '" . $userOldPassword . "'";
         $rs = odbc_exec($conn, $sql);
         $row = odbc_fetch_row($rs);
         if ($row == null) {
             odbc_close($conn);
             return "You have entered an invalid password for your account; please try again.";
         }
     }
     //save new password
     if ($conn) {
         $sql = "UPDATE Users SET User_Password = '" . $userNewPassword . "' WHERE User_Name = '" . $userName . "'";
         $rs = odbc_exec($conn, $sql);
     }
     return "OK";
 }
開發者ID:nemac,項目名稱:flash-fcav,代碼行數:31,代碼來源:NEMAC_MapViewer_queries.php

示例2: getId

 /**
  * @see IdGenerator::getId()
  */
 public function getId($seqname = null)
 {
     if ($seqname === null) {
         throw new SQLException('You must specify the sequence name when calling getId() method.');
     }
     $triedcreate = false;
     while (1) {
         try {
             $n = $this->conn->executeUpdate("UPDATE {$seqname} SET id = id + 1", ResultSet::FETCHMODE_NUM);
             if ($n == 0) {
                 throw new SQLException('Failed to update IdGenerator id', $this->conn->nativeError());
             }
             $rs = $this->conn->executeQuery("SELECT id FROM {$seqname}", ResultSet::FETCHMODE_NUM);
         } catch (SQLException $e) {
             $odbcerr = odbc_error($this->conn->getResource());
             if ($triedcreate || $odbcerr != 'S0000' && $odbcerr != 'S0002') {
                 throw $e;
             }
             $this->drop($seqname, true);
             $this->create($seqname);
             $triedcreate = true;
             continue;
         }
         break;
     }
     $rs->first();
     return $rs->getInt(1);
 }
開發者ID:BackupTheBerlios,項目名稱:nodin-svn,代碼行數:31,代碼來源:ODBCIdGenerator.php

示例3: doquery

function doquery($query, $table, $fetch = false)
{
    global $link, $debug, $ugamela_root_path;
    @(include $ugamela_root_path . 'config.php');
    if (!$link) {
        $link = odbc_connect($dbsettings["server"], $dbsettings["user"], $dbsettings["pass"]) or $debug->error(odbc_error() . "<br />{$query}", "SQL Error");
        //message(mysql_error()."<br />$query","SQL Error");
        odbc_select_db($dbsettings["name"]) or $debug->error(odbc_error() . "<br />{$query}", "SQL Error");
    }
    // por el momento $query se mostrara
    // pero luego solo se vera en modo debug
    $sqlquery = odbc_exec($query, str_replace("{{table}}", $dbsettings["prefix"] . $table)) or $debug->error(odbc_error() . "<br />{$query}", "SQL Error");
    //message(mysql_error()."<br />$query","SQL Error");
    unset($dbsettings);
    //se borra la array para liberar algo de memoria
    global $numqueries, $debug;
    //,$depurerwrote003;
    $numqueries++;
    //$depurerwrote003 .= ;
    $debug->add("<tr><th>Query {$numqueries}: </th><th>{$query}</th><th>{$table}</th><th>{$fetch}</th></tr>");
    if ($fetch) {
        //hace el fetch y regresa $sqlrow
        $sqlrow = odbc_fetch_array($sqlquery);
        return $sqlrow;
    } else {
        //devuelve el $sqlquery ("sin fetch")
        return $sqlquery;
    }
}
開發者ID:sonicmaster,項目名稱:RPG,代碼行數:29,代碼來源:odbc.php

示例4: sql_result

function sql_result($query, $conn = NULL)
{
    if (DATABASE == "mysql") {
        if (is_null($conn)) {
            $qryRslt = @mysql_query($query, $GLOBALS["db_con"]);
        } else {
            $qryRslt = @mysql_query($query, $conn);
        }
        if (!$qryRslt) {
            echo $query;
            error_log(date("F j, Y, g:i a") . "\t{$query}\n" . $_SERVER["PATH_INFO"] . "\n\t" . @mysql_error() . "\n\n", 3, "sql_error.log");
            die("<br><font color=\"red\">Due to some technical problem, your Transaction was <b>NOT</b> successful</font>\n");
        }
        return $qryRslt;
    } else {
        if (DATABASE == "odbc") {
            if (is_null($conn)) {
                $qryRslt = @odbc_exec($GLOBALS["db_con"], $query);
            } else {
                $qryRslt = @odbc_exec($conn, $query);
            }
            if (!$qryRslt) {
                error_log(date("F j, Y, g:i a") . "\t{$query}\n" . $_SERVER["PATH_INFO"] . "\n\t" . @odbc_error() . "\n\n", 3, "sql_error.log");
                die("<br><font color=\"red\">Due to some technical problem, your Transaction was <b>NOT</b> successful</font>\n");
            }
            return $qryRslt;
        }
    }
}
開發者ID:rugbyprof,項目名稱:visitme,代碼行數:29,代碼來源:sqlfunctions.php

示例5: chkConnect

 /**
  * check the connection.
  *
  * @return void
  */
 public static function chkConnect($config)
 {
     $conid = @odbc_connect($config['dsn'], $config['username'], $config['password'], SQL_CUR_USE_ODBC);
     if (odbc_error()) {
         //return odbc_errormsg(); //SQL Server 2005 不支持 utf-8 編碼,其使用  UCS-2  編碼架構(所有 unicode 字符都占用 2 個字節)。
         return 'connect failed';
     }
     return true;
 }
開發者ID:quan2010,項目名稱:DataDictionaryGenerator,代碼行數:14,代碼來源:Check.php

示例6: setError

 /**
  * set error code and message based on last odbc connection/prepare/execute error.
  * 
  * @todo: consider using GET DIAGNOSTICS for even more message text:
  * http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Frzala%2Frzalafinder.htm
  * 
  * @param null $conn
  */
 protected function setError($conn = null)
 {
     // is conn resource provided, or do we get last error?
     if ($conn) {
         $this->setErrorCode(odbc_error($conn));
         $this->setErrorMsg(odbc_errormsg($conn));
     } else {
         $this->setErrorCode(odbc_error());
         $this->setErrorMsg(odbc_errormsg());
     }
 }
開發者ID:zendtech,項目名稱:ibmitoolkit,代碼行數:19,代碼來源:Odbcsupp.php

示例7: die_sql

 private function die_sql($sql, $line, $file, $function, $class)
 {
     error_log($file . ' : L ' . $line . chr(10) . $sql . chr(10) . odbc_errormsg($this->link));
     $err = '<span style="font-size:18px;font-weight:bold;">lisha</span><br /><br />';
     $err .= 'Erreur MySQL<br /><br />';
     $err .= '<b style="color:#DD2233;">Erreur ' . odbc_error($this->link) . "</b> : <b>" . odbc_errormsg($this->link) . '</b><br /><br />';
     $err .= 'Classe : ' . $class . ' - Ligne : ' . $line . ' - ' . $file . ' - ' . $function . '<br /><br /><br />';
     $err .= '<textarea style="width:90%;height:200px;;">' . $sql . '</textarea>';
     echo $err;
     die;
 }
開發者ID:bubaigcect,項目名稱:magictree,代碼行數:11,代碼來源:class_odbc.php

示例8: raiseError

 public function raiseError($sql = NULL, $prms = array())
 {
     $error_id = odbc_error($this->_con);
     if (strlen($error_id) == 5) {
         $error_msg = "[" . $error_id . "] " . odbc_errormsg($this->_con);
         //odbc_close($this->_con);
         if (!empty($sql)) {
             $error_msg = $error_msg . "-------------------------\nSQL trace: " . $sql . ", \n-------------------------\nParams: " . print_r($prms, 1);
         }
         throw new Error($error_msg);
     }
 }
開發者ID:startsevsa,項目名稱:cash,代碼行數:12,代碼來源:odbc.php

示例9: query

 /**	
  * Send an SQL query
  * @param String sql
  * @return Mixed
  */
 public function query($sql)
 {
     $this->debugInfo($sql);
     $rs = odbc_exec($this->conn, $sql);
     if (!$rs) {
         trigger_error(odbc_error(), E_USER_ERROR);
         return FALSE;
     }
     odbc_binmode($rs, ODBC_BINMODE_RETURN);
     odbc_longreadlen($rs, 1024 * 1024);
     return new QueryResult($this, $rs);
 }
開發者ID:ryanblanchard,項目名稱:Dashboard,代碼行數:17,代碼來源:ODBCConnection.php

示例10: executeQuery

 public function executeQuery($sql)
 {
     //echo $sql;
     $res = odbc_exec(self::connection(), $sql);
     //execute sql query	using db connection
     if (!$res) {
         throw new Exception(odbc_error());
     }
     self::closeConnection();
     // close db connection
     return $res;
     //return result resource
 }
開發者ID:vallepu,項目名稱:my-project-dipak,代碼行數:13,代碼來源:fromDB.php

示例11: Query

	function Query($query)
	{
            if ($this->conn)
            {
                $result = odbc_exec($this->conn, $query);
                if (odbc_error()) $this->setError(odbc_error());
                return $result;
            }
            else
            {
                return false;
            }
	}
開發者ID:rogerwebmaster,項目名稱:Philweb,代碼行數:13,代碼來源:ODBCDatabase.php

示例12: db_query

function db_query($qstring,$conn) 
{
	global $strLastSQL,$dDebug;
	if ($dDebug===true)
		echo $qstring."<br>";
	$strLastSQL=$qstring;
	if(!($rs=odbc_exec($conn,$qstring)))
	  trigger_error(odbc_error(), E_USER_ERROR);
	odbc_binmode($rs,ODBC_BINMODE_RETURN);
	odbc_longreadlen($rs,1024*1024);
	return $rs;
	
}
開發者ID:helbertfurbino,項目名稱:sgmofinanceiro,代碼行數:13,代碼來源:dbconnection.odbc.php

示例13: ErrorNo

 function ErrorNo()
 {
     if ($this->haserrorfunctions) {
         $e = odbc_error($this->_connectionID);
         // bug in 4.0.6, error number can be corrupted string (should be 6 digits)
         // so we check and patch
         if (strlen($e) <= 2) {
             return 0;
         }
         return $e;
     } else {
         return ADODBConnection::ErrorNo();
     }
 }
開發者ID:qoire,項目名稱:portal,代碼行數:14,代碼來源:adodb-odbc.inc.php

示例14: login

 private function login(client_login_info $login_info)
 {
     //TODO: odbc connect probably supports these DSNs: http://www.connectionstrings.com/oracle/
     //may be something like "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;"
     $connect = odbc_connect($login_info->DSN, $login_info->user, $login_info->pass);
     if ($connect === false) {
         $this->login_error_message = odbc_error() . ": " . odbc_errormsg();
     } else {
         $this->logged_in = true;
         $this->connection = $connect;
     }
     if ($this->logged_in) {
         $login_info->save_in_cookies();
     }
 }
開發者ID:Tkachov,項目名稱:POD,代碼行數:15,代碼來源:client.php

示例15: open_odbc_connection

function open_odbc_connection()
{
    global $debug, $ze_hostname, $ze_login, $ze_pwd, $conn_o;
    $cnx_err = false;
    // erreur de connexion
    if ($debug) {
        echo "Ouverture de la connexion ODBC<br />";
    }
    $conn_o = odbc_connect($ze_hostname, $ze_login, $ze_pwd);
    if (!$conn_o) {
        $cnx_err = true;
        $msg = "Echec de la connexion au serveur : " . odbc_error();
        if ($debug) {
            echo $msg . "<br>";
        }
    }
    return $cnx_err;
}
開發者ID:onewingedfallen59,項目名稱:SmartPlug,代碼行數:18,代碼來源:connect_db.php


注:本文中的odbc_error函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。