示例#1
0
文件: odbc.php 项目: jvinet/pronto
 function _catch($msg = "")
 {
     if (!($this->error = odbc_errormsg($this->conn))) {
         return true;
     }
     $this->error($msg . "<br>{$this->query} \n {$this->error}");
 }
示例#2
0
 protected function HandleError($conn)
 {
     if (Config::DAO_DEBUG_MODE == 1) {
         odbc_errormsg($conn);
     }
     return false;
 }
示例#3
0
文件: ODBC.php 项目: johsbk/penguin
 /**
  * Enter description here...
  *
  * @param unknown_type $query
  *
  * @return unknown
  */
 public static function query($query)
 {
     if (!($var = \odbc_exec(self::$conn, $query))) {
         throw new DBException('(' . $query . ') had an error: ' . \odbc_errormsg());
     }
     return $var;
 }
 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 = '******'";
         $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 = '******' WHERE User_Name = '" . $userName . "'";
         $rs = odbc_exec($conn, $sql);
     }
     return "OK";
 }
示例#5
0
function db_erro($db_resource)
{
    $erro = odbc_errormsg($db_resource);
    if (!empty($erro)) {
        echo 'ERRO: ' . $erro;
    }
}
示例#6
0
 function ErrorMsg()
 {
     if ($this->haserrorfunctions) {
         return odbc_errormsg($this->_connectionID);
     } else {
         return ADODBConnection::ErrorMsg();
     }
 }
示例#7
0
 /**
  * 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());
     }
 }
 function ErrorMsg()
 {
     if ($this->_haserrorfunctions) {
         if (empty($this->_connectionID)) {
             return @odbc_errormsg();
         }
         return @odbc_errormsg($this->_connectionID);
     } else {
         return ADOConnection::ErrorMsg();
     }
 }
示例#9
0
 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;
 }
示例#10
0
文件: odbc.php 项目: startsevsa/cash
 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);
     }
 }
 function query($sql)
 {
     $this->conn = $this->db_connect() or die("No fue posible connectar con la base de dados -> " . "{$this->database}");
     if ($res = odbc_exec($this->conn, $sql) or die("Inválida: " . odbc_errormsg())) {
         return $res;
     } else {
         echo "No es posible ejecutar esta consulta: <br>";
         echo "{$sql}";
         $this->db_close($this->conn);
         return false;
     }
 }
示例#12
0
function get_results($query)
{
    global $con;
    if ($query == "") {
        echo "";
    } else {
        $res = @odbc_exec($con, $query);
        if ($res) {
            odbc_result_all($res);
        } else {
            echo odbc_errormsg($con);
        }
    }
}
示例#13
0
/**
 * Helper function for connecting to a odb database.
 * Just does some error checking.
 *
 * Returns NULL on error.
 *
 */
function myOdbcConnect($dataSourceName, $username, $password)
{
    if (!function_exists('odbc_connect')) {
        //$logger->log(WARN,
        Logger::warn("Virtuoso adapter requires PHP ODBC extension to be loaded");
        return NULL;
    }
    $con = @odbc_connect($dataSourceName, $username, $password);
    if (null == $con) {
        //$logger->log(WARN,
        Logger::warn("Unable to connect to Virtuoso Universal Server via ODBC: " . odbc_errormsg());
        return NULL;
    }
    return $con;
}
示例#14
0
文件: client.php 项目: Tkachov/POD
 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();
     }
 }
