• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems with ODBC and Active Record

#1
[eluser]carlosgoce[/eluser]
Hello,

first of all, sorry for my english.

i have a DBase with a ODBC, it's working with pdo or odbc php functions.

I'm beginning with Code Igniter and i need to use the odbc database. The thing is, at first, i have to change the odbc driver file:
Code:
return '('.implode(', ', $tables).')'; //before
return implode(', ', $tables);  //now

Because the querys were something like "SELECT name FROM (table)" and odbc didnt works with this query.

Ok, now it seems its working but i dont like to modify the system files of ci, i don't know if this is right.

But now when i try to get a query like that:
Code:
$query = $this->db->get('table', 10);

It's not returning only 10 rows, the query returns every single row that the table contains, the whole table.

So maybe i need to change things again on the odbc driver ? because on this database the LIMIT clausule is not LIMIT, is TOP and it needs an Order By Clausule to works.

The real question. Can i use odbc or at least, odbc without active record on Code Igniter or not?

Maybe there is a workaround for get('table', 10) ?

Thank you for your attention.

#2
[eluser]TheFuzzy0ne[/eluser]
Sounds like it could be a bug. I recommend you file that as a bug as soon as you can.

The Active Record library is optional. You don't have to use it if you don't want to. You can disable it within your database config file: ./application/config/database.php

Code:
$active_record = FALSE;

#3
[eluser]carlosgoce[/eluser]
Thank you FuzzyOne. But what do you mean with "I recommend you file that as soon as you can." I don't get it my english is poor.

What's the way to work with odbc on a model without Active Record? I was looking for a tutorial out there and couldn't find anything useful.
I have doubts on the way to connect to my db. Where should i put my odbc connection string?

#4
[eluser]TheFuzzy0ne[/eluser]
Sorry, I've corrected that error. That should have read "I recommend you file that as a bug as soon as you can."

You can use $this->db->query() to fire your query at the database.

You should get an error if CodeIgniter is unable to connect to your database. Your odbc connection string should go into $database['default']['hostname'] in ./application/config/database.php

#5
[eluser]carlosgoce[/eluser]
Ahhhh, that's great. Thank you very much.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.