문제

This is SQLite for Android...

I am inserting a new column using ALTER TABLE tablename ADD COLUMN.

I have 2 questions:

  1. Is there a way I can just copy values from existing columnA to this newly inserted/added columnB?

  2. I need to add another columnC, the value of which is MD5 hash output of columnA. Is there a way SQLite can add columnC and set its value to MD5 hash (either using an existing SQLite internal function or my custom function)

도움이 되었습니까?

해결책

  1. UPDATE MyTable SET NewCol = columnA

  2. The Android DB API does not expose a mechanism for registering custom functions. You have to read all the columnA values, compute the hash in your code, and update the records one by one.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top