Chapter4 -> Application Programs and OR Capabilities Flashcards
Explain the idea behind locators as an approach to external access to structured types.
- > Reference to SQL data item inside DB , which can be used in statements
- > Generated by SQL engine and transferred to app (NOT an SQL data type /DB level concept)
- Inroduced for LOBs
- > specify host variable AS LOCATOR -> impl. dependent integer pointer
- > types can be specified as locators
How can locators be used in external routines?
Specify parameter or return types (which are UDT/collection) AS LOCATOR
- > invoking generate and pass inter as parameter
- > returning…
Give an overview over Transforms
- > UDFs invoked automatically when UDT values are exchanged between SQL/app
- > associate UDT with transform groups (pars of functions from-SQL to-SQL)
- maps predefined value
How can transforms be created and how do thez work together with methods?
CREATE TRANSFORM FOR group1 (FROM SQL WITH FUNCTION F(), TO SQL WITH FUNCTION G(); ------------------------ IMPLICIT TRANSFORMS FOR DISTINCT TyPES: CAST FUNCTIONS
Give an overview of how transforms are used in SQL
- > Embedded program can specify transform group
- > host variable specify predefined type, which must be the same of TO/FROM SQL functions
- > Functions are invoked automatically when reading/writting host var
- > In external routines: host language type = predef type
- > To SQL methods: type preserving
Give an overview of complex value transfers.
- Uses transparent proprietary format, supported jointly by DB+API(JDBC e.g.)
- Generic object structures on app side (e.g. getString(1)
How can transforms work together with methods?
FROM/TO SQL WITH METHOD m() FOR
** m( ) can be overriden.
Give an overview of JDBC and its support for Complex Value Transfers.
JDBC: getConnection, createStatement, executeQuery, rs.next()+rs.getString() (useful for generic apps/tools)
- > Generic Objects: attribute values as array of Java objects
- > JDBC interface Struct: String getTzpeName(), object[ ] getAttributtes() (rs.getObject()->struct)
How does JDBC support mapping of UDTs to Java?
Works transparently (get/set object on ResultSet or prepared statement)
- > mapping UDT instance to Java instances (mapping table records correspondence) - > Java class implements SQLData (read/write SQL methods) - > SQL Input/Output stream interfaces
Give an overview of OLB (SQLJ Part 0) and compare it to JDBC.
-> static embedded SQL in Java (More concise, easier than JDBC) -> Static type checking
- > Composite types/UDT -> Based on JDBC
- > (type mapping can be supplied on properties file)
Compare the advantages and disadvantages of each approach.
- > Locators:
- Values remains in DB, avoids unnecessary transformation/transfer (+)
- Available for collections (+)
- Manipulation of values restricted to SQL operations (-)
- > Transforms:
- Flexible: tailored UDT eexchange, accomodate existing formats (+)
- additional effort: transform functions, parsing/generation (-)
- > Complex-value transfer:
- generic representation for dynamic apps (+)
- allows user-defined mapping; improved integration (+)
- potential development impact (~)
- only for java (-)