#1 2017-01-25 13:44:11

mauriciobs
Member
From: Brazil
Registered: 2016-05-11
Posts: 16

Access Violation in TSQLModel.Create

When defining a field of the TSQlRecord class as Boolean, the following error occurs:

An unhandled exception occurred at $0047824C:
EAccessViolation: Access violation
  $0047824C  TSQLMODEL__DESTROY,  line 33081 of C:/fpcupdeluxe/ccr/mORMotFPC/mORMot-master/SQLite3/mORMot.pas
  $00477042  TSQLMODEL__CREATE,  line 32551 of C:/fpcupdeluxe/ccr/mORMotFPC/mORMot-master/SQLite3/mORMot.pas
  $005B9EC9  CREATEMODEL, line 110 of ModelCreate.pas

Here's my code:

TSQLAuthUsuario = class(TSQLRecord)
  private
    fativo: boolean;
  public
    constructor Create; override;
    destructor Destroy; override;
  published
    property ativo: boolean read fativo write fativo;
  end;

function CreateModel: TSQLModel;
begin
  result := TSQLModel.Create([TSQLAuthUsuario], 'site');  // Here the error occurs.
end;

Using mORMot 1.18.3352 FTS3
Running on Windows 7 SP1 (6.1.7601) with code page 1252
TSQLite3LibraryStatic 3.16.2 with internal MM
Generated with: Free Pascal 3.1.1 ERTTI MOP compiler

Last edited by mauriciobs (2017-01-25 13:45:31)

Offline

#2 2017-01-25 14:59:29

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Access Violation in TSQLModel.Create

As a temporary fix, while waiting for Ab, please change this in mORMot.pas:

In function
function TTypeInfo.EnumBaseType: PEnumType;
{$ifdef FPC}
var base: PPTypeInfo;
begin
  result := PEnumType(GetFPCTypeData(@self));
  // no redirection if bool                                   <------------------- add
  if TTypeInfo(self).Kind=tkBool then exit;            <------------------- add

Offline

#3 2017-01-25 19:11:21

mauriciobs
Member
From: Brazil
Registered: 2016-05-11
Posts: 16

Re: Access Violation in TSQLModel.Create

Thank you AOG. Another error is now occurring, any idea?

An unhandled exception occurred at $006F38C9:
EZSQLException: SQL Error: ERROR:  syntax error at or near "READ"
LINE 1: ... SESSION CHARACTERISTICS AS TRANSACTION ISOLATION READ COMMI...
                                                             ^
  $006F38C9  CHECKPOSTGRESQLERROR,  line 704 of C:/fpcupdeluxe/ccr/zeos/src/dbc/ZDbcPostgr
eSqlUtils.pas
  $0061DCFD  TZPOSTGRESQLCONNECTION__SETTRANSACTIONISOLATION,  line 1093 of C:/fpcupdeluxe
/ccr/zeos/src/dbc/ZDbcPostgreSql.pas
  $005A7F31  TSQLDBZEOSCONNECTION__CREATE,  line 734 of C:/fpcupdeluxe/ccr/mORMotFPC/mORMo
t-master/SynDBZeos.pas
  $005A76DF  TSQLDBZEOSCONNECTIONPROPERTIES__NEWCONNECTION,  line 561 of C:/fpcupdeluxe/cc
r/mORMotFPC/mORMot-master/SynDBZeos.pas
  $005987EC  TSQLDBCONNECTIONPROPERTIESTHREADSAFE__THREADSAFECONNECTION,  line 6455 of C:/
fpcupdeluxe/ccr/mORMotFPC/mORMot-master/SynDB.pas
  $00598742  TSQLDBCONNECTIONPROPERTIESTHREADSAFE__GETMAINCONNECTION,  line 6438 of C:/fpc
updeluxe/ccr/mORMotFPC/mORMot-master/SynDB.pas
  $005A7414  TSQLDBZEOSCONNECTIONPROPERTIES__CREATE,  line 493 of C:/fpcupdeluxe/ccr/mORMo
tFPC/mORMot-master/SynDBZeos.pas

Offline

#4 2017-01-25 19:26:59

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Access Violation in TSQLModel.Create

Well, this one is much more complicated !
No mORMot code, ZEOS (version ?), Postgresql (version ?), no code at all.
Hard to solve/help for me ...

Offline

#5 2017-01-25 19:42:33

mauriciobs
Member
From: Brazil
Registered: 2016-05-11
Posts: 16

Re: Access Violation in TSQLModel.Create

Zeoslib version is 7.2.1-rc and Postgresql version is 9.4. It was downloaded by fpcupdeluxe 1.2.0h. Interesting that the same version of Zeoslib downloaded by site sourceforge.net/projects/zeoslib the error does not occur.

Last edited by mauriciobs (2017-01-25 19:43:38)

Offline

#6 2017-01-25 19:57:57

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Access Violation in TSQLModel.Create

Offline

#7 2017-01-26 13:14:48

mauriciobs
Member
From: Brazil
Registered: 2016-05-11
Posts: 16

Re: Access Violation in TSQLModel.Create

Many thanks for your always quick response.

Offline

Board footer

Powered by FluxBB