dbixx-devel Mailing List for dbi++
Status: Alpha
Brought to you by:
cyborch
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: Jerry S. <ye...@sp...> - 2002-06-19 06:40:34
|
Hello, Uploaded a patch to the sourceforge project page which *should* add mySQL support. Stuff changed: Added MySQLInterface.java file - Added MySQL database support. Modified DatabaseInterface.java - Modified the save() methods to allow Search parameters to be supplied for an update statement. You probably want to review this file before adding it to the source tree. I have a feeling I didn't understand this interface correctly. Modified PersistentFactory.java - Added a storePersistent() method to the interface. Modified Search.java - Fixed a bug where stuff was getting double-quoted. At least I hope I was fixing something. :) You'll probably want to take a look at this as well. Patch by doing the following: cd dbixx/java/dbixx patch -p1 < mysqladd.diff Enjoy. Jerry Seutter |
From: Anders B. <cy...@de...> - 2002-06-17 10:55:21
|
Jerry Seutter wrote: > Hello again, > > I have a basic MySQLDatabaseInterface class going. It can retrieve > simple objects from the database and store them to the database. I haven't > worked on multiple table support yet. > > A couple of questions have arisen out of this: > > 1. PersistentFactory.createPersistent(DatabaseInterface dbi, Object identifier) > In my implementation of the PersistentFactory interface I have been using > identifier to pass in a string that tells the Factory which record to > retrieve from the database. It happens to be a String object and in the > Factory I just use the toString() method on the object to use the String in > my search. Is this the way it was intended to be used? Is the usage of > the Object being passed in something that the implementor of the > PersistentFactory interface and the user of it have to agree on? > The identifier is an Object since it HAS to be of the same datatype as the primary key of the table that holds the Persistent. If your primary key is a CHAR or VARCHAR like datatype this Object will have to be a String. On the other hand if it is an integer or a numeric or the like it will have to be an int. Therefore this is something the implementor of the PersistentFactory and the user have to agree on. > > 2. PersistentFactory did not have a storePersistent() method like the > diagrams indicate. I added: > storePersistent(DatabaseInterface dbi, Persistent p) > Sound about right? Indeed. That is correct. > 3. When storing an object to the database, I don't know when to use an > UPDATE statement and when to use an INSERT statement. If the object was > retrieved from the database, modified and is now to be put back into the > database, an UPDATE statement should be used. If it is a brand new object > then an INSERT statement should be used. How do you tell which one the > object is? Running another query just to find out if the object is in the > database seems wasteful and if the database allows multiple non-unique > records then this method would not work. It seems to me that the Factory > needs to have control over which type of statement is run. Thoughts? I agree that this may seem wasteful. It seems a bit wasteful to me. But there is only one place data can be stored: The Database. When a new Persistent is created it is not given an id. While that id is zero I presume that INSERT is the correct function to use. Otherwise id holds the primary key of the Persistent and UPDATE should be used. This way we should be able to avoid that extra database call. > > I'm close to getting the code in a contributable state. How do > you want it submitted? I would like to have it in diff format submitted to the project page. If i'm impressed (and it sounds like I will be) with what you have done you'll get cvs access. That way you can work faster and get more feedback as you work. -- Anders Borch Web Forge Software Engineer Jenagade 22 G, 2300 Copenhagen S, Denmark an...@we... www.web-forge.dk |
From: Jerry S. <ye...@sp...> - 2002-06-16 15:59:12
|
Hello again, I have a basic MySQLDatabaseInterface class going. It can retrieve simple objects from the database and store them to the database. I haven't worked on multiple table support yet. A couple of questions have arisen out of this: 1. PersistentFactory.createPersistent(DatabaseInterface dbi, Object identifier) In my implementation of the PersistentFactory interface I have been using identifier to pass in a string that tells the Factory which record to retrieve from the database. It happens to be a String object and in the Factory I just use the toString() method on the object to use the String in my search. Is this the way it was intended to be used? Is the usage of the Object being passed in something that the implementor of the PersistentFactory interface and the user of it have to agree on? 2. PersistentFactory did not have a storePersistent() method like the diagrams indicate. I added: storePersistent(DatabaseInterface dbi, Persistent p) Sound about right? 3. When storing an object to the database, I don't know when to use an UPDATE statement and when to use an INSERT statement. If the object was retrieved from the database, modified and is now to be put back into the database, an UPDATE statement should be used. If it is a brand new object then an INSERT statement should be used. How do you tell which one the object is? Running another query just to find out if the object is in the database seems wasteful and if the database allows multiple non-unique records then this method would not work. It seems to me that the Factory needs to have control over which type of statement is run. Thoughts? I'm close to getting the code in a contributable state. How do you want it submitted? Jerry |
From: Anders B. <an...@we...> - 2002-06-07 14:35:58
|
Jerry Seutter wrote: > Hello Anders (and others), > > I have been taking a look at the code to see how it is supposed to work. > > You mention on the homepage and the emails that the PersistentFactory > should call DatabaseInterface's load() method to get the object from the > database. Everything was making sense until I looked for a class that > implements DatabaseInterface. The only one that implements it is > SybaseInterface. I am trying to use MySQL. > > There is a class dbixx.sql.mysql.MySQLInterface that extends > SQLDatabaseInterface but does not implement DatabaseInterface. > > My question is, should dbixx.sql.mysql.MySQLInterface implement > DatabaseInterface or should there be a class dbixx.MySQLInterface, similar > to SybaseInterface, that implements DatabaseInterface? > > You mentioned in a previous mail that SybaseInterface needs to be > rewritten. > > Looking at dbixx.sql.mysql.MySQLInterface, it looks like it is meant to > handle the connection to the database and construct the query that returns > the attributes. > > My guess is that there needs to be a dbixx.MySQLInterface that implements > DatabaseInterface and uses an instance of dbixx.sql.mysql.MySQLInterface. > Is this correct? > > As you can probably tell, my understanding is limited, but I'm trying to > figure this out. Feel free to correct/flame me. > > As an aside, one of the diagrams on the homepage has text so small that it > is unreadable. Could you replace it with a larger version? > > Jerry Seutter > The classes in the dbixx.sql package are only SQL abstractions, the classes in the dbixx package contains what the library is really all about. You are absolutely correct that only dbixx.SybaseInterface implements the dbixx.DatabaseInterface interface. We will need a dbixx.MySQLInterface which uses the dbixx.sql classes (and their methods). To answer your question: No, dbixx.sql.mysql.MySQLInterface should NOT implement dbixx.DatabaseInterface, but a dbixx.MySQLInterface class should be written which implements dbixx.DatabaseInterface in much the same way as dbixx.SybaseInterface implements dbixx.DatabaseInterface. So in short: You are correct in your guess. The dbixx.SybaseInterface.load method I described (in pseudocode) in my last mail could be implemented almost identically in a dbixx.MySQLInterface.load method. Please go ahead and write such a method! I must excuse the low activity (on my part) on the project during the last week. This will change shortly. I will implement a new version of the dbixx.SybaseInterface method which should work as a template for the dbixx.MySQLInterface class methods (which I strongly encourage you to implement). If you have any further questions (or if I didn't answer your original question) you are very welcome to write! On your side note: right I only resized the image via the img tag, go ahead and right-click on it to view it. I resized it to make the page more readable in general. I have changed the page to make the image a link to a full sized view of the image. I hope this helps. -- Anders Borch Web Forge Software Engineer Jenagade 22 G, 2300 Copenhagen S, Denmark an...@we... www.web-forge.dk |
From: Jerry S. <ye...@sp...> - 2002-06-06 02:04:21
|
Hello Anders (and others), I have been taking a look at the code to see how it is supposed to work. You mention on the homepage and the emails that the PersistentFactory should call DatabaseInterface's load() method to get the object from the database. Everything was making sense until I looked for a class that implements DatabaseInterface. The only one that implements it is SybaseInterface. I am trying to use MySQL. There is a class dbixx.sql.mysql.MySQLInterface that extends SQLDatabaseInterface but does not implement DatabaseInterface. My question is, should dbixx.sql.mysql.MySQLInterface implement DatabaseInterface or should there be a class dbixx.MySQLInterface, similar to SybaseInterface, that implements DatabaseInterface? You mentioned in a previous mail that SybaseInterface needs to be rewritten. Looking at dbixx.sql.mysql.MySQLInterface, it looks like it is meant to handle the connection to the database and construct the query that returns the attributes. My guess is that there needs to be a dbixx.MySQLInterface that implements DatabaseInterface and uses an instance of dbixx.sql.mysql.MySQLInterface. Is this correct? As you can probably tell, my understanding is limited, but I'm trying to figure this out. Feel free to correct/flame me. As an aside, one of the diagrams on the homepage has text so small that it is unreadable. Could you replace it with a larger version? Jerry Seutter |
From: Anders B. <an...@we...> - 2002-05-28 09:44:52
|
I've been using the ruby port of the dbi++ library for a project for some time now. And i've come to see some flaws in the way, that the library works. Some of them are implementation flaws (which means trivial to easy to fix) others are design flaws (which means throw away a lot of code and try again). To start with a small and easy thing to fix (unless I overlooked something): Having a class that extends another class will often mean that the extended class will appear in one table, whereas the extending class will appear in two tables. This is of cause aside from the fact that there may be many other associations which make some of the class attributes appear in separate tables. For example a User with a list of AccessRights will most likely have a user table and a accessrights table in the underlying database. This means that we will have to have two sets of load methods. I've already begun implementing this and the general idea should be visible from what is already in cvs. The ruby port has this implemented in 0.0.2 and the java port has a general idea of the implementation. The idea is described in a now closed (maybe it should be reopened) feature request (no. 554960). You will still be able to find it in the tracker on the project page. This is a small issue. There are larger things. Design flaws. Firstly, the SQL Abstraction api should be used. This is not a big thing. Actually this is mostly about throwing almost everything in the SybaseInterface away and replacing it with a few calls to sql.SQLDatabaseInterface and sql.Select. The basic idea is that it is the responsibility of dbixx.DatabaseInterface to load, save and remove persistents from a database in a transparent way, with the help of the PersistentFactory, which knows the structure of the db. It is the repsonsibility of dbixx.sql package to provide access to sql statements while still making sure that the individualities of different sql databases are kept hidden from the user of the api. This I forgot as I was coding at the DatabaseInterface. Therefore everything was coded twice... This should be fixed. All the code concerning loading could very well cut down to very few lines: <pseudocode> <!-- well, actually almost real code --> SybaseInterface.SybaseInterface (...) sqldbi = dbixx.sql.SQLDatabaseInterface (...) ; } Persistent[] SybaseInterface.load (table, search, p) { select = sqldbi.getSelect () ; select.column (table, "*") ; select.where (search) ; sql = select.toString () ; return doLoad (sql, p) ; } </pseudocode> From this point on the next goal is to make sure that the damned thing actually works. The dbixx.sql.* was tested rather thoroughly before it was in the dbixx package (it was removed from an internal (proprietary) software package into the dbixx package). Nothing but the package name was changed, but this probably wasn't done in all places and therefore broke something. We need to restest everything and make sure it still works. Next up: sequences, booleans, stored procedures, triggers, views, and ddl in general. Nikolaj (pan...@us...) has talked to me about the existence of boolean handling in the code, I never saw it (and didn't look very hard). If it's not there then it needs to be implemented. Next, more databases: some things are not available in all databases. Like MySQL is nearly not a relational db. For those we need to make an attempt to implement suff ourselves. I haven't thought hard about this but maybe a meta-table (or a set of meta-tables) could describe the stuff missing from the database, like stored procedures and views. Also, Sybase has no sequences or autoincrements, this could be emulated with triggers, but the purpose of the SQL Abstraction layer is to make such things transparent. So i propose a Sequence class that will act in the same way as Oracle sequences. This, we should be able to implement via meta-tables in Sybase, MySQL and just use the build-in sequences or Oracle. The DatabaseInterface has no save method implemented yet. I have implemented the save method in C++ and we should be able to use what I have learned there to make a nice Java implementation of the save method. <pseudocode> SybaseInterface.save (table, persistent) persistent.getAttributes (table, updateCriteria) ; /* fetch attributes and update criteria for this table */ save (table, attributes, updateCriteria) ; } SybaseInterface.save (table, attributes, updateCriteria) ; update = sqldbi.getUpdate () ; update.set (attributes) ; update.where (updateCriteria) ; sql = update.toString () ; execute (sql) ; /* if this fails then the entry doen not exist yet and we must insert */ insert = sqldbi.getInsert () ; insert.set (attributes) ; sql = insert.toString () ; execute (sql) ; } </pseudocode> We may consider having a SQLDatabaseInterface, which SybaseInterface, MySQLInterface and others in the dbixx package (not the dbixx.sql package) could extend and thereby save ourselves a lot of code. Most of the code will me in dbixx.sql anyways... Some more futuristic ideas: xmldbmsi (extended modelling language database management systems interface) Along with the sql abstraction layer an xml abstraction layer would be nice too... Before even attempting to lay the description of this out we need to do some research on xml databases (whether any of them are in a state where supporting them is possible). Unless of cause some of you know something about xml databases and would like to share it with the rest of us. I need not speak highly of xml to you (I don't think I need to - anyways). It would be very nice indeed to have xml database support in this library. But, what interfaces are there to xml databases. Is it at all possible to store classes via the dbi++ api, or do we need some form of extension to the api before being able to store data in an xml database? How about xml queries? I know very little of these things and need to study it before being able to tell anything about it. If you have any knwoledge of xml databases please come forward and tell about them. Finally, if you have any ideas or suggestions or questions... or anything, go ahead and write to the list! This is what the mailinglist is there for! -- Anders Borch Web Forge Software Engineer Jenagade 22 G, 2300 Copenhagen S, Denmark an...@we... www.web-forge.dk |
From: Anders B. <an...@we...> - 2002-05-08 09:17:58
|
The C++ version of the library has the beginnings of stored procedure support, the problem, as i see it is to verify that the parameters given to the stored procedure are correct. The C++ function is defined as: virtual int DatabaseInterface::executeProcedure (string *procedure, vector<string> *params) = 0 ; The java function may be defined as: public int excecuteProcedure (String procedure, String[] params) {} ; Panzer42 also looked into making transparent handling of booleans and sequences. I do not think he has implemented any of it yet. This is something we need to look at too. Also, if you have any ideas about how to do the parameter verification on stored procedures, please speak up. It will of cause have to be implemented differently on all databases. Also, some databases do not support stored procedures at all, that will have to be handled too. Btw. when looking though the public CVS archive i noticed that some files have not been added yet. I'll make sure all the files are available tomorrow. ----- Original Message ----- From: "Roberto Hasif" <ho...@pr...> To: <cy...@de...> Sent: Wednesday, May 08, 2002 5:10 AM Subject: Re: Intrest in part of project > HI Anders, > > Thanx for uploading it and now what about support of stored procedures and prepaired statement.shall we also try to incorporate this also into our project? > > regards, > Roberto > ----- Original Message ----- > From: Anders Borch <cy...@de...> > Date: Tue, 07 May 2002 13:22:31 +0100 > To: Roberto Hasif <ho...@pr...> > Subject: Re: Intrest in part of project > > > > Thanks a bundle, I've assigned this to panzer42. I succeeded in uploading your > > new files... it seems that only one file can be uploaded at a time - so be it. > > > > Roberto Hasif wrote: > > > Hi, Thanx for the mail.I have gone through the .java files and found that > > > the the sql generation part will contain one extra ',' after making > > > it.Accordingly i have made changes to it and done so on the forum,but was > > > not able to upload more than one file with that.so iam sending you across > > > the files with this. > > > > > > Thanx and regards > > > > > > Roberto > > > |
From: Roberto H. <ho...@pr...> - 2002-05-03 17:59:58
|
Hi, Thanx for the mail.I have gone through the .java files and found that the the sql generation part will contain one extra ',' after making it.Accordingly i have made changes to it and done so on the forum,but was not able to upload more than one file with that.so iam sending you across the files with this. Thanx and regards Roberto ----- Original Message ----- From: Anders Borch <an...@we...> Date: Thu, 02 May 2002 09:46:18 +0100 To: Roberto Hasif <ho...@pr...> Subject: Re: Intrest in part of project > Hi, > > (i'm sending a copy of this to the developer list since it also contains a bit > of information about the current status of our development) > > This project has just been added to sourceforge yesterday, this means that not > all parts of it has been checked in to the public cvs yet. I was trying to > find a way to preserve my cvs history in the sourceforge cvs... but failed. I > will make sure what has been made of the java port will be checked into cvs by > the end of the day. You are then very welcome to check it out and see what you > can make of it. > > I have updated the architecture description on the homepage hoping that it may > help you to better understand the code: > > http://sourceforge.net/docman/display_doc.php?docid=11009&group_id=52545 > > A few quick (and not so quick) TODOs before this library is usable to the world: > > o Everything is in the webforge package since until now it was an internal > project. It will need to be moved to the dbixx package. > > o A SQL abstraction layer is being made, internally the DatabaseInterface > talks directly to a database, it should be brought to talk to a > SQLDatabaseInterface to make it more easy to add xml database compatibility > later. > > o Implementations of SQLDatabaseInterface to more databases. We need to make > sure special characters are escaped correctly for all kinds of databases. > Also we need to make our own wrappers of features, that do not exist in all > databases such as sequences and autoincrement. > > o Porting. I would like to have this library in C++, Java, Perl, and Ruby > versions. There are many other oo languages out there that would benefit > from this kind of library. Therefore having the existing code implemented > in as many languages as possibled is desireable. > > Roberto Hasif wrote: > > Hi, > > > > Iam intrested in part of this project and willing to devote > > my spare time for the noble cause as much as i can .I have > > more than 3 yrs experience in software developemnt field in > > java,vb,vc and database and worked on realtime systems > > which work 24*7 days with high speed and acuracy.If u > > allows i can send across my CV and more information if u > > need.Iam really looking forward to contribute to source > > forge projects > > > > Regards, > > Roberto > > -- > Anders Borch Web Forge > Software Engineer Jenagade 22 G, 2300 Copenhagen S, Denmark > an...@we... www.web-forge.dk > > > -- ************************************************* May I Help You ? Can You Help Me ? ************************************************** _______________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup |
From: Anders B. <an...@we...> - 2002-05-02 07:52:13
|
Hi, (i'm sending a copy of this to the developer list since it also contains a bit of information about the current status of our development) This project has just been added to sourceforge yesterday, this means that not all parts of it has been checked in to the public cvs yet. I was trying to find a way to preserve my cvs history in the sourceforge cvs... but failed. I will make sure what has been made of the java port will be checked into cvs by the end of the day. You are then very welcome to check it out and see what you can make of it. I have updated the architecture description on the homepage hoping that it may help you to better understand the code: http://sourceforge.net/docman/display_doc.php?docid=11009&group_id=52545 A few quick (and not so quick) TODOs before this library is usable to the world: o Everything is in the webforge package since until now it was an internal project. It will need to be moved to the dbixx package. o A SQL abstraction layer is being made, internally the DatabaseInterface talks directly to a database, it should be brought to talk to a SQLDatabaseInterface to make it more easy to add xml database compatibility later. o Implementations of SQLDatabaseInterface to more databases. We need to make sure special characters are escaped correctly for all kinds of databases. Also we need to make our own wrappers of features, that do not exist in all databases such as sequences and autoincrement. o Porting. I would like to have this library in C++, Java, Perl, and Ruby versions. There are many other oo languages out there that would benefit from this kind of library. Therefore having the existing code implemented in as many languages as possibled is desireable. Roberto Hasif wrote: > Hi, > > Iam intrested in part of this project and willing to devote > my spare time for the noble cause as much as i can .I have > more than 3 yrs experience in software developemnt field in > java,vb,vc and database and worked on realtime systems > which work 24*7 days with high speed and acuracy.If u > allows i can send across my CV and more information if u > need.Iam really looking forward to contribute to source > forge projects > > Regards, > Roberto -- Anders Borch Web Forge Software Engineer Jenagade 22 G, 2300 Copenhagen S, Denmark an...@we... www.web-forge.dk |