trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbirds...@apache.org
Subject [1/3] incubator-trafodion git commit: trafodion-1743 add connection session
Date Wed, 17 Aug 2016 18:35:06 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 0a31bbb9a -> d9e8233c8


trafodion-1743 add connection session


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/b25f9437
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/b25f9437
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/b25f9437

Branch: refs/heads/master
Commit: b25f9437e3beb356959eaa000f1bab13c0b4a0f5
Parents: f4d9910
Author: mashengchen <mashengchen@gmail.com>
Authored: Mon Aug 1 07:19:14 2016 +0000
Committer: mashengchen <mashengchen@gmail.com>
Committed: Mon Aug 1 07:19:14 2016 +0000

----------------------------------------------------------------------
 core/conn/jdbc_type2/native/CoreCommon.h        |  2 ++
 core/conn/jdbc_type2/native/SQLMXConnection.cpp | 14 ++++++++++++++
 core/conn/jdbc_type2/native/SrvrOthers.cpp      |  9 +++++++++
 3 files changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b25f9437/core/conn/jdbc_type2/native/CoreCommon.h
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type2/native/CoreCommon.h b/core/conn/jdbc_type2/native/CoreCommon.h
index 92fc1c8..c131173 100644
--- a/core/conn/jdbc_type2/native/CoreCommon.h
+++ b/core/conn/jdbc_type2/native/CoreCommon.h
@@ -440,6 +440,8 @@ typedef struct _SRVR_GLOBAL_Def
 #define CLEAR_SCHEMA                1013
 #define CQD_DOOM_USER_TXN           1014
 #define CQD_PCODE_OFF               1015
+#define BEGIN_SESSION               1016
+#define END_SESSION                 1017
 
 typedef struct tagDATE_TYPE
 {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b25f9437/core/conn/jdbc_type2/native/SQLMXConnection.cpp
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type2/native/SQLMXConnection.cpp b/core/conn/jdbc_type2/native/SQLMXConnection.cpp
index b25d940..e554715 100644
--- a/core/conn/jdbc_type2/native/SQLMXConnection.cpp
+++ b/core/conn/jdbc_type2/native/SQLMXConnection.cpp
@@ -591,6 +591,20 @@ JNIEXPORT void JNICALL Java_org_trafodion_jdbc_t2_SQLMXConnection_connectInit
 
     }
 
+    odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL,
+                 &setConnectException,
+                 dialogueId,
+                 BEGIN_SESSION,
+                 0,
+                 NULL,
+                 &sqlWarning);
+    if (setConnectException.exception_nr != CEE_SUCCESS)
+    {
+        throwSetConnectionException(jenv, &setConnectException);
+        FUNCTION_RETURN_VOID(("BEGIN_SESSION - setConnectException.exception_nr(%s) is not
CEE_SUCCESS",
+                        CliDebugSqlError(setConnectException.exception_nr)));
+    }
+
     if(blnDoomUsrTxn)
     {
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b25f9437/core/conn/jdbc_type2/native/SrvrOthers.cpp
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type2/native/SrvrOthers.cpp b/core/conn/jdbc_type2/native/SrvrOthers.cpp
index 16fa01e..08d8a7c 100644
--- a/core/conn/jdbc_type2/native/SrvrOthers.cpp
+++ b/core/conn/jdbc_type2/native/SrvrOthers.cpp
@@ -1125,6 +1125,15 @@ odbc_SQLSvc_SetConnectionOption_sme_(
         }
         strcat(sqlString, schemaValueStr);
         break;
+    case BEGIN_SESSION:
+        if(optionValueStr != NULL && strlen(optionValueStr) > 0)
+            sprintf(sqlString,"SET SESSION DEFAULT SQL_SESSION 'BEGIN:%0.200s';",optionValueStr);
+        else
+            strcpy(sqlString, "SET SESSION DEFAULT SQL_SESSION 'BEGIN';");
+        break;
+    case END_SESSION:
+        strcpy(sqlString, "SET SESSION DEFAULT SQL_SESSION 'END'");
+        break;
     case RESET_DEFAULTS:
         strcpy(sqlString, "CONTROL QUERY DEFAULT * RESET");
         break;


Mime
View raw message