You are not logged in.
Pages: 1
I test with the TPdfDocumentGdi , and set the i from 1 to 70000,it out of memory!
var
// PDF: TPdfDocument;
PDF: TPdfDocumentGDI;
PDFPage: TPdfpage;
SW: TStopwatch;
I: Integer;
FS: TFileStream;
pdfImage: TPdfImage;
BarCode: string;
X, Y: Single;
aRect: TRect;
begin
SW := TStopwatch.StartNew;
PDF := TPdfDocumentGDI.Create;
// PDF := TPdfDocument.Create;
FS := TFileStream.Create(ExtractFilePath(Application.ExeName) + 'output.pdf', fmCreate);
try
PDF.NewDoc;
PDF.PDFA1 := True;
PDF.DefaultPaperSize := psA4;
PDF.SaveToStreamDirectBegin(FS);
aRect := Rect(Point(20, 40), Point(60, 80));
for I := 1 to 70000 do
begin
PDF.AddPage;
BarCode := IdGenerator.NextId.ToString;
GDICommentJpegDirect(PDF.VCLCanvas.Handle, 'd:\test.jpg', aRect);
PDF.SaveToStreamDirectPageFlush(True);
end;
PDF.SaveToStreamDirectEnd;
Memo1.Lines.Add(SW.ElapsedMilliseconds.ToString);
finally
PDF.Free;
FS.Free;
end;
My code is as follows, the image test.jpg is only 5kb in size. The program ran for more than 10 minutes, but did not receive the expected PDF file. Finally, it indicated that there was insufficient memory.
How can I improve it? Thank you!
var
PDF: TPdfDocument;
PDFPage: TPdfpage;
SW: TStopwatch;
I: Integer;
FS: TFileStream;
pdfImage: TPdfImage;
BarCode: string;
X, Y: Single;
begin
SW := TStopwatch.StartNew;
PDF := TPdfDocument.Create;
FS := TFileStream.Create(ExtractFilePath(Application.ExeName) + 'output.pdf', fmCreate);
try
PDF.NewDoc;
PDF.PDFA1 := True;
PDF.DefaultPaperSize := psA4;
PDF.SaveToStreamDirectBegin(FS);
for I := 1 to 30000 do
begin
PDF.AddPage;
BarCode := IdGenerator.NextId.ToString;
pdfImage := TPdfImage.CreateJpegDirect(PDF, 'd:\test.jpg', True);
PDF.AddXObject(BarCode, pdfImage);
X := 200;
Y := 800;
PDF.Canvas.DrawXObject(X, Y, 30, 30, BarCode);
pdfImage.ForceSaveNow;
PDF.SaveToStreamDirectPageFlush(True);
end;
PDF.SaveToStreamDirectEnd;
Memo1.Lines.Add(SW.ElapsedMilliseconds.ToString);
finally
PDF.Free;
FS.Free;
end;
thank you,it works!
my code:
var
PDF: TPdfDocument;
R: TPdfRect;
R.Left := 30;
R.Top := 500;
R.Right := 100;
R.Bottom := 800;
PDF.Canvas.SetFont('Times New Roman', 12, []);
PDF.Canvas.MultilineTextRect(R, 'Welcome to mORMot Open Source', True);
Only the text 'Welcome to' is displayed, no other text is displayed.
Thanks.
Thanks,ab.
My code:
var
props: TSQLDBWinHTTPConnectionProperties;
SQL: TStringBuilder;
begin
props := TSQLDBWinHTTPConnectionProperties.Create('127.0.0.1', 'XXX', '123', '123');
SQL := TStringBuilder.Create;
DD := TSynDBDataSet.Create(self);
DD.Connection := props;
SQL.Append('SELECT XGSTUFSID,XM,').AppendLine;
SQL.Append('CASE WHEN SUBSTRING(BKZYDM,3,1) IN(''5'',''6'') THEN ''2'' ELSE ''1'' END LX').AppendLine;
SQL.Append('FROM BBK').AppendLine;
DD.CommandText := SQL.ToString;
DD.Open;
When I modify the field of XM,and call Post and ApplyUpdates(0),but no data was saved.
How can i do ?Thanks.
Hi:
EgonHugeist,Can you send a copy of the updated the Native ASA driver of zeos for V17 to me?My Email:51536348@qq.com.
Thanks!
Just a note from me: I've updated the Native ASA driver of zeos for V17. Also did i add a new driver with protocol name "asa_capi" for the recommended sybase api.
Are you sure that the 40,000 records are actually fetched, and not only the first dozen, just enough to be displayed?
We don't use open cursors (which tend to put any DB server on its knees when too much cursors are opened at once), but fetch all records as JSON and close the statement ASAP.
If it is too big/slow, reduce the number of records fetched by using paging.I am not convinced that NativeDB is faster than FireDAC or Zeos. Usually, Zeos is faster than anything else on Delphi.
For instance, ZDBC or our SynDB classes are like NativeDB in concept: it bypasses the DB.pas unit and TDataSet.
I still suppose you are not fetching all rows, just the first ones.
For SQL Anywhere 17, I believe NativeDB is the fastest, this can be verified by testing.
So,currently,NativeDB is the best solution to access SAP SQL Anywhere.
Zeos can connect to the database, but it prompts an error when querying and failed.
The NativeDB query statement is the same as FireDAC, and the total amount of data to be obtained in the end is similar to the following code:
query.sql.add ('select * from test');
query.open();
query.fecthall();//for firedac
memo.lines.add (query.recordcont.tostring);
"Slow" is relative, mainly because NativeDB is too fast. I have tested, access SQL Anywhere on local machine, take out 40,000 records, NativeDB only needs 6-11ms, and FireDAC needs 700-900ms. As the server side, this speed experience is very obvious. Therefore, I hope to increase the NativeDB driver, thanks.
You can try SynDBOleDB, SynDBODBC or SynDBZeos. Hope all of them can connect to Sybase.
Thank you,they are too slow.
Hello:
NativeDB is a special drive for Sybase SQL Anywhere and extremely fast,NativeDB see http://www.nativedb.com/.
I want to use it for TSQLDBServerHttpApi,although now using TSQLDBFireDACConnectionProperties can connect to Sybase SQL Anywhere, but it's speed is relatively slow, far less than NativeDB.
Hope to add the NativeDB driver support for Sybase SQL Anywhere.
Thank a lot!
Thank you,i'll try to do it.
Hello:
I am a new user of mormot,and more interested in TSQLDBServerHttpApi.
I want to use redis as a session manager for TSQLDBServerHttpApi,clients that have not passed session authentication cannot access the TSQLDBServerHttpApi server,BUT:
1) How to combine this redis session manager with TSQLDBServerHttpApi?
2) How does the client carry the session to access TSQLDBServerHttpApi
Thanks!
It's work well.
Thank!
It is not supported yet.
What is the closest SQL dialect?
It's Transact-SQL ,like MS SQL.
Hope to support it as soon as possible.
Thanks a lot!
I wanted to connect to SAP SQL Anywhere 17 by TSQLDBFireDACConnectionProperties:
var
FD: TSQLDBFireDACConnectionProperties;
FD := TSQLDBFireDACConnectionProperties.Create('ASA?ENG=test', 'TEST',
'dba', 'sql');
Error Message:
TSQLDBFireDACConnectionProperties.Create:unknown provider-available: OraMSSQLMSAccMySQLSQLiteIBPGDB2Infx.
How to connect to the SAP SQL Anywhere 17 by TSQLDBFireDACConnectionProperties?
Thanks.
Pages: 1