SlideShare une entreprise Scribd logo
1  sur  13
Rajab Davudov
What is SQLite?
• SQLite is Open Source Database
  embedded into Mobile Devices.
• SQLite supports SQL syntax, transactions
  and prepared statements.
• SQLite consumes low memory approx.
  250Kbyte.
SQLite Types
• TEXT (String in Java)
• INTEGER (long in Java)
• REAL (double in Java)
SQLite in Android
• SQLite comes with all Android devices
• Application database is stored at
DATA/data/APP_NAME/databases/FILENAME
SQLite in Android
• Two packages
  – android.database
  – android.database.sqlite
SQLiteOpenHelpler
•   onCreate()
•   onUpgrade()
•   getReadableDatabase()
•   getWriteableDatabase()
SQLiteDatabase
•   insert()
•   update()
•   delete()
•   query()
•   rawQuery()
insert()
ContentValues values = new ContentValues() ;
values.put("username", username) ;
values.put("fullname", fullname) ;
values.put("password", password) ;
database.insert("users", null, values) ;
query()
Cursor cursor = database.query(
  "users",
  new String[] {"fullname"},
  "username = ? and password = ?",
  new String[]{username, password},
  null, null, null) ;
rawQuery()
Cursor cursor = database.rawQuery(
"select fullname from users where username = ?
and password = ?",
new String[] { username, password }) ;
Cursor
A Cursor represents the result of a query and
basically points to one row of the query result.
• getCount()
• moveToFirst()
• moveToNext()
• …
Think, Design, Code !!!
Rajab Davudov
  Senior Developer at Azerfon
            radjab@gmail.com
https://play.google.com/store/apps/developer?id=RADJAB
http://gplus.to/radjab
http://www.fb.me/rajab.davudov
http://www.linkedin.com/in/radjab

Contenu connexe

Tendances

Data Handning with Sqlite for Android
Data Handning with Sqlite for AndroidData Handning with Sqlite for Android
Data Handning with Sqlite for Android
Jakir Hossain
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorage
Krazy Koder
 
Introduction4 SQLite
Introduction4 SQLiteIntroduction4 SQLite
Introduction4 SQLite
Stanley Huang
 

Tendances (20)

ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
 
Persitance Data with sqlite
Persitance Data with sqlitePersitance Data with sqlite
Persitance Data with sqlite
 
Accessing data with android cursors
Accessing data with android cursorsAccessing data with android cursors
Accessing data with android cursors
 
Android Database Tutorial
Android Database TutorialAndroid Database Tutorial
Android Database Tutorial
 
SQLite database in android
SQLite database in androidSQLite database in android
SQLite database in android
 
Data Handning with Sqlite for Android
Data Handning with Sqlite for AndroidData Handning with Sqlite for Android
Data Handning with Sqlite for Android
 
Sqlite
SqliteSqlite
Sqlite
 
Database
DatabaseDatabase
Database
 
Using sqlite database in android with sqlite manager browser add ons
Using sqlite database in android with sqlite manager browser add onsUsing sqlite database in android with sqlite manager browser add ons
Using sqlite database in android with sqlite manager browser add ons
 
Sql lite android
Sql lite androidSql lite android
Sql lite android
 
Introduction to SQLite: The Most Popular Database in the World
Introduction to SQLite: The Most Popular Database in the WorldIntroduction to SQLite: The Most Popular Database in the World
Introduction to SQLite: The Most Popular Database in the World
 
Sqlite
SqliteSqlite
Sqlite
 
Persistence on iOS
Persistence on iOSPersistence on iOS
Persistence on iOS
 
Advanced Core Data
Advanced Core DataAdvanced Core Data
Advanced Core Data
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorage
 
SQLite 3
SQLite 3SQLite 3
SQLite 3
 
Android sq lite-chapter 22
Android sq lite-chapter 22Android sq lite-chapter 22
Android sq lite-chapter 22
 
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
 
