Page 1 of 6
Interbase & Firebird : Wrapper Problem
Posted: Fri Sep 19, 2008 7:36 am
by Progi1984
Hi all, I work on the wrapper of Firebird Wrapper.
FireBirdTest.zip
Some things work :
- create database
- create table
- insert data
- update data
But I have some problems with "select" so i come to you for some help.
Thanks in advance of your help
Posted: Fri Sep 26, 2008 7:50 am
by Progi1984
115 Views, 19 downloads, but no answer !
May be someone have a clue, a link, some URLs on Internet for this which can help me ?
Posted: Fri Sep 26, 2008 2:40 pm
by blueb
I believe 'Flype' had a wrapper for Firebird that he was working on.
I suggest searching for Firebird and Flype.
--blueb
Posted: Fri Sep 26, 2008 2:44 pm
by Progi1984
Yep ! But his wrapper doesn't work ! It didn't connect to a database and/or create one.
The mine actually creates one, connect to it, insert and update data. But the problem is the select and returned data.
Posted: Fri Sep 26, 2008 2:51 pm
by blueb
Yes,
I did play with Firebird a couple of years ago, but moved on to Postgres and Sqlite.
I liked the idea that you could include the client DLL with your program and the user wouldn't have to install Firebird itself. But if I remember correctly the DLL was quite large.
--blueb
Posted: Mon Sep 29, 2008 8:18 am
by Progi1984
The dll (downloaded on the website of FirebirdSQL) is large of 440Ko.
Posted: Sat Dec 06, 2008 9:01 pm
by thanos
@Progi1984
Congratulations!
Your project is very useful.
I tried your wrapper but unfortunately the code:
Code: Select all
Debug isc_attach_database(status, 0, "db_firebird.fdb", @db_handle, 0, #Null)
returns the following fatal error:
The debugger executable quit unexpectedly.
Do you have an idea how to solve this?
I am using the PB 4.30 beta 4 and FireBird 2.1
Regards.
Thanos
Posted: Sat Dec 06, 2008 9:16 pm
by Progi1984
I prefer waiting for the complete release of PB 4.30 before updating my wrappers...
Posted: Sat Dec 06, 2008 9:35 pm
by thanos
Progi1984 wrote:I prefer waiting for the complete release of PB 4.30 before updating my wrappers...
Wise decision
Regards.
Thanos
Posted: Sat Dec 06, 2008 11:49 pm
by the.weavster
@thanos
iirc you should pass a pointer to a variable containing the db name rather than the name itself.
@Progi1984
Again iirc to perform a select you have to run through these functions
isc_dsql_alloc_statement2 // to get a statement handle
isc_dsql_prepare // to prepare the sql
isc_dsql_describe // the first time you call this it returns the number of fields the sql will return in one of the elements of XSQLDA (I can't remember which off the top of my head)
isc_dsql_describe // then you allocate enough memory for one XSQLDA plus one XSQLVAR for each field to be returned and call describe again
isc_dsql_execute // then run the query, the first records fields will then be in the XSQLVARs (one of the elements holds a pointer to the field value, the other elements contain field meta data)
isc_dsql_fetch // to move next
***edit***
You may also require a transaction handle for some of these functions, I can't remember whether it's an optional parameter or not.
Posted: Sun Dec 07, 2008 7:33 am
by Progi1984
@the weavster
I tested with your idea (and some others) but with no results. If you have a starting of code, i am interested
Posted: Sun Dec 07, 2008 12:40 pm
by the.weavster
I did spend some time about a year ago learning the interbase api, although all the code I did at the time was in REALbasic.
I actually did consider using PureBasic to create a dll that would piggy back off fbclient.dll and expose a simplified api as I thought the interbase api was a tricky little blighter.
Maybe if we get a few rainy days I'll refresh my memory and have a go.
Posted: Sun Dec 07, 2008 2:44 pm
by thanos
the.weavster wrote:@thanos
iirc you should pass a pointer to a variable containing the db name rather than the name itself.
Thank you for the response.
Could you give me an example on how to use the pointer into the following code?
Code: Select all
Debug isc_attach_database(status, 0, "db_firebird.fdb", @db_handle, 0, #Null)
Regards.
Thanos
Posted: Sun Dec 07, 2008 3:07 pm
by the.weavster
thanos wrote:
Could you give me an example on how to use the pointer into the following code?
Code: Select all
Debug isc_attach_database(status, 0, "db_firebird.fdb", @db_handle, 0, #Null)
Regards.
Thanos
Code: Select all
dbName.s = "db_firebird.fdb"
Debug isc_attach_database(status, 0, @dbName, @db_handle, 0, #Null)
The other thing to be aware of is if you're using the server client library rather than the embedded library the final parameter should be the memory address of a buffer that contains connection information (user name, password etc...) which has to be formatted in a particular way.
Again I'm speaking from memory so I hope I'm not giving you bum information but I'm pretty sure that's right.
If I get a chance this evening I will get out the api reference and check.
Posted: Sun Dec 07, 2008 4:18 pm
by thanos
the.weavster wrote:
Code: Select all
dbName.s = "db_firebird.fdb"
Debug isc_attach_database(status, 0, @dbName, @db_handle, 0, #Null)
Thank you for the response.
I tried the above code but i took the following message:
Bad parameter type: a string is expected.
Regards.
Thanos