Package com.scooterframework.orm.sqldataexpress.object

Examples of com.scooterframework.orm.sqldataexpress.object.TableInfo


        throw new IllegalArgumentException("connName cannot be null.");
     
        if (tableName == null)
            throw new IllegalArgumentException("tableName cannot be null.");
       
        TableInfo ti = DBStore.getInstance().getTableInfo(connName, tableName);
        if (ti != null) return ti;
       
        UserDatabaseConnection udc = null;
        try {
          udc = SqlExpressUtil.getUserDatabaseConnection(connName);
View Full Code Here


       
        if (tableName == null)
            throw new IllegalArgumentException("Table name is empty.");
       
        String connName = udc.getConnectionName();
        TableInfo ti = DBStore.getInstance().getTableInfo(connName, tableName);
        if (ti != null) return ti;
       
        return _lookupAndRegisterTableInfo(udc, tableName);
    }
View Full Code Here

        String[] s3 = dba.resolveCatalogAndSchemaAndTable(connName, tableName);
        String catalog = s3[0];
        String schema = s3[1];
        String table = s3[2];
       
        TableInfo ti = null;
       
        try {
            ti = createTableInfo(dba, udc, catalog, schema, table);
            DBStore.getInstance().addTableInfo(connName, tableName, ti);
        }
View Full Code Here

    }
   
    private static TableInfo createTableInfo(DBAdapter dba, UserDatabaseConnection udc, String catalog, String schema, String table) {
        String connName = udc.getConnectionName();
       
        TableInfo ti = null;
       
        try {
            String tableType = TableInfo.TYPE_TABLE; //default
            tableType = getTableType(dba, udc.getConnection(), catalog, schema, table, TableInfo.getSupportedTypes());
           
View Full Code Here

        if (table == null)
            throw new IllegalArgumentException("Table name is empty.");
       
        String fullTableName = DatabaseConfig.getInstance().getFullTableName(table);
       
        TableInfo ti = null;
        Statement stmt = null;
        ResultSet rs = null;
        ResultSet rs2 = null;
       
        try {
            String sqlString = dba.getOneRowSelectSQL(catalog, schema, fullTableName);
            log.debug("lookupTable   catalog: " + catalog);
            log.debug("lookupTable    schema: " + schema);
            log.debug("lookupTable sqlString: " + sqlString);
           
            ti = new TableInfo();
            ti.setCatalog(catalog);
            ti.setSchema(schema);
            ti.setName(table);
           
            stmt = conn.createStatement();

            // Query the table
            rs = stmt.executeQuery(sqlString);
           
            RowInfo header = new RowInfo(table, rs.getMetaData());
            header.setCatalog(catalog);
            header.setSchema(schema);
            header.setTable(table);
           
            ti.setHeader(header);
            DAOUtil.closeResultSet(rs);

            //set more properties
            DatabaseMetaData dbmd = conn.getMetaData();
            rs2 = dbmd.getColumns(toUpperCaseIfAllowed(dba, catalog),
View Full Code Here

            throw new IllegalArgumentException("Connection is null.");
       
        if (viewName == null)
            throw new IllegalArgumentException("View name is empty.");
       
        TableInfo ti = null;
        ResultSet rs = null;
        try {
            ti = new TableInfo();
            ti.setCatalog(catalog);
            ti.setSchema(schema);
            ti.setName(viewName);
           
            DatabaseMetaData dbmd = conn.getMetaData();
            rs = dbmd.getColumns(toUpperCaseIfAllowed(dba, catalog),
                toUpperCaseIfAllowed(dba, schema),
                toUpperCaseIfAllowed(dba, viewName), (String)null);
           
            RowInfo header = ti.getHeader();
            header.setResultSetMetaDataForView(rs);
            header.setCatalog(catalog);
            header.setSchema(schema);
            header.setTable(viewName);
           
            // set some table properties
            ti.setSchema(ti.getHeader().getColumnInfo(0).getSchemaName());
            ti.setCatalog(ti.getHeader().getColumnInfo(0).getCatalogName());
            ti.setType(TableInfo.TYPE_VIEW);
           
            header.setCatalog(ti.getCatalog());
            header.setSchema(ti.getSchema());
            header.setTable(ti.getName());
        }
        finally {
            DAOUtil.closeResultSet(rs);
        }
       
View Full Code Here

      String sqlDataTypeName = null;
      String javaClassName = null;

      if (tableName != null && columnName != null) {
        // find more properties of this column
        TableInfo ti = SqlExpressUtil.lookupTableInfo(udc, tableName);

        // add more properties for this column
        RowInfo header = ti.getHeader();
        int columnIndex = header.getColumnPositionIndex(columnName);

        sqlDataType = header.getColumnSqlDataType(columnIndex);
        sqlDataTypeName = header.getColmnDataTypeName(columnIndex);
        javaClassName = header.getColumnJavaClassName(columnIndex);
View Full Code Here

   
    private boolean isColumnInTable(String columnName, String potentialTableName) {
        boolean bMatch = false;
       
        try {
            TableInfo ti = SqlExpressUtil.lookupTableInfo(udc, potentialTableName);
            bMatch = ti.getHeader().isValidColumnName(columnName);
        }
        catch(Exception ex) {
          String error = "Failed in isColumnInTable method for column \"" +
        columnName + "\" and table \"" + potentialTableName +
        "\" because " + ex.getMessage();
View Full Code Here

    /**
     * Returns table meta data. <tt>table</tt> is a full table name.
     */
    private TableInfo lookupAndRegister(String connName, String table) {
        TableInfo ti = SqlExpressUtil.lookupTableInfo(connName, table);
        if (ti == null) {
          throw new IllegalArgumentException("Failed to look up table '" +
              table + "' for connection '" + connName + "'.");
        }
        return ti;
View Full Code Here

        return deleteCount;
    }
   
    public static RowInfo getRowInfo(String connName, String table) {
        RowInfo ri = null;
        TableInfo ti = SqlExpressUtil.lookupTableInfo(connName, table);
        if (ti != null) {
            ri = ti.getHeader();
        }
       
        if (ri == null) {
            throw new IllegalArgumentException("Failed to retrieve column header " +
                "information from table \"" + table + "\" with " +
View Full Code Here

TOP

Related Classes of com.scooterframework.orm.sqldataexpress.object.TableInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.