Clover coverage report - Replica - 1.0-Alpha
Coverage timestamp: Dom Fev 1 2004 17:00:58 WET
file stats: LOC: 73   Methods: 5
NCLOC: 57   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
ASTQueryStatement.java 0% 0% 0% 0%
coverage
 1   
 /* JJT:    0.2.2 */
 2   
 
 3   
 package    mobisnap.mobile_trx;
 4   
 
 5   
 import java.util.*;
 6   
 import nmp.dbms.*;
 7   
 
 8   
 /**
 9   
  * Implements query statement
 10   
  */
 11   
 public class ASTQueryStatement extends mobisnap.mobile_trx.SimpleNode {
 12   
     public Vector into;
 13   
     public Vector what;
 14   
     public Vector from;
 15   
     public Vector fromid;
 16   
     public ASTSQLExpression where;
 17   
 
 18   
     public boolean selectAll = false;
 19   
     public boolean forUpdate = false;
 20   
     public boolean connect = false;
 21   
     public boolean groupBy = false;
 22   
     public boolean orderBy = false;
 23   
     public boolean setClause = false;
 24   
 
 25  0
     public ASTQueryStatement(int id) {
 26  0
         super(id);
 27  0
         into = new Vector();
 28  0
         what = new Vector();
 29  0
         from = new Vector();
 30  0
         fromid = new Vector();
 31   
     }
 32   
 
 33  0
     public ASTQueryStatement( MobisnapSQL    p, int i) {
 34  0
         super( p, i);
 35  0
         id = i;
 36  0
         into = new Vector();
 37  0
         what = new Vector();
 38  0
         from = new Vector();
 39  0
         fromid = new Vector();
 40   
     }
 41   
     
 42   
     /** Accept the visitor. **/
 43  0
     public Object jjtAccept(MobisnapSQLVisitor visitor, Object data) {
 44  0
         return visitor.visit(this, data);
 45   
     }
 46   
     
 47  0
     public SQLVectorResult getResult( int msql_type) throws Exception {
 48  0
         StringBuffer buf = new StringBuffer();
 49  0
         sourceCode( msql_type, buf);
 50  0
         return MobisnapSQL.transaction.executeQuery( buf.toString().trim());
 51   
     }
 52   
 
 53  0
     public void process( int msql_type) throws Exception {
 54  0
         SQLVectorResult result = getResult( msql_type);
 55  0
         if( result.rows.size() == 1) {
 56  0
             Object[] row = (Object[])result.rows.elementAt( 0);
 57  0
             if( row.length == into.size()) {
 58  0
                 for( int i = 0; i < into.size(); i++) {
 59  0
                     MSQLTVariable var = (MSQLTVariable)MobisnapSQL.names.getName( (String)into.elementAt(i));
 60  0
                     var.associateRsrv( null);
 61  0
                     if( row[i] == null)
 62  0
                         var.setValue( SQLNull.getInstance());
 63   
                     else
 64  0
                         var.setValue( row[i]);
 65   
                 }
 66   
             } else
 67  0
                 throw new mobisnap.MobisnapException( "Select into statement with mismatch size of columns");
 68   
         } else
 69  0
             throw new mobisnap.MobisnapException( "Select into statement returns more than one row");
 70   
     }
 71   
 
 72   
 }
 73