Ejemplo n.º 1
0
 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";
 }
Ejemplo n.º 2
0
 /**
  * @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);
 }
Ejemplo n.º 3
0
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;
    }
}
Ejemplo n.º 4
0
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;
        }
    }
}
Ejemplo n.º 5
0
 /**
  * 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;
 }
Ejemplo n.º 6
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());
     }
 }
Ejemplo n.º 7
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;
 }
Ejemplo n.º 8
0
 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);
     }
 }
Ejemplo n.º 9
0
 /**	
  * 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);
 }
Ejemplo n.º 10
0
 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
 }
Ejemplo n.º 11
0
	function Query($query)
	{
            if ($this->conn)
            {
                $result = odbc_exec($this->conn, $query);
                if (odbc_error()) $this->setError(odbc_error());
                return $result;
            }
            else
            {
                return false;
            }
	}
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;
	
}
Ejemplo n.º 13
0
 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();
     }
 }
Ejemplo n.º 14
0
 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();
     }
 }
Ejemplo n.º 15
0
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;
}
Ejemplo n.º 16
0
function doquery($query, $table, $fetch = false)
{
    global $link, $debug, $xnova_root_path;
    @(include $xnova_root_path . 'config.php');
    if (!$link) {
        $link = odbc_connect($dbsettings["server"], $dbsettings["user"], $dbsettings["pass"]) or $debug->error(odbc_error() . "<br />{$query}", "SQL Error");
        odbc_select_db($dbsettings["name"]) or $debug->error(odbc_error() . "<br />{$query}", "SQL Error");
    }
    $sqlquery = odbc_exec($query, str_replace("{{table}}", $dbsettings["prefix"] . $table)) or $debug->error(odbc_error() . "<br />{$query}", "SQL Error");
    unset($dbsettings);
    global $numqueries, $debug;
    $numqueries++;
    $debug->add("<tr><th>Query {$numqueries}: </th><th>{$query}</th><th>{$table}</th><th>{$fetch}</th></tr>");
    if ($fetch) {
        $sqlrow = odbc_fetch_array($sqlquery);
        return $sqlrow;
    } else {
        return $sqlquery;
    }
}
 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;
             }
         }
     }
 }
Ejemplo n.º 19
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;
 }
Ejemplo n.º 20
0
 public function getErrno()
 {
     return $this->_link ? odbc_errormsg($this->dbConnection()) : odbc_error($this->dbConnection());
 }
Ejemplo n.º 21
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 
    }
}
Ejemplo n.º 22
0
 function sql_error()
 {
     $error['code'] = odbc_error($this->db_connect_id);
     $error['message'] = odbc_errormsg($this->db_connect_id);
     return $error;
 }
Ejemplo n.º 23
0
 /**
  * The error message number
  *
  * @access	private
  * @return	integer
  */
 function _error_number()
 {
     return odbc_error($this->conn_id);
 }
Ejemplo n.º 24
0
    <td align="center" bgcolor="#6666FF"><font color="#FFFF00"><b>INSTANSI</b></font></td>
    <td align="center" bgcolor="#6666FF"><font color="#FFFF00"><b>ALAMAT</b></font></td>
    <td align="center" bgcolor="#6666FF"><font color="#FFFF00"><b>PETUGAS</b></font></td>
	<td align="center" bgcolor="#6666FF"><font color="#FFFF00"><b>BIAYA</b></font></td>
    <td align="center" bgcolor="#6666FF"><font color="#FFFF00"><b>TGL SELESAI</b></font></td>

  					</tr>
  					<?php
require("koneksi.php");
         $link=mysql_connect($host,$dbuser,$dbpwd) or die('Can not connect to server!');
          mysql_select_db($dbname,$link);
        if (!mysql_select_db($dbname,$link)) die ("gagal memilih database");

      $sql = "select no_sn,jenis_hw,merk_hw,type_hw,spesifik_hw,tgl_ggn,jns_ggn,inst_perbaikan,almt_inst,ptgs_penerima,biaya,tgl_selesai from table_ggn_hw where no_sn like '$input1%' and jenis_hw like '$input2%' order by jenis_hw";

      echo odbc_error();
      $hasil = mysql_query($sql,$link);