示例#15
0
function OM_InnovExport_Order_Release($OrderNumber)
{
    if ($OrderNumber != '') {
        $connect = odbc_connect("qa-om", "sa", "systemop", SQL_CUR_USE_ODBC);
        if (!$connect) {
            exit("Connection Failed: " . $connect);
        }
        $sql = "use QAData update Orders set InnovExport = '0' where OrderNumber = '{$OrderNumber}'";
        $result = odbc_exec($connect, $sql);
        if (!$result) {
            odbc_errormsg($connect);
            exit("Error in SQL");
        }
        echo '<table class="table_main">';
        echo "<tr><td colspan='6' style='text-align:center;color:green;'>Reset {$OrderNumber}</td></tr>";
        echo '</table>';
    }
}
示例#16
0
function dbQuery($query, $show_errors = true, $all_results = true, $show_output = true)
{
    if ($show_errors) {
        error_reporting(E_ALL);
    } else {
        error_reporting(E_PARSE);
    }
    // Connect to the MS Access Database via ODBC connection (http://www.w3schools.com/PHP/php_db_odbc.asp)
    // NOTE: execute statements from above one at a time because MS Access doesn't support stacked SQL commands
    $link = odbc_connect("testdb", "", "");
    if (!$link) {
        die(odbc_errormsg());
    }
    // Print results in HTML
    print "<html><body>\n";
    // Print SQL query to test sqlmap '--string' command line option
    //print "<b>SQL query:</b> " . $query . "<br>\n";
    // Perform SQL injection affected query
    $result = odbc_exec($link, $query);
    if (!$result) {
        if ($show_errors) {
            print "<b>SQL error:</b> " . odbc_errormsg() . "<br>\n";
        }
        exit(1);
    }
    if (!$show_output) {
        exit(1);
    }
    print "<b>SQL results:</b>\n";
    print "<table border=\"1\">\n";
    while ($line = odbc_fetch_array($result)) {
        print "<tr>";
        foreach ($line as $col_value) {
            print "<td>" . $col_value . "</td>";
        }
        print "</tr>\n";
        if (!$all_results) {
            break;
        }
    }
    print "</table>\n";
    print "</body></html>";
}
示例#17
0
 /**
  * Executes the supplied SQL statement and returns
  * the result of the call.
  * 
  * @access  public
  *  
  * @param   string  SQL to execute
  */
 function exec()
 {
     if (func_num_args() > 1) {
         $args = func_get_args();
         $sql = $args[0];
         unset($args[0]);
         // remove the sql
         $args = array_values($args);
         // and reset the array index
     } else {
         $sql = func_get_arg(0);
     }
     $this->ensureConnection();
     if (isset($args)) {
         $result = odbc_prepare($this->connection, $sql);
         if (!odbc_execute($result, $args)) {
             throw new Exception(odbc_errormsg($this->connection));
         }
         return odbc_num_rows($result);
     } else {
         return odbc_exec($this->connection, $sql);
     }
 }
 public function processInterface()
 {
     // Make sure there was no conneg error prior to this process call
     if ($this->ws->conneg->getStatus() == 200) {
         $this->ws->validateQuery();
         // If the query is still valid
         if ($this->ws->conneg->getStatus() == 200) {
             // Create and describe the resource being registered
             // Note: we make sure we remove any previously defined triples that we are
             //       about to re-enter in the graph. All information other than these
             //       new properties will remain in the graph
             $query = "delete from <" . $this->ws->wsf_graph . ">\n                  { \n                    <" . $this->ws->registered_uri . "> a <http://purl.org/ontology/wsf#WebService> .\n                    <" . $this->ws->registered_uri . "> <http://purl.org/dc/terms/title> ?title . \n                    <" . $this->ws->registered_uri . "> <http://purl.org/ontology/wsf#endpoint> ?endpoint .\n                    <" . $this->ws->registered_uri . "> <http://purl.org/ontology/wsf#hasCrudUsage> ?crud_usage .\n                    ?crud_usage ?crud_property ?crud_value .\n                  }\n                  where\n                  {\n                    graph <" . $this->ws->wsf_graph . ">\n                    {\n                      <" . $this->ws->registered_uri . "> a <http://purl.org/ontology/wsf#WebService> .\n                      <" . $this->ws->registered_uri . "> <http://purl.org/dc/terms/title> ?title . \n                      <" . $this->ws->registered_uri . "> <http://purl.org/ontology/wsf#endpoint> ?endpoint .\n                      <" . $this->ws->registered_uri . "> <http://purl.org/ontology/wsf#hasCrudUsage> ?crud_usage .\n                      ?crud_usage ?crud_property ?crud_value .\n                    }\n                  }\n                  insert into <" . $this->ws->wsf_graph . ">\n                  {\n                    <" . $this->ws->registered_uri . "> a <http://purl.org/ontology/wsf#WebService> .\n                    <" . $this->ws->registered_uri . "> <http://purl.org/dc/terms/title> \"" . $this->ws->registered_title . "\" .\n                    <" . $this->ws->registered_uri . "> <http://purl.org/ontology/wsf#endpoint> \"" . $this->ws->registered_endpoint . "\" .\n                    <" . $this->ws->registered_uri . "> <http://purl.org/ontology/wsf#hasCrudUsage> <" . $this->ws->registered_uri . "usage/> .\n                    \n                    <" . $this->ws->registered_uri . "usage/> a <http://purl.org/ontology/wsf#CrudUsage> ;\n                    <http://purl.org/ontology/wsf#create> " . ($this->ws->crud_usage->create ? "\"True\"" : "\"False\"") . " ;\n                    <http://purl.org/ontology/wsf#read> " . ($this->ws->crud_usage->read ? "\"True\"" : "\"False\"") . " ;\n                    <http://purl.org/ontology/wsf#update> " . ($this->ws->crud_usage->update ? "\"True\"" : "\"False\"") . " ;\n                    <http://purl.org/ontology/wsf#delete> " . ($this->ws->crud_usage->delete ? "\"True\"" : "\"False\"") . " .\n                    \n                    <" . $this->ws->wsf_graph . "> <http://purl.org/ontology/wsf#hasWebService> <" . $this->ws->registered_uri . ">.\n                  }";
             @$this->ws->db->query($this->ws->db->build_sparql_query(str_replace(array("\n", "\r", "\t"), " ", $query), array(), FALSE));
             if (odbc_error()) {
                 $this->ws->conneg->setStatus(500);
                 $this->ws->conneg->setStatusMsg("Internal Error");
                 $this->ws->conneg->setStatusMsgExt($this->ws->errorMessenger->_300->name);
                 $this->ws->conneg->setError($this->ws->errorMessenger->_300->id, $this->ws->errorMessenger->ws, $this->ws->errorMessenger->_300->name, $this->ws->errorMessenger->_300->description, odbc_errormsg(), $this->ws->errorMessenger->_300->level);
                 return;
             }
         }
     }
 }
 public function processInterface()
 {
     // Make sure there was no conneg error prior to this process call
     if ($this->ws->conneg->getStatus() == 200) {
         $this->ws->validateQuery();
         // If the query is still valid
         if ($this->ws->conneg->getStatus() == 200) {
             $dateTime = date("c");
             /*
               Ordered changes for a record using sparql and this part of the WSF ontology.
             
               sparql select * from <http://.../wsf/track/> where 
               {
                 ?s <http://purl.org/ontology/wsf#record> <http://.../wsf/datasets/67/resource/Welfare> .
             
                 ?s <http://purl.org/ontology/wsf#changeTime> ?time.
               }
               ORDER BY asc(xsd:dateTime(?time));
             */
             $trackRecord = "<" . $this->ws->wsf_graph . "track/record/" . md5($dateTime . $this->ws->record . $this->ws->fromDataset) . "> \n                           a <http://purl.org/ontology/wsf#ChangeState> ;";
             $trackRecord .= "<http://purl.org/ontology/wsf#record> <" . $this->ws->record . "> ;";
             $trackRecord .= "<http://purl.org/ontology/wsf#fromDataset> <" . $this->ws->fromDataset . "> ;";
             $trackRecord .= "<http://purl.org/ontology/wsf#changeTime> \"" . $dateTime . "\"^^xsd:dateTime ;";
             $trackRecord .= "<http://purl.org/ontology/wsf#action> \"" . $this->ws->action . "\" ;";
             $trackRecord .= "<http://purl.org/ontology/wsf#previousState> \"\"\"" . $this->ws->previousState . "\"\"\" ;";
             $trackRecord .= "<http://purl.org/ontology/wsf#previousStateMime> \"" . $this->ws->previousStateMime . "\" ;";
             $trackRecord .= "<http://purl.org/ontology/wsf#performer> \"" . $this->ws->performer . "\" .";
             $this->ws->db->query("DB.DBA.TTLP_MT('" . addslashes($trackRecord) . "', '" . $this->ws->wsf_graph . "track/" . "', '" . $this->ws->wsf_graph . "track/" . "')");
             if (odbc_error()) {
                 $this->ws->conneg->setStatus(400);
                 $this->ws->conneg->setStatusMsg("Bad Request");
                 $this->ws->conneg->setError($this->ws->errorMessenger->_302->id, $this->ws->errorMessenger->ws, $this->ws->errorMessenger->_302->name, $this->ws->errorMessenger->_302->description, odbc_errormsg(), $this->ws->errorMessenger->_302->level);
                 return;
             }
         }
     }
 }
