⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ij.jj

📁 derby database source code.good for you.
💻 JJ
📖 第 1 页 / 共 5 页
字号:
{	int row;	String c;	ResultSet rs;}{	<RELATIVE> row = intLiteral() c=identifier()	{		haveConnection();		// Verify that we have JDBC 2.0		Session s = currentConnEnv.getSession();		rs = (ResultSet) s.getCursor(c);		JDBCDisplayUtil.checkNotNull(rs,"cursor");		return utilInstance.relative(rs, row);	}}ijResultBeforeFirstStatement()throws SQLException:{	String c;	ResultSet rs;}{	<BEFORE> <FIRST> c=identifier()	{		haveConnection();		// Verify that we have JDBC 2.0		Session s = currentConnEnv.getSession();		rs = (ResultSet) s.getCursor(c);		JDBCDisplayUtil.checkNotNull(rs,"cursor");		return utilInstance.beforeFirst(rs);	}}ijResultFirstStatement()throws SQLException:{	String c;	ResultSet rs;}{	<FIRST> c=identifier()	{		haveConnection();		// Verify that we have JDBC 2.0		Session s = currentConnEnv.getSession();		rs = (ResultSet) s.getCursor(c);		JDBCDisplayUtil.checkNotNull(rs,"cursor");		return utilInstance.first(rs);	}}ijResultNextStatement()throws SQLException:{	String c;	ResultSet rs;}{	<NEXT> c=identifier()	{		haveConnection();		Session s = currentConnEnv.getSession();		rs = (ResultSet) s.getCursor(c);		JDBCDisplayUtil.checkNotNull(rs,"cursor");		return new ijRowResult(rs, rs.next());	}}ijResultAfterLastStatement()throws SQLException:{	String c;	ResultSet rs;}{	<AFTER> <LAST> c=identifier()	{		haveConnection();		// Verify that we have JDBC 2.0		Session s = currentConnEnv.getSession();		rs = (ResultSet) s.getCursor(c);		JDBCDisplayUtil.checkNotNull(rs,"cursor");		return utilInstance.afterLast(rs);	}}ijResultLastStatement()throws SQLException:{	String c;	ResultSet rs;}{	<LAST> c=identifier()	{		haveConnection();		// Verify that we have JDBC 2.0		Session s = currentConnEnv.getSession();		rs = (ResultSet) s.getCursor(c);		JDBCDisplayUtil.checkNotNull(rs,"cursor");		return utilInstance.last(rs);	}}ijResultPreviousStatement()throws SQLException:{	String c;	ResultSet rs;}{	<PREVIOUS> c=identifier()	{		haveConnection();		// Verify that we have JDBC 2.0		Session s = currentConnEnv.getSession();		rs = (ResultSet) s.getCursor(c);		JDBCDisplayUtil.checkNotNull(rs,"cursor");		return utilInstance.previous(rs);	}}ijResultGetCurrentRowNumber()throws SQLException:{	ResultSet rs;	String c;}{	<GETCURRENTROWNUMBER> c=identifier()	{		haveConnection();		// Verify that we have JDBC 2.0		Session s = currentConnEnv.getSession();		rs = (ResultSet) s.getCursor(c);		JDBCDisplayUtil.checkNotNull(rs,"cursor");	LocalizedResource.OutputWriter().println(utilInstance.getCurrentRowNumber(rs));		return null;	}}ijResultCloseStatement()throws SQLException:{	String c;	ResultSet rs;	Statement s;}{	<CLOSE> c=identifier()	{		haveConnection();		Session sn = currentConnEnv.getSession();		rs = (ResultSet) sn.getCursor(c);		JDBCDisplayUtil.checkNotNull(rs,"cursor");		s = (Statement) sn.getCursorStatement(c);		JDBCDisplayUtil.checkNotNull(s,"cursor");		rs.close();		s.close();		sn.removeCursor(c);		sn.removeCursorStatement(c);		return null;	}}/** * Hack to get the grammar to leave a * EXECUTE STATEMENT <stmt> alone.  Short * circuit the ij EXECUTE built in. */ijResult JBMSPreparedStatementExec()	throws SQLException :{	Token s = null;}{	<EXECUTE> <STATEMENT> s = <STRING>	{		return executeImmediate(stringValue(s.image));	}}		/** * Hack to get the grammar to leave a * EXECUTE PROCEDURE <procSpec> alone.  Short * circuit the ij EXECUTE built in so that * we can deploy ij against Foundation2000. */ijResult F2KExecuteProcedure()	throws SQLException :{	Token s = null;}{	<EXECUTE> <PROCEDURE> s = <STRING>	{		haveConnection();		Statement	aStatement = theConnection.createStatement();		String		text = "execute procedure " + s;		aStatement.execute( text );		return new ijStatementResult( aStatement,true );	}}		/** * Two forms of execute: immediate, with a string * and prepared, with the id of a prepared statement. * We expect the latter form will * eventually support a USING clause to supply * parameter values (that will be constants). * No parameters yet, however. * <p> * Syntax: *   EXECUTE statementSource [ USING statementSource] ; * *	 statementSource is an identifier of a previously prepared statement *	 or a string containing SQL-J text. */ijResultExecuteStatement()throws SQLException:{	String i = null;	Token s = null;	PreparedStatement ps;	String sVal = null;	String iUsing = null;	Token sUsing = null;	Token	usingObject = null;}{	<EXECUTE> 	( i=identifier()	| s=<STRING>	)	( <USING> ( iUsing=identifier()			| sUsing=<STRING>			)	)?	{	    if (iUsing!=null || sUsing!=null) { // parameters in use			String sUsingVal = null;			PreparedStatement psUsing;			SQLWarning warns = null;			haveConnection();			/*				Steps:				1. find or prepare the statement				2. execute the using statement				3. push the row of the using statement into the parameters				4. execute the statement against those parameters				5. clear the parameters			 */			/*				get the prepared statement			 */			boolean closeWhenDone = false; // will we close the ps when done?    		if (i!=null) {				ps = (PreparedStatement) currentConnEnv.getSession().getPreparedStatement(i);				JDBCDisplayUtil.checkNotNull(ps,"prepared statement "+i);    		}    		else { // (s!=null)				sVal = stringValue(s.image);				ps = theConnection.prepareStatement(sVal);				closeWhenDone = true;				JDBCDisplayUtil.checkNotNull(ps,"prepared statement");				warns = appendWarnings(warns, ps.getWarnings());				ps.clearWarnings();    		}			/*				execute the using statement			 */    		if (iUsing!=null) {				psUsing = (PreparedStatement) currentConnEnv.getSession().getPreparedStatement(iUsing);				JDBCDisplayUtil.checkNotNull(psUsing,"prepared statement "+iUsing);    		}    		else { // (sUsing!=null)				sUsingVal = stringValue(sUsing.image);				psUsing = theConnection.prepareStatement(sUsingVal);				JDBCDisplayUtil.checkNotNull(psUsing,"prepared statement");				warns = appendWarnings(warns, psUsing.getWarnings());				psUsing.clearWarnings();    		}			ResultSet rsUsing;			/*				If the USING statement is not a query, we				will not execute the statement; the number of				rows controls the execution.			 */			if (psUsing.execute()) {				rsUsing = psUsing.getResultSet();				/*					push the row of the using statement into the parameters				 */				ResultSetMetaData rsmdUsing = rsUsing.getMetaData();				int numCols = rsmdUsing.getColumnCount();				/*					Insufficient or too many parameters will					be caught at the JDBC level, and halt execution.				 */				boolean exec = false;				/* Only do 1 next on rsUsing if autocommit is on,				 * since rsUsing will be closed when ps is closed.				 */			    boolean autoCommited = false;				ijMultiResult result = new ijMultiResult(ps,rsUsing,closeWhenDone);//				while (! autoCommited && rsUsing.next()) {//					// note the first time through//					if (!exec) {//						exec = true;////						// send a warning if additional results may be lost//						if (theConnection.getAutoCommit()) {//							// FIXME: currOut.println("IJ WARNING: Autocommit may close using result set");//							autoCommited = true;//						}//					}//					for (int c=1; c<=numCols; c++) {//						if (usingObject == null)//						{//							ps.setObject(c,rsUsing.getObject(c),//								rsmdUsing.getColumnType(c));//						} //						else//						{//							ps.setObject(c,rsUsing.getObject(c));//						}//					}////					/*//						4. execute the statement against those parameters//					 */////					ps.execute();//					result.addStatementResult(ps);////					/*//						5. clear the parameters//					 *///					ps.clearParameters();////				}//				if (!exec) {//					throw ijException.noUsingResults();//				}////				if (! theConnection.getAutoCommit())//				{//					rsUsing.close();//				}//				// REMIND: any way to look for more rsUsing rows if autoCommit?//				// perhaps just document the behavior... 				return result;			}			else				throw ijException.noUsingResults();		}		else { // no parameters in use	    	if (i!=null) {				haveConnection();				ps = (PreparedStatement) currentConnEnv.getSession().getPreparedStatement(i);				JDBCDisplayUtil.checkNotNull(ps,"prepared statement "+i);				ps.execute();				return new ijStatementResult(ps,false);	    	}	    	else { // (s!=null)			    return executeImmediate(stringValue(s.image));	    	}	    }	}}/** * Async: like execute immediate, without using, * but runs the statement in a separate thread, against * the current connection. * <p> * Syntax: *   ASYNC asyncName statementSource  * *	 statementSource is a string containing SQL-J text. */ijResultAsyncStatement()throws SQLException:{	Token s = null;	String n = null;}{	<ASYNC> n=identifier() s=<STRING>	{	    return executeAsync(stringValue(s.image), n);	}}/** * Wait for: the second half of Async, waits for completion * if needed and then supplies the result.  Only execute is done, * not row fetching. * <p> * Syntax: *   WAIT FOR asyncName  * *	 asyncName is a name used in an ASYNC statement previously */ijResultWaitForStatement()throws SQLException:{	Token s = null;	String n = null;}{	<WAIT> <FOR> n=identifier()	{		AsyncStatement as = currentConnEnv.getSession().getAsyncStatement(n);		if (as == null) throw ijException.noSuchAsyncStatement(n);		try {		    as.join(); // we wait for it to finish.		} catch (InterruptedException ie) {			throw ijException.waitInterrupted(ie);		}		return as.getResult();	}}/** * RemoveStatement is REMOVE identifier. It identifies * a previously prepared statement.  We would prefer a DROP * syntax, but SQL-J is using that word and I want to point out * that special processing will be needed to give that parser * this parser's input for unrecognized text. */ijResultRemoveStatement()throws SQLException:{	String i;	PreparedStatement ps;}{	<REMOVE> i=identifier()	{		haveConnection();		Session s = currentConnEnv.getSession();		ps = (PreparedStatement) s.getPreparedStatement(i);		JDBCDisplayUtil.checkNotNull(ps,"prepared statement "+i);		ps.close();		s.removePreparedStatement(i);		return null;	}}ijResultRunStatement()throws SQLException:{	Token i;    Token r = null;	PreparedStatement ps;}{	<RUN> 	[r = <RESOURCE>] i=<STRING>	{		if (utilInstance==null) return null;	    if (r == null)			utilInstance.newInput(stringValue(i.image));		else            utilInstance.newResourceInput(stringValue(i.image));		return null;    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -