Interbase & Firebird : Wrapper Problem

Just starting out? Need help? Post your questions and find answers here.
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Interbase & Firebird : Wrapper Problem

Post by Progi1984 »

Hi all, I work on the wrapper of Firebird Wrapper.

FireBirdTest.zip
Image

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
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post 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 ?
User avatar
blueb
Addict
Addict
Posts: 1111
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Post by blueb »

I believe 'Flype' had a wrapper for Firebird that he was working on.

I suggest searching for Firebird and Flype. :idea:

--blueb
- It was too lonely at the top.

System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post 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.
User avatar
blueb
Addict
Addict
Posts: 1111
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Post 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
- It was too lonely at the top.

System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

The dll (downloaded on the website of FirebirdSQL) is large of 440Ko.
thanos
Enthusiast
Enthusiast
Posts: 423
Joined: Sat Jan 12, 2008 3:25 pm
Location: Greece
Contact:

Post 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
» myPersonal Banker :: Because you do not need to have a master degree in economics in order to organize your finances!
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

I prefer waiting for the complete release of PB 4.30 before updating my wrappers...
thanos
Enthusiast
Enthusiast
Posts: 423
Joined: Sat Jan 12, 2008 3:25 pm
Location: Greece
Contact:

Post by thanos »

Progi1984 wrote:I prefer waiting for the complete release of PB 4.30 before updating my wrappers...
Wise decision :wink:
Regards.

Thanos
» myPersonal Banker :: Because you do not need to have a master degree in economics in order to organize your finances!
User avatar
the.weavster
Addict
Addict
Posts: 1576
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

Post 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.
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post 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
User avatar
the.weavster
Addict
Addict
Posts: 1576
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

Post 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.
thanos
Enthusiast
Enthusiast
Posts: 423
Joined: Sat Jan 12, 2008 3:25 pm
Location: Greece
Contact:

Post 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
» myPersonal Banker :: Because you do not need to have a master degree in economics in order to organize your finances!
User avatar
the.weavster
Addict
Addict
Posts: 1576
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

Post 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.
thanos
Enthusiast
Enthusiast
Posts: 423
Joined: Sat Jan 12, 2008 3:25 pm
Location: Greece
Contact:

Post 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
» myPersonal Banker :: Because you do not need to have a master degree in economics in order to organize your finances!
Post Reply