示例#20
0
 /**
  * Rollback changes in a transaction.
  * @param  string  optinal savepoint name
  * @return void
  * @throws DibiDriverException
  */
 public function rollback($savepoint = NULL)
 {
     if (!odbc_rollback($this->connection)) {
         throw new DibiDriverException(odbc_errormsg($this->connection) . ' ' . odbc_error($this->connection));
     }
     odbc_autocommit($this->connection, TRUE);
 }
示例#21
0
 /**
  * Error
  *
  * Returns an array containing code and message of the last
  * database error that has occured.
  *
  * @return	array
  */
 public function error()
 {
     return array('code' => odbc_error($this->conn_id), 'message' => odbc_errormsg($this->conn_id));
 }
示例#22
0
 /**
  * Get the native error code of the last error (if any) that
  * occured on the current connection.
  *
  * @access public
  *
  * @return int ODBC error code
  */
 function errorNative()
 {
     if (!isset($this->connection) || !is_resource($this->connection)) {
         return @odbc_error() . ' ' . @odbc_errormsg();
     }
     return @odbc_error($this->connection) . ' ' . @odbc_errormsg($this->connection);
 }
示例#23
0
 function RetrieveODBCData($action)
 {
     $availableActions = array('-delete', '-edit', '-find', '-findall', '-new', '-sqlquery');
     if (!in_array(strtolower($action), $availableActions)) {
         // first off, toss out any requests for actions NOT supported under ODBC
         return new FX_Error("The action requested ({$action}) is not supported under ODBC via FX.php.");
     }
     $odbc_res = odbc_connect($this->database, $this->DBUser, $this->DBPassword);
     // although username and password are optional for this function, FX.php expects them to be set
     if ($odbc_res == false) {
         return new FX_Error('Unable to connect to ODBC data source.');
     }
     switch ($action) {
         case '-delete':
         case '-edit':
         case '-find':
         case '-findall':
         case '-new':
             $this->dataQuery = $this->BuildSQLQuery($action);
             if (FX::isError($this->dataQuery)) {
                 return $this->dataQuery;
             }
         case '-sqlquery':
             // note that there is no preceding break, as we don't want to build a query
             $odbc_result = odbc_exec($odbc_res, $this->dataQuery);
             if (!$odbc_result) {
                 $tempErrorText = odbc_errormsg($odbc_res);
                 odbc_close($odbc_res);
                 return new FX_Error("Unsuccessful query: {$this->dataQuery} ({$tempErrorText})");
             }
             $this->foundCount = odbc_num_rows($odbc_result);
             $fieldCount = odbc_num_fields($odbc_result);
             if ($theResult < 0) {
                 $tempErrorText = odbc_errormsg($odbc_res);
                 odbc_close($odbc_res);
                 return new FX_Error("Unable to access field count for current ODBC query.  ({$tempErrorText})");
             }
             $odbc_columns = odbc_columns($odbc_res);
             if (!$odbc_columns) {
                 $tempErrorText = odbc_errormsg($odbc_res);
                 odbc_close($odbc_res);
                 return new FX_Error("Unable to retrieve column data via ODBC.  ({$tempErrorText})");
             }
             while (odbc_fetch_row($odbc_columns)) {
                 $fieldNumber = odbc_result($odbc_columns, 'ORDINAL_POSITION');
                 $this->fieldInfo[$fieldNumber]['name'] = odbc_result($odbc_columns, 'COLUMN_NAME');
                 $this->fieldInfo[$fieldNumber]['type'] = odbc_result($odbc_columns, 'TYPE_NAME');
                 $this->fieldInfo[$fieldNumber]['emptyok'] = odbc_result($odbc_columns, 'IS_NULLABLE');
                 $this->fieldInfo[$fieldNumber]['maxrepeat'] = 1;
                 $this->fieldInfo[$fieldNumber]['extra'] = 'COLUMN_SIZE:' . odbc_result($odbc_columns, 'COLUMN_SIZE') . '|BUFFER_LENGTH:' . odbc_result($odbc_columns, 'BUFFER_LENGTH') . '|NUM_PREC_RADIX:' . odbc_result($odbc_columns, 'NUM_PREC_RADIX');
             }
             while (odbc_fetch_row($odbc_result)) {
                 $tempRow = array();
                 for ($i = 1; $i <= $fieldCount; ++$i) {
                     $theResult = odbc_result($odbc_result, $i);
                     if (!$this->useInnerArray) {
                         $tempRow[$this->fieldInfo[$i]['name']] = $theResult;
                     } else {
                         $tempRow[$this->fieldInfo[$i]['name']] = array($theResult);
                     }
                     if ($this->fieldInfo[$i]['name'] == $this->primaryKeyField) {
                         $currentKey = $theResult;
                     }
                 }
                 if ($this->genericKeys || $this->primaryKeyField == '') {
                     $this->currentData[] = $tempRow;
                 } else {
                     $this->currentData[$currentKey] = $tempRow;
                 }
             }
             break;
         default:
             return new FX_Error("The action requested ({$action}) is not supported by FileMaker under ODBC via FX.php.");
             break;
     }
     $this->fxError = 0;
     return true;
 }
