function _connect($HostOrInterface, $UserOrDSN = '', $argPassword = '', $argDatabase = '') { $this->_connectionID = @odbtp_connect($HostOrInterface, $UserOrDSN, $argPassword, $argDatabase); if ($this->_connectionID === false) { $this->_errorMsg = $this->ErrorMsg(); return false; } $this->odbc_driver = @odbtp_get_attr(ODB_ATTR_DRIVER, $this->_connectionID); // Set driver specific attributes switch ($this->odbc_driver) { case ODB_DRIVER_MSSQL: $this->fmtDate = "'Y-m-d'"; $this->fmtTimeStamp = "'Y-m-d h:i:sA'"; $this->sysDate = 'convert(datetime,convert(char,GetDate(),102),102)'; $this->sysTimeStamp = 'GetDate()'; $this->ansiOuter = true; $this->leftOuter = '*='; $this->rightOuter = '=*'; $this->hasTop = 'top'; $this->hasInsertID = true; $this->hasTransactions = true; $this->_bindInputArray = true; $this->_canSelectDb = true; $this->substr = "substring"; $this->length = 'len'; $this->upperCase = 'upper'; $this->identitySQL = 'select @@IDENTITY'; $this->metaDatabasesSQL = "select name from master..sysdatabases where name <> 'master'"; break; case ODB_DRIVER_JET: $this->fmtDate = "#Y-m-d#"; $this->fmtTimeStamp = "#Y-m-d h:i:sA#"; $this->sysDate = "FORMAT(NOW,'yyyy-mm-dd')"; $this->sysTimeStamp = 'NOW'; $this->hasTop = 'top'; $this->hasTransactions = false; $this->_canPrepareSP = true; // For MS Access only. // Can't rebind ODB_CHAR to ODB_WCHAR if row cache enabled. if ($this->_useUnicodeSQL) { odbtp_use_row_cache($this->_connectionID, FALSE, 0); } break; case ODB_DRIVER_FOXPRO: $this->fmtDate = "{^Y-m-d}"; $this->fmtTimeStamp = "{^Y-m-d, h:i:sA}"; $this->sysDate = 'date()'; $this->sysTimeStamp = 'datetime()'; $this->ansiOuter = true; $this->hasTop = 'top'; $this->hasTransactions = false; $this->replaceQuote = "'+chr(39)+'"; $this->true = '.T.'; $this->false = '.F.'; $this->upperCase = 'upper'; break; case ODB_DRIVER_ORACLE: $this->fmtDate = "'Y-m-d 00:00:00'"; $this->fmtTimeStamp = "'Y-m-d h:i:sA'"; $this->sysDate = 'TRUNC(SYSDATE)'; $this->sysTimeStamp = 'SYSDATE'; $this->hasTransactions = true; $this->_bindInputArray = true; $this->concat_operator = '||'; break; case ODB_DRIVER_SYBASE: $this->fmtDate = "'Y-m-d'"; $this->fmtTimeStamp = "'Y-m-d H:i:s'"; $this->sysDate = 'GetDate()'; $this->sysTimeStamp = 'GetDate()'; $this->leftOuter = '*='; $this->rightOuter = '=*'; $this->hasInsertID = true; $this->hasTransactions = true; $this->upperCase = 'upper'; $this->identitySQL = 'select @@IDENTITY'; break; default: if (@odbtp_get_attr(ODB_ATTR_TXNCAPABLE, $this->_connectionID)) { $this->hasTransactions = true; } else { $this->hasTransactions = false; } } @odbtp_set_attr(ODB_ATTR_FULLCOLINFO, TRUE, $this->_connectionID); if ($this->_useUnicodeSQL) { @odbtp_set_attr(ODB_ATTR_UNICODESQL, TRUE, $this->_connectionID); } return true; }
function _initrs() { $this->_numOfFields = @odbtp_num_fields($this->_queryID); if (!($this->_numOfRows = @odbtp_num_rows($this->_queryID))) { $this->_numOfRows = -1; } if (!$this->connection->_useUnicodeSQL) { return; } if ($this->connection->odbc_driver == ODB_DRIVER_JET) { if (!@odbtp_get_attr(ODB_ATTR_MAPCHARTOWCHAR, $this->connection->_connectionID)) { for ($f = 0; $f < $this->_numOfFields; $f++) { if (@odbtp_field_bindtype($this->_queryID, $f) == ODB_CHAR) { @odbtp_bind_field($this->_queryID, $f, ODB_WCHAR); } } } } }
function _connect($argHost, $argUsername = '', $argPassword = '', $argDSN = '', $persist = false) { if ($argUsername) { $argDSN .= ";uid={$argUsername}"; } if ($argPassword) { $argDSN .= ";pwd={$argPassword}"; } if ($persist) { $this->_connectionID = @odbtp_rconnect($argHost, $argDSN); } else { $this->_connectionID = @odbtp_connect($argHost, $argDSN); } if ($this->_connectionID === false) { $this->_errorMsg = $this->ErrorMsg(); return false; } $this->odbc_driver = @odbtp_get_attr(ODB_ATTR_DRIVER, $this->_connectionID); //$this->oic_level = @odbtp_get_attr(ODB_ATTR_OICLEVEL, $this->_connectionID); $tc = @odbtp_get_attr('ODB_ATTR_TXNCAPABLE', $this->_connectionID); if ($tc == 0) { $this->hasTransactions = false; } else { $this->hasTransactions = true; } return true; }