UniverseUniversity


Home Projects Jobs Clientele Contact

uu


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UU code



I have my code working with CODBCDatabase and I'm trying to change it to
CDatabase as you suggested.
I can't create objects using keyword 'new' with sptk::CDatabase, what's
the right way to create new connection?
Also CDatabase does not have active() method implemented, but I use it in
my DB pool, what should I do?

Thanks.


>
> 2) We should never use CODBCDatabase in our code besides creating the
> connection object. Any code that needs a database object should use
> CDatabase. That allows us to change a single line of code if we need to
> switch to totally different database driver. SPTK allows to create a
> database driver for anything that supports basic database functions. If we
> don't like Postgres ODBC driver, for instance, we can create
> CPostgresDatabase class, and replace:
>
> CDatabase* db;
> ...
>
> db = new CODBCDatabase("DSN=.....");
> with
> db = new CPostgresDatabase(".....");
>
> It would not require any corrections in C++ code besides the difference in
> SQL syntax.
>
>
> --
> Alexey Parshin,
> http://www.sptk.net
>



Authoright © Total Knowledge: 2001-2008