Entity Framework Database and Code First
Entity Framework Database and Code FirstEntity Framework Database and Code First
Entity Framework Database and Code First
 
Introduction4 SQLite
Introduction4 SQLiteIntroduction4 SQLite
Introduction4 SQLite
 

En vedette

Android for-indoor-services
Android for-indoor-servicesAndroid for-indoor-services
Android for-indoor-services
OSLL
 
писаревский алексей
писаревский алексейписаревский алексей
писаревский алексей
apps4allru
 

En vedette (16)

Android vs iOS
Android vs iOSAndroid vs iOS
Android vs iOS
 
Android development beyond the basics
Android development   beyond the basicsAndroid development   beyond the basics
Android development beyond the basics
 
Sq lite
Sq lite Sq lite
Sq lite
 
SQLite
SQLiteSQLite
SQLite
 
Android de la A a la Z - Unidad 7
Android de la A a la Z - Unidad 7Android de la A a la Z - Unidad 7
Android de la A a la Z - Unidad 7
 
SQLite3
SQLite3SQLite3
SQLite3
 
Developing for Android (The movie)
Developing for Android (The movie)Developing for Android (The movie)
Developing for Android (The movie)
 
Hackathon final
Hackathon finalHackathon final
Hackathon final
 
Brew Compilation
Brew CompilationBrew Compilation
Brew Compilation
 
Android for-indoor-services
Android for-indoor-servicesAndroid for-indoor-services
Android for-indoor-services
 
04 ns array
04   ns array04   ns array
04 ns array
 
писаревский алексей
писаревский алексейписаревский алексей
писаревский алексей
 
Дмитрий Рыжков. Intel Android x86.
Дмитрий Рыжков. Intel Android x86.Дмитрий Рыжков. Intel Android x86.
Дмитрий Рыжков. Intel Android x86.
 
Государственный реестр регистраторов расчетных операций (РРО) от 02.08.2013
Государственный реестр регистраторов расчетных операций (РРО)  от 02.08.2013Государственный реестр регистраторов расчетных операций (РРО)  от 02.08.2013
Государственный реестр регистраторов расчетных операций (РРО) от 02.08.2013
 
Use-Case is Everything
Use-Case is EverythingUse-Case is Everything
Use-Case is Everything
 
Живые обои для Android. Как создать. Тонкости. Продвижение
Живые обои для Android. Как создать. Тонкости. ПродвижениеЖивые обои для Android. Как создать. Тонкости. Продвижение
Живые обои для Android. Как создать. Тонкости. Продвижение
 

Similaire à Android Database

Android App Development 05 : Saving Data
Android App Development 05 : Saving DataAndroid App Development 05 : Saving Data
Android App Development 05 : Saving Data
Anuchit Chalothorn
 

Similaire à Android Database (20)

Rajab Davudov - Android Database
Rajab Davudov - Android DatabaseRajab Davudov - Android Database
Rajab Davudov - Android Database
 
Solid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaSolid And Sustainable Development in Scala
Solid And Sustainable Development in Scala
 
Solid and Sustainable Development in Scala
Solid and Sustainable Development in ScalaSolid and Sustainable Development in Scala
Solid and Sustainable Development in Scala
 
前端MVC之BackboneJS
前端MVC之BackboneJS前端MVC之BackboneJS
前端MVC之BackboneJS
 
Scala Frustrations
Scala FrustrationsScala Frustrations
Scala Frustrations
 
SQL Provider
SQL ProviderSQL Provider
SQL Provider
 
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...
 
ReactJS for Beginners
ReactJS for BeginnersReactJS for Beginners
ReactJS for Beginners
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
Object Relational model for SQLIite in android
Object Relational model for SQLIite  in android Object Relational model for SQLIite  in android
Object Relational model for SQLIite in android
 
6° Sessione - Ambiti applicativi nella ricerca di tecnologie statistiche avan...
6° Sessione - Ambiti applicativi nella ricerca di tecnologie statistiche avan...6° Sessione - Ambiti applicativi nella ricerca di tecnologie statistiche avan...
6° Sessione - Ambiti applicativi nella ricerca di tecnologie statistiche avan...
 
