Examples of ColumnMap


Examples of org.apache.torque.map.ColumnMap

        ColumnMap[] columnMaps = dbMap.getTable(tableName).getColumns();
        boolean shouldSave = false;
        for (int j = 0; j < columnMaps.length; j++)
        {
            ColumnMap colMap = columnMaps[j];
            String key = new StringBuffer(colMap.getTableName())
                    .append('.')
                    .append(colMap.getColumnName())
                    .toString();
            if (criteria.containsKey(key))
            {
                // A village Record.setValue( String, Object ) would
                // be nice here.
                Object obj = criteria.getValue(key);
                if (obj instanceof SimpleKey)
                {
                    obj = ((SimpleKey) obj).getValue();
                }
                try
                {
                    if (obj == null)
                    {
                        rec.setValueNull(colMap.getColumnName());
                    }
                    else if (obj instanceof String)
                    {
                        rec.setValue(colMap.getColumnName(), (String) obj);
                    }
                    else if (obj instanceof Integer)
                    {
                        rec.setValue(colMap.getColumnName(),
                                criteria.getInt(key));
                    }
                    else if (obj instanceof BigDecimal)
                    {
                        rec.setValue(colMap.getColumnName(), (BigDecimal) obj);
                    }
                    else if (obj instanceof Boolean)
                    {
                        rec.setValue(colMap.getColumnName(),
                            criteria.getBoolean(key) ? 1 : 0);
                    }
                    else if (obj instanceof java.util.Date)
                    {
                        rec.setValue(colMap.getColumnName(),
                            (java.util.Date) obj);
                    }
                    else if (obj instanceof Float)
                    {
                        rec.setValue(colMap.getColumnName(),
                            criteria.getFloat(key));
                    }
                    else if (obj instanceof Double)
                    {
                        rec.setValue(colMap.getColumnName(),
                            criteria.getDouble(key));
                    }
                    else if (obj instanceof Byte)
                    {
                        rec.setValue(colMap.getColumnName(),
                            ((Byte) obj).byteValue());
                    }
                    else if (obj instanceof Long)
                    {
                        rec.setValue(colMap.getColumnName(),
                            criteria.getLong(key));
                    }
                    else if (obj instanceof Short)
                    {
                        rec.setValue(colMap.getColumnName(),
                            ((Short) obj).shortValue());
                    }
                    else if (obj instanceof Hashtable)
                    {
                        rec.setValue(colMap.getColumnName(),
                            hashtableToByteArray((Hashtable) obj));
                    }
                    else if (obj instanceof byte[])
                    {
                        rec.setValue(colMap.getColumnName(), (byte[]) obj);
                    }
                }
                catch (Exception e)
                {
                    throwTorqueException(e);
View Full Code Here

Examples of org.apache.torque.map.ColumnMap

                else
                {
                    columnName = orderByColumn.substring(
                            orderByColumn.indexOf('.') + 1, spacePos);
                }
                ColumnMap column = dbMap.getTable(table).getColumn(columnName);
                if (column.getType() instanceof String)
                {
                    if (spacePos == -1)
                    {
                        orderByClause.add(
                                db.ignoreCaseInOrderBy(orderByColumn));
View Full Code Here

Examples of org.apache.torque.map.ColumnMap

    {
        // Assume all the keys are for the same table.
        String key = (String) criteria.keys().nextElement();

        String table = criteria.getTableName(key);
        ColumnMap pk = null;

        if (!table.equals(""))
        {
            DatabaseMap dbMap = Torque.getDatabaseMap(criteria.getDbName());
            if (dbMap == null)
View Full Code Here

Examples of org.apache.torque.map.ColumnMap

     *         rethrown wrapped into a TorqueException.
     */
    public static void doUpdate(Criteria updateValues, Connection con)
        throws TorqueException
    {
        ColumnMap pk = getPrimaryKey(updateValues);
        Criteria selectCriteria = null;

        if (pk != null && updateValues.containsKey(pk.getFullyQualifiedName()))
        {
            selectCriteria = new Criteria(2);
            selectCriteria.put(pk.getFullyQualifiedName(),
                updateValues.remove(pk.getFullyQualifiedName()));
        }
        else
        {
            throw new TorqueException("No PK specified for database update");
        }
View Full Code Here

Examples of org.apache.torque.map.ColumnMap

            DatabaseMap tempDbMap = dbMap;

            ColumnMap[] columnMaps = tempDbMap.getTable(tab).getColumns();
            for (int j = 0; j < columnMaps.length; j++)
            {
                ColumnMap colMap = columnMaps[j];
                if (colMap.isPrimaryKey())
                {
                    kd.addAttrib(colMap.getColumnName());
                }
                String key = new StringBuffer(colMap.getTableName())
                        .append('.')
                        .append(colMap.getColumnName())
                        .toString();
                if (selectCriteria.containsKey(key))
                {
                    if (selectCriteria
                        .getComparison(key)
                        .equals(Criteria.CUSTOM))
                    {
                        whereClause.add(selectCriteria.getString(key));
                    }
                    else
                    {
                        whereClause.add(
                            SqlExpression.build(
                                colMap.getColumnName(),
                                selectCriteria.getValue(key),
                                selectCriteria.getComparison(key),
                                selectCriteria.isIgnoreCase(),
                                db));
                    }
View Full Code Here

Examples of org.apache.torque.map.ColumnMap

                {
                    columnName = orderByColumn.substring(
                            orderByColumn.indexOf('.') + 1,
                            spacePos);
                }
                ColumnMap column = dbMap.getTable(table).getColumn(columnName);
                if (column.getType() instanceof String)
                {
                    if (spacePos == -1)
                    {
                        orderByClause.add(
                            db.ignoreCaseInOrderBy(orderByColumn));
View Full Code Here

Examples of org.apache.torque.map.ColumnMap

        TableMap tableMap = dbMap.getTable(table);
        Object keyInfo = tableMap.getPrimaryKeyMethodInfo();
        IdGenerator keyGen
                = database.getIdGenerator(tableMap.getPrimaryKeyMethod());

        ColumnMap pk = getPrimaryKey(criteria);

        // If the keyMethod is SEQUENCE or IDBROKERTABLE, get the id
        // before the insert.
        if (keyGen != null && keyGen.isPriorToInsert())
        {
            // pk will be null if there is no primary key defined for the table
            // we're inserting into.
            if (pk != null && !criteria.containsKey(pk.getFullyQualifiedName()))
            {
                id = getId(pk, keyGen, con, keyInfo);
                criteria.add(pk.getFullyQualifiedName(), id);
            }
        }

        // Use Village to perform the insert.
        TableDataSet tds = null;
View Full Code Here

Examples of org.apache.torque.map.ColumnMap

        ColumnMap[] columnMaps = dbMap.getTable(table).getColumns();
        boolean shouldSave = false;
        for (int j = 0; j < columnMaps.length; j++)
        {
            ColumnMap colMap = columnMaps[j];
            String colName = colMap.getColumnName();
            String key = new StringBuffer(colMap.getTableName())
                    .append('.')
                    .append(colName)
                    .toString();
            if (criteria.containsKey(key))
            {
View Full Code Here

Examples of org.apache.torque.map.ColumnMap

    {
        // Assume all the keys are for the same table.
        String key = (String) criteria.keys().nextElement();

        String table = criteria.getTableName(key);
        ColumnMap pk = null;

        if (!table.equals(""))
        {
            DatabaseMap dbMap = Torque.getDatabaseMap(criteria.getDbName());
            if (dbMap == null)
View Full Code Here

Examples of org.apache.torque.map.ColumnMap

     *         rethrown wrapped into a TorqueException.
     */
    public static void doUpdate(Criteria updateValues, Connection con)
        throws TorqueException
    {
        ColumnMap pk = getPrimaryKey(updateValues);
        Criteria selectCriteria = null;

        if (pk != null && updateValues.containsKey(pk.getFullyQualifiedName()))
        {
            selectCriteria = new Criteria(2);
            selectCriteria.put(pk.getFullyQualifiedName(),
                updateValues.remove(pk.getFullyQualifiedName()));
        }
        else
        {
            throw new TorqueException("No PK specified for database update");
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.