Code Duplication    Length = 35-36 lines in 2 locations

system/libraries/drivers/Database/Mssql.php 1 location

@@ 368-403 (lines=36) @@
365
        return $this->result_array($object, $type);
366
    }
367
368
    public function result_array($object = null, $type = MSSQL_ASSOC)
369
    {
370
        $rows = array();
371
372
        if (is_string($object)) {
373
            $fetch = $object;
374
        } elseif (is_bool($object)) {
375
            if ($object === true) {
376
                $fetch = 'mssql_fetch_object';
377
378
                // NOTE - The class set by $type must be defined before fetching the result,
379
                // autoloading is disabled to save a lot of stupid overhead.
380
                $type = (is_string($type) and Kohana::auto_load($type)) ? $type : 'stdClass';
381
            } else {
382
                $fetch = 'mssql_fetch_array';
383
            }
384
        } else {
385
            // Use the default config values
386
            $fetch = $this->fetch_type;
387
388
            if ($fetch == 'mssql_fetch_object') {
389
                $type = (is_string($type) and Kohana::auto_load($type)) ? $type : 'stdClass';
390
            }
391
        }
392
393
        if (mssql_num_rows($this->result)) {
394
            // Reset the pointer location to make sure things work properly
395
            mssql_data_seek($this->result, 0);
396
397
            while ($row = $fetch($this->result, $type)) {
398
                $rows[] = $row;
399
            }
400
        }
401
402
        return isset($rows) ? $rows : array();
403
    }
404
405
    public function list_fields()
406
    {

system/libraries/drivers/Database/Pgsql.php 1 location

@@ 360-394 (lines=35) @@
357
        return $this->result_array($object, $type);
358
    }
359
360
    public function result_array($object = null, $type = PGSQL_ASSOC)
361
    {
362
        $rows = array();
363
364
        if (is_string($object)) {
365
            $fetch = $object;
366
        } elseif (is_bool($object)) {
367
            if ($object === true) {
368
                $fetch = 'pg_fetch_object';
369
370
                // NOTE - The class set by $type must be defined before fetching the result,
371
                // autoloading is disabled to save a lot of stupid overhead.
372
                $type = (is_string($type) and Kohana::auto_load($type)) ? $type : 'stdClass';
373
            } else {
374
                $fetch = 'pg_fetch_array';
375
            }
376
        } else {
377
            // Use the default config values
378
            $fetch = $this->fetch_type;
379
380
            if ($fetch == 'pg_fetch_object') {
381
                $type = (is_string($type) and Kohana::auto_load($type)) ? $type : 'stdClass';
382
            }
383
        }
384
385
        if ($this->total_rows) {
386
            pg_result_seek($this->result, 0);
387
388
            while ($row = $fetch($this->result, null, $type)) {
389
                $rows[] = $row;
390
            }
391
        }
392
393
        return $rows;
394
    }
395
396
    public function insert_id()
397
    {