You are not logged in.
Hello everybody,
my problem is my server does not create default records in authgroup and user tables.
aProps := TSQLDBUniDACConnectionProperties.Create('MySQL', 'medplatform', 'root', 'Tiger4711');
aProps.SpecificOptions.Values['Server'] := 'localhost';
aProps.SpecificOptions.Values['Port'] := '3306';
try
aModel := DataModel;
VirtualTableExternalRegisterAll(aModel, aProps);
MapFields(aModel);
try
aRestServer := TSQLRestServerDB.Create(aModel,'data.db3', true); // authentication=true
try
aRestServer.CreateMissingTables; // create tables or fields if missing
....
function DataModel: TSQLModel;
begin
Result := TSQLModel.Create([TUser, TSQLAuthGroup, TTransfer, TOmMessageDetailsInstant]);
end;
After aRestServer.CreateMissingTables; I have added next code
if not aRestServer.TableHasRows(TSQLAuthGroup) then
begin
TSQLAuthGroup.InitializeTable(aRestServer, '', [itoNoIndex4ID, itoNoIndex4UniqueField, itoNoIndex4NestedRecord, itoNoIndex4RecordReference]);
end;
Now server tries to create the records BUT when it creates ADMIN record an exception is raised.
Log:
20140924 16390435 SQL TSQLDBUniDACStatement(0289F500) insert into User (id,LogonName,DisplayName,PasswordHashHexa,GroupRights,MetaData,Name1,Name2,Title,id_country,id_mandant,id_client,id_Personal,id_Language) values (1,'Admin','Admin','67aeea294e1cb515236fd7829c55ec820ef888e8e221814d24d83b3dc4d825dd',1,NULL,'','','',0,0,0,0,0)
20140924 16390557 EXC EVariantBadIndexError ("Variant or safe array index out of bounds") at 00424D38 stack trace API 004826E4
20140924 16390560 EXC EVariantBadIndexError ("Variant or safe array index out of bounds") at 00424D38 stack trace API 004826E4 0040646C 77CC6A8B 77C90143 00424D38 00424E85 0042D0EE 0042D95F 0042A5C5 0067B32C 0067B2DD 0068EB35 006AAD8C 0067E504 006B13CC 00582CB5
What way should I go to fix it?
Thanks.
Offline
Add the debug detailed .map information, so that you have the stack trace.
Are you sure the MySQL database is void?
Is there not any previous table content when the program starts?
BTW which version of the framework are you using?
Offline
Thanks for your help.
Detailed log:
20140925 14402248 + TSQLDBUniDACStatement(02A9F440).002AD220 SynDBDataset.TSQLDBDatasetStatementAbstract.ExecutePrepared (460)
20140925 14402248 SQL TSQLDBUniDACStatement(02A9F440) insert into User (id,username,DisplayName,passwort,GroupRights,MetaData,Name1,Name2,Title,id_country,id_mandant,id_client,id_Personal,id_Language) values (1,'Admin','Admin','67aeea294e1cb515236fd7829c55ec820ef888e8e221814d24d83b3dc4d825dd',1,NULL,'','','',0,0,0,0,0)
20140925 14402441 EXC EVariantBadIndexError ("Variant or safe array index out of bounds") at 00023D38 Variants.TranslateResult stack trace API 000816E4 SynCommons.SynRtlUnwind (41486)
20140925 14402445 EXC EVariantBadIndexError ("Variant or safe array index out of bounds") at 00023D38 Variants.TranslateResult stack trace API 000816E4 SynCommons.SynRtlUnwind (41486) 0000546C System.@HandleAnyException 00023D38 Variants.TranslateResult 00023E85 Variants.VarResultCheck 0002C0EE Variants.VarArrayGet 0002C95F Variants.DynArrayFromVariant 000295C5 Variants.@VarToDynArray 0027A32C DBAccess.TDAParam.GetParamObject 0027A2DD DBAccess.TDAParam.GetNativeParamObject 0028DB35 DBAccess.TCustomDASQL.AssignParamValue 002A9D8C Uni.TUniSQL.WriteParams 0027D504 DBAccess.TCustomDADataSet.Execute 002B03CC SynDBUniDAC.TSQLDBUniDACStatement.DatasetExecSQL (531) 00181CB5 mORMotDB.TSQLRestStorageExternal.ExecuteFromJSON (1674)
20140925 14402446 - 01.957.649
Tables information:
before server first start I have existing EMPTY user table and groups table does not exist.
version information:
in inc files I see words about version 1.18
environment information:
win 7 64bit, delphi 2010
Offline
You said TSQLAuthUser.LogonName is primary key for the corresponding table...
Hmm... What do I do wrong?
Result := TSQLModel.Create([TSQLAuthUser, TSQLAuthGroup, TTransfer, TOmMessageDetailsInstant]);
and I see in DB authuser table with ID: Integer as primary key.
Thanks.
Last edited by alexdmatveev (2014-09-25 13:55:36)
Offline
Thanks. What is about previous reply about the exception?
Offline