Package com.scooterframework.orm.sqldataexpress.object

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


        }
        return (td != null)?td.getFirstRow():null;
    }
   
    public static RowData createRecord(Map<String, Object> inputs, String connName, String table) {
        RowInfo ri = getRowInfo(connName, table);
        inputs = StringUtil.convertKeyToUpperCase(inputs);
       
        StringBuilder insertSQL = new StringBuilder();
        insertSQL.append("INSERT INTO ").append(SqlExpressUtil.getExpandedTableName(connName, table));
        insertSQL.append(" ").append(prepareInsertSQL(ri, inputs));
View Full Code Here


       
        return record;
    }
   
    public static int updateRecord(Map<String, Object> inputs, String connName, String table, String restfulId) {
        RowInfo ri = getRowInfo(connName, table);
        inputs = StringUtil.convertKeyToUpperCase(inputs);
       
        StringBuilder updateSQL = new StringBuilder();
        updateSQL.append("UPDATE ").append(SqlExpressUtil.getExpandedTableName(connName, table));
        updateSQL.append(" SET ").append(prepareSetSQL(ri, inputs));
View Full Code Here

       
        return updateCount;
    }
   
    public static int deleteRecord(Map<String, Object> inputs, String connName, String table, String restfulId) {
        RowInfo ri = getRowInfo(connName, table);
       
        StringBuilder deleteSQL = new StringBuilder();
        deleteSQL.append("DELETE FROM ").append(SqlExpressUtil.getExpandedTableName(connName, table));
       
        String condition = prepareDynamicWhereClauseForRestfulId(inputs, ri, restfulId);
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();
        }
       
View Full Code Here

      super(connName, Record.getFinderSql(connName, tableName));
      this.tableName = tableName;
    }
   
    protected List<RowData> retrieveList() {
      RowInfo ri = Record.getRowInfo(connName, tableName);
     
      Map<String, Object> inputs = new HashMap<String, Object>();
      inputs.putAll(inputOptions);
      inputs.put(DataProcessor.input_key_database_connection_name, connName);
     
View Full Code Here

            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),
                toUpperCaseIfAllowed(dba, schema),
                toUpperCaseIfAllowed(dba, table), (String)null);
            header.setResultSetMetaDataForTable(rs2);
           
            // set some table properties
            //ti.setSchema(ti.getHeader().getColumnInfo(0).getSchemaName());
            //ti.setCatalog(ti.getHeader().getColumnInfo(0).getCatalogName());
           
            // get primary keys
            if (!header.hasPrimaryKey()) {
                PrimaryKey pk = lookupPrimaryKey(dba, conn, catalog, schema, table);
                if (pk != null) header.setPrimaryKeyColumns(pk.getColumns());
            }
        }
        finally {
            DAOUtil.closeResultSet(rs);
            DAOUtil.closeResultSet(rs2);
View Full Code Here

            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

     *
     * @param model model name
     * @return RowInfo for the model
     */
    public static RowInfo getRowInfo(String model) {
        RowInfo ri = homeInstance(model).getRowInfo();
        return (ri != null)?ri:(new RowInfo());
    }
View Full Code Here

     *
     * @param record a record object
     * @return RowInfo attribute of the record.
     */
    public static RowInfo rowInfoOf(ActiveRecord record) {
        return (record != null)?record.getRowInfo():(new RowInfo());
    }
View Full Code Here

     *
     * @param record a record object
     * @return RowInfo attribute of the record.
     */
    public static RowInfo rowInfoOf(RowData record) {
        return (record != null)?record.getRowInfo():(new RowInfo());
    }
View Full Code Here

TOP

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

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.