Testing Codeigniter with Firebird

Fecha 19/4/2012 20:10:27 | Tema: CodeIgniter

I’ve been using Codeigniter as my development platform and framework of choice since last year. Being a ten year PHP developer, Codeigner was a refreshing way of coding web apps with PHP.

The first ones developments I did with Codeigniter were using MySQL, a very used database. But since I’ve also been using Firebird SQL Database from ten or more years ago, I decided to give a try to the Codeigniter-Firebird duo.

So I downloaded the Firebird drivers for Codeigniter, written by Carlos Garcia, and installed in my Codeigniter application setup.

Everything went ok, in the first attempts to make a connection and display a table, the data was displayed as expected. But I noted some little differences in using Firebird, here’s the list:

a) You must use the array indexes of the result array of a query in capital letters. For instance, in this code:

$arr =  $this->db->query("select  id, field from table");
$data $arr->result_array();

When you refer to the content of the data array, you should do that in this way:
echo $data[0]['ID'];


By the way, in the query statement, you can use lower or uppercase letters.

NOTE: Still have not used the ActiveRecord Get methods that return objects for each row of the table, I’ll report them as soon as I use them.

b) When a query fetches a lot of records (sorry, I didn’t test the exact number), it throws an http ‘Internal server 500’ message. I also didn’t test if it’s my server setup. As I know I’ll be using pagination, the error disappeared when I used a 20 record page pagination in the display of the table.

c) I also had an error when making a SELECT * FROM TABLE statement, and if that table has a very large VARCHAR (or CHAR) fields. This was fixed when I specified only a few fields of the table.

d) Another thing I noted is that the num_rows method of a query always returns 1. Don’t know if it’s a bug or product of a special condition in my program. This was resolved by using the sizeof function of PHP, applying it to the result array. This way I know how many rows returned the query.

These are the things I have observed so far. I did my testing today, and plan to continue the application. I’ll report these issues to Carlos, and as he lives in the same city than I, maybe I’ll thank him (in the name of all Codeigniter/Firebird developers) his time and effort in development this piece of software with a pair of beers (maybe more).

Apart from these little issues, the Firebird driver for Codeigniter is working very well and it's very nice to make web applications with both development softwares.


You can download the Firebird Driver for Codeigniter in this URL:
https://github.com/cgarciagl/Firebird-for-Codeigniter




Este artículo proviene de Albringas.com
http://albringas.com

La URL para este artículo es:
http://albringas.com/modules/AMS/article.php?storyid=17