Welcome Guest, Not a member yet? Register   Sign In
Lost Database Connection
#1

When I use this code:

PHP Code:
$this->db = \Config\Database::connect($this->base_datos);
$this->query $this->db->table($this->db_tabla);
$this->db_columnas $this->db->getFieldNames($this->db_tabla); 

I get the error:

Quote:ErrorException: pg_escape_literal() expects parameter 1 to be resource, boolean given

If don't call getFieldNames the error desapears.

Thanks
Reply
#2

PHP Code:
$this->db_columnas $this->query->getFieldNames(); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Thank you for the reply, InsiteFX. But CI4 doesn't like that. It throws this error:

Call to undefined method CodeIgniter\Database\Postgre\Builder::getFieldNames()

I think it has to be with loosing connection with the DB.

Thank you.
Reply
#4

(07-11-2016, 06:00 AM)portaflex Wrote: Thank you for the reply, InsiteFX. But CI4 doesn't like that. It throws this error:

Call to undefined method CodeIgniter\Database\Postgre\Builder::getFieldNames()

I think it has to be with loosing connection with the DB.

Thank you.

That will be fixed shortly. There is a bug report that came in over the weekend about this that I haven't had a chance to correct yet.

Pull requests are welcome. Smile
Reply
#5

(07-11-2016, 06:17 AM)kilishan Wrote: That will be fixed shortly. There is a bug report that came in over the weekend about this that I haven't had a chance to correct yet.

Pull requests are welcome. Smile

You've got it, Kilishan. But I'm not sure it solves the issue. I get very strange behaviour with those three lines:

PHP Code:
$this->db = \Config\Database::connect($this->base_datos);
$this->query $this->db->table($this->db_tabla);
$this->db_columnas $this->db->getFieldNames($this->db_tabla); 

I have them in a class returning a complete html table. The Error of loosing $this->ConnID comes from escape() method in system/Database/Postgre/Connection.php ONLY when I invoke through an AJAX call from the paginator in the table. If I just refresh the page, those three lines work well.

Ain't it weird? I can't figure out the solution, it is beyond my knowledge.

Thanks.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB