Hi Rainer,

thanks for your answer.

For the SET DATEFORMAT sql: wouldn't be better to handle it with
SQL_DATE_TEMPATE and SQL_DATETIME_TEMPLATE like in Oracle driver?

I mean something like this in DBDatabaseDriverMSSQL.getSqlPhrase():

case SQL_DATE_TEMPLATE:           return "convert(date, '{0}', 121)";
case SQL_DATETIME_TEMPLATE:       return "convert(datetime, '{0}', 121)";


Regards,
Ivan

On Sat, Oct 31, 2015 at 9:51 AM, Rainer Döbele <[email protected]> wrote:

> Hi Ivan,
>
> I can say for SQL-Server that there is a default schema but this might not
> necessarily be the database schema you want to work with.
> Hence you need to select the database using USE [xyz] in order to access
> the correct database schema.
> This might not be necessary if the default schema for the connecting user
> has already been set correctly.
>
> Also the date format is set to make sure, that the order of day, month and
> year corresponds to our internal representation, in case it differs.
>
> This needs to be done for every connection unless you can make sure, that
> the connections already has all required settings.
> So the best way would be to check your user settings in the database first
> and check whether when you connect you already access the correct db schema.
> If this is the case, then there is no need to execute the statements.
>
> You might derive your own class from your preferred database driver and
> then use this to skip this or implement your own logic.
>
> Regards,
> Rainer
>
> -------------------------------------------------------------------
> > from: Ivan Nemeth [mailto:[email protected]]
> > to: [email protected]
> > re: DBDatabase.open() question
> >
> > Hi guys,
> >
> > I have a question about DBDatabase.open() method. It sets the driver for
> the db and calls the driver's attachDatabase method which in most cases
> does nothing . But in case of MSSQL and MySql driver it executes some
> initialization SQL (*). We use a connection pool and a singleton DBDatabase
> instance, which is opened only once when the app is initialized. So this
> initialization script is executed only for the first connection.
> >
> > So what is the purpose of this initialization SQL? Is it necessary, and
> if yes, in case of a connection pool the DBDatabase should be open for
> every new connection?
> >
> > Regards,
> > Ivan
> >
> > * it sets the database to use (USE DATABASE...) and the date format
>

Reply via email to