?>



<?php
   // Buat Table
      //print("<table border=\"1\" width=\"100%\" >\n");

      //print("<table border=\"1\">\n");
       //header
      //print("<TR>\n");


      $n=0;
Ejemplo n.º 25
0
 /**
  * Gets the DBMS' native error code and message produced by the last query
  *
  * @return string  the DBMS' error code and message
  */
 function errorNative()
 {
     if (!is_resource($this->connection)) {
         return @odbc_error() . ' ' . @odbc_errormsg();
     }
     return @odbc_error($this->connection) . ' ' . @odbc_errormsg($this->connection);
 }
Ejemplo n.º 26
0
 /**
  * Gather information about an error, then use that info to create a
  * DB error object and finally return that object.
  *
  * @param  integer  $errno  PEAR error number (usually a DB constant) if
  *                          manually raising an error
  * @return object  DB error object
  * @see errorNative()
  * @see DB_common::errorCode()
  * @see DB_common::raiseError()
  */
 function odbcRaiseError($errno = null)
 {
     if ($errno === null) {
         switch ($this->dbsyntax) {
             case 'access':
                 if ($this->options['portability'] & DB_PORTABILITY_ERRORS) {
                     $this->errorcode_map['07001'] = DB_ERROR_NOSUCHFIELD;
                 } else {
                     // Doing this in case mode changes during runtime.
                     $this->errorcode_map['07001'] = DB_ERROR_MISMATCH;
                 }
         }
         $errno = $this->errorCode(odbc_error($this->connection));
     }
     return $this->raiseError($errno, null, null, null, $this->errorNative());
 }
Ejemplo n.º 27
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));
 }
Ejemplo n.º 28
0
        }
        $resultset = @$db->query("select avg(request_processing_time) as average from " . $data_ini["triplestore"]["log_table"] . " where \n                                requested_web_service = '{$ws}'");
        $averageTime = "0";
        if (!odbc_error()) {
            $averageTime = odbc_result($resultset, 1);
        }
        $statisticsXML .= "    <" . str_replace("/", "_", $ws) . " nbQueries=\"{$nbQueries}\" averageTimePerQuery=\"{$averageTime}\">\n";
        $statisticsXML .= "      <httpMessages>\n";
        $resultset = @$db->query("select distinct request_http_response_status, count(request_http_response_status) as nb \n                                from " . $data_ini["triplestore"]["log_table"] . " where requested_web_service = '{$ws}' \n                                group by request_http_response_status");
        if (!odbc_error()) {
            while (odbc_fetch_row($resultset)) {
                $statisticsXML .= "        <msg type=\"" . odbc_result($resultset, 1) . "\" count=\"" . odbc_result($resultset, 2) . "\" />\n";
            }
        }
        $statisticsXML .= "      </httpMessages>\n";
        $statisticsXML .= "      <requestedMimes>\n";
        $resultset = @$db->query("select distinct requested_mime, count(requested_mime) as nb from " . $data_ini["triplestore"]["log_table"] . " " . "where requested_web_service = '{$ws}' group by requested_mime");
        if (!odbc_error()) {
            while (odbc_fetch_row($resultset)) {
                $statisticsXML .= "        <mime type=\"" . odbc_result($resultset, 1) . "\" count=\"" . odbc_result($resultset, 2) . "\" />\n";
            }
        }
        $statisticsXML .= "      </requestedMimes>\n";
        $statisticsXML .= "    </" . str_replace("/", "_", $ws) . ">\n";
    }
    $statisticsXML .= "  </webservices>\n";
    $statisticsXML .= "</statistics>\n";
    header("Content-Type: text/xml; charset=utf-8");
    echo $statisticsXML;
}
//@}
Ejemplo n.º 29
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);
 }
Ejemplo n.º 30
0
 /**
  * return sql error array
  * @access private
  */
 function _sql_error()
 {
     return array('message' => @odbc_errormsg(), 'code' => @odbc_error());
 }