Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
SQLite Provider: Database access made easy
Search
David González
January 29, 2014
Technology
350
7
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SQLite Provider: Database access made easy
David González
January 29, 2014
Transcript
16 slides
SQLite Provider: A simplification of database access David Gonzalez
Content Providers Managers of structured data Abstract underlying data storage
Allow external access to data
Manage connection to data source
Easy access to data
Implicit intents
Loader callbacks
Provide data to external apps
PROBLEMS — And we had to fix them
Boilerplate code
DB versioning
JSON to SQL mapping
Create the database public ExampleDatabase(Context context, CursorFactory factory, int version)
{ super(context, DATABASE_NAME, factory, version); } @Override public void onCreate(SQLiteDatabase db) { createDatabase(db); }
protected void createDatabase(SQLiteDatabase db) { final String articleTable = "CREATE
TABLE articles" // + " ('" // + _id + "' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, '" // + title + "' TEXT, '" // + content + "' TEXT, '" // + timestamp + "' TIMESTAMP NOT NULL );"; db.execSQL(articleTable); @Override public void onCreate(SQLiteDatabase db) { createDatabase(db); }
Upgrade it @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) { if (oldVersion == 0) { db.execSQL("DROP TABLE article"); createDatabase(db); } }
Upgrade it ContentResolver resolver = getContentResolver(); String[] projection = new
String[] {UserDictionary.Words._ID, UserDictionary.Words.WORD}; String selectionClause = UserDictionary.Words.WORD + " = ?"; String[] selectionArgs = new String[] {"Android"}; String sortOrder = UserDictionary.Words.WORD + " ASC”; Cursor cursor = resolver.query(UserDictionary.Words.CONTENT_URI, projection, selectionClause, selectionArgs, sortOrder);
Our solution https://github.com/novoda/SQLiteProvider
More Decks by David González
See All by David González
A comprehensive guide to tracker protection on Android
malmstein
1
110
Building a Multiplatform library for iOS and Android
malmstein
9
1.4k
Unidirectional Data Flow on Android
malmstein
6
570
Introduction to Kotlin Coroutines
malmstein
0
210
A State Container Architecture for mobile applications
malmstein
0
180
Things I wish I knew before starting to work remote
malmstein
0
130
Remote, lonely and productive
malmstein
0
220
The source of all technical debt
malmstein
6
470
Android Architecture Blueprints
malmstein
0
340
Other Decks in Technology
See All in Technology
高品質と高スピードを支える品質のシフトレフトのアプローチ
goyoki
2
870
田んぼから始まる挑戦 〜新米農家の1年目〜
miu_crescent
PRO
0
290
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
17
120k
仕様と現実の間で落とし所を探るリモートMCPの認証・認可 — Sansanの認証基盤における課題と実践
sansantech
PRO
2
290
Frontier Teams — Amazon は AI で「開発のやり方」をどう変えたのか
kmotohas
0
230
田んぼの見回りをIoTで減らしたい!水位監視から電池駆動カメラまでの試行錯誤
itosoft
1
170
Kiro IDE 入門 (画面の各部から、頼み方、任せ方、戻し方まで) | 目指せ Kiro マスター 02
inariku
PRO
4
230
会社説明資料_最新版
demaecan
0
32k
Kiro CLI 入門 (ターミナルと CI で使う) | 目指せ Kiro マスター 03
inariku
PRO
2
140
GCASアップデート(202607-202610)
techniczna
1
330
小さなエージェントから始めてみよう!実践コンテキストエンジニアリング
iwamot
PRO
0
120
異夢同船〜異なる夢でも同じ船でなんとかする〜
fortegp05
0
190
Featured
See All Featured
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
610
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.6k
Scaling GitHub
holman
464
140k
sira's awesome portfolio website redesign presentation
elsirapls
0
510
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
460
Facilitating Awesome Meetings
lara
57
7.2k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
480
YesSQL, Process and Tooling at Scale
rocio
174
15k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.7k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.5k
The Art of Programming - Codeland 2020
erikaheidi
57
14k