#1 Re: mORMot 2 » [Resolved]TDocVariant bug in mORMot2? » 2024-05-12 18:34:39

I'm using lazarus3.2+fpc3.2.2,I will try the fixes branch,Thanks!

#2 mORMot 2 » [Resolved]TDocVariant bug in mORMot2? » 2024-05-12 01:48:08

delphi_911
Replies: 2

Here is a really simple code in mORMot1 is OK.

 
    v := TDocVariant.NewJSON('{"U":"ad","P":"12"}'); 
    s := v.U;  // ---  property not found here with mORMot2 

---------------
Regards,
YANG

#3 mORMot 1 » Incorrect result of "IsValidJSON"? » 2021-06-08 09:22:26

delphi_911
Replies: 1

Hi, is it a problem of this function?

 uses SynCommons;
          b := IsValidJSON(StringToUTF8('100')) ; // b =True  

With best regards.

#4 Re: mORMot 1 » Template for generating Swagger-UI-JSON » 2020-02-06 07:32:11

Please confirm:
If TNullable* types in TSQLRecord(ORM Record), unable to generate correct JSON.

THANKS!

#5 Re: mORMot 1 » TSynBinaryDataSet Error [SQLite3] » 2019-08-22 01:47:54

const SQL_PEOPLE = 'select 1 as KeyID, firstname from People where firstname = ''YANG'''; 

With a computed field, if no data(0 row) retrieved, raise error:"GetFieldData ColumnType=Unknown".


I have changed source code to avoid this problem in SynDBVCL.pas, but I am not sure whether this is a correct modification.

-------------------------------------------------------------------------

procedure TSynBinaryDataSet.InternalInitFieldDefs;
var F: integer;
    DBType: TFieldType;
begin
    ......
    case ColumnType of
    ......
    SynTable.ftDouble, SynTable.ftCurrency:
      DBType := ftFloat;
    else
      if (fDataAccess.DataRowCount = 0) then //------ Check RowCount  here------
        DBType := ftDefaultMemo else
      raise EDatabaseError.CreateFmt(
        'GetFieldData ColumnType=%s',[TSQLDBFieldTypeToString(ColumnType)]);
    end;
    FieldDefs.Add(UTF8ToString(ColumnName),DBType,ColumnDataSize);
  end;
end; 

#6 Re: mORMot 1 » TSynBinaryDataSet Error [SQLite3] » 2019-07-12 02:38:36

const SQL_PEOPLE = 'select 1 as KeyID, firstname from People where firstname = ''YANG'''; 

Error:"GetFieldData ColumnType=Unknown".

---------------------
@ab, Still this problem. Please check, Thanks.

#7 Re: mORMot 1 » TSynBinaryDataSet Error [SQLite3] » 2019-06-17 01:57:16

@ab, I wrote a demo, it can reproduce the problem. Please download and check,Many thanks!
http://129.204.55.202/ilabstar/files/Test.rar

delphi ver. 10.2.3

#8 Re: mORMot 1 » TSynBinaryDataSet Error [SQLite3] » 2019-06-14 14:23:25

I do not think the SQL is wrong, consider these SQL: table t0,  2 fields: x and y, if no data(0 row in table), still raise error with the following statement.

  const SQL = 'select x*y as value from t0'; 

or this SQL:

  const SQL_PEOPLE = 'select lastname || firstname as FULLNAME, * from People';

#9 Re: mORMot 1 » TSynBinaryDataSet Error [SQLite3] » 2019-06-14 12:08:55

@ab Sorry, I changed the code, with a computed field:

const SQL_PEOPLE = 'select 1 as KeyID, firstname from People where 1=2';

then got the error:"GetFieldData ColumnType=Unknown".

#10 Re: mORMot 1 » TSynBinaryDataSet Error [SQLite3] » 2019-06-14 01:34:40

@ab, There still has the same error with following statement, "GetFieldData ColumnType=Unknown"

select F1, F2 from Table1 where 1=2

#12 Re: mORMot 1 » TSynBinaryDataSet Error [SQLite3] » 2019-05-30 03:11:16

@ab, Hi, I found another question. There's a table t0,  2 fields: x and y, if no data(0 row in table), still raise error with the following statement.

select x*y as value from t0;
//or
select 1 as ID, x, y from t0;

-----
Best regards

#14 Re: mORMot 1 » TSynBinaryDataSet Error [SQLite3] » 2019-05-29 07:40:11

I have debugged the code, with SQLite3, if there was a computed field in SELECT statement, e.g.

select 1 as ID;
select F1*F2  from Tbl;
function TSQLRequest.FieldDeclaredType(Col: Integer): RawUTF8;
var P: PUTF8Char;
begin
  if cardinal(Col)>=cardinal(FieldCount) then
    raise ESQLite3Exception.Create(RequestDB,SQLITE_RANGE,'FieldDeclaredType');
  P := pointer(sqlite3.column_decltype(Request,Col));
  FastSetString(result,P,SynCommons.StrLen(P));
end;

// Result here was empty. Then ColumnTypeNativeToDB won't get the field type correctly.

#15 mORMot 1 » TSynBinaryDataSet Error [SQLite3] » 2019-05-28 12:15:49

delphi_911
Replies: 18

