Fork me on GitHub

I am querying a mySQL db table using next.jdbc and honeySQL. The table has a column that stores URLs. In the query result this field appears as a vector of ints e.g. [104 116 116 112 58 47 47 115 114 118 49 46 109 121 99 111 109 112 97 110 121 46 99 111 109 47 108 111 103], which is the list of chars that make up the URL string. Other string fields appear correctly. If I query the same table from Kotlin or Golang the URL field correctly appears as a string. What should I do to get this read correctly in clojure? I also tried with with the same result.


What is the actual column type in MySQL?


(also, there's a #sql channel where folks can get help with database-related stuff and are more likely to see Qs like this since it is lower traffic)


As part of debugging this, I'd also suggest trying the query directly with next.jdbc/execute! without using HoneySQL and println the direct result without any further processing, just to verify that you really are getting that back from JDBC rather than it being an issue in your post-processing @U0DV4USKH


The column type is blob. That explains it. Thank you for responding, as well as for the pointer to the #sql channel. Since the documentation says that there is no equivalent for blob similar to clob->string, I am simply updating the fields with #(->> % (map char) (string/join "")


But that would mean you would get strings, even for images etc.


I guess my question would be: why on earth did someone declare URL columns as Blob???


Oh, MySQL returns Blob as byte[] -- my bad. Yeah, that sucks. So, even more of a reason that declaring a URL column as Blob is a dumb idea.


BTW (string/join) would be shorter and equivalent there.


Inherited 12 year old db at work 😪. Migrating to MariaDB soon, so will try to get this fixed. This column only contains URL strings pointing to log files.


Thank you for the tip on (string/join)

Alex Miller (Clojure team)23:11:03

Does anyone have some public code that has known perf characteristics and uses primarily normal long (checked) math ops? I'm trying to evaluate actual benefits of in a non-synthetic benchmark