You are not logged in.
You already have everything you need in mORMot
See FTS mORMot documentation
This sound good. Only I thing is not clear. I should duplicate my text in regular TSQLRecord table and in associated TSQLRecordFTS3 or store it only in TSQLRecordFTS3. What is the good approach?
In my application I use mORMot Framework to store some record with text fields.
Now I want add a smart search about these text, something like google for webpage: I have some words or phrases and I need sort by best result (based on relevance), do you know some library about this? It would be fine also if it is does not integrate with mORMot Framework (I can extract data with mORMot Framework then use library to order the result).
I'm looking for something open source or free to use with delphi.
On server side is there a way to trigger database changes? I have find OnUpdateEvent event however this event is call "is called BEFORE deletion, and AFTER insertion or update". I need of a way to know when the database is ready after a upgrade (deletion, insertion, update) to copy it on remote location.
Is there a way? Thanks
In the past I have create a table with a column defined as TEXT column.
However I have saved numbers and not text inside this field, so now I'd like change column definition to FLOAT.
I have try to use external editor but I get always the same error: "no such collation sequence:_SYSTEMNOCASE".
I need change it in alternative when I use SUM inside my query I get problem with negative numbers.
Is there a way to do this?
Try with the latest version.
Also check if the callback has not been released on the client side.
See also the CallbackReleased() kind of method (defined e.g. in IServiceWithCallbackReleased). It would allow the server to be notified when a callback has been released on the client server side, to avoid such errors.
Please considers this scenario: there is a server application and a client application. After run server application, you run client application. Now for same reason the client application is terminate with a "no standard mode", for example the application process is terminate from task manager. Now client is run again.
I think in this case the there are problem with callback in fact I get a error like my last image posted on this thread.
Is it right or something wrong?
Is there a way (just implemented) to send a notify from server to client when there is a change on DB.
I'd like add the clients GUI when there is a change on DB. In this moment my clients update the DB when the user change windows status from minimized to normal or maximized, however thi update the GUI without reason in many case.
I like know if there is a way to optimize this procress so the client can update the GUI when needed and only the piece of GUI needed (for example if there change only on table Product the client will update only the GUI about this table).
Is this just implemented or I need do it?
It means that the server was not able to send a notification to the client.
Are you using the latest version of the framework?
One potential cause may be that the callback has been released on the client side, so when the server tries to release it, it can't find it.
I have update the framework some week ago. I think in april.
I using WebSockets to change message (commands) between server and client.
Sometimes I get an error on client (see image).

