Hi,
is there any possibilty to get binary data from a DBF field using the X# runtime?
Thank you very much!
Wolfgang
P.S. another thing: when I call a X# VO dialect library from a X# Core application: is there any need to initialize the runtime like it was needed with the Vulcan runtime?
binary DBF access in the X# runtime
binary DBF access in the X# runtime
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
binary DBF access in the X# runtime
Wofgang,
Thanks for reminding me.
I will add a FieldGetBytes() function that reads the bytes directly from the buffer in the DBF
and a FieldPutBytes()
What you can do in the mean time:
And there is no need to initialize the runtime afaik.
But please remember: even if you use X# Core, the Macro compiler will "silently" load XSharp.RT because it needs the USUAL type and CODEBLOCK type that are defined in XSharp.RT. So XSharp.RT should be available at runtime.
Robert
Thanks for reminding me.
I will add a FieldGetBytes() function that reads the bytes directly from the buffer in the DBF
and a FieldPutBytes()
What you can do in the mean time:
Code: Select all
LOCAL oRDD as IRDD
oRdd := (IRDD) DbInfo(DBI_RDD_OBJECT)
// get the bytes from the current record
local aBytes as Byte[]
aBytes := oRDD:GetRec()
// manipulate the bytes
// and to write the bytes
oRDD:PutRec(aBytes)
// (not tested but this should work)
But please remember: even if you use X# Core, the Macro compiler will "silently" load XSharp.RT because it needs the USUAL type and CODEBLOCK type that are defined in XSharp.RT. So XSharp.RT should be available at runtime.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
binary DBF access in the X# runtime
Hi Robert,
thank you very much!
Your code will also work for memo fields? I'm mostly using memo fields to store bitmaps or compressed content (or both at the same time as bitmaps have a good compression ratio), and sometimes also for crypted content.
Of course I will make sure the RT and Macro compiler DLL are available at runtime, as they are needed by the VO dialect library.
Wolfgang
thank you very much!
Your code will also work for memo fields? I'm mostly using memo fields to store bitmaps or compressed content (or both at the same time as bitmaps have a good compression ratio), and sometimes also for crypted content.
Of course I will make sure the RT and Macro compiler DLL are available at runtime, as they are needed by the VO dialect library.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
binary DBF access in the X# runtime
Wolfgang,
No this does not work for memo fields.
In the case of memo fields, the buffer contains the location of the memo in the file. To read the memo you have move the file to the right location.
You can use DbInfo(DBI_MEMOFIELD, nFieldPos) to retrieve the location of the memo in the DBT/FPT file and then retrieve the memo file handle with DBI_MEMOHANDLE, and read the data yourself.
But I will take care of this in a next build.
Robert
No this does not work for memo fields.
In the case of memo fields, the buffer contains the location of the memo in the file. To read the memo you have move the file to the right location.
You can use DbInfo(DBI_MEMOFIELD, nFieldPos) to retrieve the location of the memo in the DBT/FPT file and then retrieve the memo file handle with DBI_MEMOHANDLE, and read the data yourself.
But I will take care of this in a next build.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
binary DBF access in the X# runtime
Hi Robert,
I suspected that as I have some experience accessing DBF files in a binary mode.
It is not urgent, but it would be a good thing to have it in the next build.
Currently I will start to migrate my Dictionary Editor to the X# runtime and use it myself - but many other applications, including my most important ones, need the binary data.
Maybe in the meantime the trick (by Chris <g>) will help:
https://www.xsharp.eu/forum/public-vo-v ... o-a-sql-db
Wolfgang
I suspected that as I have some experience accessing DBF files in a binary mode.
It is not urgent, but it would be a good thing to have it in the next build.
Currently I will start to migrate my Dictionary Editor to the X# runtime and use it myself - but many other applications, including my most important ones, need the binary data.
Maybe in the meantime the trick (by Chris <g>) will help:
https://www.xsharp.eu/forum/public-vo-v ... o-a-sql-db
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
binary DBF access in the X# runtime
Hi Wolfgang,
I had completely forgotten about that! But, yeah this trick should work also with the X# RDD for storing/reading binary data, as it makes an extra conversion which negates the binary<->text conversion .that the RDD makes. Remember to use the simpler version of the code in post 2686: https://www.xsharp.eu/forum/public-vo-v ... ql-db#2686
Of course Robert's solution will be a lot faster, as it will return/store the raw bytes, with no conversions at all.
I had completely forgotten about that! But, yeah this trick should work also with the X# RDD for storing/reading binary data, as it makes an extra conversion which negates the binary<->text conversion .that the RDD makes. Remember to use the simpler version of the code in post 2686: https://www.xsharp.eu/forum/public-vo-v ... ql-db#2686
Of course Robert's solution will be a lot faster, as it will return/store the raw bytes, with no conversions at all.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
binary DBF access in the X# runtime
Hi Robert,
The (Core dialect) WPF application is reading data from DBFs and PostgreSQL sources and writing to PostgreSQL databases (from where my VO application accesses it using a X# COM module).
Wolfgang
I can confirm that - my production planning application (that I have currently in development) works perfectly also with the X# runtime (and DBFCDX) without any special initialization.And there is no need to initialize the runtime afaik.
But please remember: even if you use X# Core, the Macro compiler will "silently" load XSharp.RT because it needs the USUAL type and CODEBLOCK type that are defined in XSharp.RT. So XSharp.RT should be available at runtime.
The (Core dialect) WPF application is reading data from DBFs and PostgreSQL sources and writing to PostgreSQL databases (from where my VO application accesses it using a X# COM module).
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
binary DBF access in the X# runtime
Why do you need COM? Doesn't npgsql work for you?
Only curious...
Only curious...
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
binary DBF access in the X# runtime
Hi Karl,
using the .NET data access I don't need anything to install on the machines. This approach works very well with MySQL, SQLite and PostgreSQL.
Wolfgang
using the .NET data access I don't need anything to install on the machines. This approach works very well with MySQL, SQLite and PostgreSQL.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
binary DBF access in the X# runtime
Hi Wolfgang,
If I want to use an existing MySQL database using COM, do not need to install a MySQL server on the machines ?
Juraj
If I want to use an existing MySQL database using COM, do not need to install a MySQL server on the machines ?
Juraj