From d37e86b5b1b455d6ab3ffbc2c8dddc32a7f31e04 Mon Sep 17 00:00:00 2001 From: Scott Campbell Date: Sun, 15 Feb 2015 17:20:01 -0700 Subject: [PATCH 1/5] Rebasing: Use stateless flag from toolkit.ini it is present to override value in $_options array. Add to constructor by adding to the array in getOptionalParams. Change default stateless flag to flase in the toolkit.ini to match existing functionality Add second stateless flag for XML toolkit. Check if call is being made from compatibility wrapper and use appropriate stateless flag. --- ToolkitApi/toolkit.ini | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ToolkitApi/toolkit.ini b/ToolkitApi/toolkit.ini index 0a4492b..ae51cf0 100644 --- a/ToolkitApi/toolkit.ini +++ b/ToolkitApi/toolkit.ini @@ -59,8 +59,13 @@ dataStructureIntegrity = true ; For backward compatibility with pre-1.4.0, set to false. arrayIntegrity = true -; CW only: stateless mode is default for i5_connect (though automatically overridden if private conns are used) -stateless = true +; CW stateless flag +; stateless mode is default for i5_connect (though automatically overridden if private conns are used) +stateless = false +; Non-CW Stateless flag - default to true +; This should be overridden if you require stateful connections +; Set the default value of 'stateless' to true, for the regular toolkit (not CW). +stateless_mode_default = true [transport] ; transport type allows configuration of transport from this INI. From 36c0386427a9d41f0883f150e067c6b68b4f1333 Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Fri, 12 Nov 2021 16:05:36 -0400 Subject: [PATCH 2/5] Rebasing and re-applying changes (Calvin edit: Don't add "stateless", fixed this while resolving rebase conflict) --- ToolkitApi/Toolkit.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ToolkitApi/Toolkit.php b/ToolkitApi/Toolkit.php index 64be405..79f4e75 100644 --- a/ToolkitApi/Toolkit.php +++ b/ToolkitApi/Toolkit.php @@ -86,6 +86,7 @@ class Toolkit implements ToolkitInterface 'sbmjobCommand' => '', // optional complete override of SBMJOB command when new toolkit job is submitted 'prestart' => false, 'stateless' => false, + 'stateless_mode_default' => true, // add new stateless flag for toolkit (non CW) 'performance' => false, // whether to enable performance collection (not fully implemented) 'idleTimeout' => '', // created for Compat. Wrapper (CW) 'cdata' => true, // whether to ask XMLSERVICE to wrap its output in CDATA to protect reserved XML characters @@ -181,7 +182,7 @@ public function __construct($databaseNameOrResource, $userOrI5NamingFlag = '0', } // Optional params. Don't specify if not given in INI. - $this->getOptionalParams('system', array('v5r4', 'ccsidBefore', 'ccsidAfter', 'useHex', 'paseCcsid', 'trace', 'dataStructureIntegrity', 'arrayIntegrity')); + $this->getOptionalParams('system', array('stateless_mode_default', 'v5r4', 'ccsidBefore', 'ccsidAfter', 'useHex', 'paseCcsid', 'trace', 'dataStructureIntegrity', 'arrayIntegrity')); $this->getOptionalParams('transport', array('httpTransportUrl', 'plugSize', 'xmlserviceCliPath')); // populate serviceParams with $transport, or get it from INI @@ -1861,7 +1862,12 @@ public function getInternalKey() */ public function isStateless() { - return $this->getOption('stateless'); + if ($this->getIsCw()){ + return $this->getOption('stateless'); + } + else{ + return $this->getOption('stateless_mode_default'); + } } /** From 7eb3ecbbeb05b2e0f89e48b481760cb38514de5e Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Fri, 12 Nov 2021 16:12:22 -0400 Subject: [PATCH 3/5] Revert back to original behaviour that would work And document it --- ToolkitApi/Toolkit.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ToolkitApi/Toolkit.php b/ToolkitApi/Toolkit.php index 79f4e75..0f566b2 100644 --- a/ToolkitApi/Toolkit.php +++ b/ToolkitApi/Toolkit.php @@ -1858,16 +1858,13 @@ public function getInternalKey() } /** + * See if stateless mode has been turned on. Affects both CW and not-CW. + * * @return bool|void */ public function isStateless() { - if ($this->getIsCw()){ - return $this->getOption('stateless'); - } - else{ - return $this->getOption('stateless_mode_default'); - } + return $this->getOption('stateless'); } /** From 67c7fc19469c57a04bdb9849fdf1282aec59c28a Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Fri, 12 Nov 2021 16:14:04 -0400 Subject: [PATCH 4/5] Flip this to match original semantics Otherwise would be breaking change for new installs --- ToolkitApi/toolkit.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ToolkitApi/toolkit.ini b/ToolkitApi/toolkit.ini index ae51cf0..983511a 100644 --- a/ToolkitApi/toolkit.ini +++ b/ToolkitApi/toolkit.ini @@ -59,13 +59,13 @@ dataStructureIntegrity = true ; For backward compatibility with pre-1.4.0, set to false. arrayIntegrity = true -; CW stateless flag +; CW stateless flag, true for compatibility ; stateless mode is default for i5_connect (though automatically overridden if private conns are used) -stateless = false -; Non-CW Stateless flag - default to true +stateless = true +; Non-CW Stateless flag - default to false to match original semantics ; This should be overridden if you require stateful connections ; Set the default value of 'stateless' to true, for the regular toolkit (not CW). -stateless_mode_default = true +stateless_mode_default = false [transport] ; transport type allows configuration of transport from this INI. From b5977d8a58cfd5b066e7bc50da2a55ca430196b1 Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Fri, 12 Nov 2021 16:31:30 -0400 Subject: [PATCH 5/5] The names are different, so special handling --- ToolkitApi/Toolkit.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ToolkitApi/Toolkit.php b/ToolkitApi/Toolkit.php index 0f566b2..2de5b4d 100644 --- a/ToolkitApi/Toolkit.php +++ b/ToolkitApi/Toolkit.php @@ -177,12 +177,16 @@ public function __construct($databaseNameOrResource, $userOrI5NamingFlag = '0', // set service parameters to use in object. $this->serviceParams = $this->getDefaultServiceParams(); + /* We don't add these in getOptionalParams because the names are different */ if ($this->getConfigValue('system', 'sbmjob_params')) { $this->serviceParams['sbmjobParams'] = $this->getConfigValue('system', 'sbmjob_params'); } + if ($this->getConfigValue('system', 'stateless_mode_default')) { + $this->serviceParams['stateless'] = $this->getConfigValue('system', 'stateless_mode_default'); + } // Optional params. Don't specify if not given in INI. - $this->getOptionalParams('system', array('stateless_mode_default', 'v5r4', 'ccsidBefore', 'ccsidAfter', 'useHex', 'paseCcsid', 'trace', 'dataStructureIntegrity', 'arrayIntegrity')); + $this->getOptionalParams('system', array('v5r4', 'ccsidBefore', 'ccsidAfter', 'useHex', 'paseCcsid', 'trace', 'dataStructureIntegrity', 'arrayIntegrity')); $this->getOptionalParams('transport', array('httpTransportUrl', 'plugSize', 'xmlserviceCliPath')); // populate serviceParams with $transport, or get it from INI