Author: shawkins
Date: 2010-10-12 14:04:46 -0400 (Tue, 12 Oct 2010)
New Revision: 2643
Modified:
branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
branches/7.1.x/engine/src/main/java/org/teiid/query/function/FunctionMethods.java
Log:
TEIID-950 merging ENV function changes.
Modified:
branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
===================================================================
---
branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2010-10-12
16:39:25 UTC (rev 2642)
+++
branches/7.1.x/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2010-10-12
18:04:46 UTC (rev 2643)
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
<chapter id="scalar_functions">
<title>Scalar Functions</title>
<para>
@@ -1862,9 +1865,10 @@
<para><code>ENV(key)</code></para>
</entry>
<entry>
- <para>Retrieve an environment property. The only key
- currently allowed is ‘sessionid’, although this will expand
- in the future.</para>
+ <para>Retrieve a system environment property. The only key specific
to the current session is ‘sessionid’.
+ However the preferred mechanism for getting the session id is with the
session_id() function.
+ To prevent untrusted access to system properties, the use of this
function must be specifically enabled in the &jboss-beans; file.
+ </para>
</entry>
<entry>
<para>key in {string}, return is string</para>
@@ -1872,6 +1876,17 @@
</row>
<row>
<entry>
+ <para><code>SESSION_ID()</code></para>
+ </entry>
+ <entry>
+ <para>Retrieve the string form of the current session
id.</para>
+ </entry>
+ <entry>
+ <para>return is string</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
<para><code>USER()</code></para>
</entry>
<entry>
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/query/function/FunctionMethods.java
===================================================================
---
branches/7.1.x/engine/src/main/java/org/teiid/query/function/FunctionMethods.java 2010-10-12
16:39:25 UTC (rev 2642)
+++
branches/7.1.x/engine/src/main/java/org/teiid/query/function/FunctionMethods.java 2010-10-12
18:04:46 UTC (rev 2643)
@@ -56,7 +56,6 @@
import org.teiid.language.SQLConstants.NonReserved;
import org.teiid.query.QueryPlugin;
import org.teiid.query.util.CommandContext;
-import org.teiid.query.util.ContextProperties;
/**
* Static method hooks for most of the function library.
@@ -1242,11 +1241,7 @@
}
public static Object session_id(CommandContext context) {
- Properties envProps = context.getEnvironmentProperties();
- if(envProps != null &&
envProps.containsKey(ContextProperties.SESSION_ID)) {
- return envProps.getProperty(ContextProperties.SESSION_ID);
- }
- return null;
+ return context.getConnectionID();
}
// ================= Function - MODIFYTIMEZONE ========================
Show replies by date