Package bm.db

Examples of bm.db.Table


            throws VirtualMachineException
    {
        final int id = checkMethod( methodName, args );
        if( id != -1 )
        {
            final Table table = (Table) target.getAttachment( "table" );
            if( table != null )
            {
                try
                {
                    switch( id )
                    {
                        case GET_NAME           :
                            return Conversor.toInstance(
                                    getVirtualMachine(),
                                    table.getName()
                            );

                        case GET_PARENT         :
                            return (Instance) target.getAttachment( "parent" );

                        case FETCH              :
                            return sendRow(
                                    table.fetch(
                                            Conversor.toInteger(
                                                    args[0].get( "value" )
                                            ).intValue()
                                    ),
                                    target
                            );

                        case OPEN               :
                            table.open();
                            break;

                        case CLOSE              :
                            table.close();
                            break;

                        case OPEN_TREE          :
                            table.openTree();
                            break;

                        case CLOSE_TREE         :
                            table.closeTree();
                            break;

                        case DROP               :
                            table.drop();
                            break;

                        case CREATE_INDEX       :
                            table.createIndex(
                                    Conversor.toString( args[0] ),
                                    Conversor.toInteger( args[1] ).intValue(),
                                    Conversor.mapToStringArray( args[2] ),
                                    Conversor.toInteger( args[3] ).byteValue(),
                                    Conversor.toBoolean( args[4] )
                            );
                            break;

                        case FIND               :
                            return sendRowSet(
                                    table.find(
                                            Conversor.toString( args[0] ),
                                            args[1].get( "value" )
                                    ),
                                    target
                            );

                        case CREATE_ROW         :
                            return sendRow( table.createRow(), target );

                        case FIND_FUZZY         :
                            return sendRowSet(
                                    table.findFuzzy(
                                            Conversor.toString( args[0] ),
                                            Conversor.toString( args[1] )
                                    ),
                                    target
                            );

                        case FIND_ALL           :
                            return sendRowSet( table.findAll(), target );

                        case REMOVE             :
                            table.remove();
                            break;

                        case HAS_FIELD          :
                            return Conversor.toInstance(
                                    getVirtualMachine(),
                                    table.hasField( Conversor.toString(
                                            args[0]
                                    ) ) ?
                                        CoreConstants.TRUE :
                                        CoreConstants.FALSE
                            );
View Full Code Here


                    case GET_TABLE:
                        if( db != null )
                        {
                            final String tableName = Conversor.toString( args[0] );
                            final Table table = db.getTable(
                                    tableName
                            );
                            if( table != null )
                            {
                                Hashtable tables = (Hashtable)
                                        target.getAttachment( "tables" );
                                if( tables == null )
                                {
                                    tables = new Hashtable( 10 );
                                    target.setAttachment( "tables", tables );
                                }
                                Instance t = (Instance) tables.get( tableName );
                                if( t == null )
                                {
                                    t = getVirtualMachine().newInstance( "Table" );
                                    t.setAttachment( "table", table );
                                    t.setAttachment( "parent", target );
                                    tables.put( tableName, t );
                                }
                                return t;
                            }
                            else
                            {
                                return null;
                            }
                        }
                        else
                        {
                            return null;
                        }

                    case CREATE_TABLE:
                        if( db != null )
                        {
                            final Table table = (Table)
                                    args[0].getAttachment( "table" );
                            db.createTable( table );
                            Hashtable tables = (Hashtable)
                                    target.getAttachment( "tables" );
                            if( tables == null )
                            {
                                tables = new Hashtable( 10 );
                                target.setAttachment( "tables", tables );
                            }
                            Instance t = (Instance) tables.get( table.getName() );
                            if( t == null )
                            {
                                t = getVirtualMachine().newInstance( "Table" );
                                t.setAttachment( "table", table );
                                t.setAttachment( "parent", target );
                                tables.put( table.getName(), t );
                            }
                            return t;
                        }
                        else
                        {
View Full Code Here

TOP

Related Classes of bm.db.Table

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.