Is there type Long in SQLite?

前端 未结 7 703
我在风中等你
我在风中等你 2020-12-23 20:00

I want to create a table with the column type Long instead of Integer. Is it possible?

7条回答
  •  自闭症患者
    2020-12-23 20:45

    the INTEGER can store the long but to get long from cursor should do like this :

    int type = cursor.getType(j);
    
    String value = cursor.getString(j);
    try {
           int intValue = Integer.parseInt(value);
           field.set(object, intValue);
        } catch (NumberFormatException e) {
           long longValue = Long.parseLong(value);
           field.set(object, longValue);
    }
    

    i use this to store timestamp in sqlite

提交回复
热议问题