Hi, Actually I had submitted fix that would help pass more than one parameters when executing a direct SQL within Castor. But I never got any response. Attached is the diff file one more time. I would appreciate if someone from Castor team can at least have a look at it.
Thanks ! Sudhir
? diff.txt ? org/exolab/castor/jdo/.nbattrs ? org/exolab/castor/jdo/drivers/.nbattrs ? org/exolab/castor/jdo/engine/.nbattrs ? org/exolab/castor/jdo/engine/diff.txt Index: org/exolab/castor/jdo/drivers/OracleFactory.java =================================================================== RCS file: /cvs/castor/castor/src/main/org/exolab/castor/jdo/drivers/OracleFactory.java,v retrieving revision 1.12 diff -c -r1.12 OracleFactory.java *** org/exolab/castor/jdo/drivers/OracleFactory.java 7 Sep 2001 02:03:54 -0000 1.12 --- org/exolab/castor/jdo/drivers/OracleFactory.java 12 Nov 2001 18:24:24 -0000 *************** *** 113,123 **** */ public Class adjustSqlType( Class sqlType ) { ! if (sqlType == java.lang.Integer.class) { return java.math.BigDecimal.class; } else { return sqlType; ! } } } --- 113,124 ---- */ public Class adjustSqlType( Class sqlType ) { ! /*if (sqlType == java.lang.Integer.class) { return java.math.BigDecimal.class; } else { return sqlType; ! }*/ ! return sqlType; } } Index: org/exolab/castor/jdo/engine/OQLQueryImpl.java =================================================================== RCS file: /cvs/castor/castor/src/main/org/exolab/castor/jdo/engine/OQLQueryImpl.java,v retrieving revision 1.66 diff -c -r1.66 OQLQueryImpl.java *** org/exolab/castor/jdo/engine/OQLQueryImpl.java 22 Jun 2001 23:57:24 -0000 1.66 --- org/exolab/castor/jdo/engine/OQLQueryImpl.java 12 Nov 2001 18:24:24 -0000 *************** *** 308,313 **** --- 308,314 ---- } + public void createCall( String oql ) throws QueryException { StringBuffer sql; int as; *************** *** 339,345 **** throw new QueryException( "Syntax error: parenthesis" ); } sql.append( oql.substring( 5, leftParen ) ); ! sql.append( '(' ); for ( int i = leftParen + 1; i < rightParen; i++ ) { if ( oql.charAt( i ) == '$' ) { // get parameter number if given --- 340,350 ---- throw new QueryException( "Syntax error: parenthesis" ); } sql.append( oql.substring( 5, leftParen ) ); ! ! //Sudhir added the while loop ! while(leftParen > 0) ! { ! sql.append( '(' ); for ( int i = leftParen + 1; i < rightParen; i++ ) { if ( oql.charAt( i ) == '$' ) { // get parameter number if given *************** *** 366,379 **** _paramInfo.put( paramNo , info ); paramCnt++; } ! } ! for ( int i = 0; i < paramCnt; i++ ) { sql.append( '?' ); if ( i < paramCnt - 1 ) sql.append( ',' ); ! } sql.append( ')' ); ! } _spCall = sql.toString(); _projectionType = ParseTreeWalker.PARENT_OBJECT; _bindTypes = new Class[ paramCnt ]; --- 371,398 ---- _paramInfo.put( paramNo , info ); paramCnt++; } ! sql.append( '?' ); ! if(i < (rightParen-1)) ! sql.append( ',' ); ! }//end of for ! sql.append( ')' ); ! leftParen = oql.indexOf( "(", rightParen); ! if(leftParen > 0) ! sql.append(oql.substring(rightParen+1, leftParen)); ! else{ ! if(rightParen < (as-1)) ! sql.append(oql.substring(rightParen+1, as-1)); ! }//end of else ! rightParen = oql.indexOf( ")", leftParen); ! }//end of while ! /*for ( int i = 0; i < paramCnt; i++ ) { sql.append( '?' ); if ( i < paramCnt - 1 ) sql.append( ',' ); ! }//end of for sql.append( ')' ); ! */ ! }//end of else _spCall = sql.toString(); _projectionType = ParseTreeWalker.PARENT_OBJECT; _bindTypes = new Class[ paramCnt ]; *************** *** 396,402 **** if ( _dbEngine == null || _dbEngine.getPersistence( _objClass ) == null ) throw new QueryException( "Could not find an engine supporting class " + objType ); } - public QueryResults execute() throws QueryException, PersistenceException, TransactionNotInProgressException --- 415,420 ---- Index: org/exolab/castor/jdo/engine/SQLEngine.java =================================================================== RCS file: /cvs/castor/castor/src/main/org/exolab/castor/jdo/engine/SQLEngine.java,v retrieving revision 1.108 diff -c -r1.108 SQLEngine.java *** org/exolab/castor/jdo/engine/SQLEngine.java 29 Oct 2001 23:58:26 -0000 1.108 --- org/exolab/castor/jdo/engine/SQLEngine.java 12 Nov 2001 18:24:25 -0000 *************** *** 431,437 **** System.arraycopy( jdoFields0, 0, jdoFields, 0, count ); System.arraycopy( sqlTypes0, 0, sqlTypes, 0, count ); // changes for the SQL Direct interface begins here ! if(spCall.startsWith("SQL")){ sql =spCall.substring(4); return new SQLQuery( this, sql, types ); } else{ --- 431,437 ---- System.arraycopy( jdoFields0, 0, jdoFields, 0, count ); System.arraycopy( sqlTypes0, 0, sqlTypes, 0, count ); // changes for the SQL Direct interface begins here ! if(spCall.startsWith(" SQL")){ sql =spCall.substring(4); return new SQLQuery( this, sql, types ); } else{