You are not logged in.
Pages: 1
Utf8CompareOS works OK with Chinese/Japanese characters, and much faster then sysstr - AnsiStrComp.
Thank you so much for your support!
I tested [Utf8ICompReference] from mormot.core.unicode. did not get correct order when there were Chinese/Japanese characters.
And found [AnsiIComp] in sysstr.inc got the correct order but a lot more slower.
Env: Windows64 / Lazarus3.2+fpc3.2fix + mORMot2 trunk
var
json: RawUtf8;
dataset: TOrmTableDataSet;
//////////
json := '[{"F":1},{"F":2},{"F":3},{"F":2},{"F":null},{"F":0},{"F":null}]';
dataset := TOrmTableDataSet.CreateFromJson(Application, json, [oftInteger]); // Create a DataSet
dataset.Table.SortFields('F', True); // Sort Field
expected: null, null, 0, 1, 2, 2, 3
actual: 0, null, null, 1, 2, 2, 3
Did I make a mistake?
Another question: I want to sort Japanese/Chinese fields, the {CustomCompare} para in SortFields how should I put in?
Thanks!
I'm using lazarus3.2+fpc3.2.2,I will try the fixes branch,Thanks!
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
Hi, is it a problem of this function?
uses SynCommons;
b := IsValidJSON(StringToUTF8('100')) ; // b =True
With best regards.
Please check https://synopse.info/fossil/info/c60b5cabe2
Please confirm:
If TNullable* types in TSQLRecord(ORM Record), unable to generate correct JSON.
THANKS!
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;
const SQL_PEOPLE = 'select 1 as KeyID, firstname from People where firstname = ''YANG''';
Error:"GetFieldData ColumnType=Unknown".
---------------------
@ab, Still this problem. Please check, Thanks.
@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
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';
@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".
@ab, There still has the same error with following statement, "GetFieldData ColumnType=Unknown"
select F1, F2 from Table1 where 1=2
The same error?
-----
Yes.
@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
Thanks,it works perfectly.
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.
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!
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!
[dcc32 Error] mORMoti18n.pas(2207): E2250 There is no overloaded version of 'Hash32' that can be called with these arguments
Another question: [array of const] in param, a error: "TJSONRecordRTTI.Create: error when retrieving enhanced RTTI for TVarRec", any suggestion?
Thanks.
Thanks @ab, it's OK now. I use XE10.2, it does not store pas files as UTF-8 by default.
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;
How to generate method/param descriptions for swagger-UI?
Many Thanks!
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.
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;
Does anyone found this problem?
Form OnCreate even:
ReportMemoryLeaksOnShutdown := True;
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.
Please check https://synopse.info/fossil/info/a05ff8978d
Also SynDBFireDAC.pas need to fix.
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.
Pages: 1