Xbasic

Objects that support Parsing

Description

Some of the SQL objects support parsing directly. By this, we mean that you can declare the variable and immediately have it parse a string to assign values. These objects include:

  • SQL::Query

  • SQL::InsertStatement

  • SQL::UpdateStatement

  • SQL::DeleteStatement

  • SQL::Query::Join

  • SQL::Query::ValueExpression

  • SQL::Query::LogicalExpression

  • SQL::Query::SelectItem

  • SQL::Query::ColumnOrder

Properties

Each of these objects supports the following properties.

  • ColumnReferences

    Type

    ReferenceList of SQL::Query::ColumnReference

    Mode

    Read Only

    Description

    An array of all column references in the query (including nested occurrences). Behaves the same way as .SelectTableReferences.

  • ErrorColumn

    Type

    Numeric

    Mode

    Read Only

    Description>

    The column number of the first error reported by the parser.

  • ErrorText

    Type

    Character

    Mode

    Read Only

    Description>

    The text of the parser error reported.

  • FunctionReferences

    Type

    ReferenceList of SQL::Query::ValueExpression

    Mode

    Read Only

    Description>

    An array of all function calls parsed. Behaves the same way as .SelectTableReferences.

  • ObjectDefinitions

    Type

    Character

    Mode

    Read Only

    Description>

    Dumps the descriptions of the parse tree mapping.

  • ParseTree

    Type

    -

    Mode

    Read Write

    Description>

    A string description of the parse tree created.

  • SelectTableReferences

    Type

    ReferenceList of SQL::Query::SelectTableReference

    Mode

    Read Only

    Description>

    An array of all table references in the query (including those nested inside of sub-selects and joins). This array is created when the property is requested, but can become out of date. Use the Resynch() function on any variable holding this list when any changes are made.

  • SQLStatement

    Type

    Character

    Mode

    Read Write

    Description>

    A variable that can be assigned a syntax string without parsing it. If no value is passed to the Parse() method, this value is used. Note: This string is dynamically created from the parse tree, so it may not match the original string exactly.

  • XML

    Type

    Character

    Mode

    Read Write

    Description>

    An XML description of the parse tree. This property can be assigned to.

Methods

Each of these objects supports the following methods.

  • ::Execute()

    Executes the current statement using the current or passed connection.

  • ::Query::Format()

    Formats a SQL statement, optionally placing each element on a separate line.

  • ::GenerateNativeSyntax()

    Generates a native SQL statement using the selected syntax associated with the current or passed connection.

  • ::OpenConnection()

    Generates a native SQL statement using the selected syntax and connects to a database.

  • ::Parse()

    Parses the SQL statement passed (or the value previously set into the .SQLStatement property). If the parse is successful, the elements of the SQL statement will be available immediately as properties of the object.

  • ::ReleaseConnection()

    Clears out the connection property.

  • ::Reset()

    Resets the query as if it had just been created.

  • ::Validate()

    Executes the current statement using the current or passed connection.

For example:

dim query as SQL::Query

query.Parse("select customer from orders where id = 12")

Limitations

Desktop applications only.

See Also