CodeIgniter Forums
sql problem using CI and ActiveRecord - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: sql problem using CI and ActiveRecord (/showthread.php?tid=11112)

sql problem using CI and ActiveRecord - El Forum - 08-26-2008

I'm really just getting started with CI. I am connecting to an IBM Iseries(AS400,I5)
I finally got the db2 driver(located in the wiki) working and connecting to my Iseries.

I have been working through a simple tutorial that lists jobs and has a link to view a specific job.

The first part of listing all the jobs works howeve when i try to select the specific job it does not work.

The problem seems to be with the DB_active_record.php. I have noticed that there is a lack of spaces in the query.

for my list of all jobs the query is 'Select *from' (notice no space between * and from)

Although this seems to work ok.

However when i add a where clause

'Select *from tstmis.jobsWHERE "id" = '1' '

again notice the lack of spaces between and WHERE

This query does not run.
Maybe it has something to do with DB2 that doesn't allow it, but at anyrate I'm not quite sure what to do about it.

Any ideas?

sql problem using CI and ActiveRecord - El Forum - 08-28-2008

Well i solved this by changing the DB_active_record.php file to make sure there is a space in the where clause. I haven't gotten this far yet, but i suspect i will have to do the same with order by and other clauses.

Now that said, i'm not sure how safe this is because i will have to remember to do the same thing again when i get a new release of CI. Seems like it should be putting spaces in there naturally.