SchemaAccessor

Trait SchemaAccessor 

Source
pub trait SchemaAccessor {
    // Required methods
    fn lookup_column(
        &self,
        table_ref: &TableRef,
        column_id: &Ident,
    ) -> Option<ColumnType>;
    fn lookup_schema(&self, table_ref: &TableRef) -> Vec<(Ident, ColumnType)>;
}
Expand description

Access tables and their schemas in a database.

This accessor should be implemented by both the prover and verifier and then used by the Proof of SQL code to convert an IntermediateAst into a ProofPlan.

Required Methods§

Source

fn lookup_column( &self, table_ref: &TableRef, column_id: &Ident, ) -> Option<ColumnType>

Lookup the column’s data type in the specified table

Return:

  • Some(type) if the column exists, where type is the column’s data type
  • None in case the column does not exist in the table

Precondition 1: the table must exist and be tamperproof. Precondition 2: table_ref and column_id must always be lowercase.

Source

fn lookup_schema(&self, table_ref: &TableRef) -> Vec<(Ident, ColumnType)>

Lookup all the column names and their data types in the specified table

Return:

  • The list of column names with their data types

Precondition 1: the table must exist and be tamperproof. Precondition 2: table_name must be lowercase.

Implementors§