zoukankan      html  css  js  c++  java
  • ContentValues 和HashTable区别

    ContentValues  

    This class is used to store a set of values that the ContentResolver can process.

    用于保存一些数据(string boolean byte double float int long  short ...)信息,这些信息可以被数据库操作时使用。

    ContentValues() Creates an empty set of values using the default initial size

    ContentValues(int size) Creates an empty set of values using the given initial size

    ContentValues(ContentValues from) Creates a set of values copied from the given set

    ContentValues 和HashTable

    ContentValues 和HashTable类似都是一种存储的机制但是两者最大的区别就在于,contenvalues只能存储基本类型的数据,像string,int之类的,不能存储对象这种东西,而HashTable却可以存储对象。

    在往数据库中插入数据的时候,首先应该有一个ContentValues的对象所以:

    ContentValues initialValues = new ContentValues();

    initialValues.put(key,values);

    SQLiteDataBase sdb ;

    sdb.insert(database_name,null,initialValues);

    插入成功就返回记录的id否则返回-1;

  • 相关阅读:
    git
    Django RestFramework
    vuex以及axios
    npm 、webpack 、 vue-cli
    vue的生命周期
    vue-router
    vue框架 (小清单)
    nodejs review-01
    npm-bluebird使用
    js整理4
  • 原文地址:https://www.cnblogs.com/leehongee/p/2938354.html
Copyright © 2011-2022 走看看