#101 mORMot 1 » git bisect: 4b1ef819c6f1d76801be is the first bad commit » 2017-02-10 23:28:06

Junior/RO
Replies: 11

@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.

#102 Re: mORMot 1 » Contribution: TSynRestDataset » 2017-02-08 19:28:59

Thank you, Esteban. Very useful changes.

#103 Re: mORMot 1 » 2nd Edition of mORMot book » 2017-02-03 16:22:15

@erick, which tools are you using for Latex?

#106 Re: mORMot 1 » Possible bug in SynMustache: rendering top level arrays » 2016-11-24 19:22:45

@ab, I agree with you. I haven't read the official specification, only StackOverflow. This is a undocumented feature.

#108 mORMot 1 » Possible bug in SynMustache: rendering top level arrays » 2016-11-12 15:51:13

Junior/RO
Replies: 6

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.

#109 Re: mORMot 1 » DDD Sample » 2016-11-07 16:24:04

I am very interessed in a DDD example with a desktop mORMot client

#111 Re: mORMot 1 » Is there some documentation on master detail relationships in mORMot? » 2016-09-22 02:26:31

I can think of complex structures using arrays. Can you give a example of complex structs using the Variant type?

#112 Re: mORMot 1 » NewPascal preview - fork for mORMot » 2016-08-30 18:53:41

Yes! Please make DBISAM and ElevateDB mORMot compatible smile

#113 Re: mORMot 1 » Contribution: TSynRestDataset » 2016-08-09 14:31:08

@Esteban, what if you fork the git repo?

#114 Re: mORMot 1 » Contribution: TSynRestDataset » 2016-05-24 21:25:57

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;

#115 Re: mORMot 1 » SetCurrentThreadName causes External Exception when debugging » 2016-05-24 20:51:01

I use Delphi 7.1, and this was happening with my IDE too.

#116 Re: mORMot 1 » Contribution: TSynRestDataset » 2016-05-24 15:49:43

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?

#117 Re: mORMot 1 » Contribution: TSynRestDataset » 2016-05-13 15:38:04

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 ? now

Then it works

#118 Re: mORMot 1 » Is a good idea mix ORM access and SynDBRemote? » 2016-05-11 19:56:22

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.

#119 mORMot 1 » Is a good idea mix ORM access and SynDBRemote? » 2016-05-11 17:59:31

Junior/RO
Replies: 10

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.

#120 Re: mORMot 1 » Imaginary fields » 2015-09-04 22:00:29

Can you help me on this, @AB?

#121 Re: mORMot 1 » Imaginary fields » 2015-09-03 20:40:22

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?

#122 Re: mORMot 1 » Imaginary fields » 2015-09-03 11:35:04

I can create a TSynSQLTableDataSet descendent and write a special case InternalInitFieldDefs. It this the best approach?

#123 Re: mORMot 1 » Imaginary fields » 2015-09-02 19:45:18

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?

#124 mORMot 1 » Imaginary fields » 2015-09-02 18:12:20

Junior/RO
Replies: 8

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?

#126 Re: mORMot 1 » Automatically converting an Array of Object to a Dataset » 2015-07-29 17:05:40

I have examples of converting json with JSONToDataSet().

@ab, can you write a quick example using array of objects?

#127 Re: mORMot 1 » Fast read a big file » 2015-07-16 05:29:04

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?

#128 mORMot 1 » Consume a Rails or C# rest web service with mORMot » 2015-07-15 16:32:57

Junior/RO
Replies: 1

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?

#129 Re: mORMot 1 » free objects on the server side » 2015-07-14 17:23:47

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;

#130 Re: mORMot 1 » free objects on the server side » 2015-07-14 14:47:24

I can't get it.

function TSQLRest.RetrieveListObjArray() is Boolean, but you are using Result as a [absolute] TObjectDynArray in ObjArrayClear()

#132 Re: mORMot 1 » mORMot road-map » 2015-06-29 14:05:15

@ab, what is the current road-map today?

#133 mORMot 1 » Delphi 7, RegisterCustomJSONSerializerFromText() and TypeInfo() » 2015-06-23 20:29:51

Junior/RO
Replies: 1

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?

#134 Re: mORMot 1 » small application in AngularJS » 2015-06-16 14:06:20

Warley, the javascript code in your example is minified, I think. Can't read.

#136 Re: mORMot 1 » Finding DynArray items » 2015-06-10 16:24:08

This is weird. I tried again and it worked now.

Thank you again.

#137 Re: mORMot 1 » Finding DynArray items » 2015-06-10 13:05:07

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;

#138 mORMot 1 » Finding DynArray items » 2015-06-09 16:42:48

Junior/RO
Replies: 4

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.

#139 Re: mORMot 1 » DynArrayHashed with old objects » 2015-06-04 13:42:49

Yes, virtual methods for this type of object is very buggy in Delphi 7. Thank you, AB.

#140 mORMot 1 » DynArrayHashed with old objects » 2015-06-03 21:03:00

Junior/RO
Replies: 2

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?

#141 Re: mORMot 1 » mORMot performance » 2015-06-03 20:57:00

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.

#143 Delphi » How to show ≥ (greater than or equal to sign) using Delphi 7 » 2015-06-02 12:12:07

Junior/RO
Replies: 1

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.

#144 Re: mORMot 1 » How make Post to a Web Services that response with http code and Json » 2015-05-25 19:59:34

What if I post a flac audio file (or stream) for the google Speech Api? TDocVarient will handle this?

#146 Re: mORMot 1 » TSynSQLTableDataSet still the best way create a TDataset? » 2015-03-25 16:04:55

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()?

#148 mORMot 1 » TSynSQLTableDataSet still the best way create a TDataset? » 2015-03-24 20:43:14

Junior/RO
Replies: 3

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;

#149 Re: mORMot 1 » XE7 is out and mORMot works with it » 2014-09-05 14:12:18

What about performance and .exe size?

#150 Re: mORMot 1 » Class and form generating tool » 2014-08-01 12:56:18

AntonE, please put your project in a github account smile

Board footer

Powered by FluxBB