base64 encode in MySQL

前端 未结 8 1211
执笔经年
执笔经年 2020-12-01 05:10

I want to select a blob col from one table, base64 encode it and insert it into another tables. Is there any way to do this without round tripping the data out of the DB and

相关标签:
8条回答
  • 2020-12-01 05:43

    Looks like no, though it was requested, and there’s a UDF for it.

    Edit: Or there’s… this. Ugh.

    0 讨论(0)
  • 2020-12-01 05:50
    SELECT `id`,`name`, TO_BASE64(content) FROM `db`.`upload`
    

    this will convert the blob value from content column to base64 string. Then you can do with this string whatever you want even insert it into another table

    0 讨论(0)
提交回复
热议问题