Changeset 2459

Show
Ignore:
Timestamp:
04/09/2008 01:23:37 PM (6 months ago)
Author:
zombor
Message:

Misc updates to Where class.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/2.2-database/system/libraries/Database_Where.php

    r2458 r2459  
    1 <?php //defined('SYSPATH') or die('No direct script access.'); 
     1<?php defined('SYSPATH') or die('No direct script access.'); 
    22/** 
    33 * Provides database access in a platform agnostic way, using simple query building blocks. 
     
    1414        protected $where = array(); 
    1515        protected $drivers = array(); 
    16  
    17         public function __construct($group = 'default') 
    18         { 
    19                  
    20         } 
    2116 
    2217        public function where() 
     
    6156        public function build($group = 'default') 
    6257        { 
    63                 if (is_string($group)) 
     58                if (is_string($group)) // group name was passed 
    6459                { 
    6560                        $config = Config::item('database.'.$group); 
     
    8176                        // Set driver name 
    8277                        $driver_class_name = 'Database_'.ucfirst($driver).'_Driver'; 
    83          
     78 
    8479                        // Load the driver 
    8580                        if ( ! Kohana::auto_load($driver)) 
    8681                                throw new Kohana_Database_Exception('database.driver_not_supported', $driver_class_name); 
    87          
     82 
    8883                        // Initialize the driver 
    8984                        $this->drivers[$driver] = new $driver_class_name(); 
    90          
     85 
    9186                        // Validate the driver 
    9287                        if ( ! ($this->drivers[$driver] instanceof Database_Driver)) 
     
    9994                foreach ($this->where as $where) 
    10095                { 
    101                         if (is_object($where[0])) 
     96                        if ($where[0] instanceof Database_Where_Core) 
    10297                        { 
    10398                                $where_string.=$where[0]->build();