sql queries on smalltalk objectsesug.org/data/esug2015/3 wednesday/1100-1130 sql... ·...
TRANSCRIPT
![Page 1: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/1.jpg)
SQL Queries
On Smalltalk Objects
James Foster
Director of Operations
![Page 2: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/2.jpg)
2
Agenda
• Introduction to GemStone Smalltalk
• SQL & ODBC
• Code Review & Demo
• Questions
![Page 3: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/3.jpg)
“Image-based” development
• Smalltalk is a programming environment (not
merely a language)
– An Object represents a combination of behavior
and properties (code and data)
• Each object is an instance of a Class
– Object Space represents RAM
– Virtual Machine represents CPU
– Image represents disk
• Persist copy of memory when system is not active3
![Page 4: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/4.jpg)
All-inclusive environment
• Open an “image” and step into a magical world
• Develop by modifying an existing environment
– New environment created by copying (cloning)
• Environment contains all your tools
– Schema definition tools, source code editor,
runtime code debugger, object inspector, source
code management, etc.
• Save an “image” to create a snapshot
4
![Page 5: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/5.jpg)
Advantages of Smalltalk
• Pure object system
– “Everything” is an Object
• Simple, elegant language
• Powerful class libraries
5
![Page 6: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/6.jpg)
Limitations of traditional Smalltalks
• Object space (image) must fit in (virtual) RAM
• Object space visible to only one VM
• Sharing objects between VMs is difficult
– Convert to non-object format (binary, XML, SQL)
– No built-in object identity for multiple exports
• Object state is lost when VM exits
6
![Page 7: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/7.jpg)
What is GemStone/S?
• Multi-User Object Space
– Scalable
– Concurrency
– User-based Security
• Programmable Object Server
• Large-scale Object Space
• Transaction Semantics
• System Management7
![Page 8: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/8.jpg)
Multi-User Object Server - 1
• Scalable
– Thousands of concurrent user sessions
– VMs on hundreds of hosts
– Object space (image) of terabytes
– Thousands of transactions per second
8
![Page 9: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/9.jpg)
Multi-User Object Server - 2
• Concurrency
– Multiple user sessions can be active
– Each user may have multiple sessions
– Separate or shared namespaces per user
– Changes to objects are committed in transaction
– Concurrency controls and locks for coordination
9
![Page 10: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/10.jpg)
Multi-User Object Server - 3
• User-based Security
– Login (password)
– Namespace: global lookup visibility
– System operations (backup, change password, …)
– Per-object read/write access by user/group
10
![Page 11: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/11.jpg)
Programmable Object Server
• Smalltalk
– Data definition
– Object manipulation
– Query facilities
– Concurrency management
– System management
11
![Page 12: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/12.jpg)
Large-Scale Object Space
• Object space limited only by disk size
– System handles RAM caching
• Object space shared by all connected sessions
– View based on point of last commit/abort
• Persistence by reachability from root object
– Attach new objects to an existing collection
• On commit, new & changed objects are visible
– Other sessions must commit/abort to see changes12
![Page 13: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/13.jpg)
Transaction Semantics
• Database view is isolated with repeatable reads
– Changes made before a commit are not shared
– Committed changes made by others since current
view was obtained are not visible until current
session does an abort/commit
– On abort the current view is reset to current state,
including any persistent objects for which changes
were made and abandoned
13
![Page 14: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/14.jpg)
System Management
• On-line (live system) backup
• Database restore, including transaction logs
• Use shared memory to cache disk pages
• Use asynchronous I/O to parallelize disk writes
• Allow hosts to be added and removed
• Monitor and tune system for performance
14
![Page 15: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/15.jpg)
15
Agenda
• Introduction to GemStone Smalltalk
• SQL & ODBC
• Code Review & Demo
• Questions
![Page 16: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/16.jpg)
What is SQL?
• Structured Query Language
– Data Definition Language
– Data Manipulation Language
• Developed at IBM in the early 1970s
• Various ANSI Standards
– SQL-92
16
![Page 17: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/17.jpg)
What is ODBC?
• Open Database Connectivity
• Standard API calls from generic library
• Started by Microsoft in the early 1990s
17
![Page 18: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/18.jpg)
ODBC Incentives
• "Standard" database tools (Crystal Reports)
• Cross-platform
• Vendor-neutral
• Supported by many applications and DBMSs
• Encapsulate (hide) "strangeness" of OODBMS
• Avoid language lock-in (use from non-Smalltalk)
18
![Page 19: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/19.jpg)
ODBC Architecture
19
• Vendor provides:
– Setup executable
– Setup DLL
– Driver DLL
![Page 20: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/20.jpg)
ODBC Setup Executable
• Vendor-supplied executable
• Register DLLs with OS– HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\
• Copy DLLs to designated directory
• Update file usage count
• We have an executable built using Dolphin
20
![Page 21: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/21.jpg)
ODBC Setup DLL
• ConfigDriver()
• ConfigDSN()
21
![Page 22: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/22.jpg)
ODBC Driver DLL
• Implements specified functions
– SQLConnect()
– SQLExecDirect()
– SQLFetch()
– SQLDisconnect()
– (and many more…)
22
![Page 23: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/23.jpg)
SQL Parsing in Smalltalk
• ConfigurationOfSqlEvaluator
• Available on smalltalkhub.comMCHttpRepository
location: 'http://smalltalkhub.com/' ,
'mc/Moose/PetitParser/main'
user: ''
password: ''
23
![Page 24: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/24.jpg)
24
Agenda
• Introduction to GemStone Smalltalk
• SQL & ODBC
• Code Review & Demo
• Questions
![Page 25: SQL Queries On Smalltalk Objectsesug.org/data/ESUG2015/3 wednesday/1100-1130 SQL... · “Image-based” development •Smalltalk is a programming environment (not merely a language)](https://reader033.vdocuments.net/reader033/viewer/2022050504/5f95d8eb32c65535e00248a3/html5/thumbnails/25.jpg)
Questions?
25
GemTalk Systems LLC
15220 NW Greenbrier Pkwy., Suite 240
Beaverton, Oregon, 97006
Voice & Fax: +1 503 766 4714
James G. FosterDirector of Operations
www.gemtalksystems.com
®