<html>
<head>
    <base href="https://docs.jboss.org/author">
            <link rel="stylesheet" href="/author/s/en/2172/19/5/_/styles/combined.css?spaceKey=TEIID&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://docs.jboss.org/author/display/TEIID/System+Functions">System Functions</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://docs.jboss.org/author/display/~shawkins">Steven Hawkins</a>
    </h4>
        <div id="versionComment">
        <b>Comment:</b>
        adding session variable docs<br />
    </div>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>return value is string. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;"> <br>h1. TEIID\_SESSION_GET <br>Retrieve the session variable. <br> <br>TEIID\_SESSION_GET\(name) <br> <br>name is a string and the return value is an object.   <br> <br>A null name will return a null value.  Typically you will use the a get wrapped in a CAST to convert to the desired type. <br> <br>h1. TEIID\_SESSION_SET <br>Set the session variable. <br> <br>TEIID\_SESSION_SET\(name, value) <br> <br>name is a string, value is an object, and the return value is an object.  <br> <br>The previous value for the key or null will be returned.  A set has no effect on the current transaction and is not affected by commit/rollback. <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>System functions provide access to information in the Teiid system from within a query. </p>


<h1><a name="SystemFunctions-COMMANDPAYLOAD"></a>COMMANDPAYLOAD</h1>
<p>Retrieve a string from the command payload or null if no command payload was specified. The command payload is set by the <tt>TeiidStatement.setPayload</tt> method on the Teiid JDBC API extensions on a per&#45;query basis.</p>

<p>COMMANDPAYLOAD&#40;[key])</p>

<p>If the key parameter is provided, the command payload object is cast to a java.util.Properties object and the corresponding property value for the key is returned.  If the key is not specified the return value is the command payload object toString value.</p>

<p>key, return value are strings</p>


<h1><a name="SystemFunctions-ENV"></a>ENV</h1>
<p>Retrieve a system environment property.</p>

<p>ENV&#40;key)</p>

<p>To prevent untrusted access to system properties, this function is not enabled by default.  The ENV function may be enabled via the allowEnvFunction property in the  file.</p>

<p>key, return value are strings</p>


<h1><a name="SystemFunctions-SESSION%5CID"></a>SESSION&#95;ID</h1>
<p>Retrieve the string form of the current session id.</p>

<p>SESSION&#95;ID&#40;)</p>

<p>return value is string.</p>


<h1><a name="SystemFunctions-USER"></a>USER</h1>
<p>Retrieve the name of the user executing the query.</p>

<p>USER&#40;)</p>

<p>return value is string.</p>


<h1><a name="SystemFunctions-CURRENT%5CDATABASE"></a>CURRENT&#95;DATABASE</h1>
<p>Retrieve the catalog name of the database. The VDB name is always the catalog name.</p>

<p>CURRENT&#95;DATABASE&#40;)</p>

<p>return value is string.</p>

<h1><a name="SystemFunctions-TEIID%5CSESSIONGET"></a>TEIID&#95;SESSION_GET</h1>
<p>Retrieve the session variable.</p>

<p>TEIID&#95;SESSION_GET&#40;name)</p>

<p>name is a string and the return value is an object.  </p>

<p>A null name will return a null value.  Typically you will use the a get wrapped in a CAST to convert to the desired type.</p>

<h1><a name="SystemFunctions-TEIID%5CSESSIONSET"></a>TEIID&#95;SESSION_SET</h1>
<p>Set the session variable.</p>

<p>TEIID&#95;SESSION_SET&#40;name, value)</p>

<p>name is a string, value is an object, and the return value is an object. </p>

<p>The previous value for the key or null will be returned.  A set has no effect on the current transaction and is not affected by commit/rollback.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://docs.jboss.org/author/users/removespacenotification.action?spaceKey=TEIID">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://docs.jboss.org/author/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
        <a href="https://docs.jboss.org/author/display/TEIID/System+Functions">View Online</a>
        |
        <a href="https://docs.jboss.org/author/pages/diffpagesbyversion.action?pageId=18646258&revisedVersion=3&originalVersion=2">View Changes</a>
                |
        <a href="https://docs.jboss.org/author/display/TEIID/System+Functions?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>