#2 mORMot 1 » Commit from 15-01-21 [c1a508e] and 'nocache' » 2021-03-20 14:55:21

cregonat
Replies: 2

Hello,

I have a backend for an Android app that worked without problems when running this code:

    FOrden := TOrdenProduccion.CreateAndFillPrepare(DBController.CMain, 'NroOrden=? AND EsMatriz=0 AND IdMaquina=0 '
      + '/*nocache*/', [lIdOrdenStr])

this doesn't work anymore since the commit of 15-01-21 (fixed TSynTableStatement parsing), and it seems that the /*nocache*/ isn't parsed in the same way as before.

should I avoid using nocache there?

Thanks

#3 Re: mORMot 1 » Error with MSSQL, zeos connection » 2020-07-23 17:51:39

Michael,

thanks for your complete explanation and the connection param. Right now the small backend entered production using SynOledb connection and it's serving without any problem. There's a plan to move mssql to linux, so probably I'll revisit it later and try again using zeos.

Claudio.

#4 mORMot 1 » call TOleDBConnection.Free from the same thread... » 2020-06-28 15:21:42

cregonat
Replies: 2

Hi,

I'm getting an EAssertionFailed: "You should call TOleDBConnection.Free from the same thread which....".  As it's stated on the documentation, I've implemented the OnHttpThreadTerminate event:

  HttpServer.OnHttpThreadTerminate := FOnThreadTerminate;

then,

procedure THTTPTerminals.FOnThreadTerminate(sender: TThread);
begin
   FDBMain.ConProp.EndCurrentThread;
   FDBProd.ConProp.EndCurrentThread;
end

the strange behaviour is that if I call the server, it works without any trouble, but, if I left the server running without making any call for some time, then, the first call after that pause throws that assertion, and subsecuents calls works without throwing that assertion.

probably I should say that I've to extend a legacy system which has two databases. I know that this isn't an ideal situation, but, it what i have. So, i'm using two connections, each one with his own model.

Thanks

#5 Re: mORMot 1 » Error with MSSQL, zeos connection » 2020-06-26 17:44:32

mpv wrote:

Under Linux you can use TODBCConnectionProperties from SynDBODBC + ms odbc driver or FreeTDS. I test both. On production I use msodbcsql17

Thanks for the tip. I'll give a try.

#6 Re: mORMot 1 » Error with MSSQL, zeos connection » 2020-06-26 12:46:11

Thanks for your reply, I'll use TOleDBMSSQL2012ConnectionProperties as you suggested.
I wanted to use Zeos because there's a migration to linux planned, so I tought that would be easier the transition when that happens.

#7 mORMot 1 » Error with MSSQL, zeos connection » 2020-06-26 11:57:04

cregonat
Replies: 6

Hi,

I'm working on a backend for a mobile app, which must extend an old production system. Connected the mssql using Zeos connection and SQLNCLI native client. I get a strange error when I run this query:

 SELECT art.IdArticulo, 
     art.Descripcion, art.UniMedida, art.LlevaStock, 
    ISNULL((SELECT SUM(ingreso-egreso) FROM vtainventario inv 
    WHERE inv.idarticulo=art.idarticulo 
    AND IdDeposito = ?), 0) AS Stock, 
    sect.Descripcion as Sector, 
    ISNULL(sect.CodSector, 0) as CodSector 
    FROM COMVTAARTICULO art 
    LEFT JOIN vtasectorarticulo sect 
    ON (art.codsectorvta = sect.CodSector) 
    WHERE art.IdArticulo = ?

Error: oledb error sqlstate: 42000 native error: error message: syntax error, permission violation, or other nonspecific error..

I then changed the connection to TOleDBMSSQL2012ConnectionProperties and it worked without problems.

the line of zeos that throws the error is: line 1447, unit ZDbcOleDbStatement

      if fDEFERPREPARE and (fCommand.QueryInterface(IID_ICommandPrepare, CommandPrepare) = S_OK) then begin

I didn't know if report it on zeos forum or here. sorry if this is not the correct place to report.

Thanks!

Board footer

Powered by FluxBB