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
The underground in ActiveRecord::ConnectionAdap...
Search
Koichi ITO
March 10, 2018
Programming
6
3.5k
The underground in ActiveRecord::ConnectionAdapters
沖縄Ruby会議02
http://ruby.okinawa/okrk02/
Koichi ITO
March 10, 2018
Tweet
Share
More Decks by Koichi ITO
See All by Koichi ITO
Beyond the RuboCop Defaults
koic
3
2.7k
Minify Ruby Code
koic
2
2.1k
Permanent Agility
koic
37
7.5k
RuboCop: LSP and Prism
koic
3
4.1k
Organizational Pattern Hatching
koic
0
1.5k
A Practitioner's Journey from Ruby 1.8 to Present
koic
1
2k
A Story Featuring Right Hand Archetype
koic
0
1.1k
Without Practice, No Emergence
koic
4
2.4k
The Resurrection of the Fast Parallel Test Runner
koic
1
6.2k
Other Decks in Programming
See All in Programming
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.1k
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.1k
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
900
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
RubyLSPのマルチバイト文字対応
notfounds
0
120
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
subpath importsで始めるモック生活
10tera
0
300
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.1k
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
120
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
EventSourcingの理想と現実
wenas
6
2.3k
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Automating Front-end Workflow
addyosmani
1366
200k
Making Projects Easy
brettharned
115
5.9k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
How STYLIGHT went responsive
nonsquared
95
5.2k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
GraphQLとの向き合い方2022年版
quramy
43
13k
Transcript
"DUJWF3FDPSE $POOFDUJPO"EBQUFST ͷԼͷੈ ք ླྀٿେֶֶ෦߸ؗ 4BU ԭೄ3VCZձٞ 5IFVOEFSHSPVOEJO"3$POOFDUJPO"EBQUFST %JWFUPUIFSBJMTSBJMTSFQPTJUPSZ
ג ӬγεςϜϚωδϝϯτ ҏ౻ߒҰ !LPJD
None
None
ࠓͷ
None
None
None
w %JWFUPSBJMTSBJMTSFQP w "3$POOFDUJPO"EBQUFST w 0SBDMFFOIBODFEBEBQUFS w 0SBDMFXJUI3BJMT "HFOEB ˞#BTFEPO3BJMTSD
Dive to rails/rails
None
None
None
None
None
None
AR::ConectionAdapters
w "3ͷϞσϧܦ༝Ͱͷݺͼग़͠ʹର͠ ͯɺ3%#.4͝ͱʹཧʹ͔ͳͬͨ42- ΛΈཱͯͯฦׂ͢ w 3%#.4ͷ༷Λલఏ͢Δɻྫ͑ 0SBDMFͩͱۭจࣈͱ/6--Λ۠ผ͠ ͳ͍ɺHἬࣝผࢠ͕จࣈҎԼ "3$POOFDUJPO"EBQUFST
SBJMTSBJMTͷςετͰΔ3%#.4ͷ ༷ʹΑΔৼΔ͍ͷҧ͍ DVSSFOU@BEBQUFS
rails/rails#29370
WTOJM
Ξμϓλͷࢦఆͱ 3BJMTΛىಈ࣌ͷ ৼΔ͍ʹ͍ͭͯ
w ͝ଘEBUBCBTFZNMʹࢦఆ͢Δ BEBQUFSͱԿͳͷ͔͍·Ұ $POOFDUJPO"EBQUFSͷબ development: adapter: mysql2 development: adapter: postgresql
development: adapter: sqlite3 development: adapter: oracle_enhanced
w EBUBCBTFZNMͰࢦఆͨ͠Ξμϓλ͕ SBJMTDSBJMTTͰཁٻ͞ΕΔἬͷྲྀΕ "33BJMUJFJOJUJBMJ[FS "3$POOFDUJPO)BOEMJOHFTUBCMJTI@DPOOFDUJ PO "3$POOFDUJPO"EBQUFST$POOFDUJPO4QFDJpD BUJPOTQFD FTUBCMJTI@DPOOFDUJPO
"33BJMUJFJOJUJBMJ[FS IUUQTHJUIVCDPNSBJMTSBJMTCMPCWSDBDUJWFSFDPSEMJCBDUJWF@SFDPSESBJMUJFSC-
"3$POOFDUJPO)BOEMJOH FTUBCMJTI@DPOOFDUJPO IUUQTHJUIVCDPNSBJMTSBJMTCMPCWSDBDUJWFSFDPSEMJCBDUJWF@SFDPSEDPOOFDUJPO@IBOEMJOHSC-
"3$POOFDUJPO"EBQUFST $POOFDUJPO4QFDJpDBUJPOTQFD IUUQTHJUIVCDPNSBJMTSBJMTCMPCWSDBDUJWFSFDPSEMJCBDUJWF@SFDPSEDPOOFDUJPO@BEBQUFSTDPOOFDUJPO@TQFDJpDBUJPOSC-
w EBUBCBTFZNMͷࢦఆBEBQUFS ΛݩʹΞμϓλΛSFRVJSF͢Δ "3$POOFDUJPO"EBQUFST $POOFDUJPO4QFDJpDBUJPOTQFD path_to_adapter = "active_record/connection_adapters/#{spec[:adapter]}_adapter" begin require
path_to_adapter rescue LoadError => e (snip) end (snip) adapter_method = "#{spec[:adapter]}_connection" IUUQTHJUIVCDPNSBJMTSBJMTCMPCWSDBDUJWFSFDPSEMJCBDUJWF@SFDPSEDPOOFDUJPO@BEBQUFSTDPOOFDUJPO@TQFDJpDBUJPOSC-- SFRVJSF
SFRVJSF͞ΕΔ$PSFBEBQUFST
w EBUBCBTFZNMͷࢦఆBEBQUFS ΛݩʹίωΫγϣϯϝιου໊Λܾఆ "3$POOFDUJPO"EBQUFST $POOFDUJPO4QFDJpDBUJPOTQFD path_to_adapter = "active_record/connection_adapters/#{spec[:adapter]}_adapter" begin require
path_to_adapter rescue LoadError => e (snip) end (snip) adapter_method = "#{spec[:adapter]}_connection" IUUQTHJUIVCDPNSBJMTSBJMTCMPCWSDBDUJWFSFDPSEMJCBDUJWF@SFDPSEDPOOFDUJPO@BEBQUFSTDPOOFDUJPO@TQFDJpDBUJPOSC-- @DPOOFDUJPO
IUUQTHJUIVCDPNSBJMTSBJMTCMPCWSDBDUJWFSFDPSEMJCBDUJWF@SFDPSEDPOOFDUJPO@BEBQUFSTNZTRM@BEBQUFSSC- @DPOOFDUJPO
IUUQTHJUIVCDPNSBJMTSBJMTCMPCWSDBDUJWFSFDPSEMJCBDUJWF@SFDPSEDPOOFDUJPO@BEBQUFSTNZTRM@BEBQUFSSC- @DPOOFDUJPO %#$MJFOU
w 3VCZΦϒδΣΫτܦ༝Ͱ.Z42-Λૢ࡞͢Δ ΫϥΠΞϯτͱͳΔυϥΠό(FN require "mysql2" client = Mysql2::Client.new( :host =>
"localhost", :username => "root" ) results = client.query( "SELECT * FROM users WHERE group=‘githubbers'" ) results.each do |row| puts row["id"] # row[“id”].is_a? Integer if row["dne"] # non-existant hash entry is nil puts row["dne"] end end .ZTRMHFN IUUQTHJUIVCDPNCSJBONBSJPNZTRMVTBHF
"3ϞσϧͱυϥΠόͷதؒ $POOFDUJPO"EBQUFST "CTUSBDU"EBQUFS $POOFDUJPO "EBQUFST-BZFS "3.PEFM -BZFS %BUBCBTF $MJFOU-BZFS ˞ਤྫ.Z42-Ξμϓλ
(FNpMFʹࢦఆ ͍ͯ͠Δͷ͜Ε $POOFDUJPO"EBQUFST "CTUSBDU.ZTRM"EBQUFS $POOFDUJPO"EBQUFST .ZTRM"EBQUFS HFN NZTRM .Z42- %BUBCBTF -BZFS "3
"3ϞσϧͱυϥΠόͷதؒ $POOFDUJPO "EBQUFST-BZFS "3.PEFM -BZFS %BUBCBTF $MJFOU-BZFS ˞ਤྫ1PTUHSF42-Ξμϓλ (FNpMFʹࢦఆ ͍ͯ͠Δͷ͜Ε
$POOFDUJPO"EBQUFST 1PTUHSF42-"EBQUFS HFN QH 1PTUHSF42- %BUBCBTF -BZFS $POOFDUJPO"EBQUFST "CTUSBDU"EBQUFS "3
"3ϞσϧͱυϥΠόͷதؒ $POOFDUJPO "EBQUFST-BZFS "3.PEFM -BZFS %BUBCBTF $MJFOU-BZFS ˞ਤྫ42-JUFΞμϓλ (FNpMFʹࢦఆ ͍ͯ͠Δͷ͜Ε
$POOFDUJPO"EBQUFST 42-JUF"EBQUFS HFN TRMJUF 42-JUF %BUBCBTF -BZFS $POOFDUJPO"EBQUFST "CTUSBDU"EBQUFS "3
w EBUBCBTFZNMʹج͍ͮͨ $POOFDUJPO"EBQUFSTΛ͏ w $POOFDUJPO"EBQUFSͷઌͷଓ σʔλϕʔευϥΠόHFNͱͳΔ w NZTRM QH TRMJUFͳͲ
"3ͷσʔλϕʔεଓͷߏ
w SBJMTSBJMTϦϙδτϦͰϝϯςφ ϯε͞Ε͍ͯΔΞμϓλΛࢦ͢ w ݱࡏ.Z42- NZTRM 1PTUHSF42-42-JUFͷͭ w 3BJMTͷ$*ϚτϦοΫεʹೖͬͯΔ
$PSFBEBQUFST
w ֎෦(FNͱͯ͠ཁٻ͞ΕΔΞμϓλ w 0SBDMF w 42-4FSWFS w 'JSFCJSE w FUD
FUD SEQBSUZBEBQUFST
w 3BJMTຊମʹόϯυϧ͞Ε͍ͯΔίΞ ΞμϓλҎ֎͜͜ͰSFRVJSFͯ͠Δ "3$POOFDUJPO"EBQUFST $POOFDUJPO4QFDJpDBUJPOTQFD path_to_adapter = "active_record/connection_adapters/#{spec[:adapter]}_adapter" begin require
path_to_adapter rescue LoadError => e (snip) end (snip) adapter_method = "#{spec[:adapter]}_connection" IUUQTHJUIVCDPNSBJMTSBJMTCMPCWSDBDUJWFSFDPSEMJCBDUJWF@SFDPSEDPOOFDUJPO@BEBQUF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$-"441"5)ʹ +"3Λࢦఆ KBS PKECDKBS $POOFDUJPO"EBQUFST "CTUSBDU"EBQUFS "3
w KSVCZBDUJWFSFDPSEKECDBEBQUFS Ͱཧ͞Ε͍ͯΔ <ิ>0SBDMFҎ֎ͷ+%#$αϙʔτ
A development of Oracle enhanced adapter
w */%&9ʹؔ͢Δ5"#-&41"$&Λࢦఆ Ͱ͖ΔΑ͏ʹରԠͨ͠<> w SBJMTECTDIFNBMPBEͷϚϧνΠϯ αʔτʹରԠͨ͠<> w 3VCZ0$*Λ3VCZͷ #JH%FDJNBMରԠ<SVCZPDJ> ࢥ͍ग़ͷύονબ
w */%&9ʹؔ͢Δ5"#-&41"$&Λࢦఆ Ͱ͖ΔΑ͏ʹରԠͨ͠<> w SBJMTECTDIFNBMPBEͷϚϧνΠϯ αʔτʹରԠͨ͠<> w 3VCZ0$*Λ3VCZͷ #JH%FDJNBMରԠ<SVCZPDJ> ͡ΊͯͷΞμϓλύον
rsim/oracle-enhanced#1028
w 0SBDMFͰ5"#-&41"$&Ͱςʔϒϧ ΠϯσοΫεͷอଘྖҬࢦఆ͕Ͱ͖Δ w 0SBDMFFOBIBODFEBEBQUFSͰ EFGBVMU@UBCMFTQBDFTͰࢦఆՄೳ w QSJNBSZLFZʹରͯ͠͏·͘ޮ͔ͳ ͔ͬͨͷͰͨ͠ 5"#-&41"$&ͷࢦఆ
w ࣌ࣗ৴͕ͳ͘*TTVFͰ͓͍ खݩʹϞϯΩʔύον͋ͬͨ
w 54@*/%&9Ͱͳ͘54@%"5"ʹೖͬͯͨ ͷमਖ਼ύον 0QFOB13
"3.JHSBUJPOͷDSBFUF@UBCMFͷ SEQBSUZΞμϓλ࣮ͷมߋ தུ Ճ IUUQTHJUIVCDPNSTJNPSBDMFFOIBODFECMPCWSDMJCBDUJWF@SFDPSEDPOOFDUJPO@BEBQUFSTPSBDMF@FOIBODFETDIFNB@TUBUFNFOUTSC-
w "-5&3*/%&93*-%5"#-&41"$&Λ ࣮ߦ͢ΔϝιουΛఆ͍ٛͯ͠Δ ADSFBUF@UBCMFA͔ΒͷϑοΫ
w ϦϙδτϦΛԣஅͨ͠มߋ͕ඞཁͩͬͨ $*͕ͱ͓Βͳ͍
w 64&34Ͱͳ͘4:45&.ʹอଘ͞Εͯͨ w %&'"6-55"#-&41"$&ͷมߋ w 0SBDMF͚ͷSBJMTEFWCPYͷ13 ZBIPOEBSBJMTEFWCPY
w 3%#.4ͷΞμϓλ։ൃͳͷͰ 3%#.4ʹԠͨ͡։ൃڥΛඋ͢Δ ඞཁ͕͋Δ w ZBIPOEBSBJMTEFWCPY͕ 0SBDMF͚ͷ։ൃڥͱͳΔ w $*ͱ߹Θͤͯ͜ͷڥΛ͏ͷ͕ྑ͍ ։ൃڥͷݟΛಘΔ
Oracle with Rails 6.0
w 3BJMTҎલϓϥΠϚϦΩʔ*%ͷ ࠾൪ʹ͍ͭͯ4&26&/$&Ͱ͍ग़͞ Ε͍ͯΔ w 3BJMTҎ߱0SBDMFDͷ *EFOUJUZ$PMVNOΛ͏ํͰݕ౼ w OFYUWBMͱ͍͏1P$ͷϦϒʔτ 1P$*EFOUJUZ
w 3BJMTҎલͷσϑΥϧτ EFGBVMU@TFRVFODF@TUBSU@WBMVF w 3BJMTҎޙͷσϑΥϧτ EFGBVMU@TFRVFODF@TUBSU@WBMVF ʹͳΓଞͷΞμϓλͱಉ͡ڍಈʹ $IBOHFAEFGBVMU@TFRVFODF@TUBSU@WBMVFA GSPNUP
w SBJMTECTUSVDUVSFEVNQͷࡍ ʹσϑΥϧτͰ7*&8͕μϯϓ͞Ε ΔΑ͏ʹͳΔ &YUSBDUWJFXTUPEC TUSVDUVSFTRMCZEFGBVMU
w 0SBDMF%"5"#"4&-*/,ͱ͍͏ ଞͷ%#ͷσʔλΛҾ͘ػߏ͕͋Γ 3BJMTܥ0SBDMFΞμϓλἬαϙʔτ w 3BJMTҎޙ3BJMTͷෳ%#ର ԠʹͤΔ͜ͱʹͳΓػೳআ͢Δํ SBJMTSBJMTࢀর %SPQEBUBCBTFMJOLTVQQPSU
%SPQEBUBCBTFMJOLTVQQPSU
w "3#BTFDPOOFDUJPOUBCMFTͷ ΓʹؚΊͯΔϚςϏϡʔΛ֎͠ςʔ ϒϧͷΈฦ͢Α͏ʹ͢Δ͔Ͳ͏͔ʁ w 1PTUHSF42-Ξμϓλʹ͓͚Δಉϝ ιου͕ϚςϏϡʔΛฦ͔͢Ͳ͏͔ʹ ΑΔ (JU)VCίϝϯτௐ &YDMVEFANBUFSJBMJ[FE@WJFXTA
GSPNAUBCMFTA
w 0SBDMFD3ҎԼͰΧϥϜ໊ͳ ͲࣝผࢠʹόΠτҎԼͷ੍ݶ͕͋Δ w SBJMTSBJMTͷ"3ͷҰ෦ͷςετ͕ 0SBDMFͰམͪΔ͍ͪཁҼͰ͋Δ w 0SBDMFD3Ҏ্όΠτ ·Ͱͷ֦ு͞ΕΔ͚ͲͲ͏͢Δʁ -POHJEFOUJpFSTTVQQPSU
+3VCZ +%#$TVQQPSUT0SBDMFD PSIJHIFS1%# 1MVHHBCMFEBUBCBTF
Oracle enhanced 6.0 may require Oracle 12c or higher
w ਓྨͰݟ͍ͯΔਓ͕ݶΒΕ͍ͯΔͱ͍͏ $POOFDUJPO"EBQUFSTͷׂͱߏͱ ϦϙδτϦͰͷॴʹ͍ͭͯ͠·ͨ͠ w "SFMपล͍͠ͷͰׂѪ͍ͯ͠·͕͢ɺ ͜ͷ͋ͨΓ৮ΕΔͱ͔ͳΓڧ͍ͱࢥ͍·͢ w LBNJQP͞ΜͱZBIPOEB͞Μ͍͢͝ਓ ͓ΘΓʹ
None