示例#24
0
 /** Do content negotiation as an external Web Service
               
       @param $accept Accepted mime types (HTTP header)
       
       @param $accept_charset Accepted charsets (HTTP header)
       
       @param $accept_encoding Accepted encodings (HTTP header)
   
       @param $accept_language Accepted languages (HTTP header)
     
       @return returns NULL
     
       @author Frederick Giasson, Structured Dynamics LLC.
   */
 public function ws_conneg($accept, $accept_charset, $accept_encoding, $accept_language)
 {
     $this->conneg = new Conneg($accept, $accept_charset, $accept_encoding, $accept_language, AuthLister::$supportedSerializations);
     // Check for errors
     if (strtolower($this->mode) != "ws" && strtolower($this->mode) != "dataset" && strtolower($this->mode) != "access_dataset" && strtolower($this->mode) != "access_user") {
         $this->conneg->setStatus(400);
         $this->conneg->setStatusMsg("Bad Request");
         $this->conneg->setStatusMsgExt("Unknown listing type");
         $this->conneg->setError($this->errorMessenger->_200->id, $this->errorMessenger->ws, $this->errorMessenger->_200->name, $this->errorMessenger->_200->description, odbc_errormsg(), $this->errorMessenger->_200->level);
         return;
     }
     // Check for errors
     if (strtolower($this->mode) != "access_dataset" && ($dataset = "")) {
         $this->conneg->setStatus(400);
         $this->conneg->setStatusMsg("Bad Request");
         $this->conneg->setStatusMsgExt($this->errorMessenger->_201->name);
         $this->conneg->setError($this->errorMessenger->_201->id, $this->errorMessenger->ws, $this->errorMessenger->_201->name, $this->errorMessenger->_201->description, odbc_errormsg(), $this->errorMessenger->_201->level);
         return;
     }
 }