Hi,  how to fix this ERROR?

ToDataSet(aDataSet, AProp.Execute('select cast(2.2*3.4 as Currency) as F1', []));

AProp is TSQLDBSQLite3ConnectionProperties, connecting to a SQLite3 DB, ERROR message :

"GetFieldData ColumnType=Unknown"

---------------
Many thanks!

#16 Re: mORMot 1 » How to Encrypt/Decrypt with AESECB? » 2019-05-13 03:02:17

keinn wrote:
var
  ret:rawbytestring;
  display:rawutf8;
begin
aes:=TAESECB.Create('123',128);
try
  ret :=aes.EncryptPKCS7('mORMot is awesome!');
  display :=BinToHex(ret);
finally
  aes.free;
end;
end;

here the display result is 76D7EC0CD8E8EACA15F8214126A62D3A7C503EB0820B52233986FF917554669C
it is wrong.
when use 128 KeySize , the result should be 1d35c8513d106079e66c1f13a0e57eb5d96f97231f345b07bd42ae6d9dd02694

How to generate the key in this case? Many thanks!

#17 mORMot 1 » Unit mORMotUIEdit.pas Compiled Error [v6934] » 2019-04-29 02:27:13

delphi_911
Replies: 1

[dcc32 Error] mORMoti18n.pas(2207): E2250 There is no overloaded version of 'Hash32' that can be called with these arguments

#18 Re: mORMot 1 » Template for generating Swagger-UI-JSON » 2019-03-08 01:55:35

Another question: [array of const] in param, a error: "TJSONRecordRTTI.Create: error when retrieving enhanced RTTI for TVarRec", any suggestion?

Thanks.

#19 Re: mORMot 1 » Template for generating Swagger-UI-JSON » 2019-03-08 00:39:21

Thanks @ab, it's OK now. I use XE10.2, it does not store pas files as UTF-8 by default.

#20 Re: mORMot 1 » Template for generating Swagger-UI-JSON » 2019-03-07 09:31:31

Unable to display Unicode characters correctly and How to fix it?

Many thanks.


type
  /// comment
  ITest = interface(IInvokable)
    ['{3C7A4F39-88C2-4A10-9BC1-1B8AB0FFC5FB}']
    ///中文,こんにちは, 안녕하세요
    function Hello(aName: RawUTF8): RawUTF8;
  end;

#21 Re: mORMot 1 » Template for generating Swagger-UI-JSON » 2019-02-28 03:39:39

How to generate method/param descriptions for swagger-UI?

Many Thanks!

#22 mORMot 1 » TIMESTAMP field in MSSQLServer DB » 2019-01-24 07:03:32

delphi_911
Replies: 1

Hi, everyone,
how to write a TSQLRecord class, there is a field, I need to Create a TIMESTAMP(DB Data type) field in MSSQLServer? (TUnixTime map to bigint)

Many thanks.

#23 Re: mORMot 1 » Memory leaks when access remotely syndb[connect error] » 2018-09-13 03:40:26

All code:

var
  Form1: TForm1;
  Props: TSQLDBWinHTTPConnectionProperties;

implementation

{$R *.dfm}

procedure TForm1.btn1Click(Sender: TObject);
begin
  Props := TSQLDBWinHTTPConnectionProperties.Create('127.0.0.1', 'test', 'test', 'test'); //connect error hear
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  ReportMemoryLeaksOnShutdown := True;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  Props.Free;
end;

#25 Re: mORMot 1 » Memory leaks when access remotely syndb[connect error] » 2018-09-05 09:38:14

Form OnCreate even:

ReportMemoryLeaksOnShutdown := True;

#26 mORMot 1 » Memory leaks when access remotely syndb[connect error] » 2018-09-05 08:28:38

delphi_911
Replies: 4

Hi, is it a bug or my mistake?  Thanks!

1、 create TSQLDBWinHTTPConnectionProperties to connect romote db
 

  try
    Props := TSQLDBWinHTTPConnectionProperties.Create(s1, s2, s3, s4); //connect error hear
  finally
    Props.Free;
  end;
 

2、When program exit, An unexpected memory lead has occurred.

13-20 bytes:AnsiString * 4
21-28 bytes:AnsiString * 2
45-52 bytes:AnsiString * 1
285-300 bytes:TSQLDBWinHTTPConnectionProperties * 1

3、TSQLDBWinHTTPConnectionProperties or TSQLDBSocketConnectionProperties or TSQLDBWinINetConnectionProperties all have the same problem.

#28 mORMot 1 » SynDB - ToDataSet Error » 2018-07-28 08:50:20

delphi_911
Replies: 0

In MSSQL DB: A table has 13 columns, all type are int. There are 30 rows, All fields have null data but Field1 and Field2.
If exec 'select * from tbl' , break here:


//---------------------------------------------------------------------------
Line:
procedure TSQLDBProxyStatementAbstract.IntHeaderProcess(Data: PByte; DataLen: integer);
...
...
   if (fColumnCount>sizeof(TSQLDBProxyStatementColumns)shl 3) or
       (cardinal(fDataRowCount)>=cardinal(DataLen) div cardinal(fColumnCount)) then
      break;
...
//---------------------------------------------------------------------------

Kind Regards.

Board footer

Powered by FluxBB