Reviving DatabaseLayer

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: Reviving DatabaseLayer

Post by evstevemd »

manyleaves wrote:My apologies ... an 8 year old on school holidays doesn't do wonders for your concentration ...
Hahaha! Its okay ;)
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: Reviving DatabaseLayer

Post by evstevemd »

I have two questions:
1. Do we need execptions at all? wxWidgets standards do not like it
2. Do we really need checking #if wxCHECK_VERSION(2, 7, 0)? If yes why in world of 3.0 will we need it?
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
manyleaves
Earned a small fee
Earned a small fee
Posts: 21
Joined: Tue Mar 26, 2013 3:52 am

Re: Reviving DatabaseLayer

Post by manyleaves »

1. Exceptions? We probably don't need them but this implies that we must go through all the code wrapped by try/catch and make sure we can strictly rely on return values and associated error messages. We need to pay particular attention to the behaviour of the underlying drivers. Do they all return error codes and messages?

2. Pre version 2.8 support? I assume this is all about ANSI vs UNICODE. I'm not the best person to answer this but many of our changes may not be pre 2.8 compliant anyway. Who uses pre 2.8 wxWidgets these days? Also how many underlying drivers are now NOT unicode compliant?
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: Reviving DatabaseLayer

Post by evstevemd »

manyleaves wrote:1. Exceptions? We probably don't need them but this implies that we must go through all the code wrapped by try/catch and make sure we can strictly rely on return values and associated error messages. We need to pay particular attention to the behaviour of the underlying drivers. Do they all return error codes and messages?
We can do that later, but all we can do for now is returning true/false depending on success/failure on try and false for any exception
We can even add error event instead of throwing exeception, if that can be option or addition. Have not yet checked drivers to see practicality of the suggestions themselves but I will definitely check.
manyleaves wrote:2. Pre version 2.8 support? I assume this is all about ANSI vs UNICODE. I'm not the best person to answer this but many of our changes may not be pre 2.8 compliant anyway. Who uses pre 2.8 wxWidgets these days? Also how many underlying drivers are now NOT unicode compliant?
If drivers are unicode compliant (it will be strange if they are not) then dropping all ANSI code is the only way I see. BTW is there any one using 2.8? If no then we can even drop all pre 2.9 versions and hence unicode only builds.

There is another contributor named Patrick who have taken the sources further and made bakefiles (If I remember well) and other good changes. He will upload them in repository and from there on we will be working on repository at github. Andrew, Do you have github account so that I give you access to modify repository?

Regards,
Stefano
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: Reviving DatabaseLayer

Post by evstevemd »

I have suggestion. What about making wxDatabase::GetDatabase to receive argument as to what backend to search. Currently it returns the first backend found and if is enabled. Suppose I have MySQL and PGS enabled, I should be able t query something like this

Code: Select all

 wxDatabase::GetDatabase(wxConfig& config, ......const wxString& backend)
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
manyleaves
Earned a small fee
Earned a small fee
Posts: 21
Joined: Tue Mar 26, 2013 3:52 am

Re: Reviving DatabaseLayer

Post by manyleaves »

Stefano

I have now opened a GitHub account: @manyleaves.

When I designed GetDatabase() the "config" (whether streamed from a file or inline string) was meant to represent some sort of fallback sequence. Eg return the primary database and if that fails the backup etc... . I didn't have in mind it working as some kind of pick list.

The pick list is a good idea but needs to be well thought through. Do you want to select the backend based on database type and/or name? You could pick a MySQL database but what if more than one are defined? You could pick a "publications" database but what if there is both a MySQL and PGS "publications" database in the config?

Because we are searching a wxConfig probably the best idea would be for GetDatabase() to have an optional second "path" parameter (defaulting to wxEmptyString). Eg if path was "MySQL/publications" it would search for a [MySQL/publications] config entry, falling back to [MySQL] falling back to "" which would return the first valid database. There are other combinations of this logic. What are your thoughts?

Andrew
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: Reviving DatabaseLayer

Post by evstevemd »

Hi Andrew,
manyleaves wrote:Stefano

I have now opened a GitHub account: @manyleaves.
I have added you to contributors list so you can start using it.
manyleaves wrote:When I designed GetDatabase() the "config" (whether streamed from a file or inline string) was meant to represent some sort of fallback sequence. Eg return the primary database and if that fails the backup etc... . I didn't have in mind it working as some kind of pick list. .............Because we are searching a wxConfig probably the best idea would be for GetDatabase() to have an optional second "path" parameter (defaulting to wxEmptyString). Eg if path was "MySQL/publications" it would search for a [MySQL/publications] config entry, falling back to [MySQL] falling back to "" which would return the first valid database. There are other combinations of this logic. What are your thoughts?
After thinking a bit I thought that each files should contain a single backend kind that is only one SQLite3 or ODBC per file. That way we will not have to worry about other backends with same name. That is the best I can see.

