Package com.scooterframework.orm.sqldataexpress.object

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


        StringBuilder names = new StringBuilder();
        StringBuilder values = new StringBuilder();
        int maxSize = rd.getSize();
        int positionIndex = 0;
        ColumnInfo ci = null;
        int i = 0;
    for (i = 0; i < maxSize - 1; i++) {
            ci = ri.getColumnInfo(i);
            if (ci.isPrimaryKey() && autoPopulatePrimaryKey) continue;
            if (ci.isReadOnly() || !ci.isWritable()) continue;
            if (changedOnly && !modifiedColumns.contains(ci.getColumnName())) continue;

            names.append(ci.getColumnName()).append(", ");
            values.append("?, ");
            positionIndex = positionIndex + 1;
            outs.put(positionIndex+"", rd.getField(i));
        }

        //the last column: i=maxSize-1
        ci = ri.getColumnInfo(i);
    if (!ci.isReadOnly()
        && ci.isWritable()
        && (!changedOnly || changedOnly
            && modifiedColumns.contains(ci.getColumnName()))) {
            names.append(ci.getColumnName()).append("");
            values.append("?");
            positionIndex = positionIndex + 1;
            outs.put(positionIndex+"", rd.getField(i));
        }
View Full Code Here


            throw new IllegalArgumentException("Error in prepareSetSQL: no RowInfo.");

        int maxSize = rd.getSize();

        int i = 0;
        ColumnInfo ci = null;
    for (i = 0; i < maxSize; i++) {
            ci = ri.getColumnInfo(i);
            if (ci.isReadOnly() || !ci.isWritable() || ci.isPrimaryKey()) continue;
            if (changedOnly && !modifiedColumns.contains(ci.getColumnName())) continue;

            strBuffer.append(ci.getColumnName()).append(" = ?, ");
            outs.put(startPosition + "", rd.getField(i));
            startPosition = startPosition + 1;
        }

        return startPosition;
View Full Code Here

    List<Map<String, Object>> columns = new ArrayList<Map<String, Object>>();
    RowInfo ri = O.rowInfoOf(recordHome);
    Iterator<ColumnInfo> it = O.columns(recordHome);
    while(it.hasNext()) {
      ColumnInfo ci = (ColumnInfo)it.next();
      String columnName = ci.getColumnName();
        boolean isAuditedColumn = ri.isAuditedForCreateOrUpdate(columnName);
        if (isAuditedColumn) continue;

        if (ci.isAutoIncrement()) continue;

      String columnNameLower = columnName.toLowerCase();
        boolean isPKColumn = ri.isPrimaryKeyColumn(columnName);
        if (!isPKColumn && ci.isAutoIncrement()) continue;
      boolean isRequired = ri.isRequiredColumn(columnName);
        boolean isLongText = ri.isLongTextColumn(columnName, 255);
        boolean isDateColumn = ri.isDateColumn(columnName);
        boolean isTimestampColumn = ri.isTimestampColumn(columnName);
        int size = 80;
View Full Code Here

    public static String prepareInsertSQL(RowInfo ri, Map<String, Object> inputs) {
        Set<String> inputKeys = inputs.keySet();
        StringBuilder names = new StringBuilder();
        StringBuilder values = new StringBuilder();
        int maxSize = ri.getDimension();
        ColumnInfo ci = null;
        for(int i = 0; i < maxSize; i++) {
            ci = ri.getColumnInfo(i);
            String columnName = ci.getColumnName();
            if (columnName == null) continue;
           
            columnName = columnName.toUpperCase();
            if (!inputKeys.contains(columnName)) {
              if (!ri.isAuditedForCreate(columnName)) {
View Full Code Here

   
    public static String prepareSetSQL(RowInfo ri, Map<String, Object> inputs) {
        Set<String> inputKeys = inputs.keySet();
        StringBuilder sb = new StringBuilder();
        int maxSize = ri.getDimension();
        ColumnInfo ci = null;
        for(int i = 0; i < maxSize; i++) {
            ci = ri.getColumnInfo(i);
            String columnName = ci.getColumnName();
            if (columnName == null) continue;
           
            columnName = columnName.toUpperCase();
            if (ci.isReadOnly() || !ci.isWritable() || ci.isPrimaryKey()) continue;

            if (!inputKeys.contains(columnName)) {
              if (!ri.isAuditedForUpdate(columnName)) {
                continue;
              }
View Full Code Here

    List<Map<String, Object>> columns = new ArrayList<Map<String, Object>>();
    RowInfo ri = O.rowInfoOf(recordHome);
    Iterator<ColumnInfo> it = O.columns(recordHome);
    while(it.hasNext()) {
      ColumnInfo ci = it.next();
      String columnName = ci.getColumnName();
        boolean isAuditedColumn = ri.isAuditedForCreateOrUpdate(columnName);
        if (isAuditedColumn) continue;

        if (ci.isAutoIncrement()) continue;

      String columnNameLower = columnName.toLowerCase();
      boolean isRequired = ri.isRequiredColumn(columnName);
        boolean isLongText = ri.isLongTextColumn(columnName, 255);
        boolean isDateColumn = ri.isDateColumn(columnName);
View Full Code Here

        if (onlyColumnsStr != null && onlyColumnsStr.trim().length() > 0)
          onlyColumns = Converters.convertStringToSet(onlyColumnsStr.toUpperCase());
       
        int columnWidth = cursor.getDimension();
        for (int i = 0; i < columnWidth; i++) {
            ColumnInfo ci = cursor.getColumnInfo(i);
            String columnName = ci.getColumnName();
            if ((exceptColumns != null && exceptColumns.contains(columnName)) ||
                (onlyColumns != null && !onlyColumns.contains(columnName))) {
              continue;
            }
            allowedColumns.add(columnName);
View Full Code Here

        RowInfo header = new RowInfo();
        int columnWidth = cursor.getDimension();
        List<ColumnInfo> allowedColumnInfos = new ArrayList<ColumnInfo>();
       
        for (int i = 0; i < columnWidth; i++) {
            ColumnInfo ci = cursor.getColumnInfo(i);
            if (allowedColumns.contains(ci.getColumnName())) {
              allowedColumnInfos.add(ci);
            }
        }
       
        header.setColumnInfoList(allowedColumnInfos);
View Full Code Here

    String updateSQL = "UPDATE " + home.getTableName();

    try {
      Map<String, Object> inputs = new HashMap<String, Object>();
      StringBuilder strBuffer = new StringBuilder();
      ColumnInfo ci = null;
      RowInfo ri = home.getRowInfo();
      for (Map.Entry<String, Object> entry : fieldData.entrySet()) {
        String field = entry.getKey();
        if (field == null) continue;

        ci = ri.getColumnInfo(field);
        if (!ri.isValidColumnName(field) || ci.isReadOnly()
            || !ci.isWritable() || ci.isPrimaryKey())
          continue;

        String token = getUniqueToken(field, conditionsSQLData, true);
        strBuffer.append(field).append(" = ?").append(token).append(", ");
        inputs.put(token, entry.getValue());
View Full Code Here

TOP

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

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.