I have a sqlite table for my android application. In this table there is a String field (telephone). When I want to insert or update a phone number, start with a + plus sign (for example, “+905331234567”), then it ignores the plus sign. He writes only 905331234567. But when I change the value using spaces (or any characters other than numeric), (for example, "+905331234567"), then there is no problem.
update friend set phone = "+905331234567"; //905331234567 update friend set phone = " +905331234567";// +905331234567
thanks for your reply. Kemal.
Edit
Create line:
private static final String CREATE_FRIEND = // create table "create table " + FriendBean.DB_TABLE_NAME + "(" + FriendBean.KEY_ROWID + " integer primary key autoincrement, " + FriendBean.KEY_contactID + " String, " + FriendBean.KEY_name + " String, " + FriendBean.KEY_phone + " String, " + FriendBean.KEY_accessCode + " String, " + FriendBean.KEY_flag + " int " + ");";
Paste Method:
public void insertFriend(FriendBean bean) { SQLiteStatement statement = database.compileStatement(FriendBean.getInsertSQL()); statement.bindString(1,bean.getContactID()); statement.bindString(2,bean.getName()); statement.bindString(3,bean.getPhone() +""); statement.bindString(4,bean.getAccessCode()); statement.bindLong(5,bean.getFlag()); long id= statement.executeInsert(); }
Grade:
public class FriendBean{ public static final String DB_TABLE_NAME = "friend"; public static final String KEY_contactID = "contactID"; public static final String KEY_name = "name"; public static final String KEY_phone = "phone"; public static final String KEY_accessCode = "accessCode"; public static final String KEY_flag = "flag"; ...
Solution: String The type field is replaced by Text .
links http://www.sqlite.org/datatype3.html as well as comments.
source share