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

📄 genericpreparedstatement.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
			SanityManager.ASSERT(ps == this, "ps != this");	}	/**	 * Is this dependent persistent?  A stored dependency will be required	 * if both the dependent and provider are persistent.	 *	 * @return boolean		Whether or not this dependent is persistent.	 */	public boolean isPersistent()	{		/* Non-stored prepared statements are not persistent */		return false;	}	//	// Dependable interface	//	/**				@return the stored form of this Dependable		@see Dependable#getDependableFinder	 */	public DependableFinder getDependableFinder()	{	    return null;	}	/**	 * Return the name of this Dependable.  (Useful for errors.)	 *	 * @return String	The name of this Dependable..	 */	public String getObjectName()	{		return UUIDString;	}	/**	 * Get the Dependable's UUID String.	 *	 * @return String	The Dependable's UUID String.	 */	public UUID getObjectID()	{		return UUIDValue;	}	/**	 * Get the Dependable's class type.	 *	 * @return String		Classname that this Dependable belongs to.	 */	public String getClassType()	{		return Dependable.PREPARED_STATEMENT;	}	/**	 * Return true if the query node for this statement references SESSION schema	 * tables/views.	 * This method gets called at the very beginning of the compile phase of any statement.	 * If the statement which needs to be compiled is already found in cache, then there is	 * no need to compile it again except the case when the statement is referencing SESSION	 * schema objects. There is a small window where such a statement might get cached 	 * temporarily (a statement referencing SESSION schema object will be removed from the	 * cache after the bind phase is over because that is when we know for sure that the 	 * statement is referencing SESSION schema objects.)	 *	 * @return	true if references SESSION schema tables, else false	 */	public boolean referencesSessionSchema()	{		return referencesSessionSchema;	}		/**	 * Return true if the QueryTreeNode references SESSION schema tables/views.	 * The return value is also saved in the local field because it will be 	 * used by referencesSessionSchema() method. 	 * This method gets called when the statement is not found in cache and 	 * hence it is getting compiled.	 * At the beginning of compilation for any statement, first we check if	 * the statement's plan already exist in the cache. If not, then we add	 * the statement to the cache and continue with the parsing and binding.	 * At the end of the binding, this method gets called to see if the 	 * QueryTreeNode references a SESSION schema object. If it does, then	 * we want to remove it from the cache, since any statements referencing	 * SESSION schema objects should never get cached.  	 *	 * @return	true if references SESSION schema tables/views, else false	 */	public boolean referencesSessionSchema(QueryTreeNode qt)	throws StandardException {		//If the query references a SESSION schema table (temporary or permanent), then		// mark so in this statement		referencesSessionSchema = qt.referencesSessionSchema();		return(referencesSessionSchema);	}	//	// class interface	//	/**		Makes the prepared statement valid, assigning		values for its query tree, generated class,		and associated information.		@param qt the query tree for this statement		@param dtd	The DataTypeDescriptors for the parameters, if any		@param ac the generated class for this statement		@exception StandardException thrown on failure.	 */	void completeCompile(QueryTreeNode qt)						throws StandardException {		//if (finished)		//	throw StandardException.newException(SQLState.LANG_STATEMENT_CLOSED, "completeCompile()");		paramTypeDescriptors = qt.getParameterTypes();		// erase cursor info in case statement text changed		if (targetTable!=null) {			targetTable = null;			updateMode = 0;			updateColumns = null;			targetColumns = null;		}		// get the result description (null for non-cursor statements)		// would we want to reuse an old resultDesc?		// or do we need to always replace in case this was select *?		resultDesc = qt.makeResultDescription();		// would look at resultDesc.getStatementType() but it		// doesn't call out cursors as such, so we check		// the root node type instead.		if (resultDesc != null)		{			/*				For cursors, we carry around some extra information.			 */			CursorInfo cursorInfo = (CursorInfo)qt.getCursorInfo();			if (cursorInfo != null)			{				targetTable = cursorInfo.targetTable;				targetColumns = cursorInfo.targetColumns;				updateColumns = cursorInfo.updateColumns;				updateMode = cursorInfo.updateMode;			}		}		isValid = true;		return;	}	public GeneratedClass getActivationClass()		throws StandardException	{		return activationClass;	}	void setActivationClass(GeneratedClass ac)	{		activationClass = ac;	}	//	// ExecPreparedStatement	//	/**	 * the update mode of the cursor	 *	 * @return	The update mode of the cursor	 */	public int	getUpdateMode() {		return updateMode;	}	/**	 * the target table of the cursor	 *	 * @return	target table of the cursor	 */	public ExecCursorTableReference getTargetTable() 	{		if (SanityManager.DEBUG)		{			SanityManager.ASSERT(targetTable!=null, "Not a cursor, no target table");		}		return targetTable;	}	/**	 * the target columns of the cursor as a result column list	 *	 * @return	target columns of the cursor as a result column list	 */	public ResultColumnDescriptor[]	getTargetColumns() {		return targetColumns;	}	/**	 * the update columns of the cursor as a update column list	 *	 * @return	update columns of the cursor as a array of strings	 */	public String[]	getUpdateColumns() 	{		return updateColumns;	}	/**	 * Return the cursor info in a single chunk.  Used	 * by StrorablePreparedStatement	 */	public Object getCursorInfo()	{		return new CursorInfo(			updateMode,			targetTable, 			targetColumns,			updateColumns);	}	void setCursorInfo(CursorInfo cursorInfo)	{		if (cursorInfo != null)		{			updateMode = cursorInfo.updateMode;			targetTable = cursorInfo.targetTable;			targetColumns = cursorInfo.targetColumns;			updateColumns = cursorInfo.updateColumns;		}	}	//	// class implementation	//	/**	 * Get the byte code saver for this statement.	 * Overridden for StorablePreparedStatement.  We	 * don't want to save anything	 *	 * @return a byte code saver (null for us)	 */	ByteArray getByteCodeSaver()	{		return null;	}	/**	 * Set parameters to be associated with this	 * statement.  Used to process EXECUTE STATMENT <name>	 * USING <resultSet> statements -- the <resultSet>	 * is evaluated and a parameter list is generated.	 * That list is saved using this call.  Parameters	 * are set in the activation when it is created	 * (see getActivation). 	 * 	 * @param params the parameters	 */	protected void setParams(ParameterValueSet params)	{		this.params = params;	}	/**	 * Does this statement need a savepoint?  	 * 	 * @return true if this statement needs a savepoint.	 */	public boolean needsSavepoint()	{		return needsSavepoint;	}	/**	 * Set the stmts 'needsSavepoint' state.  Used	 * by an SPS to convey whether the underlying stmt	 * needs a savepoint or not.	 * 	 * @param needsSavepoint true if this statement needs a savepoint.	 */	void setNeedsSavepoint(boolean needsSavepoint)	{	 	this.needsSavepoint = needsSavepoint;	}	/**	 * Set the stmts 'isAtomic' state.  	 * 	 * @param isAtomic true if this statement must be atomic	 * (i.e. it is not ok to do a commit/rollback in the middle)	 */	void setIsAtomic(boolean isAtomic)	{	 	this.isAtomic = isAtomic;	}	/**	 * Returns whether or not this Statement requires should	 * behave atomically -- i.e. whether a user is permitted	 * to do a commit/rollback during the execution of this	 * statement.	 *	 * @return boolean	Whether or not this Statement is atomic	 */	public boolean isAtomic()	{		return isAtomic;	}	/**	 * Set the name of the statement and schema for an "execute statement"	 * command.	 */	void setExecuteStatementNameAndSchema(String execStmtName,												 String execSchemaName)	{		this.execStmtName = execStmtName;		this.execSchemaName = execSchemaName;	}	/**	 * Get a new prepared statement that is a shallow copy	 * of the current one.	 *	 * @return a new prepared statement	 * 	 * @exception StandardException on error	 */	public ExecPreparedStatement getClone() throws StandardException	{		GenericPreparedStatement clone = new GenericPreparedStatement(statement);		clone.activationClass = getActivationClass();		clone.resultDesc = resultDesc;		clone.paramTypeDescriptors = paramTypeDescriptors;		clone.executionConstants = executionConstants;		clone.UUIDString = UUIDString;		clone.UUIDValue = UUIDValue;		clone.savedObjects = savedObjects;		clone.execStmtName = execStmtName;		clone.execSchemaName = execSchemaName;		clone.isAtomic = isAtomic;		clone.sourceTxt = sourceTxt;		clone.targetTable = targetTable;		clone.targetColumns = targetColumns;		clone.updateColumns = updateColumns;		clone.updateMode = updateMode;			clone.params = params;		clone.needsSavepoint = needsSavepoint;		return clone;	}	// cache holder stuff.	public void setCacheHolder(Cacheable cacheHolder) {		this.cacheHolder = cacheHolder;		if (cacheHolder == null) {			// need to invalidate the statement			if (!isValid || (inUseCount != 0))				return;			ContextManager cm = ContextService.getFactory().getCurrentContextManager();			LanguageConnectionContext lcc = 				(LanguageConnectionContext) 				(cm.getContext(LanguageConnectionContext.CONTEXT_ID));			// invalidate any prepared statements that			// depended on this statement (including this one)			// prepareToInvalidate(this, DependencyManager.PREPARED_STATEMENT_INVALID);			try			{				/* NOTE: Since we are non-persistent, we "know" that no exception				 * will be thrown under us.				 */				makeInvalid(DependencyManager.PREPARED_STATEMENT_RELEASE, lcc);			}			catch (StandardException se)			{				if (SanityManager.DEBUG)				{					se.printStackTrace(System.out);					SanityManager.THROWASSERT(						"Unexpected exception - " + se);				}			}		}	}	public String toString() {		return getObjectName();	}	public boolean isStorable() {		return false;	}}

⌨️ 快捷键说明

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