Interface NCSqlColumn


  • public interface NCSqlColumn
    Object presentation of SQL column.

    In JSON/YAML generated model SQL column is represented by the model element (example):

       elements:
         - id: "col:orders_customer_id"
           groups:
           - "column"
           synonyms:
           - "{customer_id|customer <ID>}"
           - "orders {customer_id|customer <ID>}"
           - "{customer_id|customer <ID>} <OF> orders"
           metadata:
             sql:name: "customer_id"
             sql:tablename: "orders"
             sql:datatype: 12
             sql:isnullable: true
             sql:ispk: false
           description: "Auto-generated from 'orders.customer_id' column."
           valueLoader: "org.apache.nlpcraft.examples.sql.db.SqlValueLoader"
     
    Few notes:
    • All model elements representing SQL column have ID in a form of col:sql_table_name.
    • All model elements representing SQL column belong to column group.
    • These model elements have auto-generated synonyms and set of mandatory metadata.
    • User can freely add group membership, change synonyms, add new metadata, add or change value loader.
    See Also:
    NCSqlSchemaBuilder.makeSchema(NCModel), NCSqlExtractorBuilder.build(NCSqlSchema, NCVariant), NCSqlExtractor.extractColumn(NCToken), NCSqlTable.getColumns(), NCSqlSchema.getAllColumns()
    • Method Detail

      • getTable

        String getTable()
        Gets name of the table this column belongs to.

        In JSON/YAML generated model the table name is declared with the following element metadata (example):

             sql:tablename: "customer_id"
         
        Returns:
        Name of the table this column belongs to.
      • getColumn

        String getColumn()
        Gets native name of this column.

        In JSON/YAML generated model the native column name is declared with the following element metadata (example):

             sql:name: "customer_id"
         
        Returns:
        Name of this column.
      • getDataType

        int getDataType()
        Gets JDBC data type for this column.

        In JSON/YAML generated model the data type is declared with the following element metadata (example):

             sql:datatype: 12
         
        Returns:
        JDBC data type for this column.
      • isPk

        boolean isPk()
        Tests whether or not this column is a primary key column.

        In JSON/YAML generated model the primary key flag is declared with the following element metadata (example):

             sql:ispk: false
         
        Returns:
        Whether or not this column is a primary key column.
      • isNullable

        boolean isNullable()
        Tests whether or not this column is nullable.

        In JSON/YAML generated model the nullable flag is declared with the following element metadata (example):

             sql:isnullable: false
         
        Returns:
        Whether or not this column is nullable.