SlideShare uma empresa Scribd logo
1 de 39
Baixar para ler offline
DataObjects
Dirkjan Bussink
© Jon Truran
Text




Sorry for the photoshop skills...
connection = Mysql.real_connect(quot;localhostquot;, quot;rootquot;, quot;quot;, quot;do_testquot;)
 reader     = connection.query(quot;SELECT login, password FROM usersquot;)
 reader.each do |row|
   row[0] => 'dbussink'
   row[1] => 'secret'
 end
                              connection = OCI8.new(quot;rootquot;, quot;quot;, quot;localhostquot;)
                              reader     = connection.exec(quot;SELECT login, password FROM usersquot;)
                              while row = reader.fetch
                                row[0] => 'dbussink'
                                row[1] => 'secret'
                              end


connection = PGconn.connect(quot;localhostquot;, 5432, nil, nil, quot;do_testquot;, quot;rootquot;, quot;quot;)
reader     = connection.exec(quot;SELECT login, password FROM usersquot;)

for i in 0...reader.ntuples do
  reader.getvalue(i,0) => 'dbussink'
  reader.getvalue(i,1) => 'secret'
end



                       connection = SQLite3::Database.new(quot;do_test.dbquot;)
                       reader     = connection.execute(quot;SELECT login, password FROM usersquot;)

                       reader[0][0] => 'dbussink'
                       reader[0][1] => 'secret'
