#1 2021-05-26 09:09:12

L_VV
Member
Registered: 2020-10-29
Posts: 38

mormot.db.sql.odbc is not compiled with $define PUREMORMOT2

Good afternoon!

For a long time I did not update my copy of the mORMot2, today I updated it to the trunk.

With the $define PUREMORMOT2 enabled, the mormot2 package is not compiled:

mormot.db.sql.odbc.pas(1213,8) Error: Identifier not found "TODBCConnectionProperties"
mormot.db.sql.odbc.pas(1216,30) Error: Identifier not found "TODBCConnectionProperties"

This occurs in the lines below:

    if TODBCConnectionProperties(Connection.Properties).SqlStatementTimeoutSec > 0 then
      ODBC.Check(nil, self,
        ODBC.SetStmtAttrA(fStatement, SQL_ATTR_QUERY_TIMEOUT,
          SqlPointer(PtrUInt(TODBCConnectionProperties(Connection.Properties).SqlStatementTimeoutSec)),
          SQL_IS_INTEGER),
        SQL_HANDLE_STMT, fStatement);

This is due to $ifndef PUREMORMOT2 condition check in the type declaration:

{$ifndef PUREMORMOT2}
// backward compatibility types redirections

type
  TODBCConnectionProperties = TSqlDBOdbcConnectionProperties;
  TODBCConnection = TSqlDBOdbcConnection;
  TODBCStatement = TSqlDBOdbcStatement;

{$endif PUREMORMOT2}

If I disable $define PUREMORMOT2, then the mormot2 package is compiled successfully.

Offline

#2 2021-05-26 11:47:53

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: mormot.db.sql.odbc is not compiled with $define PUREMORMOT2

Should be fixed now.

Thanks for the feedback.

Offline

#3 2021-05-26 15:53:24

L_VV
Member
Registered: 2020-10-29
Posts: 38

Re: mormot.db.sql.odbc is not compiled with $define PUREMORMOT2

Sorry, but I don't see a new version of the mormot.db.sql.odbc unit in the trunk...

I updated to the trunk, but the error still here.

Offline

#4 2021-05-26 20:16:30

L_VV
Member
Registered: 2020-10-29
Posts: 38

Re: mormot.db.sql.odbc is not compiled with $define PUREMORMOT2

After latest commit all compiled successfully, thank you!

Offline

#5 2021-11-29 14:27:48

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: mormot.db.sql.odbc is not compiled with $define PUREMORMOT2

@ab - do we really need to throw in case ODBC driver name is not in predefined list?
I propose to remove this throw - https://github.com/synopse/mORMot2/blob … #L350-L352  (in mORMot1 also)

P.S.
I tries to use MS Access from Linux and driver name for FOSS ODBC MS Access driver is `mdbtools`, since it not contains `access` I got Exception. But the same exception will be throw for any ODBC driver we can works with, but it name is not in hard-coded constant in mormot.db.sql.odbc

Offline

#6 2021-11-30 08:37:46

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: mormot.db.sql.odbc is not compiled with $define PUREMORMOT2

I create a MR for mORMot1 to illustrate my proposal https://github.com/synopse/mORMot/pull/415

Offline

#7 2021-11-30 10:53:59

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: mormot.db.sql.odbc is not compiled with $define PUREMORMOT2

My guess is that a flag to ignore the name, and update the internal list (once a driver is tested) is better.

That is, keep the default behavior for safety, and only if you use an "unsupported driver", just set the flag and enjoy.
Of course, adding the unsupported driver names to the internal list is the best solution.

Offline

#8 2021-12-01 10:06:09

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: mormot.db.sql.odbc is not compiled with $define PUREMORMOT2

I do not know in advance which drivers will be used by my users. In my product database connection is configured,  so I need to support any driver.

By "flag" you mean  adds an ifdef directive?

Last edited by mpv (2021-12-01 12:18:13)

Offline

#9 2021-12-01 12:19:00

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: mormot.db.sql.odbc is not compiled with $define PUREMORMOT2

No, an option like a boolean, or a text flag within the driver name property.

Something which could be setup at runtime, not at compile time.

Offline

#10 2021-12-01 17:06:13

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: mormot.db.sql.odbc is not compiled with $define PUREMORMOT2

Please check https://github.com/synopse/mORMot2/comm … 54045a3e20 about a simple way to force a given kind of storage.

Also take a look at https://github.com/synopse/mORMot2/comm … b9119f7367 refactoring about thread safety of the connections.

Offline

Board footer

Powered by FluxBB