An intro to Azure Data Lake
An intro to Azure Data LakeAn intro to Azure Data Lake
An intro to Azure Data Lake
 
Intro to Spark and Spark SQL
Intro to Spark and Spark SQLIntro to Spark and Spark SQL
Intro to Spark and Spark SQL
 
Android App Development 05 : Saving Data
Android App Development 05 : Saving DataAndroid App Development 05 : Saving Data
Android App Development 05 : Saving Data
 
Database Programming Techniques
Database Programming TechniquesDatabase Programming Techniques
Database Programming Techniques
 
Reactive Java Programming: A new Asynchronous Database Access API by Kuassi M...
Reactive Java Programming: A new Asynchronous Database Access API by Kuassi M...Reactive Java Programming: A new Asynchronous Database Access API by Kuassi M...
Reactive Java Programming: A new Asynchronous Database Access API by Kuassi M...
 
[OSC 2020 Online/Nagoya] MySQLドキュメントストア
[OSC 2020 Online/Nagoya] MySQLドキュメントストア[OSC 2020 Online/Nagoya] MySQLドキュメントストア
[OSC 2020 Online/Nagoya] MySQLドキュメントストア
 
Naver_alternative_to_jpa
Naver_alternative_to_jpaNaver_alternative_to_jpa
Naver_alternative_to_jpa
 
ActiveJDBC - ActiveRecord implementation in Java
ActiveJDBC - ActiveRecord implementation in JavaActiveJDBC - ActiveRecord implementation in Java
ActiveJDBC - ActiveRecord implementation in Java
 
Gaej For Beginners
Gaej For BeginnersGaej For Beginners
Gaej For Beginners
 

Plus de Rashad Aliyev

Win Phone 2 - Qaliblər
Win Phone 2 - Qaliblər Win Phone 2 - Qaliblər
Win Phone 2 - Qaliblər
Rashad Aliyev
 
Win Phone 2 - Statistika
Win Phone 2 - StatistikaWin Phone 2 - Statistika
Win Phone 2 - Statistika
Rashad Aliyev
 
Win Phone 2 - Yazılan tətbiqlər
Win Phone 2 - Yazılan tətbiqlərWin Phone 2 - Yazılan tətbiqlər
Win Phone 2 - Yazılan tətbiqlər
Rashad Aliyev
 
Preparing presentations
Preparing presentationsPreparing presentations
Preparing presentations
Rashad Aliyev
 
Using Controls, calling Launchers. IsolatedStorages and Local DataBase samples
Using Controls, calling Launchers. IsolatedStorages and Local DataBase samplesUsing Controls, calling Launchers. IsolatedStorages and Local DataBase samples
Using Controls, calling Launchers. IsolatedStorages and Local DataBase samples
Rashad Aliyev
 
Apps with the operator
Apps with the operatorApps with the operator
Apps with the operator
Rashad Aliyev
 

Plus de Rashad Aliyev (20)

Win Phone 2 - Qaliblər
Win Phone 2 - Qaliblər Win Phone 2 - Qaliblər
Win Phone 2 - Qaliblər
 
Win Phone 2 - Statistika
Win Phone 2 - StatistikaWin Phone 2 - Statistika
Win Phone 2 - Statistika
 
Win Phone 2 - Yazılan tətbiqlər
Win Phone 2 - Yazılan tətbiqlərWin Phone 2 - Yazılan tətbiqlər
Win Phone 2 - Yazılan tətbiqlər
 
Teqdimat
TeqdimatTeqdimat
Teqdimat
 
Preparing presentations
Preparing presentationsPreparing presentations
Preparing presentations
 
HTML5 + PhoneGap & Windows Phone
HTML5 + PhoneGap & Windows PhoneHTML5 + PhoneGap & Windows Phone
HTML5 + PhoneGap & Windows Phone
 
