Chapter4 -> Application Programs and OR Capabilities Flashcards

1
Q

Explain the idea behind locators as an approach to external access to structured types.

A
  • > 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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can locators be used in external routines?

A

Specify parameter or return types (which are UDT/collection) AS LOCATOR

  • > invoking generate and pass inter as parameter
  • > returning…
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Give an overview over Transforms

A
  • > 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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can transforms be created and how do thez work together with methods?

A
CREATE TRANSFORM FOR  
group1 (FROM SQL WITH FUNCTION F(),
TO SQL WITH FUNCTION G();
------------------------
IMPLICIT TRANSFORMS FOR DISTINCT TyPES: CAST FUNCTIONS
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Give an overview of how transforms are used in SQL

A
  • > 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Give an overview of complex value transfers.

A
  • Uses transparent proprietary format, supported jointly by DB+API(JDBC e.g.)
  • Generic object structures on app side (e.g. getString(1)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How can transforms work together with methods?

A

FROM/TO SQL WITH METHOD m() FOR

** m( ) can be overriden.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Give an overview of JDBC and its support for Complex Value Transfers.

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How does JDBC support mapping of UDTs to Java?

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Give an overview of OLB (SQLJ Part 0) and compare it to JDBC.

A

-> 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)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Compare the advantages and disadvantages of each approach.

A
  • > 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 (-)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly