Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Room2.1 DatabaseView あるある
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Koji Wakamiya
January 28, 2020
Technology
0
710
Room2.1 DatabaseView あるある
Koji Wakamiya
January 28, 2020
Tweet
Share
More Decks by Koji Wakamiya
See All by Koji Wakamiya
Flutterコントリビューションのススメ
d_r_1009
1
1k
人気サービスをFlutter Webでリプレースするとどうなるのか
d_r_1009
0
1.1k
モバイルアプリケーション 開発組織の“学び”
d_r_1009
0
380
Add-to-appの戦い方
d_r_1009
0
1.8k
開発チーム主導で iOSの新機能に対応する 3つのポイント
d_r_1009
0
680
FlutterKaigi2021
d_r_1009
0
1.8k
Flutter?
d_r_1009
0
430
AAC Paging & Kotlin化の紹介
d_r_1009
0
1.3k
JavaからKotlinに書き換えてハマる話
d_r_1009
0
7.7k
Other Decks in Technology
See All in Technology
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
68k
Red Hat OpenStack Services on OpenShift
tamemiya
0
120
OpenShiftでllm-dを動かそう!
jpishikawa
0
130
We Built for Predictability; The Workloads Didn’t Care
stahnma
0
140
Bill One急成長の舞台裏 開発組織が直面した失敗と教訓
sansantech
PRO
2
380
Claude_CodeでSEOを最適化する_AI_Ops_Community_Vol.2__マーケティングx_AIはここまで進化した.pdf
riku_423
2
600
CDK対応したAWS DevOps Agentを試そう_20260201
masakiokuda
1
350
Oracle AI Database移行・アップグレード勉強会 - RAT活用編
oracle4engineer
PRO
0
100
Cosmos World Foundation Model Platform for Physical AI
takmin
0
940
Agent Skils
dip_tech
PRO
0
120
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
10k
ランサムウェア対策としてのpnpm導入のススメ
ishikawa_satoru
0
180
Featured
See All Featured
AI: The stuff that nobody shows you
jnunemaker
PRO
2
260
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
57
50k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
280
Navigating Team Friction
lara
192
16k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
450
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
77
Java REST API Framework Comparison - PWX 2021
mraible
34
9.1k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
1.9k
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!