#1 2020-10-05 07:30:00

Graeme
Member
Registered: 2020-10-05
Posts: 3

Cannot create AuthUser record

Hi

I have my own TSQLAuthUser record called TECSQLAuthUser) and when I attempt to create such a record to my database I get the following error:
   Cannot insert the value NULL into column 'Data', table ECSSQLAuthUsers; column not allow null, INSERT fails

This is a reasonable sql error as mORMot has created the table with the column Data declared as NOT NULL'

My database is an MSSQL database and I am using the ZEOS components/classes.

In my code I do not assign a value to my TECSQLAuthUser Data field but I still get the error when I do assign a value.

Would you please assist with my problem.

Regards
Graeme

Offline

#2 2020-10-05 08:26:16

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 11,597
Website

Re: Cannot create AuthUser record

Are you sure mORMot create it as NOT NULL?

It should be the case only for NonNullable or Unique or PrimaryKey fields, which is not the case for the Data column.

Offline

#3 2020-10-05 10:21:35

Graeme
Member
Registered: 2020-10-05
Posts: 3

Re: Cannot create AuthUser record

Hi Arnold

Thanks for the quick reply.

The tables (ECAuthGroups and ECAuthUsers) were created by mORMot code.

The SQL to create the table looks like

CREATE TABLE [dbo].[ECSQLAuthUsers](
    [ID] [bigint] NOT NULL,
    [LogonName] [nvarchar](20) NOT NULL,
    [DisplayName] [nvarchar](50) NOT NULL,
    [PasswordHashHexa] [nvarchar](64) NOT NULL,
    [GroupRights] [bigint] NOT NULL,
    [Data] [varbinary](max) NOT NULL,
    [Initials] [nvarchar](10) NOT NULL,
PRIMARY KEY CLUSTERED
(
    [ID] ASC ...........

The tables ere create during the call to CreateMissingTables and I also found the the tables would be created on the first call to CreateAndFillPrepare if the
CreateMissingTables method was not called.

Regards
Graeme

Offline

#4 2020-10-05 10:24:26

Graeme
Member
Registered: 2020-10-05
Posts: 3

Re: Cannot create AuthUser record

Hi Arnold

I forgot to mention that I manually changed the definition to NOT NULL and a problem occurred further into the execution that seemed to imply mORMOT could not handle a NUL value for the field Data.

Regards
Graeme

Offline

#5 2020-10-05 14:20:13

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 11,597
Website

Re: Cannot create AuthUser record

mORMot shouldn't create the fields with NOT NULL.
I am not able to reproduce it here.

BTW: this is not the correct thread for such questions.
You should have posted this in https://synopse.info/forum/viewforum.php?id=2

Offline

Board footer

Powered by FluxBB