Using Controls, calling Launchers. IsolatedStorages and Local DataBase samples
Using Controls, calling Launchers. IsolatedStorages and Local DataBase samplesUsing Controls, calling Launchers. IsolatedStorages and Local DataBase samples
Using Controls, calling Launchers. IsolatedStorages and Local DataBase samples
 
Windows Phone8
Windows Phone8Windows Phone8
Windows Phone8
 
Apps with the operator
Apps with the operatorApps with the operator
Apps with the operator
 
Khazar University Library
Khazar University LibraryKhazar University Library
Khazar University Library
 
HTML5 + PhoneGap
HTML5 + PhoneGapHTML5 + PhoneGap
HTML5 + PhoneGap
 
Digər proqramlaşdırma dillərində Android platforması üçün proqramlaşdırma
Digər proqramlaşdırma dillərində Android platforması üçün proqramlaşdırmaDigər proqramlaşdırma dillərində Android platforması üçün proqramlaşdırma
Digər proqramlaşdırma dillərində Android platforması üçün proqramlaşdırma
 
Telephony API
Telephony APITelephony API
Telephony API
 
Android Preferences
Android PreferencesAndroid Preferences
Android Preferences
 
Rajab Davudov - Developing Location Based Applications for Android
Rajab Davudov - Developing Location Based Applications for AndroidRajab Davudov - Developing Location Based Applications for Android
Rajab Davudov - Developing Location Based Applications for Android
 
Rajab Davudov - Android UI Design: Layouts
Rajab Davudov - Android UI Design: LayoutsRajab Davudov - Android UI Design: Layouts
Rajab Davudov - Android UI Design: Layouts
 
Ramin Orujov - Android API Overview and Repository
Ramin Orujov - Android API Overview and RepositoryRamin Orujov - Android API Overview and Repository
Ramin Orujov - Android API Overview and Repository
 
Hackathon
HackathonHackathon
Hackathon
 
Hackathon Azerbaijan Next Step
Hackathon Azerbaijan Next StepHackathon Azerbaijan Next Step
Hackathon Azerbaijan Next Step
 
Hackathon Azerbaijan
Hackathon AzerbaijanHackathon Azerbaijan
Hackathon Azerbaijan
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Dernier (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

Android Database

  • 2. What is SQLite? • SQLite is Open Source Database embedded into Mobile Devices. • SQLite supports SQL syntax, transactions and prepared statements. • SQLite consumes low memory approx. 250Kbyte.
  • 3. SQLite Types • TEXT (String in Java) • INTEGER (long in Java) • REAL (double in Java)
  • 4. SQLite in Android • SQLite comes with all Android devices • Application database is stored at DATA/data/APP_NAME/databases/FILENAME
  • 5. SQLite in Android • Two packages – android.database – android.database.sqlite
  • 6. SQLiteOpenHelpler • onCreate() • onUpgrade() • getReadableDatabase() • getWriteableDatabase()
  • 7. SQLiteDatabase • insert() • update() • delete() • query() • rawQuery()
  • 8. insert() ContentValues values = new ContentValues() ; values.put("username", username) ; values.put("fullname", fullname) ; values.put("password", password) ; database.insert("users", null, values) ;
  • 9. query() Cursor cursor = database.query( "users", new String[] {"fullname"}, "username = ? and password = ?", new String[]{username, password}, null, null, null) ;
  • 10. rawQuery() Cursor cursor = database.rawQuery( "select fullname from users where username = ? and password = ?", new String[] { username, password }) ;
  • 11. Cursor A Cursor represents the result of a query and basically points to one row of the query result. • getCount() • moveToFirst() • moveToNext() • …
  • 13. Rajab Davudov Senior Developer at Azerfon radjab@gmail.com https://play.google.com/store/apps/developer?id=RADJAB http://gplus.to/radjab http://www.fb.me/rajab.davudov http://www.linkedin.com/in/radjab