Welcome Guest, Not a member yet? Register   Sign In
Firebird Driver Finally!!
#11

[eluser]Capt. Kirk[/eluser]
Hey Carlos! What's up? :-)

Thanks man! It worked just fine. Good job!

See ya.
#12

[eluser]Myles Wakeham[/eluser]
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

[eluser]Tri.Phi[/eluser]
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:

Code:
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:

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

[eluser]Carlos G[/eluser]
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 Sad ...

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 Sad as in this example:
http://www.php.net/manual/es/function.ib....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 Smile


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

[eluser]Tri.Phi[/eluser]
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:
Code:
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.

#16

[eluser]Loretto[/eluser]
Buenos días! Goof morning!

Alguien podria ayudarme? /Someona can help me?

Me arroja: /Throws me:

A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: C:\xampplite\htdocs\org\sitis\save\system\database\DB_driver.php

Line Number: 124


En el PHP.ini tengo habilitada: / In the PHP.ini have:

extension=php_interbase.dll

Mi database.php tiene: /My database.php have:
$db['default']['hostname'] = "10.50.1.204";
$db['default']['username'] = "SYSDBA";
$db['default']['password'] = "zitiz";
$db['default']['database'] = "SAVE";
$db['default']['dbdriver'] = "firebird";
$db['default']['port'] = 3050;
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
#17

[eluser]Loretto[/eluser]
Fixed! When you install firebird you must (if doesnt have) the next line in

C:\WINDOWS\system32\drivers\etc\services

gds_db 3050/tcp #Firebird

And have in windows\system32

GDS32.DLL


I hope this can be util for someone.

#18

[eluser]kichik[/eluser]
This driver does not work with session on CI 2.1.0. User_data field on database everytime after refresh page cleared. Sorry for my bad english
#19

[eluser]Carlos G[/eluser]
[quote author="kichik" date="1339479008"]This driver does not work with session on CI 2.1.0. User_data field on database everytime after refresh page cleared. Sorry for my bad english[/quote]

if you are trying to use these driver with sessions managed in the database, you will have to overload your session class, because remember that firebird always returns the field names in UPPERCASE, and the session manager of codeigniter manage the fields for sessions in lowercase


i haven't tried it, but i think that could work

Cheers
#20

[eluser]Unknown[/eluser]
Is this driver using PHP PDO for firebird? I have firebird database installed, can anyone show me how to install it to PHP (i using WampServer) Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB