#1 Re: mORMot 2 » Prepare expected 1 parameters in request, found 0 » 2023-02-20 12:47:46

Problem is not in `?`, problem is if DESCRIPT contains single quotes ' and question marks ?
Example 1 - success:

Props.ExecuteInlined('insert into NEW_TABLE (ID, DESCRIPT) values (4, ' + QuotedStr('I''m confused') + ');', False);

Example 2 - success:

Props.ExecuteInlined('insert into NEW_TABLE (ID, DESCRIPT) values (4, ' + QuotedStr('Im confused?') + ');', False);

Example 3 - error:

Props.ExecuteInlined('insert into NEW_TABLE (ID, DESCRIPT) values (4, ' + QuotedStr('I''m confused?') + ');', False);

#2 Re: mORMot 2 » Prepare expected 1 parameters in request, found 0 » 2023-02-20 10:16:07

Thank you for your suggestion, but I'm getting sql-query from other system.
I just want to execute queries.

#3 mORMot 2 » Prepare expected 1 parameters in request, found 0 » 2023-02-19 17:17:26

senad
Replies: 5

Hi,
Whats wrong with this SQL query?
I have simple test Table (FIREBIRD):

CREATE TABLE NEW_TABLE (
    ID        INTEGER NOT NULL,
    DESCRIPT  VARCHAR(100)
);

i'm getting an error when trying to insert single quotes and question marks in DESCRIPT

Props.ExecuteInlined('insert into NEW_TABLE (ID, DESCRIPT) values (4, ' + QuotedStr('I''m confused?') + ');', False);

But, there is no parameters in this simple query.

Problem seems to be in "mormot.db.sql.ReplaceParamsByNames"?!

#5 mORMot 2 » DynArrayLoadJSON mormot1 vs mormot2 » 2023-02-08 11:03:21

senad
Replies: 2

Hi,
why is null as double in mormot2 not excepted?
this code works fine in mormot1.

procedure TForm1.Button1Click(Sender: TObject);
type
  TTestRec = packed record
    a: Integer;
    b: Double;
    c: RawUTF8;
  end;
  TTestRecDynArray = array of TTestRec;
var
  hTmpBuff: TSynTempBuffer;
  hArr: TTestRecDynArray;
begin
  hTmpBuff.Init('[{"a":0,"b":null,"c":"abc"}]');
  if (DynArrayLoadJSON(hArr, hTmpBuff.buf, TypeInfo(TTestRecDynArray)) = nil) then
    ShowMessage('error');
  hTmpBuff.Done;
end;

Board footer

Powered by FluxBB