Вы находитесь на странице: 1из 13

MySQL Workbench.

The Ultimate Guide to


DBA Productivity:
Writing Plugins and
Scripts
Vladimir Kolesnikov
Software Engineer,
Developer Tools
Session Contents
• Workbench General Overview
• Workbench Architecture, GRT
• [break]
• GRT Shell
• LUA scripting and Libraries
• [break]
• GRT LUA Plugins
• [break]
• GRT C++ Plugins
Workbench General Overview
• EER modeling tool
• Overview page lists model entities
• Canvas is where you visually create and edit your EER
models
• Use export/import/synchronization tools to interact with
live servers or store data in SQL scripts
• Use validation tools to check your models
• Various utilities for your convenience – printing, export to
PDF, PNG…
• Cross-platform with native GUIs. Runs on Win 32/64
XP/Vista, with OS X and Linux coming soon
Workbench General Overview
• Two Editions – OSS and Standard
Workbench Architecture
• Workbench core manages the most essential
functions
– OS Abstraction
– Inter-thread communication and messaging
– Graphics
– GUI
– Generic APIs
• GRT (Generic Run-Time) System
– Object model, built after the architecture of dynamic
languages (such as Objective-C)
– Modules and scripting support
Workbench Architecture
Modular Decomposition
Workbench Architecture
Threading &
updates
Messaging GRT

er
Model

ch
notifications

at
calls

sp
Canvas

Di
Modules
WB Context Bridge

updates
Dispatcher notifications

WBContext Canvas
events

commands callbacks events


App Canvas
events
Frontend Viewer
Workbench Architecture
Lua Module C++ Module ... JavaScript
C++ Modules
Implementation Implementation
Bridge Module
Implemen Python
Modules tation Modules
Lua
d Scripting GRT Loader
C++ Loaders for
Support Loader Other
Struct (DLLs) Languages
Object
Dict
List Modules
Modules
Simple

C++ Object C++ Value


Wrapper C++ Module
Wrappers
Class Wrapper Class
Workbench Architecture
GRT Object Model GrtObject

GrtNamedObject db_UserDatatype

b_mysql_StorageEngine
db_Column db_ForeignKey
db_Catalog
db_Index GrtDatabaseObject

b_Tablespace db_mysql_Catalog db_mysql_Column


db_mysql_Index
db_mysql_ForeignKey
b_mysql_Tablespace

b_Role db_Schema db_Table db_View db_Routine


b_User
db_mysql_Table db_mysql_Routine
db_mysql_Schema db_mysql_View
GRT Shell
Shell is command line interface to the Workbench
internals
Uses LUA for Scripting
Supports single- and multi-line editing modes
Can be used for script debugging
Start using shell
– Opening shell: Ctrl-F3
– Getting help: /> ? [subtopic-name]
– To enter multi-line mode: Shift-Enter
– To launch commands in multi-line mode: Ctrl-Enter
GRT Lua Scripting and Libraries
Why LUA:
– Fast
– Light-weight
– Portable
– Easily-embeddable
LUA Standard Libraries Handle All Basic
Functions
– Runtime support
– Strings, numbers, conversions, other utility
– Data structure manipulation
– Threading
GRT Lua Modules & Plugins
Modules are loaded at Workbench startup
and become globally visible
Use predefined source templates
Use Workbench scripting framework to
create/edit/manage scripts
Use GRT Shell for debugging your code
You can re-use existing modules from your
code
GRT C++ Modules & Plugins
Use C++ for Implementing complex and/or
computation-intensive modules
Use Workbench abstractions facilities for
mplementing platform-independent code
mplementing GUI
– Windows: Use Windows Managed/Native Interop
services for interfacing with GUI part
– Linux: GUI is based GTKmm which is a C++ framework
– Mac OS X: You can mix C++ and Objective-C code
within the same source to implement COCOA-based
GUI

Вам также может понравиться