You are not logged in.
@ab
Since november that I haven't updated mORMot. I have a program that uses TSynVirtualDataSet and everything worked OK. Today, after a git pull, the exception is
Project test.exe raised exception class EConvertError with message ''0.42768' is not a valid timestamp'. Process stopped. Use Step or Run to continue.git bisect says the the error is with commit 4b1ef819c6f1d76801bee1896a859a6d08d15f00. Commit message "new GetDBFieldDef and GetDBFieldValue functions to ease filling of any TDataSet from a TSQLTable content". Commit date is january, 23.
The error is in SynVirtualDataset.pas, line 406:TSynVirtualDataSet.GetFieldData. Exception is raised with a Field.DataType = ftDateTime.
This is a bug or a breaking change?
Thank you.
--
Delphi 7, Windows 10, locale brazilian-portuguese, pagecode Windows 1252.
Thank you, Esteban. Very useful changes.
@erick, which tools are you using for Latex?
If you change the type RawJSON to RawUTF8?
In my case, was Skype using port 80.
@ab, I agree with you. I haven't read the official specification, only StackOverflow. This is a undocumented feature.
I have tried to render a simple array with SynMustache
json := '["a","b","c"]';
mustache := TSynMustache.Parse('<ul>{{#.}}<li>{{.}}</li>{{/.}}</ul>');
html := mustache.RenderJSON(json);But I can't, because SynMustache don't render this template. I think this is a bug. Please see this entry in Stackoverflow.
I am very interessed in a DDD example with a desktop mORMot client
Like a TTable.RecNo?
I can think of complex structures using arrays. Can you give a example of complex structs using the Variant type?
Yes! Please make DBISAM and ElevateDB mORMot compatible ![]()
@Esteban, what if you fork the git repo?
A extra step was needed. Works now:
var
Blob: RawByteString;
SQLRawBlob: TSQLRawBlob;
Circumferences: TDoubleDynArray;
begin
Blob := TreeDataset.FieldByName('Circumferences').AsString;
SQLRawBlob := BlobToTSQLRawBlob(Blob);
DynArrayLoad(Circumferences, Pointer(SQLRawBlob), TypeInfo(TDoubleDynArray));
end;I use Delphi 7.1, and this was happening with my IDE too.
Esteban, Arnaud... I have this situation:
A field in a TSQLRecord descendant that is a TDoubleDynArray, which is retrieved as a blob field by TSynDBDataSet or TSynRestDataSet, or any TSynBinaryDataSet descendant.
type
TTree = class(TSQLRecord)
private
FCircumferences: TDoubleDynArray;
public
Circumferences: TDoubleDynArray read FCircumferences write FCircumferences;
end;My question is: How can I convert this TDataset blob field in a dynamic double array? Which functions I use to do this?
Esteban, what is the correct CommandText syntax? Using the syntax from the documentation (Readme.md) this code
http://address:port/root/tablename/select=*Don't work and give me the exception 'rdsTableName/select=*'' is not a valid component name'.
If I change for tablename?select=* as
http://address:port/root/tablename?select=* // using ? nowThen it works
Thank you, Esteban. I tried TSynRestDataset yesterday, worked well. I read your code and liked what I saw.
But I also want to use the ORM part of mORMot for some more complex reports and services, which select SQL can be up to tens of lines.
Can you tell if TSynRestDataset could handle huge, multiline SELECTs?
And some selects with expressions like
select *, Cidade||'', ''||DDD||'' ''||Telefone as CidadeTelefone from Funcionario At this point, the only option that I see is to create services on the server and return only the serialization of the results as JSON.
Hi
I was thinking about use TSynDBDataSet.CommandText, for some ClientDataSet/DBGrid/dataware access, because is the best way that I know to use mORMot with a RAD/Desktop with SQLite3.
But for some reports and some another operations, I was thinking that ORM or interface based approach would be better.
Whats is the best approach? How to serve two connections to the same SQLite3 database, one with SynDB access and other with ORM/Interface access?
I would like to use mORMotMidasVCL, but I don't know how to save the delta/modifications of ClientDataSet back to mORMot.
Thank you.
Can you help me on this, @AB?
I know what to do with the TSynSQLTableDataSet descendent, but need some instructions about which methods I should override in TSQLRecord.
TSQLRecord.InitializeTable() is a options in this case?
I can create a TSynSQLTableDataSet descendent and write a special case InternalInitFieldDefs. It this the best approach?
But the mORMot engine will create the Volume field in the table? I don't need and can't have that field in the table. Can you show me some sample code?
I am migrating a old project with TTable/TQuery to mORMot. There are some calculated fields that I want to have in the my TSQLRecord class.
But I don't want to send this fields/calculations to the server. Example
property Volume: Double read FVolume; // or GetVolume
I need Volume in published section, because I need Volume when I convert to TSynSQLTableDataSet, for use with report generators.
Any ideas, AB?
Lower is better?
I have examples of converting json with JSONToDataSet().
@ab, can you write a quick example using array of objects?
I think that you need memory mapped streams.
See http://synopse.info/files/html/api-1.18 … REAMMAPPED
There are also a TMemoryMapText class, "much faster than TStringList.LoadFromFile()", in SynCommons.pas
Which is better, @ab?
I will need to consume a web service.
There are a way using some mORMot function to create a class or record or some another structure to have some syntax sugar to implement this?
What happens if you change this
try
result := T.ToObjArray(result,Table); <------- HERE access violation
finally
T.Free;
end;to this?
try
result := T.ToObjArray(ObjArray,Table);
finally
T.Free;
end;I can't get it.
function TSQLRest.RetrieveListObjArray() is Boolean, but you are using Result as a [absolute] TObjectDynArray in ObjArrayClear()
Very nice. Thank you.
@ab, what is the current road-map today?
Ab, have you seen this?
If I try to serialize a array to Json with TDynArray.SaveToJson, Delphi 7 give me this compiler error:
TEspecieCategorias = packed record
EspecieID: Integer;
Categorias: TCategorias;
CT: Double;
CTR: Double;
end;
[...]
TTextWriter.RegisterCustomJSONSerializerFromText(TypeInfo(TEspecieCategorias), __TEspecieCategorias);[Error]: Type 'TEspecieCategorias' has no type info.
But if I add a string field, then Delphi will generate type info.
TEspecieCategorias = packed record
EspecieID: Integer;
Categorias: TCategorias;
CT: Double;
CTR: Double;
Dummy: string; // <--------- don't use for nothing
end;
[...]
TTextWriter.RegisterCustomJSONSerializerFromText(TypeInfo(TEspecieCategorias), __TEspecieCategorias);Then Delphi 7 will compile and everything will work. Very weird.
Question: The record type need to be packed?
Warley, the javascript code in your example is minified, I think. Can't read.
I use
git pull
This is weird. I tried again and it worked now.
Thank you again.
Thank you.
Another question: just to sort a already existing array, how to do? If I try to init a TDynArray to a existing array, I can't sort. This code gives me an AV when call AList.Sort.
var
Especies: TEspecieArray;
begin
Especies := GetAllEspecies;
AList.Init(TypeInfo(TEspecieArray), Especies);
AList.Compare := MyCompareItem;
AList.Sort;
end;My workaround is create a new array, call AList.AddArray() and then Sort. There are a better approach?
function SortEspecies: TEspecieArray;
var
SortedEspecies: TEspecieArray;
Especies: TEspecieArray;
begin
Especies := GetAllEspecies;
AList.Init(TypeInfo(TEspecieArray), SortedEspecies);
AList.AddArray(Especies);
AList.Compare := MyCompareItem;
ALista.Sort;
Result := SortedEspecies;
end;Ab, I am working with TDynArray with Delphi 7.
Everything is OK, but now I need to change the way to find items in the list.
TEspecie = record
EspecieID: Integer;
Nome: string;
.. some other fields..
end;When I am building the list, I need to search for the 'Nome' field. After, I will need to search by the 'EspecieID' field.
How to change Find() / FindAndFill() to work like this?
Thank you in advance.
Yes, virtual methods for this type of object is very buggy in Delphi 7. Thank you, AB.
AB, I am using Delphi 7 and DynArrayHashed with success, to process a dictionary of a record. Thank you very much about this.
type
TEspecie = record
.. some fields here ..
end;But now I need to transform TEspecie in a old fashion object (not a class).
type
TEspecie = object
.. some fields here ..
.. some methods here..
end;Can DynArrayHashed handle old objects? Will it work the same way?
I can't find any Delphi made server in that benchmark list. If i had time, I would write a benchmark.
By the way, if you or someone in this community start this project, I would be happy to contribute.
AB, can mORMot be used in this benchmark?
I am using Delphi 7, Windows 8.1, and I need to show the greater than or equal to sign in a caption (TLabel).
I can't type this sign, and the IDE don't accept using copy and past. I don't know what to do.
What if I post a flac audio file (or stream) for the google Speech Api? TDocVarient will handle this?
PDF Toolkit can be a option.
Thank you.
Before I asked this question, I have read the documentation and found ToDataSet() and ToClientDataSet(). But I don't know how to use them with my TSQLAnimal class. The examples show only with direct aProps.Execute(), not in the ORM way.
May I ask you to show a example of aTSQLRecord.FillPrepare + ToClientDataSet()?
Arnaud?
Some years ago, I used TSynSQLTableDataSet to create a TDataset from a FillTable.
I need to create a report from a TSQLRecord descendant in FastReport, now. I see that mORMot have new ways of create TDatasets. There are a better way now?
uses mORMotVCL;
var
Animal: TSQLAnimal;
begin
Animal := TSQLAnimal.Create;
try
Animal.FillPrepare(DB, 'Nome=?',['Tom']);
ds1.Dataset.Free;
ds1.DataSet := <some-thing-to-dataset>(Animal);
// create my report
finally
Animal.Free;
end;
end;What about performance and .exe size?
AntonE, please put your project in a github account ![]()