开发者

Fixing older program: database text encoding, and incorrect field types

开发者 https://www.devze.com 2022-12-08 12:14 出处:网络
I\'m currently again working on a program from when I was, umm... less capable. It has a number of problems:

I'm currently again working on a program from when I was, umm... less capable. It has a number of problems:

  • The database collation is latin1_swedish_ci. I would like to convert it to utf8. How would I do this?
  • The database has some fields that are boolean values stored as 0 or 1. However, the fields are varchars instead of bools. How c开发者_运维知识库an I convert these?


ad 2) you can export your table using sqldump or "SELECT * INTO OUTFILE xxx from MYTAB;", recreate the table and reimport, optionally after manipulating the exported data (converting 1/0's to true/false etc.)

ad 2) you can create a new bool field and UPDATE tab SET NewBool=True where OldVarChar="1"; etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消