-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
system/Database/BaseConnection.php Change in getFieldNames() method #164
Comments
Could you describe what you're seeing that makes you think this is needed? How can I repeat the issue? |
This code is at line 239 in DS_tablax.php
which is a class I use to generate a complete html table. I pass a configuration array from controller Home.php. I need to get table columns names before doing the final query to populate the html table and, unless changing getFieldNames() method, $this->connID would be lost. Thanks you. |
I'm not seeing an issue with that code working for me with the latest develop branch. I ran those same three queries in my Home controller, and tried several different combinations of queries after those three, and everything seemed to work as expected. The database is always initialized during a Are you using MySQL or PostgreSQL? I'm also confused how $this->connID gets lost? I don't see anything in |
Yes, in fact I'm using Postgre. The php function that fails is pg_escape_literal(). It needs connID as first paramenter and fails with error message "expecting $connID to be object, boolean given". Maybe the issue happens because I'm calling getFieldNames() before any query, and It calls $this->_listColumns() before initializing the connection. I'm connecting to database not in localhost but to another computer. Don't know why MySQL is working. :-( |
We have two getFieldNames() methods, one in BaseConnection.php and another in Postgre/Result.php. The second gets the field name of each query-result row number using pg_field_name() once the query has been executed. The first executes a query itself independent of any other query. Therefore, in my case, no initialization has yet happened. Moreorver, this method invokes _listColums() which, in turn, also needs $this->connID to pass to pg_escape_literal, before calling $this->query(). Regards. |
ok, cool. That makes sense then. I'll add that check. Just trying to make sure we were fixing the right problem. :) |
Thank you. |
After this:
We have to call $this->initialize() again:
As you know, I'm not proficient in making pullrequest. ;-)
The text was updated successfully, but these errors were encountered: