Hi Darren,

On Sun, Nov 15, 2009 at 3:58 PM, Darren Garvey <[email protected]> wrote:
> Hi all,
>
> I've now got litesql compiling with MSVC9.0 and running on XP, using cmake
> and the tar.gz download from SF.
>
> Generally I think the library is a very impressive start and the API is the
> cleanest of the C++ 'ORM' libraries I've tried.
>
> I have a few comments / questions after using it for the first time and
> attempting to fit it into a project I'm working on.
>
> 1. How do you check if a database already exists?
>
> I was looking for either db.exists() or an operator bool(). So far I have
> been using:
>
> try {
>    db.create();
> } except(litesql::Except&) {
>    if (db.needsUpgrade())
>      db.upgrade();
> }
>
> What is the proper way of doing this? Would it be reasonable to add an
> AlreadyExists exception type?

That is a good idea. I've just ran used needsUpgrade-method() to check
whether the database is as it should be.


> 2. What about multithreading?
>
> There are a lot of static variables in the generated database classes. Is
> litesql thread-aware yet or is there any movement in this direction? I would
> like to use the library in web applications, where multithreading is a
> requirement.
>

Nope, the library is most likely _not_ threadsafe. I've preferred to
separate all database clients to different processes. This is a bit
cumbersome in Windows, though.

> 3. Control litesql-gen directories (separate .hpp and .cpp output
> directories).
>
> I've set up a pre-build script which regenerates the database files and
> copies them to the correct places. It'd be much nicer to have a couple of
> extra options built into litesql-gen:
>
> --output-sources=/path/to/src
> --output-include=/path/to/include
> --refresh
>
> The --refresh option would only update the c++ source if the database schema
> had been modified since the c++ sources were last generated.
>

Good idea. Update-if-modified feature could even be the default mode.

> 4. Use of double underscores.
>
> The standard reserves any identifiers with double underscores for the
> implementation. The generated source files use double underscores in
> variable names, so they aren't legal c++. Added a trac ticket #17.
>

Ah, I did not know about this. They could be changed to single
underscores and identifiers in XML database definition files are not
allowed to start with an underscore.

> 5. Names suffixed with underscore.
>
> What is the reason behind the table and column names all ending with an
> underscore?

Added underscores prevent table and column names from colliding with
reserved words of a RDBMS. After having implemented this feature I
discovered that the identifiers could have been put inside quotes.. so
it is a legacy feature.

Best Regards,
Tero Laitinen

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Litesql-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/litesql-users

Reply via email to