Para crear un desarrollo web, se requieren de varias herramientas, librerías de clases y funciones que permitan crear el desarrollo requerido.
He estado trabajando desde el año pasado con Codeigniter como framework de PHP, y me ha funcionado muy bien, y he ido adicionando otras herramientas que permitan conformar un desarrollo web adecuado.
Estas son las herramientas que utilizo en un desarrollo web:
- Lenguaje: PHP
- Base de datos: Firebird y MySQL
- Framework PHP: Codeigniter
- Biblioteca de interfaz: jQuery UI
- Generador de gráficas: Flot
- Otras herramientas: Thickbox, DatePicker de Kelvin Luck
El editor de que estoy utilizando y que me gusta mucho por su rapidez y practicidad es Sublime Text, muy recomendable. También me ha gustado Aptana, aunque requiere de muchos recursos para funcionar ágilmente.
Sometimes we need to make an autoincrement field (as in the primary key of a table) but we know that such table won’t have a concurrent use, so we don’t want to use a generator to get the values.
For such situations i use this trigger, obviously, it must be a BEFORE INSERT one:
CREATE TRIGGER DATOS_BI FOR DATOS
ACTIVE BEFORE INSERT
SELECT COALESCE(MAX(ID),0) + 1 FROM DATOS INTO NEW.ID;
Where ID is the primary key field and DATOS is the name of the table.
The COALESCE function is for the case when there are not rows in the table, and the MAX function returns NULL, so COALESCE returns 0 in that case.
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:
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: