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

📄 sqlrcursor.java

📁 适合于Unix/Linux下的一个持久数据库连接池
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
// Copyright (c) 2001  David Muse// See the file COPYING for more information.package com.firstworks.sqlrelay;public class SQLRCursor {	static {		System.loadLibrary("SQLRCursor");	}	public SQLRCursor(SQLRConnection con) {		connection=con;		cursor=alloc(con.connection);	}	public native void	delete();	/** Sets the number of rows of the result set	 *  to buffer at a time.  0 (the default)	 *  means buffer the entire result set.  */	public native void	setResultSetBufferSize(long rows);	/** Returns the number of result set rows that 	 *  will be buffered at a time or 0 for the	 *  entire result set.  */	public native long	getResultSetBufferSize();	/** Tells the server not to send any column	 *  info (names, types, sizes).  If you don't	 *  need that info, you should call this	 *  method to improve performance.  */	public native void	dontGetColumnInfo();	/** Tells the server to send column info.  */	public native void	getColumnInfo();	/** Columns names are returned in the same	 *  case as they are defined in the database.	 *  This is the default. */	public native void	mixedCaseColumnNames();	/** Columns names are converted to upper case. */	public native void	upperCaseColumnNames();	/** Columns names are converted to lower case. */	public native void	lowerCaseColumnNames();	/** Sets query caching on.  Future queries	 *  will be cached to the file "filename".	 * 	 *  A default time-to-live of 10 minutes is	 *  also set.	 * 	 *  Note that once cacheToFile() is called,	 *  the result sets of all future queries will	 *  be cached to that file until another call 	 *  to cacheToFile() changes which file to	 *  cache to or a call to cacheOff() turns off	 *  caching.  */	public native void	cacheToFile(String filename);	/** Sets the time-to-live for cached result	 *  sets. The sqlr-cachemanger will remove each 	 *  cached result set "ttl" seconds after it's 	 *  created, provided it's scanning the directory	 *  containing the cache files.  */	public native void	setCacheTtl(int ttl);	/** Returns the name of the file containing the	 *  cached result set.  */	public native String	getCacheFileName();	/** Sets query caching off.  */	public native void	cacheOff();	/** Sends "query" and gets a result set.  */	public native boolean	sendQuery(String query);	/** Sends the query in file "path"/"filename" 	 *  and gets a result set.  */	public native boolean	sendQuery(String query, int length);	/** Sends "query" with length "length" and gets	*  a result set. This method must be used if	*  the query contains binary data. */	public native boolean	sendFileQuery(String path, String filename); 	/** Prepare to execute "query".  */	public native void	prepareQuery(String query);	/** Prepare to execute the contents 	 *  of "path"/"filename".  Returns 0 if the	 *  file couldn't be opened.  */	public native void	prepareQuery(String query, int length);	/** Prepare to execute "query" with length 	 * "length".  This method must be used if the	 * query contains binary data. */	public native boolean	prepareFileQuery(String path, String filename);	/** Clear all bind variables.  */	public native void	clearBinds();	/** Define a substitution variable.  */	public native void	substitution(String variable, String value);	/** Define a substitution variable.  */	public native void	substitution(String variable, long value);	/** Define a substitution variable.  */	public native void	substitution(String variable, double value, 					int precision, int scale);	/** Parses the previously prepared query,	 *  counts the number of bind variables defined	 *  in it and returns that number. */	public native short	countBindVariables();	/** Define an input bind variable.  */	public native void	inputBind(String variable, String value);	/** Define an input bind variable.  */	public native void	inputBind(String variable, long value);	/** Define an input bind variable.  */	public native void	inputBind(String variable, double value, 					int precision, int scale);	/** Define an input bind variable.  */	public native void	inputBindBlob(String variable, byte[] value, 								long size);	/** Define an input bind variable.  */	public native void	inputBindClob(String variable, String value, 								long size);	/** Define a string output bind variable.  */	public native void	defineOutputBindString(String variable, 							int bufferlength);	/** Define an integer output bind variable.  */	public native void	defineOutputBindInteger(String variable);	/** Define a double precision floating point output bind variable.  */	public native void	defineOutputBindDouble(String variable);	/** Define an output bind variable.  */	public native void	defineOutputBindBlob(String variable);	/** Define an output bind variable.  */	public native void	defineOutputBindClob(String variable);	/** Define an output bind variable.  */	public native void	defineOutputBindCursor(String variable);	/** Define an array of substitution variables.  */	public native void	substitutions(String[] variables, 							String[] values);	/** Define an array of substitution variables.  */	public native void	substitutions(String[] variables, 							long[] values);	/** Define an array of substitution variables.  */	public native void	substitutions(String[] variables, 					double[] values,					int[] precisions, int[] scales);	/** Define an array of input bind variables.  */	public native void	inputBinds(String[] variables, String[] values);	/** Define an array of input bind variables.  */	public native void	inputBinds(String[] variables, long[] values);	/** Define an array of input bind variables.  */	public native void	inputBinds(String[] variables, 					double[] values, 					int[] precisions, int[] scales);	/** If you are binding to any variables that 	 *  might not actually be in your query, call 	 *  this to ensure that the database won't try 	 *  to bind them unless they really are in the 	 *  query.  There is a performance penalty for	 *  calling this method.  */	public native void	validateBinds();	/** Returns true if "variable" was a valid	 *  bind variable of the query  */	public native boolean	validBind(String variable);	/** Execute the query that was previously 	 *  prepared and bound.  */	public native boolean	executeQuery();	/** Fetch from a cursor that was returned as	 *  an output bind variable.  */	public native boolean	fetchFromBindCursor();	/** Get the value stored in a previously	 *  defined output bind variable.  */	public native String	getOutputBindString(String variable);	/** Get the value stored in a previously	 *  defined output bind variable.  */	public native byte[]	getOutputBindBlob(String variable);	/** Get the value stored in a previously	 *  defined output bind variable.  */	public native String	getOutputBindClob(String variable);	/** Get the length of the value stored in a	 *  previously defined output bind variable.  */	public native byte[]	getOutputBindAsByteArray(String variable);	/** Get the value stored in a previously	 *  defined output bind variable as a long	 *  integer. */	public native long	getOutputBindInteger(String variable);	/** Get the value stored in a previously	 *  defined output bind variable as a double	 *  precision floating point number. */	public native double	getOutputBindDouble(String variable);	/** Get the length of the value stored in a	 *  previously defined output bind variable.  */	public native long	getOutputBindLength(String variable);	/** Get the cursor associated with a	 *  previously defined output bind variable.  */	public SQLRCursor	getOutputBindCursor(String variable) {		SQLRCursor	bindcur=new SQLRCursor(connection);		bindcur.cursor=getOutputBindCursorInternal(variable);		return bindcur;	}	/** Opens a cached result set.	 *  Returns 1 on success and 0 on failure.  */	public native boolean	openCachedResultSet(String filename);

⌨️ 快捷键说明

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