ODBC.jl icon indicating copy to clipboard operation
ODBC.jl copied to clipboard

Use GUID instead of UUID

Open ahjulstad opened this issue 1 year ago • 1 comments

This solves https://github.com/JuliaDatabases/ODBC.jl/issues/366 for me, but more testing (and unittests) is necessary.

As far as I can understand, the SQL GUID type, isn't really a UInt128, but rather a composite struct. (link

struct GUID
{
    uint32_t Data1;
    uint16_t Data2;
    uint16_t Data3;
    uint8_t  Data4[8];
}

This PR adds a new GUID struct in the ODBC package, and uses that instead of Base.UUID.

As a lot of application code might expect to receive Base.UUID from results, some more thought should probably go into this.

Things to consider

  • [ ] Comparison (GUID and UUID could be argued to have different sorting order)
  • [ ] Equality (easy, but not yet done)
  • [ ] automatic conversion to Base.UUID, if that is something one should do?

Also, I have only tested this against a MSSQL database (my test rig in dev container here: https://github.com/ahjulstad/debug-julia-odbc ), so I have no idea if this breaks other databases.

ahjulstad avatar Oct 12 '23 15:10 ahjulstad

This task has grown larger than what I was originally expecting, and help is needed on some items:

  • [ ] tests involving getproperty(row, prop).
  • [ ] the TIME SQL type.
  • [ ] .. and more

What I have now is a devcontainer setup with MariaDB and MSSQL, I have implemented a new API.GUID type, added conversions to and from Base.UUID. Many things work well, but not everything. I have to leave it like this for now, and hope to pick it up again later (unless someone else does it before me)

ahjulstad avatar Oct 23 '23 20:10 ahjulstad