You are not logged in.
Hello,
For some reason am not getting the addition of records via batch
to a client server (HTTP, No Ajax or Web) to work.
Immediate updates to another table do work though.
The following call returns 0 so it seems to work:
indx := GG_globalClient.BatchAdd(d_TableInstance, true);
The following call returns 200 so it would seem to work,
but on closer inspection
AllResults[0] and AllResults[1] are returning 0,
so there seems to be a problem.
However, cannot figure out how to find out the
cause of this error?
Var
AllResults: TIntegerDynArray;
BEGIN
ix := GG_globalClient.BatchSend(AllResults);
GG_globalClient.Commit;
Made sure the server is working properly.
The client starts as follows:
GG_globalClient := TSQLHttpClient.Create('someIP',
'888', GG_Model);
Would be very grateful for your pointers over here.
Sami
Offline
If you use regular Add instead of BatchAdd?
Do you begin the transaction?
Do you have full code to reproduce?
Did you try to put a breakpoint on the server, then step into the code and find what is wrong?
Offline
Thanks for your pointers, in fact, it turns out that
only one of the tables works with regular Add
(both have a similar structure though)
and none of them will work with
TransactionBegin:
GG_globalClient.TransactionBegin(TSQLTable1);
causes a mysterious 'Exception class EOSError'
with message 'System Error. Code 12152,
apparently generated from InternalGetInfo32 in
TWinHttpAPI.Request in the unit SynCrtSock
The server code is very simple:
Try
aProps := TSQLDBSQLite3ConnectionProperties.Create(ChangeFileExt(paramstr(0),'.db'),'','','');
VirtualTableExternalRegisterAll(aModel,aProps);
Try
aModel := get_model_HEVDB; // tbls defined in unit HEVDB
DB := TSQLRestServerDB.Create(aModel,'Hev.DB3',
CHECK_USERS);
DB.CreateMissingTables;
Try
aServer := TSQLHttpServer.Create('888',[DB]);
Write('Press [Enter] to shut down server.');
finally
aServer.Free;
end;
finally
aModel.Free;
end;
finally
aProps.Free;
To step down code in the server would require attaching some event handler to
the server, I guess?
Offline
Do you use the latest 1.18 'unstable' version?
See http://synopse.info/fossil/wiki?name=Get+the+source
You are wrongly calling VirtualTableExternalRegisterAll() I suppose.
You are calling it on a model, then retrieve another TSQLMOdel instance...
weird...
Offline
Thanks for the tip, now realize had moved
VirtualTableExternalRegisterAll(aModel,aProps)
too high in the code, it was supposed to just be before
TSQLRestServerDB.Create().
Will try instead
Try
aModel := get_model_HEVDB; // tbls defined in unit HEVDB
VirtualTableExternalRegisterAll(aModel,aProps);
Had downloaded the latest 'unstable' 1.18 version,
but there was a D2009 issue at compilation,
(will try to reproduce it and post it)
so went back a little in history...
Offline
I suspect the D2009 compilation has been fixed some days ago.
Offline
Thanks for this info, now compiled latest unstable version with no problem.
Can now finally add data to the server tables, (not using batch yet)
however, when stepping on the statement:
GG_globalClient.TransactionBegin(TSQLMyTable2)
still get the error Exception class EOSError' with message 'System Error. Code 12152
which apparently means the following:
HTTP Status 12152 The server has been taken down momentarily for database or server maintenance, or there has been a network error. This status will generally come up when attempting to upload.
Wonder if you have any ideas on this?
Offline
When running the server under the debugger, then
at the following statement
aServer := TSQLHttpServer.Create('888',[DB]);
got an error saying that administrator rights
needed for 'root'. The error does *not* appear
when the server is started normally outside the IDE.
Tried running the application as the administrator, and
it seems to work now.
Am in the habit of avoiding working under the administrator
account (for protection against malware).
Would not have guessed this to be the issue, so thank you so much
for your kind assistance!
Offline
You must regisre server first
THttpApiServer.AddUrlAuthorize('root','888',false,'+'));
Please see this topic http://synopse.info/forum/viewtopic.php?id=1059 and blog post http://blog.synopse.info/post/2011/03/1 … ode-server
See also http://synopse.info/forum/search.php
Last edited by mpv (2013-04-27 20:50:42)
Offline
Thanks a lot! Felt that something was missing but could not figure out what.
The client can now run successfully w/o having
to run as 'admin' (am using localhost on a single PC)
However, when it doesn't run as admin, seems to be slower...
Offline