.
This commit is contained in:
Paula V. Quispe
2016-11-09 17:15:18 -05:00
parent e72b256c4b
commit 0a781ed07e
4 changed files with 47 additions and 0 deletions

View File

@@ -165,6 +165,9 @@ class pmDynaform
public function jsonr(&$json)
{
$sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined";
$aContext = \Bootstrap::getDefaultContextLog();
if (empty($json)) {
return;
}
@@ -238,6 +241,10 @@ class pmDynaform
$stmt = $cnn->createStatement();
$sql = G::replaceDataField($json->sql, $this->getValuesDependentFields($json));
$rs = $stmt->executeQuery($sql, \ResultSet::FETCHMODE_NUM);
//Logger
$aContext['action'] = 'execute-sql';
$aContext['sql'] = $sql;
\Bootstrap::registerMonolog('sqlExecution', 200, 'Sql Execution', $aContext, $sysSys, 'processmaker.log');
while ($rs->next()) {
$row = $rs->getRow();
$option = new stdClass();
@@ -246,6 +253,10 @@ class pmDynaform
$json->optionsSql[] = $option;
}
} catch (Exception $e) {
//Logger
$aContext['action'] = 'execute-sql';
$aContext['exception'] = (array)$e;
\Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', $aContext, $sysSys, 'processmaker.log');
}
}

View File

@@ -240,6 +240,8 @@ function literalDate ($date, $lang = 'en')
*/
function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter = array())
{
$sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined";
$aContext = \Bootstrap::getDefaultContextLog();
$con = Propel::getConnection( $DBConnectionUID );
$con->begin();
G::loadClass('system');
@@ -342,9 +344,18 @@ function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter
$result = executeQueryOci($SqlStatement, $con, $aParameter);
}
}
//Logger
$aContext['action'] = 'execute-query';
$aContext['sql'] = $SqlStatement;
\Bootstrap::registerMonolog('sqlExecution', 200, 'Sql Execution', $aContext, $sysSys, 'processmaker.log');
return $result;
} catch (SQLException $sqle) {
//Logger
$aContext['action'] = 'execute-query';
$aContext['exception'] = (array)$sqle;
\Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', $aContext, $sysSys, 'processmaker.log');
if (isset($sqle->xdebug_message)) {
error_log(print_r($sqle->xdebug_message, true));
} else {

View File

@@ -711,6 +711,8 @@ class Variable
{
try {
$arrayRecord = array();
$sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined";
$aContext = \Bootstrap::getDefaultContextLog();
//Verify data
$process = new \ProcessMaker\BusinessModel\Process();
@@ -791,6 +793,10 @@ class Variable
);
$rs = $stmt->executeQuery($replaceFields, \ResultSet::FETCHMODE_NUM);
//Logger
$aContext['action'] = 'execute-sql-suggest';
$aContext['sql'] = $replaceFields;
\Bootstrap::registerMonolog('sqlExecution', 200, 'Sql Execution', $aContext, $sysSys, 'processmaker.log');
while ($rs->next()) {
$row = $rs->getRow();
@@ -805,6 +811,10 @@ class Variable
//Return
return $arrayRecord;
} catch (\Exception $e) {
//Logger
$aContext['action'] = 'execute-sql-suggest';
$aContext['exception'] = (array)$e;
\Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', $aContext, $sysSys, 'processmaker.log');
throw $e;
}
}