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

📄 spsdescriptor.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
			** Clear out all the dependencies that exist			** before we recreate them so we don't grow			** SYS.SYSDEPENDS forever.			*/			dm.clearDependencies(lcc, this);			/*			** Copy over all the dependencies to me			*/			dm.copyDependencies(preparedStatement, 	// from											this, 	// to											false,	// persistent only											cm);		}		// mark it as valid		valid = true;	}	/**	 * Gets the name of the sps.	 *	 * @return	A String containing the name of the statement.	 */	public final String	getName()	{		return name;	}	/**	 * Gets the full, qualified name of the statement.	 *	 * @return	A String containing the name of the statement.	 */	public final String	getQualifiedName()	{		return sd.getSchemaName() + "." + name;	}	/**	 * Gets the SchemaDescriptor for this SPS Descriptor.	 *	 * @return SchemaDescriptor	The SchemaDescriptor.	 */	public final SchemaDescriptor getSchemaDescriptor()	{		return sd;	}	/**	 * Gets an identifier telling what type of table this is.	 * Types match final ints in this interface.  Currently	 * returns SPS_TYPE_REGULAR or SPS_TYPE_TRIGGER.	 *	 * @return	An identifier telling what type of statement 	 * we are.	 */	public final char getType()	{		return type;	}		/**	 * Simple little helper function to convert your type	 * to a string, which is easier to use.	 *	 * @return type as a string	 */		public final String getTypeAsString()	{		char[] charArray = new char[1];		charArray[0] = type;		return new String(charArray);	}	/**	 * Is the statement initially compilable?  	 *	 * @return	false if statement was created with the NOCOMPILE flag	 *			true otherwise	 */	public boolean initiallyCompilable() { return initiallyCompilable; }		/**	 * Validate the type. <B>NOTE</B>: Only SPS_TYPE_REGULAR	 * and SPS_TYPE_TRIGGER are currently valid.	 *	 * @param type the type	 *	 * @return true/false		 */	public final static boolean validType(char type)	{		return (type == SPSDescriptor.SPS_TYPE_REGULAR) || 				(type == SPSDescriptor.SPS_TYPE_TRIGGER);	}	/**	 * The time this prepared statement was compiled	 *	 * @return the time this class was last compiled	 */	public final synchronized Timestamp getCompileTime()	{		return compileTime;	}	/**	 * Set the compile time to now	 *	 */	public final synchronized void setCompileTime()	{		compileTime = new Timestamp(System.currentTimeMillis());	}	 	/**	 * Get the text used to create this statement.	 * Returns original text in a cleartext string.	 *	 * @return The text	 */	public final String getText()	{		return text;	}	/**	 * Get the text of the USING clause used on CREATE	 * or ALTER statement.	 *	 * @return The text	 */	public final synchronized String getUsingText()	{		return usingText;	}	/**	 * Set the text of the USING clause. Used by	 * ALTER statement.	 *	 * @param usingText	the new value for the USING text	 */	public final synchronized void setUsingText(String usingText)	{		this.usingText = usingText;	}	/**	 * Sets the UUID of the SPS.	 *	 * @param uuid	The UUID of the SPS to be set in the descriptor	 */	public final synchronized void setUUID(UUID uuid)	{		this.uuid = uuid;	}	/**	 * Gets the UUID of the SPS.	 *	 * @return	the uuid	 */	public final UUID	getUUID()	{		return uuid;	}		/**	 * Get the array of date type descriptors for	 * this statement.  Currently, we do a lookup	 * if we don't already have the parameters saved.	 * When SPSes are cached, the parameters should	 * be set up when the sps is constructed.	 *	 * @return the array of data type descriptors	 *	 * @exception StandardException on error	 */	public final synchronized DataTypeDescriptor[] getParams()		throws StandardException	{		if (params == null && !lookedUpParams)		{			Vector v = new Vector();			params = getDataDictionary().getSPSParams(this, v);			paramDefaults = new Object[v.size()];				Enumeration iterator = v.elements();			for (int i = 0; iterator.hasMoreElements(); i++)			{				paramDefaults[i] = iterator.nextElement();			}			lookedUpParams = true;		}		return params;	}	/**	 * Set the list of parameters for this statement	 *	 * @param params	the parameter list	 */	public final synchronized void setParams(DataTypeDescriptor params[])	{		this.params = params;	}	/**	 * Get the default parameter values for this 	 * statement.  Default parameter values are	 * supplied by a USING clause on either a	 * CREATE or ALTER STATEMENT statement.	 *	 * @return the default parameter values 	 *	 * @exception StandardException on error	 */	public final synchronized Object[] getParameterDefaults()		throws StandardException	{		if (paramDefaults == null)			getParams();		return paramDefaults;	}	/**	 * Set the parameter defaults for this statement.	 *	 * @param params	the parameter defaults	 */	public final synchronized void setParameterDefaults(Object[] values)	{		this.paramDefaults = values;	}		/**	 * Get the constant action for this statement	 *	 * @return the constant action	 */	//public final synchronized ConstantAction getConstantAction()	//{	//	return preparedStatement.getConstantAction();	//}		/**	 * Get the preparedStatement for this statement.	 * If stmt is invalid or hasn't been compiled yet,	 * it will be recompiled.	 *	 * @return the preparedStatement 	 *	 * @exception StandardException on error	 */	public final ExecPreparedStatement getPreparedStatement()		throws StandardException	{		return getPreparedStatement(true);	}	/**	 * Get the preparedStatement for this statement.	 * Expects the prepared statement to have already	 * been added to SYS.SYSSTATEMENTS.	 * <p>	 * Side Effects: will update SYS.SYSSTATEMENTS with	 * the new plan if it needs to be recompiled.	 *	 * @param recompIfInvalid if false, never recompile even	 *	if statement is invalid	 *	 * @return the preparedStatement 	 *	 * @exception StandardException on error	 */	public final synchronized ExecPreparedStatement getPreparedStatement(boolean recompIfInvalid)		throws StandardException	{		//System.out.println("preparedStatement = " + preparedStatement);		/*		** Recompile if we are invalid, we don't have		** a prepared statement, or the statements activation		** has been cleared and cannot be reconstituted.		*/		if (recompIfInvalid &&			(!valid ||			 (preparedStatement == null)))		{			ContextManager cm = ContextService.getFactory().getCurrentContextManager();			/*			** Find the language connection context.  Get			** it each time in case a connection is dropped.			*/			LanguageConnectionContext lcc = (LanguageConnectionContext)					cm.getContext(LanguageConnectionContext.CONTEXT_ID);			prepareAndRelease(lcc);			if (!((org.apache.derby.impl.sql.catalog.DataDictionaryImpl) (lcc.getDataDictionary())).readOnlyUpgrade) {				//bug 4821 - First try compiling on a nested transaction so we can release				//the locks after the compilation. But if we get lock time out on the				//nested transaction, then go ahead and do the compilation on the user				//transaction. When doing the compilation on user transaction, the locks				//acquired for recompilation will be released at the end of the user transaction.				TransactionController nestedTC;				try				{					nestedTC = lcc.getTransactionCompile().startNestedUserTransaction(false);				}				catch (StandardException se)				{					// If I cannot start a Nested User Transaction use the parent					// transaction to do all the work.					nestedTC = null;				}				try				{					updateSYSSTATEMENTS(lcc, RECOMPILE, nestedTC);				}				catch (StandardException se)				{					if (se.getMessageId().equals(SQLState.LOCK_TIMEOUT))					{						if (nestedTC != null)						{						nestedTC.commit();						nestedTC.destroy();						nestedTC = null;						}						// if we couldn't do this with a nested xaction, retry with						// parent-- we need to wait this time!						updateSYSSTATEMENTS(lcc, RECOMPILE, null);					}					else throw se;				}				finally				{					// no matter what, commit the nested transaction; if something					// bad happened in the child xaction lets not abort the parent					// here.					if (nestedTC != null)					{						nestedTC.commit();						nestedTC.destroy();					}				} 			}		}		return preparedStatement;	}	/**	 * Get the compilation type schema id when this view	 * was first bound.	 *	 * @return the schema UUID	 */	public final UUID getCompSchemaId()	{		return compSchemaId;	}	/**	 * Prints the contents of the TableDescriptor	 *	 * @return The contents as a String	 */	public final String toString()	{		if (SanityManager.DEBUG)		{			return "SPSDescriptor:\n"+				"\tname: "+sd.getSchemaName()+"."+name+"\n"+				"\tuuid: "+uuid+"\n"+				"\ttext: "+text+"\n"+				"\tvalid: "+((valid) ? "TRUE" : "FALSE")+"\n" +				"\tpreparedStatement: "+preparedStatement+"\n";		}		else		{			return "";

⌨️ 快捷键说明

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