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

📄 monetpreparedstatement.java

📁 这个是内存数据库的客户端
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
					case Types.TINYINT:					case Types.SMALLINT:					case Types.INTEGER:					case Types.BIGINT:					case Types.REAL:					case Types.FLOAT:					case Types.DOUBLE:						return(true);					case Types.BIT: // we don't use type BIT, it's here for completeness					case Types.BOOLEAN:					case Types.DATE:					case Types.TIME:					case Types.TIMESTAMP:					default:						return(false);				}			}			/**			 * Retrieves the designated parameter's number of decimal			 * digits.			 *			 * @param param the first parameter is 1, the second is 2, ... 			 * @return precision			 * @throws SQLException if a database access error occurs			 */			public int getPrecision(int param) throws SQLException {				if (param < 1 || param > size)					throw new SQLException("No such parameter with index: " + param);				return(digits[param - 1]);			}			/**			 * Retrieves the designated parameter's number of digits to			 * right of the decimal point.			 *			 * @param param the first parameter is 1, the second is 2, ... 			 * @return scale 			 * @throws SQLException if a database access error occurs			 */			public int getScale(int param) throws SQLException {				if (param < 1 || param > size)					throw new SQLException("No such parameter with index: " + param);				return(scale[param - 1]);			}			/**			 * Retrieves the designated parameter's SQL type.			 *			 * @param param the first parameter is 1, the second is 2, ... 			 * @return SQL type from java.sql.Types 			 * @throws SQLException if a database access error occurs			 */			public int getParameterType(int param) throws SQLException {				if (param < 1 || param > size)					throw new SQLException("No such parameter with index: " + param);				return(javaType[param - 1]);			}			/**			 * Retrieves the designated parameter's database-specific			 * type name.			 *			 * @param param the first parameter is 1, the second is 2, ... 			 * @return type the name used by the database.  If the			 *         parameter type is a user-defined type, then a			 *         fully-qualified type name is returned. 			 * @throws SQLException if a database access error occurs			 */			public String getParameterTypeName(int param) throws SQLException {				if (param < 1 || param > size)					throw new SQLException("No such parameter with index: " + param);				return(monetdbType[param - 1]);			}			/**			 * Retrieves the fully-qualified name of the Java class			 * whose instances should be passed to the method			 * PreparedStatement.setObject.			 *			 * @param param the first parameter is 1, the second is 2, ... 			 * @return the fully-qualified name of the class in the Java			 *         programming language that would be used by the			 *         method PreparedStatement.setObject to set the			 *         value in the specified parameter. This is the			 *         class name used for custom mapping. 			 * @throws SQLException if a database access error occurs			 */			public String getParameterClassName(int param) throws SQLException {				if (param < 1 || param > size)					throw new SQLException("No such parameter with index: " + param);				return(MonetResultSet.getClassForType(javaType[param - 1]).getName());			}			/**			 * Retrieves the designated parameter's mode.			 * For MonetDB/SQL this is currently always unknown.			 *			 * @param param - the first parameter is 1, the second is 2, ... 			 * @return mode of the parameter; one of			 *         ParameterMetaData.parameterModeIn,			 *         ParameterMetaData.parameterModeOut, or			 *         ParameterMetaData.parameterModeInOut			 *         ParameterMetaData.parameterModeUnknown. 			 * @throws SQLException if a database access error occurs			 */			public int getParameterMode(int param) throws SQLException {				return(ParameterMetaData.parameterModeUnknown);			}		});	}	/**	 * Sets the designated parameter to the given Array object.  The	 * driver converts this to an SQL ARRAY value when it sends it to	 * the database.     *	 * @param i the first parameter is 1, the second is 2, ...	 * @param x an Array object that maps an SQL ARRAY value	 * @throws SQLException if a database access error occurs	 */	public void setArray(int i, Array x) throws SQLException {		throw new SQLException("Operation currently not supported!");	}	/**	 * Sets the designated parameter to the given input stream, which will have	 * the specified number of bytes. When a very large ASCII value is input to	 * a LONGVARCHAR parameter, it may be more practical to send it via a	 * java.io.InputStream. Data will be read from the stream as needed until	 * end-of-file is reached. The JDBC driver will do any necessary conversion	 * from ASCII to the database char format.	 * <br /><br />	 * Note: This stream object can either be a standard Java stream object or	 * your own subclass that implements the standard interface.	 *	 * @param parameterIndex the first parameter is 1, the second is 2, ...	 * @param x the Java input stream that contains the ASCII parameter value	 * @param length the number of bytes in the stream	 * @throws SQLException if a database access error occurs	 */	public void setAsciiStream(int parameterIndex, InputStream x, int length)		throws SQLException	{		throw new SQLException("Operation currently not supported!");	}	/**	 * Sets the designated parameter to the given java.math.BigDecimal value.	 * The driver converts this to an SQL NUMERIC value when it sends it to the	 * database.	 *	 * @param parameterIndex the first parameter is 1, the second is 2, ...	 * @param x the parameter value	 * @throws SQLException if a database access error occurs	 */	public void setBigDecimal(int parameterIndex, BigDecimal x)		throws SQLException	{		setValue(parameterIndex, x.toString());	}	/**	 * Sets the designated parameter to the given input stream, which will have	 * the specified number of bytes. When a very large binary value is input	 * to a LONGVARBINARY parameter, it may be more practical to send it via a	 * java.io.InputStream object. The data will be read from the stream as	 * needed until end-of-file is reached.	 * <br /><br />	 * Note: This stream object can either be a standard Java stream object or	 * your own subclass that implements the standard interface.	 *	 * @param parameterIndex the first parameter is 1, the second is 2, ...	 * @param x the java input stream which contains the binary parameter value	 * @param length the number of bytes in the stream	 * @throws SQLException if a database access error occurs	 */	public void setBinaryStream(int parameterIndex, InputStream x, int length)		throws SQLException	{		throw new SQLException("Operation currently not supported!");	}	/**	 * Sets the designated parameter to the given Blob object. The driver	 * converts this to an SQL BLOB value when it sends it to the database.	 *	 * @param i the first parameter is 1, the second is 2, ...	 * @param x a Blob object that maps an SQL BLOB value	 * @throws SQLException if a database access error occurs	 */	public void setBlob(int i, Blob x) throws SQLException {		throw new SQLException("Operation currently not supported!");	}	/**	 * Sets the designated parameter to the given Java boolean value. The	 * driver converts this to an SQL BIT value when it sends it to the	 * database.	 *	 * @param parameterIndex the first parameter is 1, the second is 2, ...	 * @param x the parameter value	 * @throws SQLException if a database access error occurs	 */	public void setBoolean(int parameterIndex, boolean x) throws SQLException {		setValue(parameterIndex, "" + x);	}	/**	 * Sets the designated parameter to the given Java byte value. The driver	 * converts this to an SQL TINYINT value when it sends it to the database.	 *	 * @param parameterIndex the first parameter is 1, the second is 2, ...	 * @param x the parameter value	 * @throws SQLException if a database access error occurs	 */	public void setByte(int parameterIndex, byte x) throws SQLException {		setValue(parameterIndex, "" + x);	}	/**	 * Sets the designated parameter to the given Java array of bytes. The	 * driver converts this to an SQL VARBINARY or LONGVARBINARY (depending	 * on the argument's size relative to the driver's limits on VARBINARY	 * values) when it sends it to the database.	 *	 * @param parameterIndex the first parameter is 1, the second is 2, ...	 * @param x the parameter value	 * @throws SQLException if a database access error occurs	 */	public void setBytes(int parameterIndex, byte[] x) throws SQLException {		try {			setString(parameterIndex, new String(x, "UTF-8"));		} catch (UnsupportedEncodingException e) {			// this should never happen			throw new AssertionError(e.toString());		}	}	/**	 * Sets the designated parameter to the given Reader object, which is the	 * given number of characters long. When a very large UNICODE value is	 * input to a LONGVARCHAR parameter, it may be more practical to send it	 * via a java.io.Reader object. The data will be read from the stream as	 * needed until end-of-file is reached. The JDBC driver will do any	 * necessary conversion from UNICODE to the database char format.	 * <br /><br />	 * Note: This stream object can either be a standard Java stream object or	 * your own subclass that implements the standard interface.	 * <br /><br />	 * @param parameterIndex the first parameter is 1, the second is 2, ...	 * @param reader the java.io.Reader object that contains the Unicode data	 * @param length the number of characters in the stream	 * @throws SQLException if a database access error occurs	 */	public void setCharacterStream(		int parameterIndex,		Reader reader,		int length)		throws SQLException	{		throw new SQLException("Operation currently not supported!");	}	/**	 * Sets the designated parameter to the given Clob object. The driver	 * converts this to an SQL CLOB value when it sends it to the database.	 *	 * @param i the first parameter is 1, the second is 2, ...	 * @param x a Clob object that maps an SQL CLOB value	 * @throws SQLException if a database access error occurs	 */	public void setClob(int i, Clob x) throws SQLException {		// simply serialise the CLOB into a variable for now... far from		// efficient, but might work for a few cases...		// be on your marks: we have to cast the length down!		setString(i, x.getSubString(1L, (int)(x.length())));	}	/**	 * Sets the designated parameter to the given java.sql.Date value. The	 * driver converts this to an SQL DATE value when it sends it to the	 * database.	 *	 * @param parameterIndex the first parameter is 1, the second is 2, ...	 * @param x the parameter value	 * @throws SQLException if a database access error occurs	 */	public void setDate(int parameterIndex, java.sql.Date x) throws SQLException {		setValue(parameterIndex, "date '" + x.toString() + "'");	}	/**	 * Sets the designated parameter to the given java.sql.Date value, using	 * the given Calendar object. The driver uses the Calendar object to	 * construct an SQL DATE value, which the driver then sends to the	 * database. With a Calendar object, the driver can calculate the date	 * taking into account a custom timezone. If no Calendar object is	 * specified, the driver uses the default timezone, which is that of the	 * virtual machine running the application.	 *	 * @param parameterIndex the first parameter is 1, the second is 2, ...	 * @param x the parameter value	 * @param cal the Calendar object the driver will use to construct the date	 * @throws SQLException if a database access error occurs	 */	public void setDate(int parameterIndex, java.sql.Date x, Calendar cal)		throws SQLException	{		mDate.setTimeZone(cal.getTimeZone());		setValue(parameterIndex, "date '" + mDate.format(x) + "'");	}	/**	 * Sets the designated parameter to the given Java double value. The driver	 * converts this to an SQL DOUBLE value when it sends it to the database.	 *	 * @param parameterIndex the first parameter is 1, the second is 2, ...	 * @param x the parameter value	 * @throws SQLException if a database access error occurs	 */	public void setDouble(int parameterIndex, double x) throws SQLException {		setValue(parameterIndex, "" + x);	}	/**	 * Sets the designated parameter to the given Java float value. The driver	 * converts this to an SQL FLOAT value when it sends it to the database.	 *	 * @param parameterIndex the first parameter is 1, the second is 2, ...	 * @param x the parameter value	 * @throws SQLException if a database access error occurs	 */	public void setFloat(int parameterIndex, float x) throws SQLException {

⌨️ 快捷键说明

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