It’s all about the API
connection = DataObjects::Connection.new(quot;mysql://root@localhost/do_testquot;)
command    = connection.create_command(quot;INSERT INTO users (login) VALUES ('dbussink')quot;)
result     = command.execute_non_query

result.affected_rows => 1
result.insert_id     => 2
connection = DataObjects::Connection.new(quot;mysql://root@localhost/do_testquot;)
command    = connection.create_command(quot;SELECT id, login, created_at FROM usersquot;)
reader     = command.execute_reader

reader.fields => ['id', 'login', 'created_at']

while reader.next!
  reader.values => [1, 'dbussink', Date.civil(2009, 5, 10)]
end
Typecasting
connection = DataObjects::Connection.new(quot;mysql://root@localhost/do_testquot;)
command    = connection.create_command(quot;SELECT id, login, created_at FROM usersquot;)
command.set_types(String, String, String)
reader     = command.execute_reader

reader.fields => ['id', 'login', 'created_at']

while reader.next!
  reader.values => ['1', 'dbussink', '2009-5-10']
end
connection = DataObjects::Connection.new(quot;mysql://root@localhost/do_testquot;)

command    = connection.create_command(quot;SELECT id, login, password FROM users WHERE login = ?quot;)
reader     = command.execute_reader('dbussink')
reader.fields => ['id', 'login', 'created_at']

while reader.next!
  reader.values => [1, 'dbussink', Date.civil(2009, 5, 10)]
end
Float
                     String
Integer

                                    Date
                BigDecimal


                              TrueClass
          DateTime
Shared specs
describe DataObjects::Postgres::Command do
  it_should_behave_like 'a Command'
  it_should_behave_like 'a Command with async'
end
Implement standard
                                                   Command API
describe DataObjects::Postgres::Command do
  it_should_behave_like 'a Command'
  it_should_behave_like 'a Command with async'
end
Implement standard
                                                   Command API
describe DataObjects::Postgres::Command do
  it_should_behave_like 'a Command'
  it_should_behave_like 'a Command with async'
end
                                                     Command is green
                                                       thread friendly
describe 'DataObjects::Postgres with BigDecimal' do
  it_should_behave_like 'supporting BigDecimal'
  it_should_behave_like 'supporting BigDecimal autocasting'
end
Deserialize and
                                                   serialize BigDecimal

describe 'DataObjects::Postgres with BigDecimal' do
  it_should_behave_like 'supporting BigDecimal'
  it_should_behave_like 'supporting BigDecimal autocasting'
end
Deserialize and
                                                       serialize BigDecimal

describe 'DataObjects::Postgres with BigDecimal' do
  it_should_behave_like 'supporting BigDecimal'
  it_should_behave_like 'supporting BigDecimal autocasting'
end
                                                 Database provides
                                             a mapped type (DECIMAL)
How can I help?
Improved transactions
Prepared statements
Specs!
And documentation too :)
ActiveRecord adapter
Euruko 2009 - DataObjects

Mais conteúdo relacionado

Mais procurados

Cara membuka workbook yang terproteksi
Cara membuka workbook yang terproteksiCara membuka workbook yang terproteksi
Cara membuka workbook yang terproteksi
Irmaoly
 
Adventures in Multithreaded Core Data
Adventures in Multithreaded Core DataAdventures in Multithreaded Core Data
Adventures in Multithreaded Core Data
Inferis
 

Mais procurados (20)

Кирилл Латыш "ERP on Websockets"
Кирилл Латыш "ERP on Websockets"Кирилл Латыш "ERP on Websockets"
Кирилл Латыш "ERP on Websockets"
 
Core Data with multiple managed object contexts
Core Data with multiple managed object contextsCore Data with multiple managed object contexts
Core Data with multiple managed object contexts
 
Lodash js
Lodash jsLodash js
Lodash js
 
Mongoose and MongoDB 101
Mongoose and MongoDB 101Mongoose and MongoDB 101
Mongoose and MongoDB 101
 
Python my SQL - create table
Python my SQL - create tablePython my SQL - create table
Python my SQL - create table
 
C* Summit EU 2013: Cassandra Made Simple with CQL Drivers and DevCenter
C* Summit EU 2013: Cassandra Made Simple with CQL Drivers and DevCenter C* Summit EU 2013: Cassandra Made Simple with CQL Drivers and DevCenter
C* Summit EU 2013: Cassandra Made Simple with CQL Drivers and DevCenter
 
Underscore and Backbone Models
Underscore and Backbone ModelsUnderscore and Backbone Models
Underscore and Backbone Models
 
Polyglot persistence with Spring Data
Polyglot persistence with Spring DataPolyglot persistence with Spring Data
Polyglot persistence with Spring Data
 
JavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and LodashJavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and Lodash
 
Chaining and function composition with lodash / underscore
Chaining and function composition with lodash / underscoreChaining and function composition with lodash / underscore
Chaining and function composition with lodash / underscore
 
Python my sql database connection
Python my sql   database connectionPython my sql   database connection
Python my sql database connection
 
Cara membuka workbook yang terproteksi
Cara membuka workbook yang terproteksiCara membuka workbook yang terproteksi
Cara membuka workbook yang terproteksi
 
Mysocial databasequeries
Mysocial databasequeriesMysocial databasequeries
Mysocial databasequeries
 
Mysocial databasequeries
Mysocial databasequeriesMysocial databasequeries
Mysocial databasequeries
 
Zend framework 03 - singleton factory data mapper caching logging
Zend framework 03 - singleton factory data mapper caching loggingZend framework 03 - singleton factory data mapper caching logging
Zend framework 03 - singleton factory data mapper caching logging
 
High Performance Core Data
High Performance Core DataHigh Performance Core Data
High Performance Core Data
 
Adventures in Multithreaded Core Data
Adventures in Multithreaded Core DataAdventures in Multithreaded Core Data
Adventures in Multithreaded Core Data
 
19. CodeIgniter imagini in mysql
19. CodeIgniter imagini in mysql19. CodeIgniter imagini in mysql
19. CodeIgniter imagini in mysql
 
AngularJs
AngularJsAngularJs
AngularJs
 
async/await in Swift
async/await in Swiftasync/await in Swift
async/await in Swift
 

Destaque

Rubinius @ RubyAndRails2010
Rubinius @ RubyAndRails2010Rubinius @ RubyAndRails2010
Rubinius @ RubyAndRails2010
Dirkjan Bussink
 

Destaque (6)

Datamapper @ Railsconf2010
Datamapper @ Railsconf2010Datamapper @ Railsconf2010
Datamapper @ Railsconf2010
 
Lecture on Rubinius for Compiler Construction at University of Twente
Lecture on Rubinius for Compiler Construction at University of TwenteLecture on Rubinius for Compiler Construction at University of Twente
Lecture on Rubinius for Compiler Construction at University of Twente
 
Rubinius @ RubyAndRails2010
Rubinius @ RubyAndRails2010Rubinius @ RubyAndRails2010
Rubinius @ RubyAndRails2010
 
DataMapper @ RubyEnRails2009
DataMapper @ RubyEnRails2009DataMapper @ RubyEnRails2009
DataMapper @ RubyEnRails2009
 
Girl code meets IOT
Girl code meets IOTGirl code meets IOT
Girl code meets IOT
 
Lean part of DevOps - DevOps Amsterdam meetup - 17-8-2016
Lean part of DevOps - DevOps Amsterdam meetup - 17-8-2016Lean part of DevOps - DevOps Amsterdam meetup - 17-8-2016
Lean part of DevOps - DevOps Amsterdam meetup - 17-8-2016
 

Semelhante a Euruko 2009 - DataObjects

Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
Tom Croucher
 
Google apps script database abstraction exposed version
Google apps script database abstraction   exposed versionGoogle apps script database abstraction   exposed version
Google apps script database abstraction exposed version
Bruce McPherson
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
Igor Bronovskyy
 
introtomongodb
introtomongodbintrotomongodb
introtomongodb
saikiran
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
MongoDB
 
Tips and tricks for building api heavy ruby on rails applications
Tips and tricks for building api heavy ruby on rails applicationsTips and tricks for building api heavy ruby on rails applications
Tips and tricks for building api heavy ruby on rails applications
Tim Cull
 

Semelhante a Euruko 2009 - DataObjects (20)

Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Couchdb
CouchdbCouchdb
Couchdb
 
Django Multi-DB in Anger
Django Multi-DB in AngerDjango Multi-DB in Anger
Django Multi-DB in Anger
 
Google apps script database abstraction exposed version
Google apps script database abstraction   exposed versionGoogle apps script database abstraction   exposed version
Google apps script database abstraction exposed version
 
Building an api using golang and postgre sql v1.0
Building an api using golang and postgre sql v1.0Building an api using golang and postgre sql v1.0
Building an api using golang and postgre sql v1.0
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
 
Data models in Angular 1 & 2
Data models in Angular 1 & 2Data models in Angular 1 & 2
Data models in Angular 1 & 2
 
introtomongodb
introtomongodbintrotomongodb
introtomongodb
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New Tricks
 
NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020
 
Future of Web Apps: Google Gears
Future of Web Apps: Google GearsFuture of Web Apps: Google Gears
Future of Web Apps: Google Gears
 
Beeline Firebase talk - Firebase event Jun 2017
Beeline Firebase talk - Firebase event Jun 2017Beeline Firebase talk - Firebase event Jun 2017
Beeline Firebase talk - Firebase event Jun 2017
 
Angular JS2 Training Session #1
Angular JS2 Training Session #1Angular JS2 Training Session #1
Angular JS2 Training Session #1
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
 
Kerberizing spark. Spark Summit east
Kerberizing spark. Spark Summit eastKerberizing spark. Spark Summit east
Kerberizing spark. Spark Summit east
 
MongoDB and RDBMS
MongoDB and RDBMSMongoDB and RDBMS
MongoDB and RDBMS
 
Tips and tricks for building api heavy ruby on rails applications
Tips and tricks for building api heavy ruby on rails applicationsTips and tricks for building api heavy ruby on rails applications
Tips and tricks for building api heavy ruby on rails applications
 
Jdbc Java Programming
Jdbc Java ProgrammingJdbc Java Programming
Jdbc Java Programming
 

Último

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

Euruko 2009 - DataObjects