Package org.apache.turbine.torque.engine.database.model

Examples of org.apache.turbine.torque.engine.database.model.Column


                err (") expected");
            }
            next();
        }

        Column col = new Column (columnName);
        if (columnPrecision != null)
            columnSize = columnSize + columnPrecision;
        col.setTypeFromString (columnType,columnSize);
        tbl.addColumn (col);

        if ( inEnum )
        {
            col.setNotNull(true);
            if (columnDefault != null)
            {
                col.setDefaultValue(columnDefault);
            }
        }
        else
        {
            while (!token.getStr().equals(",") && !token.getStr().equals(")"))
            {
                if (token.getStr().toUpperCase().equals("NOT"))
                {
                    next();
                    if (!token.getStr().toUpperCase().equals("NULL"))
                        err ("NULL expected after NOT");
                    col.setNotNull(true);
                    next();
                }
                else if (token.getStr().toUpperCase().equals("PRIMARY"))
                {
                    next();
                    if (!token.getStr().toUpperCase().equals("KEY"))
                        err ("KEY expected after PRIMARY");
                    col.setPrimaryKey(true);
                    next();
                }
                else if (token.getStr().toUpperCase().equals("UNIQUE"))
                {
                    col.setUnique(true);
                    next();
                }
                else if (token.getStr().toUpperCase().equals("NULL"))
                {
                    col.setNotNull(false);
                    next();
                }
                else if (token.getStr().toUpperCase().equals("AUTO_INCREMENT"))
                {
                    col.setAutoIncrement(true);
                    next();
                }
                else if (token.getStr().toUpperCase().equals("DEFAULT"))
                {
                    next();
                    if (token.getStr().equals("'"))
                    {
                        next();
                    }
                    col.setDefaultValue(token.getStr());
                    next();
                    if (token.getStr().equals("'"))
                    {
                        next();
                    }
View Full Code Here


            {
                Table table = database.getTableByJavaName(rawName);
                Vector columnValues = new Vector();
                for (int i=0; i<attributes.getLength(); i++)
                {
                    Column col = table
                        .getColumnByJavaName(attributes.getLocalName(i));
                    String value = attributes.getValue(i);
                    columnValues.add(new ColumnValue(col, value));
                }
                data.add(new DataRow(table, columnValues));
View Full Code Here

        if (!token.getStr().toUpperCase().equals("("))
            err ("( expected");
        next();

        String colName = token.getStr();
        Column c = tbl.getColumn(colName);
        if (c == null) err ("Invalid column name: "+colName);
        c.setPrimaryKey(true);
        next();
        while (token.getStr().equals(","))
        {
            next();
            colName = token.getStr();
            c = tbl.getColumn(colName);
            if (c == null) err ("Invalid column name: "+colName);
            c.setPrimaryKey(true);
            next();
        }

        if (!token.getStr().toUpperCase().equals(")"))
            err (") expected");
View Full Code Here

        while (!token.getStr().equals(")"))
        {
            if (!token.getStr().equals(","))
            {
                String colName = token.getStr();
                Column c = tbl.getColumn(colName);
                if (c == null) err ("Invalid column name: "+colName);
                    c.setUnique(true);
            }
            next();
        }
        if (!token.getStr().toUpperCase().equals(")"))
            err (") expected got: " + token.getStr());
View Full Code Here

                err (") expected");
            }
            next();
        }

        Column col = new Column (columnName);
        if (columnPrecision != null)
            columnSize = columnSize + columnPrecision;
        col.setTypeFromString (columnType,columnSize);
        tbl.addColumn (col);
       
        if ( inEnum )
        {
            col.setNotNull(true);
            if (columnDefault != null)
            {
                col.setDefaultValue(columnDefault);
            }
        }
        else
        {
            while (!token.getStr().equals(",") && !token.getStr().equals(")"))
            {
                if (token.getStr().toUpperCase().equals("NOT"))
                {
                    next();
                    if (!token.getStr().toUpperCase().equals("NULL"))
                        err ("NULL expected after NOT");
                    col.setNotNull(true);
                    next();
                }
                else if (token.getStr().toUpperCase().equals("PRIMARY"))
                {
                    next();
                    if (!token.getStr().toUpperCase().equals("KEY"))
                        err ("KEY expected after PRIMARY");
                    col.setPrimaryKey(true);
                    next();
                }
                else if (token.getStr().toUpperCase().equals("UNIQUE"))
                {
                    col.setUnique(true);
                    next();
                }
                else if (token.getStr().toUpperCase().equals("NULL"))
                {
                    col.setNotNull(false);
                    next();
                }
                else if (token.getStr().toUpperCase().equals("AUTO_INCREMENT"))
                {
                    col.setAutoIncrement(true);
                    next();
                }
                else if (token.getStr().toUpperCase().equals("DEFAULT"))
                {
                    next();
                    if (token.getStr().equals("'"))
                    {
                        next();
                    }
                    col.setDefaultValue(token.getStr());
                    next();
                    if (token.getStr().equals("'"))
                    {
                        next();
                    }
View Full Code Here

TOP

Related Classes of org.apache.turbine.torque.engine.database.model.Column

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.