Top Description Fields Constructors Methods
org.h2.bnf.context

public Class DbContextRule

extends Object
implements Rule
Class Inheritance
All Implemented Interfaces
org.h2.bnf.Rule
Imports
java.util.HashMap, .HashSet, org.h2.bnf.Bnf, .BnfVisitor, .Rule, .RuleElement, .RuleHead, .RuleList, .Sentence, org.h2.message.DbException, org.h2.util.ParserUtil, .StringUtils

A BNF terminal rule that is linked to the database context information. This class is used by the H2 Console, to support auto-complete.

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
private String
private final DbContents
public static final int
public static final int
public static final int
public static final int
public static final int
private final int

Constructor Summary

AccessConstructor and Description
public
DbContextRule(DbContents
Extract rule from this component
contents
,
int type)

BNF terminal rule Constructor

Method Summary

Modifier and TypeMethod and Description
public void
accept(BnfVisitor
the visitor
visitor
)

Implements org.h2.bnf.Rule.accept.

Call the visit method in the given visitor.

public boolean
autoComplete(Sentence
the sentence context
sentence
)

Implements org.h2.bnf.Rule.autoComplete.

Add the next possible token(s).

private void
private static String
autoCompleteTableAlias(Sentence sentence, boolean newAlias)

public void
setColumnType(String
COLUMN Auto completion can be filtered by column type
columnType
)

private boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

COLUMNback to summary
public static final int COLUMN
COLUMN_ALIASback to summary
public static final int COLUMN_ALIAS
columnTypeback to summary
private String columnType
contentsback to summary
private final DbContents contents
NEW_TABLE_ALIASback to summary
public static final int NEW_TABLE_ALIAS
PROCEDUREback to summary
public static final int PROCEDURE
SCHEMAback to summary
public static final int SCHEMA
TABLEback to summary
public static final int TABLE
TABLE_ALIASback to summary
public static final int TABLE_ALIAS
typeback to summary
private final int type

Constructor Detail

DbContextRuleback to summary
public DbContextRule(DbContents contents, int type)

BNF terminal rule Constructor

Parameters
contents:DbContents

Extract rule from this component

type:int

Rule type, one of DbContextRule#COLUMN, DbContextRule#TABLE, DbContextRule#TABLE_ALIAS, DbContextRule#NEW_TABLE_ALIAS, DbContextRule#COLUMN_ALIAS, DbContextRule#SCHEMA

Method Detail

acceptback to summary
public void accept(BnfVisitor visitor)

Implements org.h2.bnf.Rule.accept.

Doc from org.h2.bnf.Rule.accept.

Call the visit method in the given visitor.

Parameters
visitor:BnfVisitor

the visitor

Annotations
@Override
autoCompleteback to summary
public boolean autoComplete(Sentence sentence)

Implements org.h2.bnf.Rule.autoComplete.

Doc from org.h2.bnf.Rule.autoComplete.

Add the next possible token(s). If there was a match, the query in the sentence is updated (the matched token is removed).

Parameters
sentence:Sentence

the sentence context

Returns:boolean

true if a full match

Annotations
@Override
autoCompleteProcedureback to summary
private void autoCompleteProcedure(Sentence sentence)
autoCompleteTableAliasback to summary
private static String autoCompleteTableAlias(Sentence sentence, boolean newAlias)
setColumnTypeback to summary
public void setColumnType(String columnType)
Parameters
columnType:String

COLUMN Auto completion can be filtered by column type

testColumnTypeback to summary
private boolean testColumnType(DbColumn column)