Exemplo n.º 1
0
 public function __construct($module, $item, $value, $defaults = null)
 {
     $this->value = $value;
     $this->module = $module;
     $this->item = $item;
     $this->defaults = $defaults;
     parent::__construct($module);
     if (file_exists(Manager::getModulePath($module, 'db/lookup.class')) && Manager::uses('/db/lookup.class', $module) || Manager::uses('/classes/lookup.class', $module)) {
         eval("\$object = new Business{$module}Lookup();");
         eval("\$info   = \$object->autoComplete{$item}(\$this,\$defaults);");
         parent::__construct($this->module);
         if ($info) {
             $this->result = $info;
         } else {
             //faz consulta
             $sql = new Msql('');
             $sql->createFrom($this->sql);
             $sql->prepare($value);
             $db = Manager::getDatabase($this->module);
             //$this->sql = MSql::prepare($this->sql,$value);
             //$result = $this->_db->query($value ? $sql->command : str_replace('?','NULL',$this->sql));
             $result = $db->query($value ? $sql->command : str_replace('?', 'NULL', $this->sql));
             $this->result = $result[0];
         }
     }
 }
Exemplo n.º 2
0
 static function Instance()
 {
     if (self::$_instance == NULL) {
         self::$_instance = new Msql();
     }
     return self::$_instance;
 }
Exemplo n.º 3
0
 private function __construct()
 {
     $this->_msql = Msql::Instance();
 }