Welcome Guest, Not a member yet? Register   Sign In
DB_driver bug? _db_set_charset()
#1

[eluser]mpc[/eluser]
Code:
Fatal error: Call to undefined method CI_DB_pdo_driver::_db_set_charset() in /var/CodeIgniter/system/database/DB_driver.php on line 171

What does this xdebug call-stack step #10 error mean that _db_set_charset() is "undefined"?
A DB_driver.php search for _db_set_charset found only the one instance/reference to _db_set_charset() ... on line 171 (in latest CodeIgniter Revision 1748 from .svn).

To check, I removed the prefix underscore ... then, after Refresh, it sailed past this error, but stopped, again, on line 171 with a new db_set_charset() error. See Reply #2, below.

I'm getting this error from a production application (that has been running for years on an earlier CodeIgniter version) that has been downloaded to a development laptop.

It uses PDO SQLite 3 setup per the wiki page (PDO SQLite 3) ... and, according to PHPinfo(), SQLite and PDO are working, just fine.

I made sure that the CodeIgniter directory tree is owned by and in the www-data Debian/Ubuntu Apache User Group and is running under wide-open 777 Permissions. I re-started Apache ... still, no joy.

I'm not familiar with this db_set_charset() stuff. My old application didn't use it, as far as I remember.

Any insight (or fixes) would be appreciated.

thanks,
#2

[eluser]mpc[/eluser]
If it might shed light, here's the xdebug call stack:

Fatal error: Call to undefined method CI_DB_pdo_driver::_db_set_charset() in /var/CodeIgniter/system/database/DB_driver.php on line 171
Call Stack
# Time Memory Function Location
1 0.0128 112832 {main}( ) ../index.php:0
2 0.0391 181984 require_once( '/var/CodeIgniter/system/codeigniter/CodeIgniter.php' ) ../index.php:145
3 0.1196 1254920 Articles->__construct( ) ../CodeIgniter.php:201
4 0.1196 1254920 Controller->Controller( ) ../articles.php:10
5 0.1196 1254920 Controller->_ci_initialize( ) ../Controller.php:43
6 0.1260 1587328 CI_Loader->_ci_autoloader( ) ../Controller.php:83
7 0.1342 1591024 CI_Loader->database( ) ../Loader.php:985
8 0.1422 1634016 DB( ) ../Loader.php:224
9 0.1822 2811384 CI_DB_driver->initialize( ) ../DB.php:137
10 0.2002 2812416 CI_DB_driver->db_set_charset( ) ../DB_driver.php:147
#3

[eluser]mpc[/eluser]
Removing the 'private function' prefix underscore from the db_set_charset() function yields the following call stack:

Fatal error: Maximum function nesting level of '100' reached, aborting! in /var/CodeIgniter/system/database/DB_driver.php on line 171
Call Stack
# Time Memory Function Location
1 0.0010 113392 {main}( ) ../index.php:0
2 0.0026 182576 require_once( '/var/CodeIgniter/system/codeigniter/CodeIgniter.php' ) ../index.php:145
3 0.0256 1255912 Articles->__construct( ) ../CodeIgniter.php:201
4 0.0256 1255912 Controller->Controller( ) ../articles.php:10
5 0.0256 1255912 Controller->_ci_initialize( ) ../Controller.php:43
6 0.0306 1588168 CI_Loader->_ci_autoloader( ) ../Controller.php:83
7 0.0310 1591816 CI_Loader->database( ) ../Loader.php:985
8 0.0318 1634968 DB( ) ../Loader.php:224
9 0.0473 2812136 CI_DB_driver->initialize( ) ../DB.php:137
10 0.0483 2813168 CI_DB_driver->db_set_charset( ) ../DB_driver.php:147
11 0.0483 2813168 CI_DB_driver->db_set_charset( ) ../DB_driver.php:171
12 0.0483 2813168 CI_DB_driver->db_set_charset( ) ../DB_driver.php:171
... same to line 99
#4

[eluser]mpc[/eluser]
If I comment-out the db_set_charset() function, it just stops at call-stack step #9:

DB.php ... initialize()

... at the bottom of /CodeIgniter/system/database/DB.php

I found no additional mention of the two db_set_charset() parameters ($charset, $collation) , either i.e. I didn't see where these two parameters were set, prior to passing them to the /CodeIgniter/system/database/DB_driver.php ... db_set_charset() function.

*******************************

Sometimes, I could really use some sort of a CodeIgniter UML diagram - to shed some light on 'who's on first, who's on second' i.e. how things are connected ... and call each other etc. Wouldn't that be a nifty addition to the CodeIgniter pull-down "Table of Contents"? ... perhaps something like an "Expert Artchitect" code-generated CodeIgniter UML diagram ... maybe in .pdf format ? Well, I can dream, can't I ? Smile
#5

[eluser]mpc[/eluser]
It's beginning to look like the PDO SQLite 3 WIKI page (PDO SQLite 3) code has been 'broken' by the addition of new /CodeIgniter/system/database/DB_driver.php functions, such as db_set_charset().

I guess I'll have to try adapting the /CodeIgniter/system/database/drivers/sqlite/ drivers set for PDO.

As much as CodeIgniter capabilities and documentation are wonderful, lack of CodeIgniter PDO support is disappointing in that:

1. PDO is a PHP5.1-accepted, open-source, generic database interface i.e. not just for SQLite.
2. PDO is a database abstraction layer, analogous to the early 1990's Microsoft ODBC generic database interface. These generic database interfaces require vendor-specific database drivers to make vendor-distinguishing features available.
3. SQLite is part of the PHP5 standard library, an accepted approach to provide FASTER in-memory or file-system-based databases, useful for quick settings retrieval and small data volumes, than full-blown RDBMS alternatives, like MySQL or PostgreSQL.
4. A PDO-to-PHP interface is required to use SQLite 3, a major SQLite rewrite. SQLite 2 does not require a PDO database interface; it can be queried, directly.




Theme © iAndrew 2016 - Forum software by © MyBB