示例#25
0
 function _query($sql, $inputarr = false)
 {
     global $php_errormsg;
     if (isset($php_errormsg)) {
         $php_errormsg = '';
     }
     $this->_error = '';
     if ($inputarr) {
         if (is_array($sql)) {
             $stmtid = $sql[1];
         } else {
             $stmtid = odbc_prepare($this->_connectionID, $sql);
             if ($stmtid == false) {
                 $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
                 return false;
             }
         }
         if (!odbc_execute($stmtid, $inputarr)) {
             //@odbc_free_result($stmtid);
             if ($this->_haserrorfunctions) {
                 $this->_errorMsg = odbc_errormsg();
                 $this->_errorCode = odbc_error();
             }
             return false;
         }
     } else {
         if (is_array($sql)) {
             $stmtid = $sql[1];
             if (!odbc_execute($stmtid)) {
                 //@odbc_free_result($stmtid);
                 if ($this->_haserrorfunctions) {
                     $this->_errorMsg = odbc_errormsg();
                     $this->_errorCode = odbc_error();
                 }
                 return false;
             }
         } else {
             $stmtid = odbc_exec($this->_connectionID, $sql);
         }
     }
     $this->_lastAffectedRows = 0;
     if ($stmtid) {
         if (@odbc_num_fields($stmtid) == 0) {
             $this->_lastAffectedRows = odbc_num_rows($stmtid);
             $stmtid = true;
         } else {
             $this->_lastAffectedRows = 0;
             odbc_binmode($stmtid, $this->binmode);
             odbc_longreadlen($stmtid, $this->maxblobsize);
         }
         if ($this->_haserrorfunctions) {
             $this->_errorMsg = '';
             $this->_errorCode = 0;
         } else {
             $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
         }
     } else {
         if ($this->_haserrorfunctions) {
             $this->_errorMsg = odbc_errormsg();
             $this->_errorCode = odbc_error();
         } else {
             $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
         }
     }
     return $stmtid;
 }
示例#26
0
 public function getErrno()
 {
     return $this->_link ? odbc_errormsg($this->dbConnection()) : odbc_error($this->dbConnection());
 }
