Skip to content

Format BLOBs as UniqueIdentifier #2342

Closed

Description

@maseal

Describe the new feature

When you create table column with "UNIQUEIDENTIFIER" type, SQLite always stores its values as BLOB. It would be great to add human-readable formatting for such columns.

Additional info

Now SQLiteBrowser doesn't display BLOB data by default and I use the following custom display format:
substr(hex("column"), 7, 2) || substr(hex("column"), 5, 2) || substr(hex("column"), 3, 2) || substr(hex("column"), 1, 2) || '-' || substr(hex("column"), 11, 2) || substr(hex("column"), 9, 2) || '-' || substr(hex("column"), 15, 2) || substr(hex("column"), 13, 2) || '-' || substr(hex("column"), 17, 4) || '-' || substr(hex("column"), 21, 12)
(this solution came from here: https://neosmart.net/blog/2018/converting-a-binary-blob-guid-to-text-in-sql)
But it's very uncomfortable to rewrite this code for each column name.
I believe I am not the only person who need this feature.
E.g. it can be easily added to ColumnDisplayFormatDialog.cpp with the following lines (I am not a C++ developer):

ui->comboDisplayFormat->addItem(tr("UniqueIdentifier blob"), "uuidblob");
...
formatFunctions["uuidblob"] = "substr(hex(" + sqlb::escapeIdentifiercolumn_name + "), 7, 2) || substr(hex(" + sqlb::escapeIdentifiercolumn_name + "), 5, 2) || substr(hex(" + sqlb::escapeIdentifiercolumn_name + "), 3, 2) || substr(hex(" + sqlb::escapeIdentifiercolumn_name + "), 1, 2) || '-' || substr(hex(" + sqlb::escapeIdentifiercolumn_name + "), 11, 2) || substr(hex(" + sqlb::escapeIdentifiercolumn_name + "), 9, 2) || '-' || substr(hex(" + sqlb::escapeIdentifiercolumn_name + "), 15, 2) || substr(hex(" + sqlb::escapeIdentifiercolumn_name + "), 13, 2) || '-' || substr(hex(" + sqlb::escapeIdentifiercolumn_name + "), 17, 4) || '-' || substr(hex(" + sqlb::escapeIdentifiercolumn_name + "), 21, 12)";

Default displaying of UniqueIdentifier column:

image

Formatted displaying of UniqueIdentifier column:

image

Activity

  1. justinclift commented on Jul 23, 2020

    @justinclift
    Member

    Just to make sure I'm understanding, you're wanting us to add a uuidblob display format to the built-in list, using the code snippet above (or similar)?

    If so, no worries. That's probably do-able. 😄

  2. maseal commented on Jul 23, 2020

    @maseal
    Author

    Yes, exactly

  3. added a commit that references this issue on Jul 23, 2020
  4. MKleusberg commented on Jul 23, 2020

    @MKleusberg
    Member

    Thanks for the suggestion and excellent preparation, @maseal! I have just added a new display format like that. Can you check tomorrow's nightly build and see if it's working for you? 😄

  5. justinclift commented on Jul 30, 2020

    @justinclift
    Member

    @maseal Have you had a chance to see if the new format option works ok?

  6. maseal commented on Jul 30, 2020

    @maseal
    Author

    Yes I've already tested it. It works as expected

  7. added this to the 3.12.1 milestone on Jul 30, 2020
  8. justinclift commented on Jul 30, 2020

    @justinclift
    Member

    Awesome! Thanks for making the suggestion @maseal. 😄

    @MKleusberg Good stuff. I've added this to the 3.12.1 milestone, as the code change looks pretty simple. 😄

  9. straypointer commented on Dec 22, 2020

    @straypointer

    This is a great feature, but I am not seeing it in my display format dropdown list... does 'uniqueidentifier' need to be capitalized for it to work?

  10. chrisjlocke commented on Dec 22, 2020

    @chrisjlocke
    Member

    What version of DB4S are you using? It'll be in the 3.12.1 version or the nightlies...

  11. straypointer commented on Dec 22, 2020

    @straypointer
  12. chrisjlocke commented on Dec 22, 2020

    @chrisjlocke
    Member

    Interesting - this got missed from the 3.12.1 release. Just checked the 3.12.1 and yes, the list stops at 'upper case', while it's there in the nightlies.

    image

    I'd suggest download the nightly and trying that.
    https://nightlies.sqlitebrowser.org/latest/

    If you download the .zip flavour (https://nightlies.sqlitebrowser.org/latest/DB.Browser.for.SQLite-win64.zip), extract it, you can run it without 'installing' and alongside your existing version.

  13. straypointer commented on Dec 22, 2020

    @straypointer
  14. thigg commented on Nov 15, 2022

    @thigg

    is this released already?

  15. chrisjlocke commented on Nov 15, 2022

    @chrisjlocke
    Member

    Don't think its in the 3.12.2 release .. it's in the nightlies though.
    https://nightlies.sqlitebrowser.org/latest/

  16. thigg commented on Nov 16, 2022

    @thigg

    Any indication when this will be released? Will this be in the next release?

  17. justinclift commented on Feb 17, 2023

    @justinclift
    Member

    Will this be in the next release?

    Yep. We're still figuring out when to do the next release though. 😉

  18. alexey-leonovich commented on Aug 7, 2024

    @alexey-leonovich

    @chrisjlocke @justinclift is this feature included in recent 3.13.0 release?

  19. justinclift commented on Aug 11, 2024

    @justinclift
    Member

    Should be. Everything that's been in the nightlies before we branched the 3.13.x series should be in 3.13.0.

  20. jogibear9988 commented on May 7, 2025

    @jogibear9988

    I don't see this....

    Image Image
  21. jogibear9988 commented on May 7, 2025

    @jogibear9988

    Sorry, list is scrollable, itt works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions