Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » How to access a firebird database ?
How to access a firebird database ? [message #8305] Thu, 01 March 2007 18:33 Go to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
Hi,

I'm discovering UPP and seriously thinking to adopt it. However, the database I mostly use is firebird... So, I have some questions about that :

Will Firebird implementation be soon developped ?

Could I help for this developpement ? (or, if it's not too long and difficult, I could do the main part of the job, but I'll need a lot of advices as I don't know yet UPP !)

Is there another way (external library ? which one ?) to work with firebird database ?

thanks.

Re: How to access a firebird database ? [message #8318 is a reply to message #8305] Fri, 02 March 2007 13:45 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
jibe wrote on Thu, 01 March 2007 12:33


Will Firebird implementation be soon developped ?



You are the first one asking Smile No, so far we are still struggling to get PostgreSQL...

Quote:


Could I help for this developpement ? (or, if it's not too long and difficult, I could do the main part of the job, but I'll need a lot of advices as I don't know yet UPP !)



Definitely. In fact, usually it is not that complicated... Just see how Sqlite or MySql are implemented.

Quote:


Is there another way (external library ? which one ?) to work with firebird database ?



Well, this is still C++. You can do whatever you could do in C...

Mirek
Re: How to access a firebird database ? [message #8360 is a reply to message #8318] Mon, 05 March 2007 10:35 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
Hi,

Thanks for your reply !

luzr wrote on Fri, 02 March 2007 13:45

You are the first one asking Smile

Sad Too bad ! Firebird is a very good open source Database...

luzr wrote on Fri, 02 March 2007 13:45

Just see how Sqlite or MySql are implemented.

Ok. But I had a quick look, and it seems they are not implemented the same way ? Well, I'll look again better...
If I have some time, I'll try to do it. If somebody is interrested, please post here or send me a private message.

Re: How to access a firebird database ? [message #8361 is a reply to message #8360] Mon, 05 March 2007 10:39 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

jibe wrote on Mon, 05 March 2007 04:35


If somebody is interrested, please post here or send me a private message.


We all are intrested Wink Anyway, you can access firebird database through oledb interface which is supported by upp. I use it with MS SQL Server 2005 and it works great. I'm pretty sure Firebird has oledb drivers.

Re: How to access a firebird database ? [message #8998 is a reply to message #8361] Wed, 11 April 2007 16:36 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
Hi,

unodgs wrote on Mon, 05 March 2007 10:39

I'm pretty sure Firebird has oledb drivers.

Yes, that's a good idea. But I'm afraid that it will not work under Linux Grin I'll have both W$ and Linux clients...

Well, I'll try to find some time to study that, but I have not so much. So, any advice or help will be appreciate !


What is better to do : start from SQLite implementation, or from MySQL one ?
Re: How to access a firebird database ? [message #9000 is a reply to message #8998] Wed, 11 April 2007 17:43 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
BOTH are actually very similar, so most likely it does not matter Smile

Mirek
Re: How to access a firebird database ? [message #9021 is a reply to message #8305] Thu, 12 April 2007 17:52 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
Hi,

I'm very new with upp, and have still difficulties to find my way in all files... Have I all sources (I have the ones coming with last version 2007-1 of upp) ? I find a lot of .c files in the plugin/ folder for sqlite, and only one .cpp file for MySQL in the MySql/ folder... Don't understand how it can be similar !

Well... Do you think that I'm able to do this implementation for Firebird, or better to wait to know more about upp ? I'm programing in C/C++ for more than 20 years, but seems that I'll have a lot of (bad) habits to change ?

If you think that I can do it now, please could you quickly explain what files I'll have to take as examples (Maybe comparing MySql and SQLite could help to better understand how all that works ?) and how to do ? Must I put files in plugin/ as for SQLite, or in firebird/ as for MySql and Oracle ? Is there other files that I did not see or that I have not ?

Thanks.
Re: How to access a firebird database ? [message #9022 is a reply to message #9021] Thu, 12 April 2007 18:17 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
jibe wrote on Thu, 12 April 2007 11:52

Hi,

I'm very new with upp, and have still difficulties to find my way in all files... Have I all sources (I have the ones coming with last version 2007-1 of upp) ? I find a lot of .c files in the plugin/ folder for sqlite, and only one .cpp file for MySQL in the MySql/ folder... Don't understand how it can be similar !



Explanation: Sqlite itself is "embedable" SQL engine implemented in C, we are directly using Sqlite sources in the package (instead of linking the library). The U++ relevant file (and one developed by U++ team) is that single .cpp thing and header before it.

Quote:


Well... Do you think that I'm able to do this implementation for Firebird, or better to wait to know more about upp ?



I think you can (and learn U++ on the way). Do not hesitate to ask.

Quote:


Must I put files in plugin/ as for SQLite, or in firebird/ as for MySql and Oracle ?



It does not really matter. In fact, we should probably move Oracle and MySql to plugin as well. So maybe you can start there too Smile

Mirek
Re: How to access a firebird database ? [message #9033 is a reply to message #9022] Fri, 13 April 2007 18:47 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
Hi,

luzr wrote on Thu, 12 April 2007 18:17

Explanation: Sqlite itself is "embedable" SQL engine implemented in C, we are directly using Sqlite sources in the package (instead of linking the library). The U++ relevant file (and one developed by U++ team) is that single .cpp thing and header before it.

Yes, I understand ! I should have look better Embarassed

Well, I'll try to do this. Seems effectively not very difficult, I have just to find my way in all that. When one understand how it's done, the organization seems nice and good...
Re: How to access a firebird database ? [message #9072 is a reply to message #8305] Mon, 16 April 2007 18:36 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
Hi,

Seems long and not so easy to understand how all that works... And Firebird is more complete than MySQL and SQLite, with transactions, stored procedures, triggers and so on. So, I have also to look at Oracle implementation to see how to make a good interface...

Unfortunately, when several packages are documented, all those regarding SQL and databases are not ! Is it possible to have something, even not complete ? At least, the list of classes with their hierarchy ? And/Or some more explanations about what you try to do with databases in UPP ? I was thinking, as unodgs, that your goal was to have a database-independant interface. But I agree with Mirek that it seems difficult because of the many differences between RDBMS... So, I don't understand very well yet what must do the interface ?

In others words, I don't understand yet how to get started to do that ! Some more advices, if possible, will be welcome !

PS : I'm downloading undog's interface for PostGreSQL. Maybe it will help me to understand... I'll see tomorrow Wink
Re: How to access a firebird database ? [message #9077 is a reply to message #9072] Mon, 16 April 2007 19:47 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
jibe wrote on Mon, 16 April 2007 12:36

Hi,

Seems long and not so easy to understand how all that works... And Firebird is more complete than MySQL and SQLite, with transactions, stored procedures, triggers and so on. So, I have also to look at Oracle implementation to see how to make a good interface...

Unfortunately, when several packages are documented, all those regarding SQL and databases are not !



Sorry about that, we are not there yet.... (logically, documenting Core and GUI was priority).

Quote:


And/Or some more explanations about what you try to do with databases in UPP ?



I guess SQL related examples/reference are quite self-explanatory.

Mirek
Re: How to access a firebird database ? [message #9096 is a reply to message #9077] Tue, 17 April 2007 09:28 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
luzr wrote on Mon, 16 April 2007 19:47

Sorry about that, we are not there yet.... (logically, documenting Core and GUI was priority).

Sure ! I wanted just to know if you already began something about it... Too bad !

luzr wrote on Mon, 16 April 2007 19:47

I guess SQL related examples/reference are quite self-explanatory.

Yes, it's great help. But database specific, when I worried, reading the topic about postgres, if your goal was to do something common...

If I well understand, it seems difficult and not (yet) done, but somehow still in your ideas and to be studied when all databases will be implemented ?

Well, if it's not now, I think that I have not so much to care, and do something specific when needed...
Re: How to access a firebird database ? [message #10058 is a reply to message #8305] Mon, 18 June 2007 16:52 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
Hi,

Still trying to make this plugin for Firebird, but as I have few time to do that and study UPP, it's not yet working... I think I'll ask here some basic questions rather than trying by myself to discover though the code how it works, or I'll never finish... Confused Sorry for that...

1) I'm afraid I did my FirebirdSHema.h the wrong way... Please, could you explain what must be the C++ types, Database types etc. in this code :

#define INT(x)                     COLUMN("integer", int, x, 0, 0)
#define INT_ARRAY(x, items)        COLUMN_ARRAY("integer", int, x, 0, 0, items)
#define INT_(x)                    COLUMN_("integer", int, x, 0, 0)
#define INT_ARRAY_(x, items)       COLUMN_ARRAY_("integer", int, x, 0, 0, items)

Seems that I have some difficulties to find the right syntax, as some types don't work properly... What is INT, "integer" and int ?

2) What do you call a dialect ? Seems it is (an arbitrary number related to) the database engine ?

ASSERT(dialect == ORACLE || dialect == SQLITE3 || dialect == MY_SQL || dialect == MSSQL ||
	       dialect == POSTGRESS || dialect == FIREBIRD || dialect == DB2);

In Firebird, there is 2 dialects (dialect 1 and dialect 3). How can I manage it ? But first, must I consider these 2 dialects ? dialect 1 is just to have a compatibility with an old version of Interbase. Maybe we could just ignore this one ? Firebird user's opinion is welcome about that as well as UPP developper's !
Re: How to access a firebird database ? [message #10064 is a reply to message #10058] Mon, 18 June 2007 20:20 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
INT - that is what you use in .sch file to define integer column

int - this is C++ type of INT column (obviously)

"integer" is SQL type for integer
Re: How to access a firebird database ? [message #10070 is a reply to message #8305] Mon, 18 June 2007 21:58 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
Ok, thanks.

It's the way I did finally, but I have a problem with numeric values... For integers, they are 32 bits in Firebird (-2.147.483.648 to 2.147.483.647). If I use int C++ type, I always obtain 1, when I have different values in my table (created and verified with FlameRobin). If I try to use long (what is the limit for int in UPP ? 16 or 32 bits ?), I obtain this error :
database.sch:2: error: no match for call to ‘(Upp::FieldOperator) (Upp::String, long int&)’


What happens ? Am I blind that I can't see where is the problem ? Strings are working well, but no numeric values (int, doubles etc.). Not tried yet with date/time...
Re: How to access a firebird database ? [message #10077 is a reply to message #10070] Tue, 19 June 2007 11:42 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I am not quite sure at what level we are now... Smile

But "int" should work.

Anyway, .sch is secondary (and usually the simple part). You do not need .sch to test database conection; first you should rather make sure that normal executes/fetches are working, e.g.

sql.Execute("select MY_INTEGER_COLUMN from MYTABLE");
while(sql.Fetch())
   DUMP((int)sql[0]);


If this works, .sch will most likely work too.

Mirek
Re: How to access a firebird database ? [message #10078 is a reply to message #8305] Tue, 19 June 2007 11:55 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
Hi,

About Executes/Fetches, it seems to work well. My problems now seem really around schemas...

But I'm sorry for my newbie's question ! I was totally lost in all the undocumented code of UPP Embarassed

I just discoverd the Assist++ (surely, I read the manual too quicly Embarassed ) : very nice and usefull Smile . I was able to locate the problem.

I've still to redo my FirebirdShema.h : Don't understand why, there is still problems with non-corresponding types... But knowing now how to easily navigate in the code, it should be not very difficult to find the problem !

Thanks.

[Updated on: Tue, 19 June 2007 11:59]

Report message to a moderator

Re: How to access a firebird database ? [message #10188 is a reply to message #10078] Sun, 24 June 2007 10:03 Go to previous messageGo to next message
sorbelli is currently offline  sorbelli
Messages: 1
Registered: June 2007
Location: Italy - Castiglione Olona...
Junior Member
Sorry for my english.

I also want to link to firebird, i thing to create a module,
if you want i can help you, i'm also a newbie of upp but
senior c/c++ programmer.
do you use IBPP libray or direct call firebird function ?
Re: How to access a firebird database ? [message #10195 is a reply to message #10188] Sun, 24 June 2007 18:59 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 698
Registered: December 2005
Location: Budapest, Hungary
Contributor
Hi, it shouldn't be a big work. It took me a weekend to implement PastgreSQL binding. I used MySQL and SQLite classes as examples.
Re: How to access a firebird database ? [message #10486 is a reply to message #8305] Wed, 11 July 2007 23:33 Go to previous messageGo to previous message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
Hi,

Sorry that I did not come here for some time...

I abandonned this : as I said, I have very few time. I think effectively that it's easy to do, but my problem is that I was not able to take enough time to learn UPP and how its libraries are working. But effectively, I think that knowing that it's possible to do the job in 2 or 3 days, at least for basical functions. Maybe a little more difficult to implement correctly all kinds of transactions, Stored procs, triggers and so on...

sorbelli wrote on Sun, 24 June 2007 10:03

I also want to link to firebird, i thing to create a module,
if you want i can help you, i'm also a newbie of upp but
senior c/c++ programmer.


I'll contact you by PM.

sorbelli wrote on Sun, 24 June 2007 10:03

do you use IBPP libray or direct call firebird function ?

Yes, I used IBPP : why should we re-invent the wheel ? Wink

I'm still very interrested with this project, but unfortunately I'll have almost no time until next year... I'll see with sorbelli if we can cooperate.
Previous Topic: PostgreSQL fieldname case bug
Next Topic: PostgreSQL issues
Goto Forum:
  


Current Time: Mon May 06 01:24:48 CEST 2024

Total time taken to generate the page: 0.03458 seconds