can you help me to understand the problem?
I have define a TSQLRecord with a "file" field. This is a RawUTF8 variable where I save a subfolder path.
For example I have this path "SERVER\\mypath\subfolder1\subfolder2\" and I use "file" field to save the string "subfolder1\subfolder2\".
The first part of my path ("SERVER\\mypath\") can change se I don't save this on "file" field.
I'd like to do this:
1. the client ask TSQLRecord to server;
2. the server get the TSQLRecord from db and then edit "file" field from "subfolder1\subfolder2\" to "SERVER\\mypath\subfolder1\subfolder2\";
3. the server send the TSQLRecord (edit by server) to client.
Is it possible?
On my application I use a WebSockets to send command from server to client.
When the administrator close database on server application, the server application send a message to client about it and then free all variables.
The client receive the message then hide the gui about the database and free all variables about it.
I get and error on client when TSQLHttpClientWebsockets is free: "SndLow 10053 (Connection aborted by the software of the host computer)".
No!
As stated by the doc store your filter value with the callback interface in an array of records or a class list.
I have read 16.7.1, 16.7.1.1, 16.7.1.2 and 16.7.1.3 but I don't have find it.
Edit: I have found it on 16.7.2.3. Thanks
What is the right way to store "pseudo" value inside the interface?
"Join" function on Project31ChatServer save the interface inside an array then "BlaBla" send a message to all clients.
The server cannot identify the single client, so on "Join" I want save "pseudo" inside interface so the server will send the message to single client by "pseudo".
I have add a property to IChatCallback:
IChatCallback = interface(IInvokable)
['{EA7EFE51-3EBA-4047-A356-253374518D1D}']
procedure BlaBla(const pseudo, msg: string);
function GetPseudo : string;
procedure SetPseudo(aValue: string);
property Pseudo: string read GetPseudo write SetPseudo;
end;
...
TChatCallback = class(TInterfacedCallback,IChatCallback)
protected
fPseudo: string;
procedure BlaBla(const pseudo, msg: string);
function GetPseudo : string;
procedure SetPseudo(aValue: string);
public
property Username: string read GetPseudo write SetPseudo;
end;
...
function TCommandsCallback.GetPseudo : string;
begin
Result := fPseudo
end;
procedure TCommandsCallback.SetPseudo(aValue: string);
begin
fPseudo:= aValue
end;then I have edit "Join":
callback.Pseudo:= pseudo;
InterfaceArrayAdd(fConnected,callback);When I try to connect my client to server I get this error on server:
Exception class EInterfaceFactoryException with message 'TInterfacedObjectFakeServer.FakeCall(ICommandsCallback.SetPseudo) failed: 'TSQLHttpServer.NotifyCallback(3) returned status=404''. Process Project31ChatClient.exe (2248)
Today I have try ro recompile may application after small changes of GUI, synopse framwork update (I think from [f4c34b7f3b] to [096a477011]) and add SynCommons unit to implement WebSockets (I don't have implement it in this moment, only add the unit).
Now I get this error: "TSQLHttpServer: http.sys URI registration error #5 for http://+:8080/root (you need to register URI)", after this the software seems to work.
Do you have any idea about a possibile solution? I have test it only on my computer development.
TLongWorkService? How do I decide the client? Sorry but the structure interface structure I just hard to understand.
Fixed the typo in http://synopse.info/fossil/info/baebc40812
Thanks for the feedback!Our interface-based implementation allows all this, and even more.
We don't mess with a GUID for each client, but simply an interface variable per client.
You can store the interface instance on the server, e.g. in a single variable to send a message to a single client, or in an array to broadcast an event to several clients.IMHO our interface-based design is much more powerful, and much cleaner.
It works even on "pure server" side, since by definition, an interface variable works without websockets.
Take a look again at the sample 31, and I'm quite sure you will find out all the potential of our design pattern.
On example 31, where is the interface instance that I will store to contact the single client?
Is it possible add an example to show how use more clients and send a message from server to single client?
I don't have use ColumnBlob until now but the framework don't load the blob by default (to save memory) so you may need to force the blob reading.
TSQLRecord work in this mode.
On my app I use TIdTCPClient and TIdTCPServer (Indy components) to connect clients and server so can I exchange data between them (for example to implement a small chat system and more).
On timeline I have read something about " implement bidirectional client and server protocol". Can I have more information about this? Can I replace my system with this? Is there a example about this?
Thanks
I just use it but I get some problem. I post some piece of code.
This is my TSQLRecord:
TSQLNotes = class(TSQLRecord)
private
fRecordCreated: TCreateTime;
fRecordModified: TModTime;
fParent: Integer;
fKind: Integer;
fTitle: RawUTF8;
fNote: RawUTF8;
fText: RawUTF8;
published
property RecordCreated: TCreateTime read fRecordCreated write fRecordCreated;
property RecordModified: TModTime read fRecordModified write fRecordModified;
property Parent: Integer read fParent write fParent;
property Kind: Integer read fKind write fKind;
property Title: RawUTF8 read fTitle write fTitle;
property Note: RawUTF8 read fNote write fNote;
property Text: RawUTF8 read fText write fText;
end;I need save and load a graph generate from TSimpleGraph, so I use this code to save the graph:
Stream := TRawByteStringStream.Create;
Stream.Position := 0;
SimpleGraph.SaveToStream(Stream);
NotaRecord.Note := S2U(Stream.DataString);
Stream.Free;and then I try to load it with this code:
Stream := TRawByteStringStream.Create;
try
NotaRecord := TSQLNotes.Create(Database,'ID=?',[idRow]);
WriteStringToStream(Stream, NotaRecord.Note);
if (Stream.Size > 0) and (NotaRecord.Note <> '') then
begin
Stream.Seek(0,soBeginning);
SimpleGraph.LoadFromStream(Stream);
end;
NotaRecord.Free;
finally
Stream.Free;
end;However TSimpleGraph return exception when LoadFromStream is call because the stream format is not correct.
What am I doing wrong?
Thanks
Is there somethings link StreamFromString and StringFromSteam functions?
I need save and load a graph generate by a VCL component, this component have LoadFromStream and SaveToStream methods.
Thanks
Clipping issue?
Some more information?
After some test I have a new. In my case the problem is the second DrawText call.
For any page of my PDF only the first DrawText is draw without problem, the second is draw but I cannot see the text, only if select it and copy into blocknote I can see it.
Any idea?
Thanks
I have a similar problem, after upgrade the framework when try to use DrawText I get problem.
This is my code:
temp := 'Tale atto viene presentato per riportare in mappa n. 2 fabbricati non presenti. I fabbricati sono stati costruiti prima del 1967 come dichiarto dal propritario sottoscrivente. Il presente tipo non ha valenza di frazionamento.';
r.Left := 65;
r.Right := lPdf.VCLCanvasSize.cx-65;
r.Top := vpos;
r.Bottom := lPdf.VCLCanvasSize.cy-50-vpos;
DrawText(lPdf.VCLCanvas.Handle, PChar(temp), Length(temp), r, DT_END_ELLIPSIS or DT_NOPREFIX or DT_WORDBREAK or DT_EDITCONTROL);and this is the result:
https://www.dropbox.com/s/bxsfyhxdvbsox … 1.png?dl=0
besides as you can see on next image if I try to select the text and copy it the text is correct, there is a part of text outside the page:
https://www.dropbox.com/s/4clzfjljtsxy2 … 2.png?dl=0
I have try to use tpExactTextCharacterPositining like cocce but I get the same result.
Any idea?
Thanks
just an idea..
maybe you can check number of active session in a callback procedure?
I don't have idea about I do it. Can you indicate the page of documentation where I can found information about it?
Thanks
Is there a way to limit the number of client.
On my server app I have allow connect only for a number of client, for example only 5 clients. If other clients try to connect my server app must reject the connection.
Is there a simple way to do it?
regards
The "double quote" is a error. I'm not copy the code but rewrite it on post and then I have put a double quote.
Thank you fot this and for your great job.
I had nothing else to do in the last two months, so I could not follow the development of the project.
I have 2 projects where I use the mORMot framework, I have try to compile them with last version of framework. I think and I hope to have update right my code but I have a problem, how I must replace
Database.EngineExecute('VACUUM');where Database is a TSQLRestClientURI in first project and TSQLRestClientDB in second project?
Is right use:
DatabaseServer.DB.Execute('VACUUM'); // on first project (DatabaseServer is TSQLRestServerDB);
Database.Server.DB.Execute(''VACUUM'); // on second projectLast question, the first project need of database backup function, so I have replaced this code:
Stream := TFileStream.Create(Folder + NewName + '.cbbak', fmCreate);
try
Stream.Seek(0, soFromBeginning);
DatabaseServer.Backup(Stream);
finally
Stream.Free;
end;with this
DatabaseServer.DB.BackupBackground(Folder + NewName + '.cbbak', 1024, 0, BackupProgressEvento);
DatabaseServer.DB.BackupBackgroundWaitUntilFinished;Is my new code right or need of some fix?
Thanks
Imagine the record with the highest id has been deleted. Can you tell right away what the next ID will be?
It's an implementation detail and you should never rely on that.
You are right.
I think you should add a black record retrieve the id then update it with real data. It's not a good way but I think the only way.
Is it not possible to retrieve the MAX id value from table so add 1?
I have a database with 2 table with this structure:
TABLE1 (about 2000000 records)
id|name|number1|number2|...|...
1|aaa |12.23 |43.17 |...|...
2|bbb |54.145 |77.23 |...|...
3|ccc |65.2345|13.234 |...|...
TABLE2 (about 1500000 records)
id|name|number1|number2
1|ddd |100.121|12.32
2|bbb |76.223 |11.45
3|eee |55.23 |32.1I need compare the rows of TABLE1 with the rows of TABLE2 in this way: if the "name" of TABLE1 is equal the "name" of TABLE2 I need replace "number1" and "namber2" value of TABLE1 with "number1" and "namber2" value of TABLE2.
I have found this query on stackoverflow: http://stackoverflow.com/questions/3845 … -user-name
I have try to use the Synopse editor to call it but after about (2 hours) the editor are not finish besides the application "not responding".
The tables have many rows so I think it's normal a long wait, however I like know:
1. Is there a best way to call this query with your framework?
2. Is there a way to see the progress of query? (to see if the application is blocked and remaining time)
If I comment this 2 lines of SynGdiPlus.pas (on Delphi XE6)
RegisterClass(TJpegImage);
RegisterClass(TPngImage);all works. I thinks is need to add exceptions depending on the version of the compiler.
I think I have found a possible problem: I don't have add this code to my unit:
initialization
Gdip.RegisterPictures;I'm remeber taht with this code in the pas my code works however on recent Delphi version (XE3 and XE6) if I add these line I get an error.
On Delphi XE6 I get
"Exception class EFilerError with message 'A class named TJpegImage already exists'" line 1081 of SynGdiPlus.pas
How can I fix it.
I don't use ForceBlobTransfert so I don't need set ContattoRecord.Document because Database.Add don't use it.
I need save an image into my database, for this I use this code:
SaveAsRawByteString(imgDocument.Picture,doc,gptJPG,80,1500);
ContattoRecord := TSQLContacts.Create;
try
ContattoRecord.Name = "something";
ContattoRecord.Lastname= "something";
id := Database.Add(ContattoRecord, true);
if id > 0 then
begin
Database.UpdateBlob(TSQLContacts, id, 'Document', doc)
end;
finally
ContattoRecord.Free;
end;The image is not save into DB. I have check doc variable after SaveAsRawByteString with this code:
MessageDlg(UTF8ToString(doc),mtError, mbOKCancel, 0);IAnd I get always a black message.
I have use both BMP anf PNG like images for my test.
Any idea?
Yes I use SQLite, so I must only change the field definition on my code, right? Sound good!
Yes I use SynDBExplorer, it works well but sometimes I need of other tools like import data.
I have discovery SQLite Manager a extesion of FireFox (https://addons.mozilla.org/it/firefox/a … e-manager/) I think it support SYSTEMNOCASE besides allow to edit field format.
In any case I will try to edit field definition on my code. Thanks
Hi,
I have a table with a string field, this field have all float number convert to string as value.
Now I need convert this field (and all the record value) from string to double without change field name.
Is there a way to do it?
I have try to edit the database (create with the framework) with 3rd tools like Navicat but I get a message error: "no such collation sequence: SYSTEMNOCASE"
regards
I have the same problem.
OK I make some test with my DB.
1. I have use GetString to retrive text value of fields:
135131870949
135128992597
135115886182
2. I have only change GetString to GetAsDateTime and I get these:
135131870949 -> 30/12/1899
135128992597 -> 30/12/1899
135115886182 -> 30/12/1899
the fields have different value but the datatime is the same.
OK. I have try to open my database with your SynDB Explorer (in the past I have open it with a 3rd editor) and both RecordCreated and RecordModified are not 0.
These are some value:
135039350706
135123213736
Anyway I get "30/12/1899" when I use TSQLTable.GetAsDateTime().
I will make some test.
I'm working on my old project and only today I have update it with last version of framework after many time. I hope is not change something on framework from my last software compile.
The problem is that I use the same function and this work only for some file...
I need save and restore some file from database.
This the code:
TSQLDocuments = class(TSQLRecord)
private
...
fFilename: RawUTF8;
fDocument: TSQLRawBlob;
fSize: RawUTF8;
published
...
property Filename: RawUTF8 read fFilename write fFilename;
property Document: TSQLRawBlob read fDocument write fDocument;
property Size: RawUTF8 read fSize write fSize;
end;To save a file I use "StringFromFile" to convert it in RawByteString then I use UpdateBlob.
To restore I use "FileFromString" to extract file.
For my experience this way work only same type of file. For example I can save/restore TXT and DXF files but I cannot use it with PDF or JPG files, with PDF or JPG the restore file have 0 byte of size. I think these file are not save into database.
Is there error on my code?
NOTE. I have also try to use fDocument: RawUTF8;
regards
I just have try TSQLTable.GetAsDateTime() but I get always "30/12/1899".
I have check on my database: all RecordCreated and RecordModified have 0 as value.
I don't have understand the error, I have a TSQLRecord class like this:
TSQLProjects = class(TSQLRecord)
private
fRecordCreated: TCreateTime;
fRecordModified: TModTime;
...
published
property RecordCreated: TCreateTime read fRecordCreated write fRecordCreated;
property RecordModified: TModTime read fRecordModified write fRecordModified;
...
end;I think these fields (RecordCreated and RecordModified) are handle by framework when I create, add or update a record, right?
I don't edit them by code.
Any ideas?
I have try this:
TimeLogToDateTime(GetInt64(Table.Get(x, y)));but with last versions of framework I get an error: "Invalid argument to time encode".
The some code in the past it's ok.
Any idea?
I need use a query to get data from database as TSQLTableJSON.
TSQLTableJSON of 2 fields as TCreateTime and TModTime (create e edit date of record);
How can I get TDateTime from these 2 fields?
This can hep too me.
I don't understand.
If I update my framework version with this last version, my application will be problem to run on Windows XP by default?
I need to run my application on Windows XP, Vista, 7 and 8, can I update the framework? Do I need change my code?
Thanks
The same code works very well on TPaintBox canvas.
PaintBox1.Canvas.Pen.Width := 2;
PaintBox1.Canvas.Pen.Color := clGray;
PaintBox1.Canvas.Brush.Style := Vcl.Graphics.bsClear;
PaintBox1.Canvas.Brush.Color := clRed;
rt := Rect(100, 100, 200, 100 +20);
PaintBox1.Canvas.FillRect(rt);
PaintBox1.Canvas.MoveTo(100, 100);
PaintBox1.Canvas.LineTo(100, 100+20);
PaintBox1.Canvas.MoveTo(100, 100+20);
PaintBox1.Canvas.LineTo(200, 100+20);Do you have any idea?
Hi,
I have a strange problem with FillRect function. This is the code:
lPdf.VCLCanvas.Font.Name := fname;
lPdf.VCLCanvas.Font.Size := foSmall;
lPdf.VCLCanvas.Font.Style := [];
lPdf.VCLCanvas.Font.Color := clBlack;
lPdf.VCLCanvas.Pen.Width := 2;
lPdf.VCLCanvas.Pen.Color := clGray;
lPdf.VCLCanvas.Brush.Style := Vcl.Graphics.bsClear;
lPdf.VCLCanvas.Brush.Color := clRed;
rt := Rect(100, vpos, lPdf.VCLCanvasSize.cx-100, vpos +20);
lPdf.VCLCanvas.FillRect(rt);
lPdf.VCLCanvas.MoveTo(100, vpos);
lPdf.VCLCanvas.LineTo(100, vpos+20);
lPdf.VCLCanvas.MoveTo(100, vpos+20);
lPdf.VCLCanvas.LineTo(lPdf.VCLCanvasSize.cx-100, vpos+20);This code draw 2 lines and a red fill rectangle. However I see only the fill rectangle. If I remove lPdf.VCLCanvas.FillRect(rt); from code I can see the lines.
I don't understand why? I should see the line over the fill rectangle.
Is it possible add header and footer only from second page?
I don't want them on first page.