建立SQLite数据库 [英] Setting up sqlite database

查看:146
本文介绍了建立SQLite数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起我是小白,我想了解使用Linux,我找不到任何教程,涵盖了我的设置需要创建使用SQLite数据库。目前教程,我发现说开一个外壳采用ADB命令,但是当我打开一个终端就算我浏览到Android工具文件夹,这并不工作,我可以得到sqlite的命令工作,但教程不解释我是如何使用它。例如,如何存放网址,地图坐标,以及如何我引用它们。

Sorry I am a noob, I am trying to learn about sqlite databases using linux, I cannot find any tutorial that covers what I need from setup to creating to using. At the moment tutorials I find say open a shell using adb shell command but when I open a terminal this does not work even if I navigate to the android tools folder, I can get the sqlite command working but the tutorials dont explain how I use it. For instance, how do I store urls and map coordinates and how to I reference them.

我曾尝试使用Firefox的插件,但我还没有一点头绪这一切意味着什么,每一个教程说SQLite数据库是容易的,但它似乎很复杂.......帮助!

I have tried to use the firefox plugin but I havent got a clue what it all means and every tutorial says sqlite database is easy but it seems so complicated.......HELP!!!!

PS才有可能建立在应用程序code中的数据,我看到了一些应用程序,做到这一点

P.S would it be possible to create the data within the application code, I have seen some apps that do this

有没有人有一个设置指南和教程,可以帮助?

Does anyone have a set up guide and tutorial that can help?

推荐答案

要设置数据库:

推荐的方法来创建一个新的SQLite数据库是创建的 SQLiteOpenHelper 并重写<一href="http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html#onCreate%28android.database.sqlite.SQLiteDatabase%29"相对=nofollow> 的onCreate() 方法,您可以在其中执行SQLite的命令,在数据库中创建表。

The recommended method to create a new SQLite database is to create a subclass of SQLiteOpenHelper and override the onCreate() method, in which you can execute a SQLite command to create tables in the database.

要使用它:

您可以使用 SQLiteDatabase 查询() 的方法,其中接受各种查询参数,如表来查询,投影,选择,列,分组, 和别的。对于复杂的查询,比如那些需要列别名,你应该使用 SQLiteQueryBuilder ,它提供了多种convienent方法建立查询。

You can execute SQLite queries using the SQLiteDatabase query() methods, which accept various query parameters, such as the table to query, the projection, selection, columns, grouping, and others. For complex queries, such as those that require column aliases, you should use SQLiteQueryBuilder, which provides several convienent methods for building queries.

资源:

这篇关于建立SQLite数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