#1 2014-03-09 08:16:47

tech
Member
Registered: 2014-01-13
Posts: 110

'ExecuteFromJSON: Invalid Types[3]=0' for TDateTime with MSSQL

Hi all,

I've mapped an existing mssql table that contains a 'smalldatetime' field with a TDateTime one on delphi, but I receive the exception above when I want to update the virtual table.
The exception occurs on this function when mormot can't find the appropriate field type on the TSQLDBFieldType :

 TSQLRestServerStaticExternal.ExecuteFromJSON(const SentData: RawUTF8; Occasion: TSQLOccasion; UpdatedID: integer): integer; 

The connection is established with TOleDBMSSQL2008ConnectionProperties for MSSQL2008 and I can't modify RDBMS structure.

Thnx.

Offline

#2 2014-03-09 12:55:25

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

Re: 'ExecuteFromJSON: Invalid Types[3]=0' for TDateTime with MSSQL

Good idea.

We have enhanced recognition of those deprecated column types.
See http://synopse.info/fossil/info/79f80d10b6

Thanks for the feedback.

Offline

#3 2014-03-09 14:49:25

tech
Member
Registered: 2014-01-13
Posts: 110

Re: 'ExecuteFromJSON: Invalid Types[3]=0' for TDateTime with MSSQL

Good work ab.

Now I've string truncation exception.
After investigations I found that one field declared as 'RawUTF8 Index 35' takes more than 35 chars ! Why mORMot doesn't truncate strings ?

Thanks for your great work.

Offline

#4 2014-03-09 16:09:04

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

Re: 'ExecuteFromJSON: Invalid Types[3]=0' for TDateTime with MSSQL

"index 35" is just used for the CREATE TABLE statement.
The ORM itself does use this indication to truncate anything.

What you can do is adding some validation pattern to the ORM.
See "7.2. Filtering and Validating" in the SAD 1.18 pdf (around page 141).

But do you really expect the content to be silently truncated?
Sounds something unsafe to me...

Offline

#5 2014-03-09 16:20:35

tech
Member
Registered: 2014-01-13
Posts: 110

Re: 'ExecuteFromJSON: Invalid Types[3]=0' for TDateTime with MSSQL

ok i'll emplement the validation pattern later.

Offline

Board footer

Powered by FluxBB