load->database() limitation or bug? |
[eluser]Unknown[/eluser]
I'm working on a simple Vbulletin integration with a portal, but I found a strange issue: I have two functions in Member model, that retrieves user info. The first one retrieve info from VBulletin database and the second one retrieves Extra info from antoher db. But the second function tries to retrieve info from the database of the first function, even with wrong prefix. Here's the code: Member Controller: Code: class Users extends Controller { The Member Model: Code: class Membro extends Model { The DB Config (database.php): Code: $active_group = "default"; When i do this: Code: $this->load->model('membro'); OR when i do this: Code: $this->load->model('membro'); But when i tried the first controller code, loading vbulletin info first, and if exists user, load extra info, i got no luck. I got this error: Code: A Database Error Occurred It clear that CodeIgniter is searching in the wrong database config. The correct should be ('portal_user_info'), that leads to default DB config, and not the VB config. Any tips, or this is really a bug? For me it looks a limitation bug, because i used $this->load->database() twice in the same model, for different DBs.
[eluser]Unknown[/eluser]
Hi again, I debugged more things: It appears that vbdevtools hook for CI is interfering with CI's load->database, leading to connecting only with vb database, and "blocking" the access to another DB. URL: http://sourceforge.net/projects/vbdevtools/ But not appears to be a *only* vbdevtools bug, because i created another CI app, only to test the above reported bug, without any hook. The same error occurs. This time i created 2 models, one loading 'vbulletin' database and the second loding 'portal' database, in the same controller: - Controller "member" 1. ->Load first model->Load first DB; (Infos from VBulletin) 2. ->Load second model->Load another DB; (Info from another DB) 3. ->Pass info to my "Bug-Hunt" View The first loaded model returns the info from vb database wthout error. The second loaded model tries to retrieve info again from vB DB, and not from 'portal' DB. If I comment the loading of first model, the second works, loading the data from the correct database and prefixing the SELECT query correctly. Very very weird... I'll try Kohana PHP with similar code, to see if is something in my code and confirm more things. |
Welcome Guest, Not a member yet? Register Sign In |