You are not logged in.
Pages: 1
Hi,
What is the best strategy to upload photo on the server? I dont want to use the sqlrawblob because i don't want the image in the db but just a path where the server actually keep my image.
I try to use an RPC with a TByteDynArray but i have wierd errors maybye it's too big for the TByteDynArray. what do you think?
Yeah it perfectly make sense!
I don't know why i wanted to add a pivot table properties.
Thanks for the quick answer.
Hi!
When i try to send an object with TSQLRecordMany properties through HTTP i've got an 406 (error execution failed (probably due to bad input parameters)).
What i've discovered is that in mormot.pas in the function JSONToObject :
tkClass: begin
if wasString or (P^.PropType^.ClassSQLFieldType<>sftID) then
exit; // should have been handled above
V := GetInteger(PropValue,err);
if err<>0 then
exit; // invalid value
P^.SetOrdProp(Value,V);
end;
In case of TSQLRecordMany the conditional expression P^.PropType^.ClassSQLFieldType <>sftID is true and the exit is executed and the function return false and this is why i've got the error.
I changed :
if wasString or (P^.PropType^.ClassSQLFieldType<>sftID) then
by
if wasString or ((P^.PropType^.ClassSQLFieldType<>sftID) and (P^.PropType^.ClassSQLFieldType<>sftMany)) then
and it's worked fine. What do you think?
Although when mORMot generate me the wrapper for crossplateform it wraps the TSQLRecordMany properties by Integer and not by TID. Is it good?
thx.
Do you want me to provide my test application for debug?
OK it's a firebird problem because if i use the standard SQLite without VirtualTableExternalRegisterAll, all works fine. I'me going to track what's the problem or switch to the in-built standard sqlite engine.
I use firebird
class function TDbUtility.CreateDb: TSQLRestServerDb;
var
FProp: TSQLDBZEOSConnectionProperties;
begin
FProp := TSQLDBZEOSConnectionProperties.Create
(TSQLDBZEOSConnectionProperties.URI(dFirebird, '',
'D:\Program Files\Firebird\Firebird_2_5\WOW64\fbclient.dll', False),
'D:\delphi\FriendZone\TestYoann.fdb', 'SYSDBA', 'masterkey');
VirtualTableExternalRegisterAll(TModelUtility.GetModel, FProp);
Result := TSQLRestServerDB.Create(TModelUtility.GetModel, 'Test.json');
Result.CreateMissingTables;
you mean by doing this :
initialization
TJSONSerializer.RegisterObjArrayForJSON(TypeInfo(TTagDynArray), TTag);
Yes i did.
I notice something, the JSON response is not correct the array its a string like this : aXNwbGF5U3RyIjoiYmlrZSJ9LHsiSUQiOjg5LCJTdWJDYXQiOltdLCJEaXNwbGF5U3RyIjoiZm9vdGluZyJ9XQ==
Although if i inspect my blob as text on the DB the string is good : [{"ID":88,"SubCat":[],"DisplayStr":"bike"},{"ID":89,"SubCat":[],"DisplayStr":"footing"}]
Any suggestion?
Infortunatly i tried RetrieveBlobFields but its not working either.
OK, It's work better but with this code :
LTag := TTag.Create;
LTag.DisplayStr := 'Sport';
LTag2 := TTag.Create;
LTag2.DisplayStr := 'bike';
FServer.Add(LTag2, True);
LTag.DynArray('SubCat').Add(LTag2);
LTag2 := TTag.Create;
LTag2.DisplayStr := 'footing';
FServer.Add(LTag2, True);
LTag.DynArray('SubCat').Add(LTag2);
LID := FServer.Add(LTag, True);
FreeAndNil(LTag);
LTag := TTag.Create(FServer, LID);
// !subCat is empty!
LTag2 := LTag.SubCat[1];
The SubCat array is empty, i check the blob on Db it contain the Json object. May i miss someting?
Even if i think i'm going to use a pivot table for these kind of recursive data, i want to make it work for future object wich contains "regular" dynarray.
Hi!
I'm back to mORMot, I'm doing some test on nested array :
My business object is :
TTag = class;
// pas d objectlist ds Mormot seulement des array
TTagDynArray = array of TTag;
TTag = class(TSQLRecord)
private
FSubCat: TTagDynArray;
FDisplayStr: rawUTF8;
published
property SubCategory: TTagDynArray read FSubCat write FSubCat;
property DisplayStr: rawUTF8 index 200 read FDisplayStr write FDisplayStr;
end;
I try to use the ORM to store it on a DB
I create a tag sport wich has two subtags (bike and footing)
FServer := TDbUtility.CreateDb;
LTag := TTag.Create;
LTag.DisplayStr := 'Sport';
LTag2 := TTag.Create;
LTag2.DisplayStr := 'bike';
LTag.DynArray('SubCat').Add(LTag2);
LTag2 := TTag.Create;
LTag2.DisplayStr := 'footing';
LTag.DynArray('SubCat').Add(LTag2);
LID := FServer.Add(LTag, True);
FreeAndNil(LTag);
FreeAndNil(Ltag2);
LTag := TTag.Create(FServer, LID);
LTag2 := LTag.SubCat[1];
When i fetch the parent tag, the array Subcat[0] is good (bike) but the Subcat[1] always contain the parent tag (sport) himself.
Did i make a mistake somewhere?
Hi,
I try to add a user on the server with this code :
LStandardAppliUser := TSQLAuthUser.Create;
LStandardAppliUser.LogonName := 'StdUser';
LStandardAppliUser.PasswordPlain := 'Efficaps';
FServer.Add(LStandardAppliUser, False);
But when i try to set a session with this user on the client side :
FModel := TSQLModel.Create([]);
FHttpClient := TSQLHttpClient.Create('LOCALHOST', PORT_NAME, FModel);
FHttpClient.SetUser('StdUser','Efficaps');
I've got a forbidden error. How can i add a user even in designtime?
Thank you it's working!
Here my class on the server side :
TCollDbFunc = class(TInterfacedObject, IColleaguesFunc)
private
FDORMConfigCtrl: TDORMCtrl;
FLstCtrl: TListCtrl;
function GetAdvantagesList(ASession: TSession): TAdvantages;
public
constructor Create;
destructor Destroy; override;
function GetColleagues: string;
end;
When I call GetColleagues from the client, the constructor has never be called before so my nested object FDORMConfigCtrl is nil.
OK i rewrote my client and server to use interface-based services, it's very powerful.
I have a problem when i want to use on the server side my object wich implement the interface, it's TServiceCalculator in the demo. never be Created, when a method is calling by the client an AV occur because the constructor never be called. I tried different Instances life time (sicSingle, sicShared...) but it doesn't change anything. Is there something i must do to solve this?
Hi!
I try to replace Datasnap (i'm afraid of what i read about it's performance and stability) with mormot. I use Datasnap only for the http communication (the SOA part). Do you have any advices for my migration?
I have just finished reading this post, where can i find the full source?
Thanks!
Pages: 1