#51 mORMot 1 » Compile in Lazarus » 2013-05-27 21:08:11

eraldo
Replies: 2

Hi,

I would like to install the server mORMot (SQLite DB) in a VPS (Linux CentOS or Debian)
Do you have any plans for when you want to support Lazarus?


Congratulations to mORMot

#52 Re: mORMot 1 » Some example with sqlite3_busy_handler » 2013-04-16 21:41:52

eraldo wrote:

Dear admin,

. BusyTimeout does not work...

I try to enter a value greater than 0 but does not work.

  vdb: = TSQLRestServerDB.Create (dm.Model, StringToUTF8 ('base');
  vdb.DB.BusyTimeout: = 2000;


excuse me.
The property BusyTimeout works perfectly.

The confusion was mine.

#53 Re: mORMot 1 » Some example with sqlite3_busy_handler » 2013-04-16 19:20:44

Dear admin,

. BusyTimeout does not work...

I try to enter a value greater than 0 but does not work.

  vdb: = TSQLRestServerDB.Create (dm.Model, StringToUTF8 ('base');
  vdb.DB.BusyTimeout: = 2000;

#54 mORMot 1 » Some example with sqlite3_busy_handler » 2013-04-16 15:20:50

eraldo
Replies: 3

Hello,
 
could someone be kind enough to write a few lines of code using the function sqlite3_busy_handler?



Dear admin,


you can implement the routine to sets a callback function busy_handler in TSQLDataBase?

Thanks

#55 Re: mORMot 1 » EdatabaseError using JSONToDataset » 2013-03-28 13:46:12

wai-kit wrote:

Guess I didn't read the small letters in the documentation :-).
Thanks for the info, Arnaud.

Cheers,
Wai

Hello, Could you post the solution to your problem?
Thus facilitate the understanding to others.

Thank you for your kindness

#56 Re: mORMot 1 » Remote Paging and Sorting using mORMot with ExtJS » 2013-03-27 01:31:45

Hi,
Could you provide the sources of this great example?

#58 mORMot 1 » mORMot on Amazon EC2 » 2012-02-18 05:24:56

eraldo
Replies: 1

Hello admin,

I wonder whether you can use this framework on Amazon EC2.

Has anyone installed a virtual machine in the cloud?

Thank you for your attention.

#59 mORMot 1 » TSQLRequest.PrepareNext » 2012-02-06 12:51:34

eraldo
Replies: 1

Dear administrator

I think I found a bug in the "TSQLRequest.PrepareNext"
I think the right way is:

function TSQLRequest.PrepareNext: integer;
begin
  if (Request=0) or (fNextSQL^=#0) then
    result := SQLITE_DONE else begin
    Close; // free previous statement
    result := sqlite3_prepare_v2(RequestDB, fNextSQL, -1, fRequest, fNextSQL);
    while (result=SQLITE_OK) and (Request=0) and (fNextSQL^<>#0) do // comment or white-space
      result := sqlite3_prepare_v2(RequestDB, fNextSQL, -1, fRequest, fNextSQL);
    fFieldCount := sqlite3_column_count(fRequest);
    sqlite3_check(RequestDB,result); //This function should do the checking before changing the value of result
                                                  //To be generated an exception if there is any error in the script
    if Request=0 then
      result := SQLITE_DONE; // nothing more to add
  end;
end;

My code that throws an exception correctly.
I would like you to tell me if I'm doing right this way

...
  s := TStringList.Create;
  s.Add('BEGIN;');
  s.Add('INSERT INTO XXX(nome) VALUES("TEST1");');
  s.Add('INSERT ERR XXX(nome) VALUES("TEST2");');  // <<<ERROR
  s.Add('INSERT INTO XXX(nome) VALUES("TEST3");');
  s.Add('COMMIT;');
 try
  r.ExecuteAll(db.DB, s.Text);
      except
         on E : Exception do begin
         r.Execute(db.DB, 'rollback;') ;
         ShowMessage( E.Message);
        end;
 end;
  r.Close;
  s.Free;
end;

#60 Re: mORMot 1 » Function problem <TSQLRequest.Prepare> » 2012-02-04 05:57:48

Dear administrator,
I think I found a bug in the "TSQLRequest.PrepareNext"
I think the right way is:

function TSQLRequest.PrepareNext: integer;
begin
  if (Request=0) or (fNextSQL^=#0) then
    result := SQLITE_DONE else begin
    Close; // free previous statement
    result := sqlite3_prepare_v2(RequestDB, fNextSQL, -1, fRequest, fNextSQL);
    while (result=SQLITE_OK) and (Request=0) and (fNextSQL^<>#0) do // comment or white-space
      result := sqlite3_prepare_v2(RequestDB, fNextSQL, -1, fRequest, fNextSQL);
    fFieldCount := sqlite3_column_count(fRequest);
    sqlite3_check(RequestDB,result); //This function should do the checking before changing the value of result
                                                  //To be generated an exception if there is any error in the script
    if Request=0 then
      result := SQLITE_DONE; // nothing more to add
  end;
end;

My code that throws an exception correctly.

I would like you to tell me if I'm doing right this way

  ...
  s := TStringList.Create;
  s.Add('BEGIN;');
  s.Add('INSERT INTO XXX(nome) VALUES("TEST1");');
  s.Add('INSERT ERR XXX(nome) VALUES("TEST2");');  // <<<ERROR
  s.Add('INSERT INTO XXX(nome) VALUES("TEST3");');
  s.Add('COMMIT;');
 try
  r.ExecuteAll(db.DB, s.Text);
      except
         on E : Exception do begin
         r.Execute(db.DB, 'rollback;') ;
         ShowMessage( E.Message);
        end;
 end;
  r.Close;
  s.Free;
end;

#61 Re: mORMot 1 » Function problem <TSQLRequest.Prepare> » 2012-02-03 21:24:43

How do I run the script below as a transaction

  s: = TStringList.Create;
   s.Add ('BEGIN;');
   s.Add ('INSERT INTO title (name) VALUES (' TEST ');');
   s.Add ('INSERT1 INTO title (name) VALUES (' TEST ');');
   s.Add ('END');
   SQLite3DB.ExecuteNoResult (s.Text, []);

I think it should return an exception but it does not.

#62 Re: mORMot 1 » Function problem <TSQLRequest.Prepare> » 2012-02-03 13:21:09

But for SQLite that will be only one transaction?
In other words: No need to start a transaction in order to run all or not run anything if there is a problem?

#63 Re: mORMot 1 » Function problem <TSQLRequest.Prepare> » 2012-02-03 12:09:11

How would I do to properly execute the code below?
So that I received the error regarding the "frontier" what is wrong

var
   st: TStringList.
   r: TSQLRequest;
Begin;
   st: = TStringList.Create;
   begin with the st
     Add ('BEGIN')
     Add ('CREATE TEMP TABLE test (cod INTEGER, name VARCHAR (50));');
     Add ('INSERT INTO test values (1, "alex");');
     Add ('DELETE fron cod where test = 1;');
     Add ('INSERT INTO test values (1, "alex");');
     Add ('END');
end;

#64 mORMot 1 » Function problem <TSQLRequest.Prepare> » 2012-02-03 04:53:57

eraldo
Replies: 6

Dear administrator,

When I have multiple commands within a Begin, End, and one of the commands is wrong, I would have it generated an exception regarding the error.

Example:
When you run the lines below, the function: "function TSQLRequest.Prepare (" does not return the error on the line "DELETE fron cod where test = 1;"

BEGIN;
CREATE TEMP TABLE test (cod INTEGER, name VARCHAR(50));
INSERT INTO  test values (1, 'alex');
DELETE fron test where cod = 1;
INSERT INTO  test values (1, 'alex');
END;

I believe that there can be a change in function

function TSQLRequest.Prepare(DB: TSQLite3DB; const SQL: RawUTF8): integer;
begin
  fDB := DB;
  fRequest := 0;
  if DB=0 then
    raise ESQLException.Create(DB,SQLITE_CANTOPEN);
  result := sqlite3_prepare_v2(RequestDB, pointer(SQL), length(SQL)+1, fRequest, fNextSQL);
  while (result=SQLITE_OK) and (Request=0) do // comment or white-space
    result := sqlite3_prepare_v2(RequestDB, fNextSQL, -1, fRequest, fNextSQL);
  fFieldCount := sqlite3_column_count(fRequest);
  sqlite3_check(RequestDB,result);
end;

If I run the commands without the "Begin, End," is not returned any errors.

I hope you understood what I wanted to show.

#65 Re: mORMot 1 » How to return through a TMemoryStream TSQLRequest? » 2012-01-31 18:54:26

Thank you!

What I wanted was to save and retrieve a component Tkbmmentable with the data in the SQLite and now I get with these changes you made in synSQLite3 unit.

This is an excellent project.

#66 Re: mORMot 1 » How to return through a TMemoryStream TSQLRequest? » 2012-01-31 16:52:51

Thank you,

I solved this problem with your help.

You can show me an example of how to write in a SQLite TMemoryStream.

Something like:

procedure UpdateBlob(const SQL: string; BlobStream: TMemoryStream);
begin
  ...
end;

#67 mORMot 1 » How to return through a TMemoryStream TSQLRequest? » 2012-01-31 15:05:10

eraldo
Replies: 4

Hello administrator,
Can you create within SynSQLite3.pas a function to return a TMemoryStream directly.
It would be like:
TSQLRequest.FieldBlob function (Col: integer): RawByteString;
something like:
TSQLRequest.FieldBlob function (Col: integer): TMemoryStream;

Or someone shows me how to create a function to it.

I appreciate any help.

#68 Re: PDF Engine » How do I add a barcode in a PDF. » 2011-03-23 15:22:44

If we could add a unit to generate bar code would be interesting right?

#69 Re: PDF Engine » How do I add a barcode in a PDF. » 2011-03-21 13:11:42

I understood, but create the bar code is still not possible?

#71 PDF Engine » How to add a bmp or jpeg format from a file. » 2010-09-12 20:49:11

eraldo
Replies: 1

In the example below, how can I import a jpg or bmp file?
I tried several form but got no success.

procedure TForm1.btn1Click(Sender: TObject);
var i: integer;
begin
  with TGDIPages.Create(self) do
  try
    // the title of the report
    Caption := self.Caption;
    // now we add some content to the report
    BeginDoc;
    // header and footer
    AddTextToHeader(paramstr(0));
    SaveLayout;
    Font.Style := [fsItalic];
    TextAlign := taRight;
    AddTextToFooterAt('http://synopse.info',RightMarginPos);
    RestoreSavedLayout;
    AddTextToFooter(DateTimeToStr(Now));
    // main content (automaticaly split on next pages)
    NewHalfLine;
    DrawTitle(edt1.Text,true);
    for i := 1 to 10 do
      DrawText('This is some text '+IntToStr(i));
    NewLine;
    AddColumns([10,20,50]);
    AddColumnHeaders(['#','Two','Three'],true,true);
    for i := 1 to 100 do
      DrawTextAcrossCols([IntToStr(i),'Column '+IntToStr(i),'Some text here']);
    NewLine;
    DrawTitle('This is your text:');
    DrawText(mmo1.Text);
    EndDoc;
    // this method will show a preview form, and allow basic actions
    // by using the right click menu
    ShowPreviewForm;
  finally
    Free;
  end;
end;

#72 Re: mORMot 1 » Using SQLite3Pages as a stand-alone report maker » 2010-09-03 07:12:51

Administrator,

How do you add a bmp image in this example with TGDIPages?
Something like:
Var
  image: TBitmat;

image: TBitmap.Create = (nil)
image.LoadFromFile ('c: \ ...

I appreciate your help

Eraldo

Board footer

Powered by FluxBB