Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated #39: Use stateless flag from toolkit.ini it is present to override value in $_options array #173

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion ToolkitApi/Toolkit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -176,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('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
Expand Down Expand Up @@ -1857,6 +1862,8 @@ public function getInternalKey()
}

/**
* See if stateless mode has been turned on. Affects both CW and not-CW.
*
* @return bool|void
*/
public function isStateless()
Expand Down
7 changes: 6 additions & 1 deletion ToolkitApi/toolkit.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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)
; CW stateless flag, true for compatibility
; stateless mode is default for i5_connect (though automatically overridden if private conns are used)
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 = false

[transport]
; transport type allows configuration of transport from this INI.
Expand Down