Derby SQL Language System

Compilation

Compilation Flow

  1. LanguageParse: Parser generates QueryTree from SQL statement text.
  2. LanguageBind: Bind phase checks semantics.
  3. LanguageOptimize: Optimization modifies QueryTree.
  4. LanguageGenerate: Generate Java byte code for execution.

Data Structure Notes

  1. DataTypeDescriptor
  2. TypeCompiler
  3. types package JavaDoc
  4. StatementCache: Derby caches prepared statements to avoid unnecessary re-preparation.

JDBC Hookup

java.sql.Statement

For the lifetime of the execution, either until the ResultSet is closed, or the executeUpdate() call returns, the Statement has a one-to-one relationship with a single use Activation. Once the statement is complete the activation will be closed.

java.sql.PreparedStatement & CallableStatement

The application's JDBC PreparedStatement or CallableStatement has a one-to-one relationship with an Activation. The Activation maintains the state of the execution including parameters and linkage to the shared statement plan.

Execution

please fill in

Other info

http://db.apache.org/derby/binaries/ApacheDerbyInternals_1_1.pdf Derby internals presentation

  • No labels