pdfnoob.blogg.se

Android sqlite database tutorial
Android sqlite database tutorial













android sqlite database tutorial

This class is used for creating a database and version management.

android sqlite database tutorial

Example: Cursor resultset = mydatabase.rawQuery(“SELECT * FROM Employee”, null) resultset.moveToFirst() String eid = resultset.getString(1) String ename = resultset.getString(2) The rawQuery() accepts an SQL SELECT statement as an input. Calling a method of Cursor class is called rawQuery which returns a resultset with the cursor pointing to the table. Example: mydatabase.execSQL(“CREATE TABLE TutorialRide(Admin_name VARCHAR, Password VARCHAR) ”) mydatabase.execSQL(“INSERT INTO TutorialRide VALUES('ABC', '123') ”) Īn object of the Cursor class is used to fetch the data from the database.

#Android sqlite database tutorial update#

Syntax: execSQL(String SQL, Object bind Args) The execSQL() method is used not only to insert a data, but also to update or modify the existing data in database, using bind arguments. This method is defined in SQLiteDatabse class. The execSQL() method is used to insert the data into table. Syntax SQLiteDatabse mydatabase = openOrCreateDatabase (“database_name”, MODE_PRIVATE, null) This method returns an instance of SQLite database. The openOrCreateDatabase() method is called for creating a database with your database name and mode as a parameter. The is the main package in Android SQLite which contains the classes to manage your own databases. To use the SQLite database, the SQLiteOpenHelper class is used which provides various functionality.It stores data to a text file on a device and supports all the relational database features.

android sqlite database tutorial

SQLite database is embedded in every Android device.Android does not require a setup procedure or administration of the database using an SQLite database.It has methods to create, delete, execute SQL commands and perform other common database management tasks. It supports standard relational database features like SQL syntax, transactions, prepared statement, etc. What is SQLite?SQLite is an open source database.















Android sqlite database tutorial