db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <Richard.Hille...@Sun.COM>
Subject Re: Getting the LangaugeConnectionContext
Date Mon, 21 Jan 2008 14:12:09 GMT
Jazarine Jamal wrote:
> Really thanks for the reply...
>
>
>
> Is it possible to get the LCC at some later point of execution : in 
> the JDBCDisplayUtil?
>
> I have got the Connection object in the function that i need. I want 
> to if its possible to get the activation object related to the current 
> connection.
>
> By the way, why is that getCurrentLCC() throws an error when used in 
> JDBCDisplayUtil but not when it is used in classes such as 
> ConsistencyChecker, etc..?
Hi Jazarine,

The LanguageConnectionContext is the root of the SQL interpreter's state 
variable for a session. That is, the LCC is used to cache all sorts of 
information needed to parse, optimize, and execute queries. The LCC is a 
structure which only exists in the Derby engine layer, that is, it is 
only visible to code that is running on the server side of a JDBC 
connection.

JDBCDisplayUtil is tools code which runs outside the engine on the 
client side of a JDBC connection. JDBCDisplayUtil can run across the 
network in a remote client. In that remote layer, the LCC does not 
exist.  In contrast, ConsistencyChecker runs inside the engine.

Hope this helps,
-Rick
>
>
>
> On Jan 20, 2008 6:07 PM, Thomas Nielsen < Thomas.Nielsen@sun.com 
> <mailto:Thomas.Nielsen@sun.com>> wrote:
>
>     Hi Jazarine,
>
>     I'm assuming you need to get the LCC once you are in the execute
>     phase,
>     and in a class implementing ResultSet. All the different ResultSet
>     implementations in org.apache.derby.impl.sql.execute get an
>     activation
>     supplied to their constructor either directly, or through its
>     source/child ResultSet. It should hence be available either:
>     - as a member of the given ResultSet class
>     - though the ResultSets source/child ResultSet
>     - through getLanguageConnectionContext()
>     - or through getActivation().getLanguageConnectionContext()
>     depending on the ResultSet class implementation you are in.
>
>     It could be beneficial to have a look around
>     ProjectRestrictNodeResultSet, the top-most ResultSet for a SELECT qry,
>     and see how it's fetched/used?
>
>     Activations are created/built with an ActivationClassBuilder and is
>     populated during the bytecode generation phase. You can see one
>     example
>     of how the ActivationClassBuilder is used in
>     ProjectRestrictNode.generateMinion() in
>     org.apache.derby.impl.sql.compile. ProjectRestrictNode is the node
>     generating the ProjectRestrictNodeResultSet (and a few others for the
>     sake of correctness).
>     Generally we push objects to the stack, then call to
>     ActivationClassBuilder to push generation of the correct type of
>     ResultSet on the stack. This is where the actual Activation object is
>     created, and as previously stated it's often pushed as a parameter to
>     the ResultSet constructor. Once code generation is completed, we start
>     executing the generated bytecode. Someone with a little more
>     knowledge
>     of the details may want to explain this further, or correct me, if
>     necessary? :)
>
>     Hope this helps you figure it out :)
>
>     Thomas
>
>     Jazarine Jamal wrote:
>     > I need to get the langaugeconnectioncontext.
>     > I presume it can be done through this:
>     >
>     >    
>     LangaugeConnectionContext=activation.getLangaugeConnectionContext()
>     >
>     >
>     >
>     > But How do I create an Activation object? Are there any implemented
>     > classes for Activation interface..??
>     > I am doing this since it forms a part of the code to get the type of
>     > an object.
>     >
>     >
>     > Please get me some help as soon as possible..
>
>


Mime
View raw message