Another thing is, I added to API menthod to change database so that user is spared with creating new connections each time wants to connect database. I have it working only on MySQL but I will do it in PGS also (which have no internal equivalent so it will be closing connection and reopening with new database. I have not checked yet with ODBC and I have no idea of other backends.

What are your thoughts on this?
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
manyleaves
Earned a small fee
Earned a small fee
Posts: 21
Joined: Tue Mar 26, 2013 3:52 am

Re: Reviving DatabaseLayer

Post by manyleaves »

A single backend per config file/stream is certainly the simplest means of using GetDatabase().

When I get more time to look at this again I'll add the optional "path" argument to GetDatabase() because in some usage cases it may make sense to consider the config as a set of related databases that the application wishes to switch between and it's tidier to keep them all together. I'll also test Sqlite3 and MS SQL Server both direct and via ODBC.
manyleaves
Earned a small fee
Earned a small fee
Posts: 21
Joined: Tue Mar 26, 2013 3:52 am

Re: Reviving DatabaseLayer

Post by manyleaves »

Stefano

Thanks for pushing wxDatabase onto GitHub. I've never used GitHub but always meant to so it will be a learning curve for me. I've got much else to share!

I noticed that your README doesn't mention the TDS support which may be very important for some users (like me). How does one go about editing without stepping on toes?

Less important, "Integrating with Andrew's version" may confuse many without a mention of what "Andrew's version" was.

Andrew
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: Reviving DatabaseLayer

Post by evstevemd »

manyleaves wrote:Stefano

Thanks for pushing wxDatabase onto GitHub. I've never used GitHub but always meant to so it will be a learning curve for me. I've got much else to share!

I noticed that your README doesn't mention the TDS support which may be very important for some users (like me). How does one go about editing without stepping on toes?

Less important, "Integrating with Andrew's version" may confuse many without a mention of what "Andrew's version" was.

Andrew
You need to clone it, edit the files you want and push back.
So basically it will be:
1. Clone: git clone https://github.com/mtangoo/wxDatabase
2. Edit the files in cloned repo with your editor
3. Commit changes to local repo with git commit -m "the Message tied to changes"
4. push to remote repo with git push origin master

See: http://git-scm.com/book
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
rafsanmoney
Experienced Solver
Experienced Solver
Posts: 72
Joined: Tue Oct 01, 2013 11:35 am
Contact:

Re: Reviving DatabaseLayer

Post by rafsanmoney »

I just discovered this project. can anyone tell me how to build and use the wxDatabase libraries. I really appreciate your works.
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: Reviving DatabaseLayer

Post by evstevemd »

rafsanmoney wrote:I just discovered this project. can anyone tell me how to build and use the wxDatabase libraries. I really appreciate your works.
which backed do you want to use? I guess I or Andrew have to put more documentation!
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
manyleaves
Earned a small fee
Earned a small fee
Posts: 21
Joined: Tue Mar 26, 2013 3:52 am

Re: Reviving DatabaseLayer

Post by manyleaves »

Stefano

I just cloned a fresh copy of wxDatabase from your git and it seems that the samples folder is missing.

I haven't done any new work since I posted wxDatabase.rar to the forum on 8 Oct 2013 - so the samples folder therein is still my latest.

Did you get anywhere with the bakefiles?

Andrew

PS: rafsanmoney - Hacking around with the samples is how I got a grip on what wxDatabase (formerly databaselayer) is all about.
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: Reviving DatabaseLayer

Post by evstevemd »

manyleaves wrote:Stefano

I just cloned a fresh copy of wxDatabase from your git and it seems that the samples folder is missing.
Mhh! It must be a mistake. Can you push it (since you have access to?). Am rushing somewhere and I will be offline for hours.
Please do that if you are in position to do!
manyleaves wrote:I haven't done any new work since I posted wxDatabase.rar to the forum on 8 Oct 2013 - so the samples folder therein is still my latest.
I hope you consider adding it to local repo and push the changes.
Process is as simple as adding to folder, commit changes to local repo (you cloned) and push it to Github.
manyleaves wrote:Did you get anywhere with the bakefiles?
Andrew
Nope! The guy I was expecting haven't released the code yet. I will contact him this night and if I he will not respond I will have no option but writting it.
I have plan that I was thinking to make life easy for people to use it with wxWidgets
I want to add it just like wxSTC or other wxWidgets library. I'm planning on studying it so that the process will be as easy as:
1. drop the cloned folder into include folder of wxWidgets
2. Run script to install something like wxdatabase.py --install which will copy necessary bakefile replacing those in wx Installation (and backup current versions)
3. Compile wxWidgets
4. Uninstall wxDatabase (remove files and restore backups)

This will enable easy integration with wxWidgets while giving possibilities to reverting!
manyleaves wrote: PS: rafsanmoney - Hacking around with the samples is how I got a grip on what wxDatabase (formerly databaselayer) is all about.
So far I think adding WXMAKINGLIB_DATABASE to Compiler Options (resulting in -D WXMAKINGLIB_DATABASE?) and adding include path for MySQL headers and wxWidgets (I use wx-config script i.e wx-config --cxxflags --unicode=yes --debug=yes for debug/unicode) is enough for Compiler
Passing to liker the MySQL libs (libmysqlclient) and wxWidgets libs are enough. About learning, while sample is quiet good, I think Simple tutorial is necessary.

There is much to do, but the first thing is to make strong build system. Any help (especially in writting bakefiles with latest) is really appreciated.
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Post Reply