Welcome Guest, Not a member yet? Register   Sign In
Problem with CodeIgniter\Database\BaseBuilder->select ()
#1

Saludos.



Estoy utilizando CI 4 en una aplicación local que usa mysql 5.7.3.

Todas las queries funcionan con normalidad en local y la aplicación trabaja muy bien.

Ahora he clonado la aplicación en un vps y ninguna querie que lleve select a menos que comente la linea.

Es decir, si yo hago



PHP Code:
public function getTest(){
~
  31        $query $this->builderTest->select('*');
~
  32         $test $this->builderTest->get();
~
  33         echo json_encode($test->getResultArray());
~
  34     
 



That will work fine on localhost, but it won't work on the vps (which is connected to the same database).
In vps I must do:



PHP Code:
public function getTest(){
~
  31       // $query = $this->builderTest->select('*');
~  32         $test $this->builderTest->get();
~
  33         echo json_encode($test->getResultArray());
~
  34     



(continue..)
Reply
#2

SYSTEMPATH/Database/BaseBuilder.php at line 365


PHP Code:
/*
359                  * When doing 'SELECT NULL as field_alias FROM table'
360                  * null gets taken as a field, and therefore escaped
361                  * with backticks.
362                  * This prevents NULL being escaped
363                  * @see https://github.com/codeigniter4/CodeIgniter4/issues/1169
364                  */
365                 if (strtoupper(mb_substr(trim($val), 04)) === 'NULL')
366                 {
367                     $escape false;
368                 }
369 
370                 $this
->QBNoEscape[] = $escape;
371             }
372         
APPPATH/Controllers/Main.php : 31   —  CodeIgniter\Database\BaseBuilder->select ()

PHP Code:
24     public function getFinca(){
25        // $query = $this->builderFincas->select('finca_id, finca_nombre');
26         $finca $this->builderFincas->get();
27         echo json_encode($finca->getResultArray());
28     }
29 //Esta función se trae de la BD todos los nombres de la tabla fincas
30     public function getTest(){
31        $query $this->builderFincas->select('*');
32         $finca $this->builderFincas->get();
33         echo json_encode($finca->getResultArray());
34     }
35     //Esta función valida que no pongan una finca diferente al de la BD
36     public function validarFinca(){
37         $finca $this->request->getVar('fincas');
38         //$this->builderFincas->select('finca_id'); 
SYSTEMPATH/CodeIgniter.php : 910   —  App\Controllers\Main->getTest ()

PHP Code:
if (method_exists($class'_remap'))
905         {
906             $output $class->_remap($this->method, ...$params);
907         }
908         else
909         {
910             $output $class->{$this->method}(...$params);
911         }
912 
913         $this
->benchmark->stop('controller');
914 
915         
return $output;
916     
SYSTEMPATH/CodeIgniter.php : 398   —  CodeIgniter\CodeIgniter->runController ()

PHP Code:
if (! is_callable($this->controller))
392         {
393             $controller $this->createController();
394 
395             
// Is there a "post_controller_constructor" event?
396             Events::trigger('post_controller_constructor');
397 
398             $returned 
$this->runController($controller);
399         }
400         else
401         {
402             $this->benchmark->stop('controller_constructor');
403             $this->benchmark->stop('controller');
404         
SYSTEMPATH/CodeIgniter.php : 306   —  CodeIgniter\CodeIgniter->handleRequest ()

PHP Code:
300             $this->response->pretend($this->useSafeOutput)->send();
301             $this->callExit(EXIT_SUCCESS);
302         }
303 
304         
try
305         {
306             return $this->handleRequest($routes$cacheConfig$returnResponse);
307         }
308         catch (RedirectException $e)
309         {
310             $logger Services::logger();
311             $logger->info('REDIRECTED ROUTE at ' $e->getMessage());
312 
313             
// If the route is a 'redirect' route, it throws 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB