public function Connect()
 {
     // Set several ini settings
     ini_set('mssql.textlimit', '65536');
     ini_set('mssql.textsize', '65536');
     ini_set('mssql.charset', 'utf-8');
     ini_set('mssql.datetimeconvert', 'Off');
     // Lookup Adapter-Specific Connection Properties
     $strServer = $this->Server;
     $strName = $this->Database;
     $strUsername = $this->Username;
     $strPassword = $this->Password;
     $strPort = $this->Port;
     if ($strPort) {
         // Windows Servers
         if (array_key_exists('OS', $_SERVER) && stristr($_SERVER['OS'], 'Win') !== false) {
             $strServer .= ',' . $strPort;
         } else {
             $strServer .= ':' . $strPort;
         }
     }
     // Connect to the Database Server
     // Because the MSSQL extension throws warnings, we want to avoid them
     set_error_handler('QcodoHandleError', 0);
     $this->objMsSql = mssql_connect($strServer, $strUsername, $strPassword, true);
     if (!$this->objMsSql) {
         $objException = new QSqlServerDatabaseException('Unable to connect to Database: ' . mssql_get_last_message(), -1, null);
         $objException->IncrementOffset();
         throw $objException;
     }
     if (!mssql_select_db($strName, $this->objMsSql)) {
         $objException = new QSqlServerDatabaseException('Unable to connect to Database: ' . mssql_get_last_message(), -1, null);
         $objException->IncrementOffset();
         throw $objException;
     }
     // Restore the error handler to the original
     restore_error_handler();
     // Update Connected Flag
     $this->blnConnectedFlag = true;
 }
 public function Connect()
 {
     // Lookup Adapter-Specific Connection Properties
     $strServer = $this->Server;
     $strName = $this->Database;
     $strUsername = $this->Username;
     $strPassword = $this->Password;
     $strPort = $this->Port;
     if ($strPort) {
         // Windows Servers
         if (array_key_exists('OS', $_SERVER) && stristr($_SERVER['OS'], 'Win') !== false) {
             $strServer .= ',' . $strPort;
         } else {
             $strServer .= ':' . $strPort;
         }
     }
     // Connect to the Database Server
     // Because the MSSQL extension throws warnings, we want to avoid them
     $this->objMsSql = @mssql_connect($strServer, $strUsername, $strPassword, true);
     if (!$this->objMsSql) {
         $objException = new QSqlServerDatabaseException('Unable to connect to Database: ' . mssql_get_last_message(), -1, null);
         $objException->IncrementOffset();
         throw $objException;
     }
     if (!mssql_select_db($strName, $this->objMsSql)) {
         $objException = new QSqlServerDatabaseException('Unable to connect to Database: ' . mssql_get_last_message(), -1, null);
         $objException->IncrementOffset();
         throw $objException;
     }
     // Update Connected Flag
     $this->blnConnectedFlag = true;
 }
 public function __construct($intDatabaseIndex)
 {
     // Configure Base Properties
     $this->ConfigureBaseProperties($intDatabaseIndex);
     // Lookup Adapter-Specific Connection Properties
     $strServer = QApplication::$ConnectionStringArray[$intDatabaseIndex]['server'];
     $strName = QApplication::$ConnectionStringArray[$intDatabaseIndex]['database'];
     $strUsername = QApplication::$ConnectionStringArray[$intDatabaseIndex]['username'];
     $strPassword = QApplication::$ConnectionStringArray[$intDatabaseIndex]['password'];
     $strPort = QApplication::$ConnectionStringArray[$intDatabaseIndex]['port'];
     if ($strPort) {
         $strServer .= ':' . $strPort;
     }
     // Connect to the Database Server
     // Because the MSSQL extension throws warnings, we want to avoid them
     set_error_handler('QcodoHandleError', 0);
     $this->objMsSql = mssql_connect($strServer, $strUsername, $strPassword);
     if (!$this->objMsSql) {
         $objException = new QSqlServerDatabaseException('Unable to connect to Database: ' . mssql_get_last_message(), -1, null);
         $objException->IncrementOffset();
         throw $objException;
     }
     if (!mssql_select_db($strName, $this->objMsSql)) {
         $objException = new QSqlServerDatabaseException('Unable to connect to Database: ' . mssql_get_last_message(), -1, null);
         $objException->IncrementOffset();
         throw $objException;
     }
     // Restore the error handler to the original
     restore_error_handler();
 }