Logo F2FInterview

Codelgnitor Interview Questions

Q   |   QA

Answer 1
Turn on profiling (part of the benchmarking class) - this will show the full detail of all the SQL queries for the page.

Answer 2
You can do this before your query:

$this->db->_compile_select();

.. and then this, once you’ve run the query:

$this->db->last_query();  

This is covered in the Query Helper Functions section of the CI User Guide - the function you’re looking for is:

$foo = $this->db->insert_id();  

You need to use the SQL AS feature, where you assign a new name to a piece of data.
For example:

$this->db->select("COUNT('foo') AS foo_count", FALSE);
// Run your query, and then use the foo_count variable.  

Answer 1
No, you can not. This is quite explicitly described in the Creating Libraries section of the user guide:

    The Database classes can not be extended or replaced with your own classes, nor can the Loader class in PHP 4. All other classes are able to be replaced/extended.

Answer 2
Yes, you can, using the method described by rafsoaken

Yes, this seems to be kind of known, though so few CI users are on Oracle that it’s hard to pin down the problem.

Have a read of this thread, especially if you’re seeing an off-by-one error on row counts.

This thread relates to CI 1.7.0 and Oracle versions 9 & 10 - not being able to connect to the database from within CI.

There are some other Known Issues with Oracle documented on this wiki.

In order to link this F2FInterview's page as Reference on your website or Blog, click on below text area and pres (CTRL-C) to copy the code in clipboard or right click then copy the following lines after that paste into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code: