A few TZMemTable remarks

The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
Post Reply
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 797
Joined: 18.11.2018, 17:37
Location: Hungary

A few TZMemTable remarks

Post by aehimself »

Hello,

Just a few remarks for the new TZMemTable component:

- ftMemo, ftString, ftFixedChar will throw a nullpointer exception upon opening:

Code: Select all

 ZMemTable1.FieldDefs.Add('MyField', ftString);
 ZMemTable1.Open;
Issue is in ZMemTable.pas : 208

Code: Select all

        else if Current.DataType in [ftMemo, ftString, ftFixedChar] then
          ColumnInfo.ColumnCodePage := GetTransliterateCodePage(Connection.ControlsCodePage)
TZMemTable has no connection, so Connection.ControlsCodePage is referring to nil.ControlsCodePage. Lines 208 and 209 can be deleted, items can be merged with the next condition:

Code: Select all

        else if Current.DataType in [{$IFDEF WITH_FTWIDEMEMO}ftWideMemo, {$ENDIF}
          ftWideString{$IFDEF WITH_FTFIXEDWIDECHAR}, ftFixedWideChar{$ENDIF}, ftMemo, ftString, ftFixedChar] then
          ColumnInfo.ColumnCodePage := zCP_UTF16;

- The above also renders the condition in : 217 useless, as it will never be true:

Code: Select all

    if (Connection <> nil) and (Connection.Connected)
    then AConSettings := Connection.DbcConnection.GetConSettings
I created a small patch with the above, will issue a pull request soon.


With that said, I have the following code:

Code: Select all

 ZMemTable1.FieldDefs.Add('MyField', ftString);
 ZMemTable1.Open;
 ZMemTable1.Append;
 ZMemTable1.FieldByName('MyField').AsString := 'Hello, world!';
 ZMemTable1.Post;
I have a DataSource and a DBGrid connected, and it is showing that 'MyField' is WideMemo instead of String, which I explicitly created:

The reason is, ConvertDbcToDatasetType sets the fieldtype as WideMemo, if there is no length specified. I can see the reason, just want to ask if it is intended?

Code: Select all

ZMemTable1.FieldDefs.Add('MyField', ftString, 200);
Works as planned.
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: A few TZMemTable remarks

Post by EgonHugeist »

Thanks for the feedback!
As my commit says: it was a 20 min job :P
I found some more inconsistencies in other components too
  • TZStoredProc has an UpdatSQL property
  • TZStoredProc has no Transaction property
  • TZStoredProc has OnPostError Event property
  • TZMemTable has an UpdatSQL property
  • TZMemTable has OnPostError Event property
Just to name some i have seen. :roll:. That than meens there is an issue with the alltime inheritance model of some of the components.
According the AV's thanks for the temporary fix. Using the W-Fields hides theses issues. I'am working on it, including a connection property for TZMemTable.
aehimself wrote: 29.01.2021, 20:57 The reason is, ConvertDbcToDatasetType sets the fieldtype as WideMemo, if there is no length specified. I can see the reason, just want to ask if it is intended?
Yes it is. The TString/WideString-Field need a size for a buffer. Otherwise you would get an exception on creating the fields.
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 797
Joined: 18.11.2018, 17:37
Location: Hungary

Re: A few TZMemTable remarks

Post by aehimself »

EgonHugeist wrote: 05.02.2021, 06:25 Thanks for the feedback!
As my commit says: it was a 20 min job :P
...and you can't imagine how happy your 20 minutes made us, end users :)
There were lots of people waiting for this feature, so yeah, thank you again!
I already included it in one of my projects, replacing an in-memory SQLite connection :)
EgonHugeist wrote: 05.02.2021, 06:25I'am working on it, including a connection property for TZMemTable.
Does it need one? Or it'll be optional? In my view the main advantage of a memtable that it is 100% functional without a connection and therefore can be used to de- and reconstruct data tables from any source.
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
miab3
Zeos Test Team
Zeos Test Team
Posts: 1310
Joined: 11.05.2012, 12:32
Location: Poland

Re: A few TZMemTable remarks

Post by miab3 »

The most important are the methods of copying (with filtration) and even better using SQL (but it's already pretty high-grade stuff) from and to local sources(datasets). Some do this by putting SQLite underneath.

Michał
brick08
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 13.01.2021, 03:27

Re: A few TZMemTable remarks

Post by brick08 »

Hallo. I will also add.
In TZMemTable when displaying fields of type TZRawStringField, the program gives an error AV. See screenshot.
You do not have the required permissions to view the files attached to this post.
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 797
Joined: 18.11.2018, 17:37
Location: Hungary

Re: A few TZMemTable remarks

Post by aehimself »

Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: A few TZMemTable remarks

Post by EgonHugeist »

EgonHugeist wrote: 05.02.2021, 06:25 Does it need one? Or it'll be optional? In my view the main advantage of a memtable that it is 100% functional without a connection and therefore can be used to de- and reconstruct data tables from any source.
No it does not "need" a connection. I just added it to inherit the ControlsCodepage and the Formatsettings from the connection component. That's all.

Brick08 any news on this?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
brick08
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 13.01.2021, 03:27

Re: A few TZMemTable remarks

Post by brick08 »

EgonHugeist wrote: 12.02.2021, 05:53 Brick08 any news on this?
Now it's ok, thanks.
Post Reply