All,

Firebird BLR must be improved to be easier to read (the code), to be
easier to generate and parse and to be extensible.

See now, to add <override clause> to INSERT, we already have blr_store
and blr_store2, both non extensible. It would require
blr_store3/blr_store4 or blr_store3 with custom logic to have optional
parameters.

This is happening everytime. Some new verbs have custom versioning
scheme that does not generally solve the problem.

Soon we'll reach the 255 limit and will have more problems.

I propose (not yet in broad details) a new BLR encoding to be discussed.

BLR version is increased and new encoding is not backward compatible.
Backward compatible logic will be inserted in another layer (may be in
gbak, may be in a BLR filter) and will be settle forever (since new
verbs in new versions will not be backward compatible anyway).

The new encoding is as following:

BLR verb:
- code: a numeric value encoded in some (1-N) bytes - may be Jim's
encoding described in the past
- argument mask - 1-2 bytes (may encode 15 combinations of present /
not-present) - describes what arguments are presented for the verb
- arguments: may be verbs, numbers (Jim's encoding), strings

Node classes maps BLR argument numbers to node properties. In this way,
BLR can be automatically generated and parsed from/to nodes.

Verbs can be improved - just map new arguments to new properties.

Example for current blr_store/blr_store2 (argument count is fixed) -
without OVERRIDE

blr_store:
- argument 0: context
- argument 1: statement

blr_store2:
- argument 0: context
- argument 1: statement
- argument 2: statement

New blr_store - with OVERRIDE

blr_store (syntax for any verb):
- bit mask with used arguments
- arguments

StoreNode in code:
- 0: context
- 1: statement1
- 2: statement2
- 3: override

blr_store usage:
- 01101000 (first 0 means "use 1 byte for bit-mask encoding")
- context
- statement 1
- override clause

(statement 2 is not presented in the bit mask)

Note that this scheme is not auto-described - one may not parse it
without knowing types (number, string, verb) of each argument for each verb.

If we think auto-description is important, the whole BLR set may be
prefixed with a scheme header that describes the verbs presented in the
block.

Full BLR scheme for a given Firebird version may be also presented in a
system table or API function.


Adriano


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to