( ! ) Deprecated: Function WP_Dependencies-&gt;add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers. in /var/www/html/wp-includes/functions.php on line 6131
Call Stack
#TimeMemoryFunctionLocation
10.0000484048{main}( ).../index.php:0
20.0005484400require( '/var/www/html/wp-blog-header.php ).../index.php:17
30.23144105160require_once( '/var/www/html/wp-includes/template-loader.php ).../wp-blog-header.php:19
40.23624134152include( '/var/www/html/wp-content/themes/twentyfifteen/single.php ).../template-loader.php:125
50.23624134152get_header( $name = ???, $args = ??? ).../single.php:10
60.23624134368locate_template( $template_names = [0 => 'header.php'], $load = TRUE, $load_once = TRUE, $args = [] ).../general-template.php:48
70.23624134464load_template( $_template_file = '/var/www/html/wp-content/themes/twentyfifteen/header.php', $load_once = TRUE, $args = [] ).../template.php:749
80.23664135008require_once( '/var/www/html/wp-content/themes/twentyfifteen/header.php ).../template.php:814
90.23674142416wp_head( ).../header.php:18
100.23674142416do_action( $hook_name = 'wp_head' ).../general-template.php:3197
110.23674142632WP_Hook->do_action( $args = [0 => ''] ).../plugin.php:522
120.23674142632WP_Hook->apply_filters( $value = '', $args = [0 => ''] ).../class-wp-hook.php:365
130.23694146048wp_enqueue_scripts( '' ).../class-wp-hook.php:341
140.23694146048do_action( $hook_name = 'wp_enqueue_scripts' ).../script-loader.php:2311
150.23694146264WP_Hook->do_action( $args = [0 => ''] ).../plugin.php:522
160.23694146264WP_Hook->apply_filters( $value = '', $args = [0 => ''] ).../class-wp-hook.php:365
170.23704148152twentyfifteen_scripts( '' ).../class-wp-hook.php:341
180.23724149672wp_style_add_data( $handle = 'twentyfifteen-ie', $key = 'conditional', $value = 'lt IE 9' ).../functions.php:440
190.23724149672WP_Styles->add_data( $handle = 'twentyfifteen-ie', $key = 'conditional', $value = 'lt IE 9' ).../functions.wp-styles.php:245
200.23724149672WP_Dependencies->add_data( $handle = 'twentyfifteen-ie', $key = 'conditional', $value = 'lt IE 9' ).../class-wp-styles.php:385
210.23724149672_deprecated_argument( $function_name = 'WP_Dependencies->add_data()', $version = '6.9.0', $message = 'IE conditional comments are ignored by all supported browsers.' ).../class-wp-dependencies.php:317
220.23724155624wp_trigger_error( $function_name = '', $message = 'Function WP_Dependencies->add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers.', $error_level = 16384 ).../functions.php:5925
230.23724275160trigger_error( $message = 'Function WP_Dependencies-&gt;add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers.', $error_level = 16384 ).../functions.php:6131

( ! ) Deprecated: Function WP_Dependencies-&gt;add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers. in /var/www/html/wp-includes/functions.php on line 6131
Call Stack
#TimeMemoryFunctionLocation
10.0000484048{main}( ).../index.php:0
20.0005484400require( '/var/www/html/wp-blog-header.php ).../index.php:17
30.23144105160require_once( '/var/www/html/wp-includes/template-loader.php ).../wp-blog-header.php:19
40.23624134152include( '/var/www/html/wp-content/themes/twentyfifteen/single.php ).../template-loader.php:125
50.23624134152get_header( $name = ???, $args = ??? ).../single.php:10
60.23624134368locate_template( $template_names = [0 => 'header.php'], $load = TRUE, $load_once = TRUE, $args = [] ).../general-template.php:48
70.23624134464load_template( $_template_file = '/var/www/html/wp-content/themes/twentyfifteen/header.php', $load_once = TRUE, $args = [] ).../template.php:749
80.23664135008require_once( '/var/www/html/wp-content/themes/twentyfifteen/header.php ).../template.php:814
90.23674142416wp_head( ).../header.php:18
100.23674142416do_action( $hook_name = 'wp_head' ).../general-template.php:3197
110.23674142632WP_Hook->do_action( $args = [0 => ''] ).../plugin.php:522
120.23674142632WP_Hook->apply_filters( $value = '', $args = [0 => ''] ).../class-wp-hook.php:365
130.23694146048wp_enqueue_scripts( '' ).../class-wp-hook.php:341
140.23694146048do_action( $hook_name = 'wp_enqueue_scripts' ).../script-loader.php:2311
150.23694146264WP_Hook->do_action( $args = [0 => ''] ).../plugin.php:522
160.23694146264WP_Hook->apply_filters( $value = '', $args = [0 => ''] ).../class-wp-hook.php:365
170.23704148152twentyfifteen_scripts( '' ).../class-wp-hook.php:341
180.28024276264wp_style_add_data( $handle = 'twentyfifteen-ie7', $key = 'conditional', $value = 'lt IE 8' ).../functions.php:444
190.28024276264WP_Styles->add_data( $handle = 'twentyfifteen-ie7', $key = 'conditional', $value = 'lt IE 8' ).../functions.wp-styles.php:245
200.28024276264WP_Dependencies->add_data( $handle = 'twentyfifteen-ie7', $key = 'conditional', $value = 'lt IE 8' ).../class-wp-styles.php:385
210.28024276264_deprecated_argument( $function_name = 'WP_Dependencies->add_data()', $version = '6.9.0', $message = 'IE conditional comments are ignored by all supported browsers.' ).../class-wp-dependencies.php:317
220.28024276584wp_trigger_error( $function_name = '', $message = 'Function WP_Dependencies->add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers.', $error_level = 16384 ).../functions.php:5925
230.28034276808trigger_error( $message = 'Function WP_Dependencies-&gt;add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers.', $error_level = 16384 ).../functions.php:6131

android:SQLite数据库 增、删、改、查

学习android开发不可避免的会涉及数据库的使用,android使用的是SQLite数据库。对于SQLite数据库的基本信息这里就不过多的介绍,我们主要看哈是怎么用的就是了。

与以往数据库不一样的地方

以前我们做javaWeb开发时用jdbc连接,现在变了,个人觉得变得简单了。在应用程序中直接就可以去创建数据库,然后对其进行操作。不用像以前写连接代码。

操作数据库

一,SQLiteOpenHelper 类

其中:

getReadableDatabase()得到可读的数据库,返回SQLiteDatabase对象,然后通过对象进行数据库操作。

getWritableDatabase()得到可写的数据库,返回SQLiteDatabase对象,然后通过对象进行数据库操作。

onCreate(SQLiteDatabase db)在第一次创建数据库时调用。

onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)在更改数据库时都会调用。

onOpen(SQLiteDatabase db)当数据库打开时调用。

close()关闭数据库。

二,SQLiteDatabase类

这个类提供了对数据库的一些基本操作:

insert()

delete()

update()

query()

。。。。。等等。

代码:

SQLiteOpenHelper 的子类:

  1. import android.content.Context;
  2. import android.database.sqlite.SQLiteDatabase;
  3. import android.database.sqlite.SQLiteDatabase.CursorFactory;
  4. import android.database.sqlite.SQLiteOpenHelper;
  5. /**
  6.  * 通过getReadableDatabase()和getWritableDatabase()可以获得数据库对象。
  7.  * 提供onCreate()-创建数据库时,onUpgrade()-升级数据库时,两个回调函数。
  8.  */
  9. public class DatabaseHelper extends SQLiteOpenHelper {
  10.     // 按要求必须要有构造函数
  11.     public DatabaseHelper(Context context, String name, CursorFactory factory,
  12.             int version) {
  13.         super(context, name, factory, version);
  14.     }
  15.     // 当第一次得到SQLiteDatabase对象时,调用该方法
  16.     @Override
  17.     public void onCreate(SQLiteDatabase db) {
  18.         String sql = “create table MSG(id int,body varchar(100))”;
  19.         db.execSQL(sql);
  20.         System.out.println(“创建了一个数据库!”);
  21.     }
  22.     // 当更新数据库时执行该方法
  23.     @Override
  24.     public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  25.         System.out.println(“更新了数据库!”);
  26.         // 还可以写其他的操作
  27.     }
  28. }

有了这个类后,我们就可以对数据库进行增、删、改、查操作了。
插入数据:

  1. //生成ContentValues对象,key:列名,value:想插入的值
  2.                 ContentValues values = new ContentValues();
  3.                 values.put(“id”, 1);
  4.                 values.put(“body”, “hello”);
  5.                 DatabaseHelper dbhelper = new DatabaseHelper(SqliteActivity.this, “text_msg”, null, 2);
  6.                 //得到可写的SQLiteDatabase对象
  7.                 SQLiteDatabase db = dbhelper.getWritableDatabase();
  8.                 //调用insert方法,将数据插入数据库
  9.                 //参数1:表名
  10.                 //参数2:如果你想插入空值,那么你必须指定它的所在的列
  11.                 db.insert(“MSG”, null, values);
  12.                 System.out.println(“插入了:1, hello”);

删除数据:

  1. DatabaseHelper dbhelper = new DatabaseHelper(SqliteActivity.this, “text_msg”, null, 2);
  2.                 //得到可写的SQLiteDatabase对象
  3.                 SQLiteDatabase db = dbhelper.getWritableDatabase();
  4.                 //调用delete方法,删除数据
  5.                 db.delete(“MSG”, “id=?”, new String[]{“1”});
  6.                 System.out.println(“删除了:id=1”);

修改数据:

  1. ContentValues values = new ContentValues();
  2.                 values.put(“body”, “my dear!”);
  3.                 DatabaseHelper dbhelper = new DatabaseHelper(SqliteActivity.this, “text_msg”, null, 2);
  4.                 //得到可写的SQLiteDatabase对象
  5.                 SQLiteDatabase db = dbhelper.getWritableDatabase();
  6.                 //调用insert方法,将数据插入数据库
  7.                 //参数3:where 子句 “?”是占位符号,对应后面的”1”,这和web开发时的语法是一样的
  8.                 db.update(“MSG”, values, “id=?”, new String[]{“1”});
  9.                 System.out.println(“更新了:hello–>my dear!”);

查询数据:

  1. DatabaseHelper dbhelper = new DatabaseHelper(SqliteActivity.this, “text_msg”, null, 2);
  2.                 //得到可读的SQLiteDatabase对象
  3.                 SQLiteDatabase db = dbhelper.getReadableDatabase();
  4.                 //参数1:表名
  5.                 //参数2:要想显示的列
  6.                 //参数3:where子句
  7.                 //参数4:where子句对应的条件值
  8.                 //参数5:分组方式
  9.                 //参数6:having条件
  10.                 //参数7:排序方式
  11.                 Cursor cursor = db.query(“MSG”, new String[]{“id”,”body”}, “id=?”, new String[]{“1”}, null, null, null);
  12.                 System.out.println(“查到的数据为:”);
  13.                 while(cursor.moveToNext()){
  14.                         int id = cursor.getInt(cursor.getColumnIndex(“id”));
  15.                         String name = cursor.getString(cursor.getColumnIndex(“body”));
  16.                         System.out.println(“–>”+id+”::::::::::”+name);
  17.                     }

怎样使用adb查看数据库?

SQLite没有客户端,不能直接的查看数据库,所以用它提供的adb吧。

1,进入命令行后输入adb回车,会显示很多的信息。

2,输入adb shell回车,就进入了Linux命令行,现在就可以使用Linux的命令了。

3,ls回车,显示所有的东西,其中有个data。(ls:显示所有,cd:进入)

4,cd data回车,再ls回车,cd data回车,ls回车后就会看到很多的com.。。。的东西,那就是机器上的应用程序,找到你应用程序的包名,然后进入。

5,进去后在查看所有,会发现个databases,进入databases,显示所有就会发现你的数据库名字,我这里使用的是”text_msg”。

6,sqlite3 text_msg回车就进入了你的数据库了,然后“.schema”就会看到该应用程序的所有表及建表语句。

7,现在你就可以使用标准的SQL语句查看刚才生成的数据库及数据了。

对数据库的操作方法很多,这只是其中一种。

原文地址:http://blog.csdn.net/zzy916853616/article/details/6599898

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.