<?php
//25.0.2.0 FMK/Sql/ODBC.php GF
//VersionVI: 01F250083h
//(c) 2005-2012 PC SOFT - Release
 define('FMK_SQL_ODBC',true); if (!defined('__INC__FMK/Sql.php')) { define('__INC__FMK/Sql.php',true); include_once(WB_INCLUDE_PATH.'WD4b9c73b07be5742abf5273cd830e12f9.php'); } function F9b5245ee( $szTypeOdbc) { $szTypeOdbc = utf8_strtoupper($szTypeOdbc); $TabMySQL2HF = array(); $TabMySQL2HF['BIT'] = array('N', 1, 1); $TabMySQL2HF['TINYINT'] = array('N', 2, 1); $TabMySQL2HF['BIGINT'] = array('N', 3, 8); $TabMySQL2HF['LONGVARBINARY'] = array('T', 4); $TabMySQL2HF['VARBINARY'] = array('T', 5); $TabMySQL2HF['BINARY'] = array('T', 6); $TabMySQL2HF['LONGVARCHAR'] = array('T', 7); $TabMySQL2HF['CHAR'] = array('T', 9); $TabMySQL2HF['NUMERIC'] = array('N', 10); $TabMySQL2HF['DECIMAL'] = array('N', 11); $TabMySQL2HF['INTEGER'] = array('N', 12, 4); $TabMySQL2HF['INT'] = array('N', 12, 4); $TabMySQL2HF['MEDIUMINT'] = array('N', 12, 4); $TabMySQL2HF['SMALLINT'] = array('N', 13, 2); $TabMySQL2HF['FLOAT'] = array('T', 14, 4); $TabMySQL2HF['REAL'] = array('T', 15, 4); $TabMySQL2HF['DOUBLE'] = array('T', 16, 8); $TabMySQL2HF['DATE'] = array('T', 17, 8); $TabMySQL2HF['TIME'] = array('T', 18, 8); $TabMySQL2HF['DATETIME'] = array('T', 18, 8); $TabMySQL2HF['TIMESTAMP'] = array('T', 19, 8); $TabMySQL2HF['VARCHAR'] = array('T', 20); if (!isset($TabMySQL2HF[ $szTypeOdbc ])) { return array('T', 7); } $TabInfo = $TabMySQL2HF[ $szTypeOdbc ]; return $TabInfo; } class FMK_ConnexionODBC { var $ConnectID; function F98fedcfa( $Source, $Utilisateur, $MotDePasse, $NomDeLaDataBase ) { DebutErreurAttendue(); $this->ConnectID = odbc_pconnect($Source, $Utilisateur, $MotDePasse); FinErreurAttendue(); if (!$this->ConnectID) { Ffe27c994('odbc_pconnect'); return false; } return true; } function F3f4d9a86() { DebutErreurAttendue(); odbc_close( $this->ConnectID ); FinErreurAttendue(); } function Fc639f13d( $szCodeSQL ) { $res = false; DebutErreurAttendue(); $res = odbc_exec( $this->ConnectID, $szCodeSQL ) or false; FinErreurAttendue(); if ($res === false) { Ffe27c994('odbc_exec'); return false; } return $res; } function F75609ad1( $resQuery, $sCodeInsert ) { if (!is_resource($this->ConnectID)) return false; $sPartieDebutantAvecFichier = utf8_trim(utf8_substr($sCodeInsert,utf8_strpos($sCodeInsert,'INTO')+utf8_strlen('INTO'))); $nPos = utf8_strpos($sPartieDebutantAvecFichier,'('); $nPosValues = utf8_strpos($sPartieDebutantAvecFichier,'VALUES'); if ($nPosValues!==false) $nPos = min($nPos,$nPosValues-1); $sFichier = utf8_substr($sPartieDebutantAvecFichier,0,$nPos); $exec = odbc_exec($this->ConnectID, "SELECT LAST_INSERT_ID() FROM " . $sFichier); $tabRes = array(); if (!odbc_fetch_into($exec,$tabRes)) return false; return ((isset($tabRes[0])) && ($tabRes[0]!=0)) ? $tabRes[0] : false; } function F58e3a375( $resQuery ) { DebutErreurAttendue(); if ($resQuery) odbc_free_result($resQuery); FinErreurAttendue(); } function F4a096310( $resQuery ) { if (!$resQuery) return false; $tabResultat = array(); DebutErreurAttendue(); $res = odbc_fetch_into( $resQuery , $tabResultat ); FinErreurAttendue(); if ($res == FALSE) return false; return $tabResultat; } function Fd5a050a1( $resQuery ) { DebutErreurAttendue(); $return = odbc_num_fields($resQuery); FinErreurAttendue(); return $return; } function F978f8f4e( $bSimple, $bQueLesTableEtVues) { DebutErreurAttendue(); $result = odbc_tables( $this->ConnectID ) or false; FinErreurAttendue(); if (!$result) { Ffe27c994('odbc_tables'); return ""; } $szRes = ''; $TabRow = array(); DebutErreurAttendue(); $bFetch = odbc_fetch_into($result, $TabRow ); FinErreurAttendue(); while ($bFetch) { if ($szRes != '') $szRes .= "\n"; $szRes .= $TabRow[2]; if (!$bSimple) { } DebutErreurAttendue(); $bFetch = odbc_fetch_into($result, $TabRow ); FinErreurAttendue(); } return $szRes; } function Fbf1c42e2( $szNomTable, $bSimple ) { DebutErreurAttendue(); $resSelect = odbc_exec( $this->ConnectID, "SELECT * FROM $szNomTable" ); FinErreurAttendue(); if (!$resSelect) return ''; $szRes = ''; DebutErreurAttendue(); $nNbCol = odbc_num_fields( $resSelect ); FinErreurAttendue(); for ( $i=0; $i<$nNbCol; $i++) { if ($szRes != '') $szRes .= "\n"; $szRes .= $this->F39bb791f( $resSelect, $i, $bSimple); } return $szRes; } function F39bb791f( $resQuery , $i, $bSimple ) { DebutErreurAttendue(); $szRes = odbc_field_name( $resQuery , $i+1 ); FinErreurAttendue(); if ($bSimple) { DebutErreurAttendue(); $szTypeODBC = odbc_field_type($resQuery , $i+1); FinErreurAttendue(); $TabInfo = F9b5245ee( $szTypeODBC ); $szRes .= "\t" . $TabInfo[0]; $szRes .= "\t" . $TabInfo[1]; DebutErreurAttendue(); $szRes .= "\t" . odbc_field_len($resQuery , $i+1); FinErreurAttendue(); } return $szRes; } function F841ad845( &$pstInfoReq, $Code ) { DebutErreurAttendue(); $pstInfoReq->Erreur = odbc_error (); $pstInfoReq->MesErreur = $Code.":".odbc_errormsg(); FinErreurAttendue(); } } ?>