当前位置: 首页>>代码示例>>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;未经允许,请勿转载。