示例#27
0
function make_results_table($result, $show_rowid, $table_name)
{
    if ($result === false) {
        ?>
		<div class="error_message">
			<?php 
        echo odbc_error() . ": " . odbc_errormsg();
        ?>
		</div>
<?php 
    } else {
        ?>
		<!-- TODO add edit/delete buttons for each row -->
		<!-- TODO field editing on click [?] -->
		<!-- TODO think about NULL -->
		<table class="results_table">
			<tr>
<?php 
        $fields_count = odbc_num_fields($result);
        $rowid_index = -1;
        for ($i = 1; $i <= $fields_count; ++$i) {
            $field_name = odbc_field_name($result, $i);
            if ($field_name == "ROWID" && !$show_rowid) {
                $rowid_index = $i - 1;
                continue;
            }
            echo "<th>" . $field_name . "</th>";
        }
        ?>
			</tr>
<?php 
        function treat_result($res)
        {
            if ($res == '') {
                return "&nbsp;";
            }
            return htmlspecialchars($res);
        }
        $res = array();
        $current_rowid = null;
        while (odbc_fetch_into($result, $res)) {
            $current_rowid = treat_result($res[$rowid_index]);
            echo "<tr id='row_" . $current_rowid . "'>";
            $controls = true;
            for ($i = 0; $i < $fields_count; ++$i) {
                if ($i == $rowid_index) {
                    continue;
                }
                echo "<td>" . treat_result($res[$i]);
                if ($controls && $table_name != null) {
                    $controls = false;
                    echo "<div class='row_control'>";
                    echo "<a class='button delete' href='javascript:delete_entry(\"" . $current_rowid . "\");'></a>";
                    echo "<a class='button edit' href='?tables&action=add_entry&target=" . $table_name . "&rowid=" . $current_rowid . "'></a>";
                    echo "</div>";
                }
                echo "</td>";
            }
            echo "</tr>";
        }
        ?>
		</table>
<?php 
    }
}
示例#28
0
    case "cultural":
        $table = "cultural";
        $sqlselect = "SELECT " . $table . ".cultural_price, " . $table . ".cultural_type, " . $table . ".name, " . $table . ".phone, " . $table . ".address, " . $table . ".neighborhood, " . $table . ".city,\n                 reviewer.first_name, reviewer.last_name , review.review_rank, review.comments";
        $type_sql = $table . ".cultural_type = '" . $type . "'";
        $level_sql = $table . ".cultural_price = '" . $level . "'";
        break;
    case "outdoors":
        $table = "outdoors";
        $sqlselect = "SELECT " . $table . ".outdoors_level, " . $table . ".outdoors_type, " . $table . ".name, " . $table . ".phone, " . $table . ".address, " . $table . ".city, reviewer.first_name, \n                 reviewer.last_name, review.review_rank, review.comments";
        $type_sql = $table . ".outdoors_type = '" . $type . "'";
        $level_sql = $table . ".outdoors_level = '" . $level . "'";
        break;
}
$rating_sql = "review.review_rank = " . $rating;
$city_sql = $table . ".city='" . $city . "'";
$sqlfrom = "FROM reviewer INNER JOIN (" . $table . " INNER JOIN review \n                                                 ON " . $table . ".id_number = review.id_number)\n                          ON reviewer.user_name = review.user_name";
$sqlwhere = "WHERE ((" . $type_sql . ") AND (" . $level_sql . ") AND (" . $rating_sql . ") AND (" . $city_sql . "))";
$sql = $sqlselect . " " . $sqlfrom . " " . $sqlwhere;
$conn = odbc_connect('finalproject', '', '') or die('Could Not Connect to ODBC Database!');
echo "sql = " . $sql . "<br>";
$result = odbc_exec($conn, $sql) or die(odbc_errormsg());
while (odbc_fetch_row($result)) {
    for ($i = 1; $i <= odbc_num_fields($result); $i++) {
        echo "result " . $i . " = " . odbc_result($result, $i) . "<br>";
    }
}
odbc_close($conn);
?>

</body>
</html>
示例#29
0
 function sql_error()
 {
     $error['code'] = odbc_error($this->db_connect_id);
     $error['message'] = odbc_errormsg($this->db_connect_id);
     return $error;
 }
示例#30
0
 /**
  * ODBC::getError()
  *
  * Return the last error
  *
  * @return string
  * @access public
  * @author Teye Heimans
  */
 function getError()
 {
     return odbc_errormsg($this->_conn);
 }