You are not logged in.
Thomas-Acia wrote:I'm using CodeTyphon
Avoid Codetyphon. Try to use NewPascal instead
Ok thank you ! I'll test that !
Hi,
I have been working with mormot for 2 years now and I always compiled my programs under a 32 bits OS (Delphi 2010 then XE8 for Windows and Debian). But today, I encounter different problems so I have to compile some programs under a 64 bits Linux. I'm using CodeTyphon and my question is simple. Does mORMot compile under a 64 bits OS ?
I found this answer : https://synopse.info/forum/viewtopic.ph … 314#p20314 but it's old now.
Thank you !
Thank you !
Hi,
I would like to decode an array of json, for example this one : [{"id":"1","nom":"test1.sql","dti":"2016-02-19 09:49:31"},{"id":"2","nom":"test2.sql","dti":"2016-02-19 09:50:12"}]
When I use the JSONDecode function : "JSONDecode(input, ['id'], output);" , I receive only id = 1. My question is simple, how can I receive an array of values.
Thank you
Ok thank you I'm going to test !
I do this :
temp:=TStream.Create;
[...]
temp := RawByteStringToStream(content);
[...]
temp.Free;
but I have the feeling that the stream is not correctly released.
Hello,
I think you forgot the library driver.
You can find more informations here : http://synopse.info/files/html/Synopse% … #TITLE_182
Hi,
I'm using the fonction "RawByteStringToStream" and I have a simple question: How to free this stream created ?
Thank's
Ok thank you !
Hi Ab,
Firstly, I wish a Happy New Year to all mORMot'er !
If I'm not mistaken, the timeout to receiv the result of a CallBackGetResult is more or less 30 seconds.
Does exist a way to extend this delay ?
Thank you
Edit : I found the Default Timeouts in the SynCrtSock Unit
Edit 2: When I use "HttpRequest := THttpRequest.Create(IP, '83', False,'','',60000,60000,60000);", I have an abstract error.
Hi ab,
I would like to know if the support of x86-64 as a target for FPC under Linux is planned.
Thank you
@squirrel
Personnaly, when I had a 403 Error (Forbidden), I had a Model mistake. Check if you're calling your model on the server side with the right name.
Thank you for your help AOG. It will be very usefull
Hi ab,
I would like to start my http server in the background on Linux. I tested ./SERVERNAME with '&' but it doesn't work. Do you have some ideas ?
Thank you
It's solved, I use now
aAttributes.Blob := aAttributes.Blob;
to call it explicity.
Hi,
I need to call a Setter in a TSQLRecord class but it's uncalled. Is it because of the TSQLRawBlob type ??
type
TSQLAttributesRec = class(TSQLRecord)
private
fObjID, fPackedObj, fSize, fUseCount, fUnpackedObj :Integer;
fExtension, fFilePath, fMimeType, fFName, fSha :RawUTF8;
fBlob :TSQLRawBlob;
procedure SetBlob(const Value:TSQLRawBlob);
published
property ObjID: Integer Read fObjID Write fObjID;
property PackedObj: Integer Read fPackedObj Write fPackedObj;
property Size: Integer Read fSize Write fSize;
property UseCount: Integer Read fUseCount Write fUseCount;
property UnpackedObj: Integer Read fUnpackedObj Write fUnpackedObj;
property Extension: RawUTF8 Read fExtension write fExtension;
property FilePath: RawUTF8 Read fFilePath write fFilePath;
property MimeType: RawUTF8 Read fMimeType write fMimeType;
property Name: RawUTF8 Read fFName write fFName;
property Sha: RawUTF8 Read fSha write fSha;
property Blob: TSQLRawBlob read fBlob write SetBlob;
public
end;
procedure TSQLAttributesRec.SetBlob(const Value:TSQLRawBlob);
begin
...
end;
I looked at this and I noticed that you used another class.
Finally, I used a TSQLRawBlob and the method : RetrieveBlob(). It works perfectly.
I have a last question. I sometimes have a problem with my server :
I think it's a problem with the PostgreSQL connection, maybe a timeout ??
Edit : I saw the ConnectionTimeOutMinutes method in the doc, I tried it, without success.
So do you think I can do that :
FTemplate.Text := aTemplate.bin;
Edit : When I do that: my text value is :
PGh0bWw+DQoNCjxzdHlsZSB0.....
Ah !!!! And to retrieve it ??
TSQLticket_template = class(TSQLRecord)
private
flibelle_template :RawUTF8;
fbin :TSQLRawBlob;
fblbid, fid_type_rapport :Integer;
published
property libelle_template: RawUTF8 Read flibelle_template Write flibelle_template;
property bin: TSQLRawBlob Read fbin Write fbin;
property blbid: Integer Read fblbid Write fblbid;
property id_type_rapport: Integer Read fid_type_rapport Write fid_type_rapport;
public
end;
I think my TSQLRecord definition is right. I have a TSQLRawBlob. And then I don't know which args to use
I don't know know to fill all the arguments.
TSQLRecordClass = TSQLticket_template
aID = idTemplate
const BlobFieldName : RawUTF8 = ??
BlobData : I think = aTemplate.bin
For a BINARY blob, do not use RawByteString, but TSQLRawBlob published property.
Then get the blob explicitly: it is not retrieve by default with other fields.
Use TSQLRest.RetrieveBlob method instead.See http://synopse.info/files/html/Synopse% … l#TITLE_59
and search for the BLOB keyword in the documentation.But in your case, you want to store only text, I guess.
So use a plain RawUTF8 field, without any "index ###" length attribute.
It would be stored as a CLOB in th external DB.
And you have nothing special to do.
Yes, it's only a template which contains a text.
procedure TTicketClient.LoadTemplate2(idTemplate: Integer);
var
aTemplate: TSQLticket_template;
begin
aTemplate := TSQLticket_template.CreateAndFillPrepare(CTicket.Database, 'id = ?', [idTemplate]);
try
while aTemplate.FillOne do
begin
TSQLRest.RetrieveBlob(TSQLticket_template,idTemplate, ??? ,aTemplate.bin);
end;
finally
aTemplate.Free;
end;
end;
Something like that ?
TSQLticket_template = class(TSQLRecord)
private
flibelle_template :RawUTF8;
fbin :RawByteString;
fblbid, fid_type_rapport :Integer;
published
property libelle_template: RawUTF8 Read flibelle_template Write flibelle_template;
property bin: RawByteString Read fbin Write fbin;
property blbid: Integer Read fblbid Write fblbid;
property id_type_rapport: Integer Read fid_type_rapport Write fid_type_rapport;
public
end;
procedure TTicketClient.LoadTemplate2(idTemplate: Integer);
var
aTemplate: TSQLticket_template;
begin
aTemplate := TSQLticket_template.CreateAndFillPrepare(CTicket.Database, 'id = ?', [idTemplate]);
try
while aTemplate.FillOne do
begin
FTemplate.Text := aTemplate.bin;
end;
finally
aTemplate.Free;
end;
end;
I have that. But It seems like my FTemplate.text is empty
Hi,
I had to do a project in order to create and print receipts. So I used mORMot + Mustache + WPTools + ZEOS.
I am at the end of my project. But I have a little problem with a blob. In fact, I sent my templates (created with mustache) on a PgSQL database. And now I would like to retrieve these blob using mORMot. On my database, the type is "bytea". So my question is : how can I retrieve the blob as text (because my template is html/css). Wich type can I use ?
Thank you
Hello,
Personnally I use CodeTyphon. It is much like Lazarus. I had this error too. I don't know if it's the best way to solve it but :
- Go to the project options - analysis and change the mode. You can use : MODE DELPHI.
It solved my compilation errors.
Thormot
Edit 2 : I had the same problem here : http://synopse.info/forum/viewtopic.php?id=2542
ERROR FOUND !
Line 45518 in mORMot.pas, we have to add oTSQLRecord :
if ClassHasPublishedFields(ClassType) or
(JSONObject(ClassType,IsObjCustomIndex,[cpRead,cpWrite]) in
[{$ifndef LVCL}oCollection,{$endif}oObjectList,oUtfs,oStrings,
[color=#FF0000]oSQLRecord[/color],oException,oCustom]) then
You deleted this the 18th of June at 11:03.
I have no idea. I looked my code and the mORMot unit but I found nothing
A compatiblity problem would be strange because it worked before my update
How is your ITicketSignaling.ServerSetDB() method defined?
The error is pretty clear IMHO: the "wrapper" parameter of this method is not known.
Or perhaps even not compatible with interface-based services, which transmit values per representation, so need to be serializable as JSON.
See http://synopse.info/files/html/Synopse% … l#TITL_154
procedure TServiceSignaling.ServerSetDB(Wrapper: TACIASQLWrapper);
begin
DB:=Wrapper.Rest;
TSQLRestServerDB(DB).DB.LockingMode:=lmExclusive;
end;
I just updated my sources. I have a problem with this code :
STicket.GetRestServer.ServiceRegister(TServiceSignaling,[TypeInfo(ITicketSignaling)],sicShared);
Try with the latest version of Mustache:
{{#if qte>1}}{{qte}}{{/if}}
Ok, I don't have the latest version ! Thank you !
Hi,
I decided to use views with the ORM.
Now I have another question. Is possble to compare two values with a "IF" section in Mustache ??
(Example : {{#qte > 1}} {{qte}} {{/qte}} )
Thank you
Hi,
I have to create a query between many tables in order to create a ticket (ticket like McDonald's for example). I must take a lot of informations in these tables. So I have to create joins. I read these parts of documentation : http://synopse.info/files/html/Synopse% … ml#TITL_70 and synopse.info/files/html/Synopse mORMot … l#TITL_129 but I didn't understand all.
Firstly, for the cardinalities, I'll have a number of articles on my tickets, but this number may change every ticket. So I have to declare a number of attributs in my virtual table ? Like this :
property FirstOne: TSQLMyFileInfo read FFirstOne write FFirstOne;
property SecondOne: TSQLMyFileInfo read FSecondOne write FSecondOne;
Or only one time ?
Secondly, the join must be created with the ID of the table I want to join or with the attribut ?
MyFile := TSQLMyFile.CreateJoined(Client,aMyFileID);
I didn't find a sample with an example of joins.
For now, I have this :
{ Table cat_passself }
TSQLcat_passself = class(TSQLRecord)
private
fid_passage: Integer;
fdate_passself, flibelle_repas, fnumero_ticket, foperateur, fprix_repas, fprix_repas_recalcul,
fsubvention_fixe, fsubvention_cent : RawUTF8;
published
property id_passage: Integer Read fid_passage Write fid_passage;
property date_passself: RawUTF8 Read fdate_passself Write fdate_passself;
property libelle_repas: RawUTF8 Read flibelle_repas Write flibelle_repas;
property numero_ticket: RawUTF8 Read fnumero_ticket Write fnumero_ticket;
property operateur: RawUTF8 Read foperateur Write foperateur;
property prix_repas: RawUTF8 Read fprix_repas Write fprix_repas;
property prix_repas_recalcul: RawUTF8 Read fprix_repas_recalcul Write fprix_repas_recalcul;
property subvention_fixe: RawUTF8 Read fsubvention_fixe Write fsubvention_fixe;
property subvention_cent: RawUTF8 Read fsubvention_cent Write fsubvention_cent;
end;
And in few tables :
{ Table com_personne }
TSQLcom_personne = class(TSQLRecord)
private
fid_entite: Integer;
fnom, fprenom1: RawUTF8;
fcat_passself: TSQLcat_passself;
published
property id_entite: Integer Read fid_entite Write fid_entite;
property nom: RawUTF8 Read fnom Write fnom;
property prenom1: RawUTF8 Read fprenom1 Write fprenom1;
property cat_passself: TSQLcat_passself read fcat_passself write fcat_passself;
public
end;
with the join with "cat_passself"
I only declared attributs in my virtual tables. I didn't create joins for now.
Thank you !
By the way, my project is ended. I have a client and a server mORMot with a SQL query (ZEOS + PGSQL).
It's working on Linux AND Windows but not with an Android device yet. I'm working on it. If I have good news, I'll come back !
ILIKE is not supported, since it is a PostgreSQL specific extension, not handled by Sqlite3 for instance.
Since ILIKE is not recognized by the framework, the statement is passed to the virtual SQLite3 table engine, which does not support ILIKE either...
IMHO the only possibility is to run the SQL query directly on PostgreSQL, using the SynDB connection properties.
ILIKE use falls into the category of optimization for a single SQL engine, so is not handled by the ORM.
Yes but the objective is to use the ORM anyway ..
So I use the Uppercase method.
And to return to the RDBMS "specificities", I think the caracters " . " or "UPPERCASE" are not just a specificitiy. It's a standard...
Thank you !
Hi,
How can I do a ILIKE pgsql with the ORM ? "Like" is working but not iLike
Thank's !
And with uppercase too
A schema with . in it?
I just hate RDBMS specificities.
Yes with . in it !
My connection is working well. But there's a problem in the framework.
When a schema contains a . in the name, mORMot doesn't generate the " " around the name.
Hi,
I'm working on a new part of my projet. I just added RTTI to my server and now I'm trying to connect my server to PostgeSQL.
I used this
PropsPostgreSQL := TSQLDBZEOSConnectionProperties.Create(
TSQLDBZEOSConnectionProperties.URI(dPostgreSQL,'localhost:5432'),
'dbname','username','password');
And now my question is, how can I assign these properties ? Can I use a TZConnection or anything else ?
RTTI is now working well. Next step is to connect my server to my Postgresql database with ZEOS.
I found the problem. TestSQL3FPCInterfaces was used in another unit !
Now a last error. Even if I include "My RTTI unit".pas, I have the "No RTTI available for ..."
I have a new error, only with FPC :
The wrapper generator need to access the FPC-mORMotInterfaces.pas.mustache template.
Ok all is now clear. Thank's a lot !
This should be the folder where the cross-platform templates files are available on your local computer.
It depends where you did unzip the framework source code.
Ok I corrected my links but what are they for ?
What does
['..\CrossPlatform\templates','..\..\CrossPlatform\templates']
exactly mean ?
If you like to experiment .... you could try this:
1)
Use fpcup to install the special branch of fpc, that includes an RTTI extension.
fpcup --fpcURL="rtti" --installdir="myspecialfpcdir"
https://github.com/LongDirtyAnimAlf/Reiniero-fpcup2)
enable fpc RTTI inside of synopse.inc
{.$define HASINTERFACERTTI} ... remove dotNote: this additional RTTI is (at the moment) only available for i386, X86_64 and ARM.
I already tried fpcup and I prefer CodeTyphon. But this is an other way to use RTTI, it's interesting.
Without the SQLite3ConsoleTests, of course: put here some code using your IIDAPSignaling interface with mORMot (or simply register it).
Yes of course
You have to run it under Delphi!
But Delphi 6 is enough - or any later revision.
With Delphi ok ! Thank you for the speed of your response