Discover how to use sqlite editor, include the articles, news, trends, analysis and practical advice about how to use sqlite editor on alibabacloud.com
Label:Zhu JinchanSource: http://blog.csdn.net/clever101The Sqlite3_open function is required to open a SQLite database, but the first parameter of the Sqlite3_open function is the absolute path to the database file. It is fastidious and must be a UTF8 string. That is, if the file path is a non-UTF8 character, it is converted to UTF characters. So referring to the information on the Internet, wrote a most commonly used from multi-byte to UTF8 function,
SQLite is a lightweight relational database, it is because of its small, mobile platform is widely used, but not suitable for processing large amounts of data and bulk operations. Its bottom layer is written in C, originally designed to be used in embedded, resource-intensive and easy-to-use, and most of the programming language can be very well combined. In. NET, its SDK supports LINQ implementations and i
This article does not involve a number of conceptual things, please forgive us a lotThis is the simple frame of Android SQLite.Using SQLite is about 3 stepsThe first step: Create your own Sqliteopenhelper classStep two: Create a DAO layer in the database with the operations of the databaseStep three: Use the DAO layer operation in activity (multi-threaded form, prevent card interface)First step: Create Sqli
retrieve the data of a column in a record, two steps are required: cursor. getstring (INDEX), and the index is obtained through getcolumnindex.
Summary: databases are your own weaknesses. When using multimedia, you will always encounter such database and mediaprovider problems, so pay attention to them.
On the csdn post, I saw such a refined explanation:
What is sqlitedatabase?An instance of sqlitedatabase represents an SQLite database. Through some
Label:
Sqlitedatabase
The class used to manage the SQLite database. Sqlitedatabase can also perform other common database administration tasks by adding, modifying, deleting, and querying database data.
Method
Describe
(void) execsql (String sql)
Methods for executing an SQL statement
(long) Insert (String table,string nullcolumnhack,contentvalues values)
Ways to add
) Understanding the cursorResultSet interface similar to JDBCMaster the Getxxxx () and movexxxx () methods10) Know SqliteopenhelperParameters of the constructor methodContext Context: Contextual ObjectString Name: Database name, file name, such as Tarena.dbCursorfactory Factory: Cursor factory, value NULLint version: Current version, not less than the same app's historical version numberOnCreate (): Execute when database is createdOnupgrade (): Database version upgrade is performedGetreadabledat
1. 2. This demo demonstrates how to use the android SQLite database and bind data to the listview. 3. demonstrate two ways to use databases, including transaction processing. 4. My platform is 2.2. You can run the project after getting it to eclipse, but pay attention to version matching. 5. this demo is suitable for beginners who are learning Android for les
The use of small databases built into Android is basically consistent with the use of SQL sever;The basic process of creating a SQLite data is as follows, which requires implementation of the Sqlopenhelper database Management assistant interface. As follows: Create a new Mysqliteopebhelper class1 Public classMysqlitehelperextendsSqliteopenhelper {2 //constru
Installation and use of SQLite database on Linux platformSQLite is a lightweight database, it is designed to be embedded, and it has been used in many embedded products, it occupies a very low resource, it may only need hundreds of K of memory is enough. can support Windows/linux/unix and so on mainstream operating system, and can be combined with many programming languages, such as TCL, C #, PHP, Java, and
Children's shoes using SQLite database should be no stranger to cursor, if you are engaged in. NET development you can interpret the cursor as a collection of data in ADO, which is equivalent to DataReader. Today, I'm going to take it out alone to deepen my understanding of using Cursor in Android.About CursorWhen you understand and use the Android cursor, you must first know a few things about the cursor:T
"; Private Static Final intDb_version=1; PublicDBHelper (Context context) {//context Context, String name, Cursorfactory factory, int version//Factory Enter NULL, use default value Super(Context, Db_name,NULL, db_version); } //OnCreate is called when the data is first created@Override Public voidonCreate (Sqlitedatabase db) {//Create a tableDb.execsql ("CREATE TABLE IF not EXISTS info" + "(_id INTEGER PRIMARY KEY autoincrement, name VARCHAR
; Getactivity (). Invalidateoptionsmenu (); Updatesubtitle (); return true; 3. SQLite database 1) Create the initial database Create the Crimebasehelper class with the following code: public class Crimebasehelper extends Sqliteopenhelper { private static final int VERSION = 1; private static final String database_name = "CRIMEBASE.DB"; Public Crimebasehelper (Context context) { Super (context, database_name, NULL, VERSION);
); }
}
}
Public Static voidclosecurrentsession () {unbindcontext (); }
Public StaticISession getcurrentsession () {bindcontext (); return_sessionfactory.getcurrentsession (); }
#endregion
#regionClose sessionfactory (typically at end of application) Public Static voidclosesessionfactory () {if(!_sessionfactory.isclosed)
{_sessionfactory.close (); }
}
#endregion
#regionOpen a new session Public StaticISe
manager.begintransaction () forIinch 0.. 10000{let P= Person (dict: ["name":"Zs + \ (i)"," Age":3+i]) P.insertperson ()ifi = = +{manager.rollbacktransaction ()//Note: Be sure to jump out of the loop and stop the update after rolling back.
Break
}
}
//Commit a transactionManager.committransaction () Precompiled bindings: //1. Open the databaseSqlite3 *db =[self sqlite3_open_database]; //2. Build the precompiled statement object and compi
statement1) The return value of the query succeeds differently Sqlite_row2) The mechanism of the operation is also different: before all the data in the table is traversed, the query operation is performed, and each query to a qualifying record returns a Sqlite_row, so you can use this feature to extract the eligible data from the table. while(Sqlite3_step (stmt) = =Sqlite_row) { /*first parameter: stmt the second parameter: the value of which co
Database Connection ObjectSqliteconnection con;Database Command ObjectSqlitecommand command;Database Read ObjectSqlitedatareader reader;Database path in unity, place the database file in the Streamingassets file under the Assets folder for example: database name Stu.sqliteString Sqlitepath = "Data source=" + Application.streamingassetspath + "/stu.sqlite";Create a database connectionCon=new sqliteconnection (Sqlitepath);Create a database directive (to be created by the connection object that con
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.