On Fri, Dec 25, 2009 at 9:06 PM, OvermindDL1 <[email protected]> wrote: > I have started looking at Wt::DBO to replace my sqlite marshaller and > I notice something odd right off the bat. > It seems there can only be one session at a time? > Rather, more specifically, I would have to use some type of locking > queue of connections, and pull from it each time I wish to create a > session, and it kind of looks like it would be rather heavy to create > a session object each time as well. So I can either use a pool of > connections and create sessions on demand from a connection in that > pool (with the running of many mapClass's), or I could make a pool of > sessions, each attached to its own connections, and use the sessions > from the pool as necessary, and so on and so forth. The two files I > found that demonstrate how to use the DBO are just test frameworks and > it is quite obvious that this is not how it was designed to be used, > so is there an actual example somewhere that demonstrates its real > use, or should I just create a pool of session objects as I was > initially thinking? > > Also, the createtables, does it destructively recreate the tables, as > in deleting the existing data, or if the table already exists does it > do nothing, or what if the table layout is different, does it do > nothing, or does it create/remove columns as it needs, and is that > destructive or not to the existing data, and is there a method to drop > tables as well? > > You might look at the Python library SQLAlchemy, it handles all of > this extremely well (and I have actually linked in Python into some of > my C++ projects *just* so I could use sqlalchemy, it is that nice to > use, although a slight bit of an overhead since it is, well, python).
I started looking at how DBO was implemented. In Cession.c:194, the parseSql function. The parsing seems a bit heavy. If you do not mind a requirement on a more recent version of Boost then I can Spirit'ify it, which can fill the final values with what they should be directly, instead of filling up temporaries and multiple finds over a string. Also it mentions that it should start with select (would be nice to have a way to mutate values without needing to fetch them... A counter is a good example of why this would be good), but the select test just looks to see if "select " appears anywhere in the sql string at all, what if it was in a string blob, or someone had a cell name of myselect, that would mess it up pretty well. If I wrote a full Spirit.Qi parser then there would be no such issue, but that requires a newer version of Boost then what your current requirements state. ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
