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
Room2.1 DatabaseView あるある
Search
Koji Wakamiya
January 28, 2020
Technology
770
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Room2.1 DatabaseView あるある
Koji Wakamiya
January 28, 2020
More Decks by Koji Wakamiya
See All by Koji Wakamiya
Flutterコントリビューションのススメ
d_r_1009
1
1.4k
人気サービスをFlutter Webでリプレースするとどうなるのか
d_r_1009
0
1.3k
モバイルアプリケーション 開発組織の“学び”
d_r_1009
0
430
Add-to-appの戦い方
d_r_1009
0
2k
開発チーム主導で iOSの新機能に対応する 3つのポイント
d_r_1009
0
750
FlutterKaigi2021
d_r_1009
0
2k
Flutter?
d_r_1009
0
480
AAC Paging & Kotlin化の紹介
d_r_1009
0
1.4k
JavaからKotlinに書き換えてハマる話
d_r_1009
0
7.9k
Other Decks in Technology
See All in Technology
USB PDを使ってスマホを労わりたい
raspython3
0
180
サブエージェントと Claude Mods で作る独自 Advisor ツールの話
kenichiodo
2
170
OptunaHub: ブラックボックス最適化のためのプラットフォーム
pfn
PRO
0
140
専門領域のAIをどう評価するか
bengo4com
2
310
Webの常識が通じないHTMLメールのダークモード
teamlab
PRO
0
140
AIカンパニーへの転換を支えた、エンジニアの仕事の再定義
kworkdev
PRO
2
1.3k
Conditional PED-ANOVA: Hyperparameter Importance in Hierarchical & Dynamic Search Spaces
pfn
PRO
0
140
CTO Night|NotionのAIエージェントとFDE
kzkhykw1991
0
240
PHPカンファレンス関西の招待状 / Invitation to PHP Conference Kansai
ykanoh
0
220
20261017福岡devIO 「AIは"良いダッシュボード"を作れるか?
jtakeda
0
190
V8のArray.prototype.flatを最大約20倍速くするまでと、巨大OSSへの大規模コミットの道のり
riyaamemiya
0
310
価値について
gree_tech
PRO
0
110
Featured
See All Featured
From π to Pie charts
rasagy
1
400
The Curse of the Amulet
leimatthew05
3
16k
Claude Code のすすめ
schroneko
67
230k
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Between Models and Reality
mayunak
4
500
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.2k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
500
Designing Experiences People Love
moore
143
24k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.7k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Done Done
chrislema
187
17k
Transcript
Room2.1 DatabaseView ͋Δ͋Δ ͋Δ͋ΔLTʙ ͓ਖ਼݄ͩΑʂAndroid & iOS߹ಉ େLTେձ ʙ Vol.10
ࣗݾհ • Koji Wakamiya • Studyplus, inc. • @koji-1009 (Github)
• @D_R_1009 (Twitter, Hatena, etc…)
DatabaseView ͬͯ·͔͢ʁ
DatabaseViewʹ͍ͭͯʢ͓͞Β͍ʣ • Room 2.1ͰՃ͞Εͨػೳ • Inner/Outer joinΛRoomͰ࣮ݱ • ςʔϒϧΛ͋Δ͖ܗʹׂ͠ දࣔ(View)ʹ߹ΘͤͯσʔλΛ߹͢Δ͜ͱ͕Ͱ͖Δ
ෳͷςʔϒϧͱForeignKey • ؔ࿈ͷ͋ΔෳͷςʔϒϧΛѻ͏͜ͱʹͳΔͨΊ ForeignKeyΛར༻͢Δ͜ͱ͕͋Δ • ؔ࿈͚Λߦ͏͜ͱͰɺத৺ͱͳΔrowΛআͨ࣌͠ʹ ଞͷςʔϒϧͷrowআ͢ΔͳͲͷߟྀΛߦ͏
OnConflictStrategy.REPLACEͰ σʔλ͕ফ͑ͪΌ͏ࣄ݅
OnConflictStrategy • InsetॲཧதʹConflict͕ൃੜ(row͕طʹଘࡏ)ͨ࣌͠ ͲͷΑ͏ͳѻ͍Λ͢Δ͔ΛܾΊΔ͜ͱ͕Ͱ͖Δ • DBͷར༻༻్తʹ߹Θͤͯར༻͢ΔStrategy͕มΘΔ
OnConflictStrategy • ABORT (default) • OnConflict strategy constant to abort
the transaction. • REPLACE • OnConflict strategy constant to replace the old data and continue the transaction. • Ignore • OnConflict strategy constant to ignore the conflict.
ࣄ݅ঢ়گ • ΞΠςϜςʔϒϧͱΞΠςϜฒͼॱςʔϒϧ͕ଘࡏ • ΞΠςϜΞϓϦىಈ࣌ʹαʔόʔͱಉظ • @InsertͱOnConflictStrategy.REPLACEͰશσʔλߋ৽ • ฒͼॱͷσʔλΞϓϦʹ͔͠ଘࡏ͠ͳ͍ͨΊอ࣋
ࣄ݅ঢ়گ • αʔόʔͱΞϓϦDBΛಉظ(ϦϑϨογϡ)͢Δͱ ΞΠςϜϦετ͕දࣔ͞Εͳ͘ͳΔ • ௐͯΈΔͱʮΞΠςϜʯͷσʔλ͋Δ͕ ʮΞΠςϜฒͼॱʯ͕ଘࡏ͠ͳ͘ͳ͍ͬͯΔ • Inner JoinͷͨΊDatabaseView͕ੜ͞Ε͍ͯͳ͍……ʁ
Ͳ͏ͯ͠σʔλফ͑ͪΌ͏Μ……
REPLACEʹΑΔUpdateॲཧ • REPLACE࣮࣭తʹUpdateॲཧʢͩͱࢥ͍ͬͯͨʣ • Conflictൃੜ͠ͳ͍ → ৽نrow࡞ॲཧ • Conflictൃੜ͢Δ →
طଘrowߋ৽ॲཧ
REPLACEʹΑΔUpdateॲཧ • REPLACE࣮࣭తʹUpdateॲཧʢͰͳ͍ʣ • Conflictൃੜ͠ͳ͍ → ৽نrow࡞ॲཧ • Conflictൃੜ͢Δ →
طଘrowߋ৽ॲཧ طଘrowআॲཧ + ৽نrowՃॲཧ
REPLACEʹΑΔUpdateॲཧ • طଘrowͷআ + ForeignKeyʹΑΔؔ࿈͚ʹΑΓ ʮΞΠςϜʯͷআͰʮΞΠςϜฒͼॱʯ͕আ͞Ε͍ͯͨ • @InsertͰͳ͘@UpdateΛར༻͠ͳ͚ΕͳΒͳ͔ͬͨ • Ճͱߋ৽ॲཧΛϝιουͰΓ͚Δ͜ͱͰ
͜ͱͳ͖ΛಘΔ͜ͱ͕Ͱ͖ͨ
υΩϡϝϯτͪΌΜͱಡΉ ʢ͋ͱɺԣண͠ͳ͍ʣ
Thanks!