Hello,
I’m wondering if singlestore has an equivalent to MySql’s Convert(aCol using ascii) function. I have looked but have not seen anything.
We have a data export for a recipient who cant accept non ANSI characters
Thank you,
Peter
Hello,
I’m wondering if singlestore has an equivalent to MySql’s Convert(aCol using ascii) function. I have looked but have not seen anything.
We have a data export for a recipient who cant accept non ANSI characters
Thank you,
Peter
Thank you for your question and welcome to the SingleStore forums.
Could you provide a little information please? Are you using the Cloud or On-Prem version of SingleStoreDB? Also the version number.
Thank you.
We don’t have a function to convert to ascii that I know of. One thing you could do is write your own is_ascii function in MPSQL. You can do this sort of thing:
+--------------------------------------------+
| json_array_unpack_i8('foobar' :> longblob) |
+--------------------------------------------+
| [102,111,111,98,97,114] |
+--------------------------------------------+
Then you can convert the result of that to an array with json_to_array, then iterate through the array and check that each character is in the desired range for ASCII.
But if you want to downgrade the string to ASCII, that would be more work.
If you are using our cloud service, you could write a Wasm UDF to do this and use somebodies existing library of C or Rust code.