Minijack: Abstract the underlying database operations

This CL introduces Database, Table, Executor, ExecutorFactory.

Database abstracts the underlying database. It now uses sqlite3 as an
implementation. Its main purpose is to get a Table instance.

Table abstracts the behaviors of a database table, like table creation,
row insertion, etc. It controls the database using SQL commands.

Executor hides the underlying database operations, like executing an
SQL query, fetching results, etc.

ExecutorFactory generates Executor objects. It is passed from Database
to Table, such that Table can be generate an executor. It helps separating
Table from the database access.

Check the detailed usages in the unit tests.

Some of the code comes from py/minijack/parser/parser_base.py.

BUG=chrome-os-partner:18749,chrome-os-partner:18798
TEST=make test

Change-Id: I6b0309025781ab1f4cae48fbc9260ac16cd6926c
Reviewed-on: https://gerrit.chromium.org/gerrit/48885
Reviewed-by: Andy Cheng <andycheng@chromium.org>
Commit-Queue: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2 files changed