I have developed a FirebirdDB driver for Codeigniter 2.0 +
you can get it at GitHub here: [url=https://github.com/cgarciagl/Firebird-for-Codeigniter[/url]
**moved to GitHUB**
feel free to provide feedback 😊
Cheers
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
October 21, 2010 1:59am
Subscribe [10]#1 / Oct 21, 2010 1:59am
I have developed a FirebirdDB driver for Codeigniter 2.0 +
you can get it at GitHub here: [url=https://github.com/cgarciagl/Firebird-for-Codeigniter[/url]
**moved to GitHUB**
feel free to provide feedback 😊
Cheers
#2 / Oct 21, 2010 2:46am
Excellent Carlos.
Felicidades Carlos en lo particular no he usado mucho Interbase o Firebird, pero por cuestiones de trabajo hace casi un año que tengo que administrar una base de datos de firebird, así que abra que probar este driver. Gracias por el aporte.
#3 / Oct 21, 2010 3:12am
Good work man. Your efforts are much appreciated.
#4 / Oct 22, 2010 11:39am
It’s been more than 2 years since the last time I had to work with a Firebird database… And now I’ll be required to use it again for a new project.
Just in time. Gracias Carlos!
#5 / Oct 26, 2010 4:56pm
Finally!! My pain is going to end! :lol:
Serious… I have used a modification that I found on the internet that has allowed me to make selects in this database, wich has served me well so far. However, I had now to write some code to make insertions and it isn’t working. Will this driver of yours work on CI 1.72 or it is designed for 2.0 only? By the way, when this new version will ever be launched anyway?
Thanks for the help.
#6 / Oct 27, 2010 2:28am
Thank you Carlos i would try it and let you know about it as of in searching of this so long.
#7 / Oct 27, 2010 2:42pm
Hey guys! What’s up?
Carlos, I have updated the driver of my application with yours and guess what? It works! :cheese: Thank you for the good work!!
However, I’m having throuble with blob type fields. The select returns a strange data like “0x000000170000029e”, instead of my saved text.
Can you help me?
Thanks.
#8 / Oct 27, 2010 3:45pm
Hey guys! What’s up?
Carlos, I have updated the driver of my application with yours and guess what? It works! :cheese: Thank you for the good work!!
However, I’m having throuble with blob type fields. The select returns a strange data like “0x000000170000029e”, instead of my saved text.
Can you help me?
Thanks.
Glad to hear that it works for you 😊
could you provide a test case for this issue?? Firebird Version and the type and subtype of the blob field ??
#9 / Oct 27, 2010 4:10pm
Firebird 2.1.2
Blob field = MESS_TEXTO BLOB SUB_TYPE 1 CHARACTER SET NONE
if (!isset($_POST['mess_id'])):
$result = $this->mensagens_model->recupera_mensagem($id);
foreach ($result->result() as $row):
foreach ($row as $field => $value):
if (is_date($value)):
$_POST[strtolower($field)] = dtoc($value);
else:
$_POST[strtolower($field)] = $value;
endif;
endforeach;
endforeach;
endif;
print_r($_POST);
Array
(
[mess_id] => 12
[mess_destinatario_codigo] => AL
[mess_destinatario_nomefant] => Alagoas
[mess_data_entrega] => 27/10/2010
[mess_tipo] => E
[mess_natureza] => Promoção
[mess_duracao] => 2
[mess_notificacao] => 0
[mess_notifica_email] =>
[mess_imagem] =>
[mess_texto] => 0x000000150000029e <- This the Blob field
)#10 / Oct 28, 2010 2:09am
Hi, i’ve updated the driver in bitbucket with a new function to get the blob content of a field.
You just have to pass to the new function the content that is returning now in your field and it will return the real content of the field, in your case with something like this:
echo $this->db->get_blob($_POST[mess_texto]);so, update the driver and hope this works for you 😉
#11 / Oct 28, 2010 3:38pm
Hey Carlos! What’s up? 😊
Thanks man! It worked just fine. Good job!
See ya.
#12 / Oct 29, 2010 9:56am
Hi Carlos, thanks for doing this. We really need it.
I’ve been using Firebird since 2006 with CI, but never used the native CI libraries for this because of poor performance. The CI libraries, from what I’ve seen and from a cursory review of your code as well, uses the COUNT(*) command to determine max number of rows so that pagination can be supported. This works great in MySQL but in Firebird as you probably know, as is the case with any other version supported database, is really bad in performance.
I took a quick look at your code and I see that you are using the COUNT(*) basis for this with queries, and I suspect you’ll encounter the very same issues I found with this - queries are REALLY slow for large table sets. I’m not sure what the answer is to address this, but I ended up writing an entire separate library based on some existing code, and with the help of Firebird expert Alan McDonald, to do this that is based around the EZSql code libraries, and since pretty much all of my queries are done to stored procedures, I can get this to work fine for performance.
I’m not sure if you have any ideas of how to get around avoiding using COUNT(*) altogether, but I think its needed if this is to perform with larger data sets (ie. more than 20,000 rows in a query).
Thoughts?
Myles
#13 / Mar 20, 2012 2:05pm
Hi,
Can you update the source code with changes below?
I just fix the code for “num_rows()” function on the “firebird_result.php”.
I think because “ibase_num_rows” does not exists, o function was implemented to return always TRUE, see the code below:
function num_rows()
{
return TRUE; //ibase_num_rows($this->result_id);
}
As I need this function working, I did a fix for it, see the code:
function num_rows()
{
$i = 0;
while ($row = @ibase_fetch_object($this->result_id)) {
$i++;
}
return $i;
}Thanks a lot,
Fábio R. Bot Silva.
KeyCode Tecnologia.
#14 / Mar 20, 2012 3:24pm
Hi Fábio !!!
i have tried that to get the num_rows, but the problem is that once the num_rows function is called i can’t reset the pointer of the resultset to the first record again, so when you use ActiveRecord the querys always are returned as empty :( ...
the only solution is to run twice the query, once to get the number of records of the resultset and another to get the resultset itself :( as in this example:
http://www.php.net/manual/es/function.ibase-fetch-row.php#33820
i dont want to run twice the query so, i’m still thinking and waiting for a better solution for that problem… any help about it is very welcome 😊
by the way i’ve moved the project to GitHub where i’m mantaining some other projects at this address:
https://github.com/cgarciagl/Firebird-for-Codeigniter
Thanx
#15 / Mar 21, 2012 8:10am
Hi Carlos,
You’re right, unfortunatelly the record pointer advances and a new and undesirable fetch will become necessary.
At the application model, I’m doing some simulations to get records count with:
num = count($query->row_array());It seems to work right for while.
About num_rows(), I’m trying to get the original “SQL SELECT statement” from the query, and then do a new query over that for count, something like this:
“SELECT 1 FROM (SELECT statement)” and then count the result set on a loop.
I can’t use “SELECT COUNT(*) FROM (SELECT statement)” because COUNT(*) isn’t eficient and can cause an overhead.
I’m doing some tests and if I reach an acceptable solution I will tell you.
Thanks,
Fábio R. Bot Silva.
KeyCode Tecnologia.