Slide 1

Slide 1 text

Delightful Android DB Development shaunkawano

Slide 2

Slide 2 text

Common DB implementation in Android

Slide 3

Slide 3 text

https://developer.android.com/training/basics/data-storage/databases.html

Slide 4

Slide 4 text

https://developer.android.com/training/basics/data-storage/databases.html

Slide 5

Slide 5 text

https://developer.android.com/training/basics/data-storage/databases.html

Slide 6

Slide 6 text

https://developer.android.com/training/basics/data-storage/databases.html

Slide 7

Slide 7 text

https://developer.android.com/training/basics/data-storage/databases.html

Slide 8

Slide 8 text

https://developer.android.com/training/basics/data-storage/databases.html

Slide 9

Slide 9 text

• Very Boilerplate 
 Static final Strings, ContentValues.. • Java × SQL Mixed up • Very fragile
 “CREATE TABLE”, “INTEGER PRIMARY KEY”

Slide 10

Slide 10 text

Slide 11

Slide 11 text

SQLDelight

Slide 12

Slide 12 text

SQLDelight https://github.com/square/sqldelight

Slide 13

Slide 13 text

SQLDelight • Static analysis of your SQL • Completely separated SQL from Java codes • Auto generated Java Models based on SQL

Slide 14

Slide 14 text

Dependency

Slide 15

Slide 15 text

Dependency https://github.com/square/sqldelight

Slide 16

Slide 16 text

Dependency https://github.com/square/sqldelight

Slide 17

Slide 17 text

IntelliJ Plugin https://github.com/square/sqldelight

Slide 18

Slide 18 text

Create .sq File

Slide 19

Slide 19 text

Create .sq File • com/your/package/model/Potatotip.java

Slide 20

Slide 20 text

Create .sq File • com/your/package/model/Potatotip.java • sqldelight/com/your/package/model/ Potatotip.sq

Slide 21

Slide 21 text

Create .sq File • com/your/package/model/Potatotip.java • sqldelight/com/your/package/model/ Potatotip.sq Same package as your model class!

Slide 22

Slide 22 text

Potatotip.sq

Slide 23

Slide 23 text

Completely separated SQL from Java codes sqlidelight/com/your/package/Potatotip.sq

Slide 24

Slide 24 text

Static analysis of your SQL

Slide 25

Slide 25 text

• Auto generated Java Models based on .sq file

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

SQLDelight + AutoValue + Retrolambda

Slide 29

Slide 29 text

Map Insert

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

SQLDelight https://github.com/square/sqldelight

Slide 32

Slide 32 text

Delightful Android DB Development shaunkawano fin.