Welcome Guest, Not a member yet? Register   Sign In
CI and SQL SERVER 2005 and MS ADODB not ADOdb
#5

[eluser]riza_nurhadi[/eluser]
and now for the adodb_result.php [located @ system\database\drivers\adodb_result.php]
this is the code.

the change that i made was
- function num_rows
- function _data_seek
- function _fetch_assoc....this is the code is important for function result_array

the other thing was just to close the mssql_whatever php function.

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class CI_DB_adodb_result extends CI_DB_result {
    function num_rows()
    {
        //return @mssql_num_rows($this->result_id);
        //$rs = $conn->Execute($sql);
        
        $rs = $this->result_id;
         $rowcount = 0;
         if(!$rs->EOF && !$rs->BOF) {
         $rs->MoveFirst;
          while (!$rs->EOF) {
          $rs->MoveNext();
          $rowcount++;
          }
            $rs->MoveFirst;
          }
        
        return $rowcount;
    }

    function _data_seek($n = 0)
    {
        //return mssql_data_seek($this->result_id, $n);
        return true;
    }

    function _fetch_assoc()
    {
        $rs = $this->result_id;
        $num_columns = $rs->Fields->Count();
         $ado_field_name = array();
         for ($i=0; $i < $num_columns; $i++){
          $ado_field_name[] = $rs->Fields($i)->Name;
         }
        
         $result = array();
         $test = array();
         $rowcount = 0;
         if(!$rs->EOF && !$rs->BOF) {
         $rs->MoveFirst;
          while (!$rs->EOF) {
          for ($i=0; $i < $num_columns; $i++) {
            $result[$rowcount][$ado_field_name[$i]] = $rs->Fields[$i]->value;
        }
          $rs->MoveNext();
          $rowcount++;
         }
          $rs->MoveFirst;
         }
        
        //return mssql_fetch_assoc($this->result_id);
        return $result;
    }

}


/* End of file mssql_result.php */
/* Location: ./system/database/drivers/mssql/mssql_result.php
AND CHANGED TO Location: ./system/database/drivers/adodb/adodb_result.php
*/

as you see i only copy this code from mssql driver.
and thats it...im not change the other 2 driver.


Messages In This Thread
CI and SQL SERVER 2005 and MS ADODB not ADOdb - by El Forum - 04-21-2009, 10:32 AM
CI and SQL SERVER 2005 and MS ADODB not ADOdb - by El Forum - 04-22-2009, 06:18 AM
CI and SQL SERVER 2005 and MS ADODB not ADOdb - by El Forum - 05-06-2009, 03:07 AM
CI and SQL SERVER 2005 and MS ADODB not ADOdb - by El Forum - 05-06-2009, 03:23 AM
CI and SQL SERVER 2005 and MS ADODB not ADOdb - by El Forum - 05-06-2009, 03:31 AM
CI and SQL SERVER 2005 and MS ADODB not ADOdb - by El Forum - 05-06-2009, 03:39 AM
CI and SQL SERVER 2005 and MS ADODB not ADOdb - by El Forum - 05-06-2009, 11:54 AM
CI and SQL SERVER 2005 and MS ADODB not ADOdb - by El Forum - 05-12-2009, 03:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB