Skip to content

Commit 8620b34

Browse files
committed
adds parameter to tell adodb view operations if it's a materialized or regular view
1 parent cc9f6b7 commit 8620b34

File tree

10 files changed

+191
-199
lines changed

10 files changed

+191
-199
lines changed

.php_cs.cache

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/controllers/DisplayController.php

Lines changed: 90 additions & 90 deletions
Large diffs are not rendered by default.

src/controllers/FunctionsController.php

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function doDefault($msg = '')
107107
'function' => [
108108
'title' => $this->lang['strfunction'],
109109
'field' => Decorator::field('proproto'),
110-
'url' => \SUBFOLDER . "/redirect/function?action=properties&{$this->misc->href}&",
110+
'url' => \SUBFOLDER."/redirect/function?action=properties&{$this->misc->href}&",
111111
'vars' => ['function' => 'proproto', 'function_oid' => 'prooid'],
112112
],
113113
'returns' => [
@@ -413,10 +413,11 @@ private function _getNamedParamsArgs($data, $fndata)
413413
}
414414
if (isset($names_arr[$i]) && '' != $names_arr[$i]) {
415415
$data->fieldClean($names_arr[$i]);
416-
$args .= '"' . $names_arr[$i] . '" ';
416+
$args .= '"'.$names_arr[$i].'" ';
417417
}
418418
$args .= $args_arr[$i];
419419
}
420+
420421
return $args;
421422
}
422423

@@ -437,6 +438,7 @@ public function doEdit($msg = '')
437438

438439
if ($fndata->recordCount() <= 0) {
439440
echo "<p>{$this->lang['strnodata']}</p>\n";
441+
440442
return;
441443
}
442444
$fndata->fields['proretset'] = $data->phpBool($fndata->fields['proretset']);
@@ -471,7 +473,7 @@ public function doEdit($msg = '')
471473
$args = $fndata->fields['proarguments'];
472474
}
473475

474-
echo '<form action="' . \SUBFOLDER . "/src/views/functions\" method=\"post\">\n";
476+
echo '<form action="'.\SUBFOLDER."/src/views/functions\" method=\"post\">\n";
475477
echo "<table style=\"width: 90%\">\n";
476478
echo "<tr>\n";
477479
echo "<th class=\"data required\">{$this->lang['strschema']}</th>\n";
@@ -542,7 +544,7 @@ public function doEdit($msg = '')
542544
echo "<tr><th class=\"data required\" colspan=\"5\">{$this->lang['strdefinition']}</th></tr>\n";
543545
echo '<tr><td class="data1" colspan="5">';
544546
$textarea_id = ($fnlang === 'sql' || $fnlang === 'plpgsql') ? 'query' : 'formDefinition';
545-
echo '<textarea style="width:100%;" rows="20" cols="50" id="' . $textarea_id . '" name="formDefinition">';
547+
echo '<textarea style="width:100%;" rows="20" cols="50" id="'.$textarea_id.'" name="formDefinition">';
546548
echo htmlspecialchars($_POST['formDefinition']);
547549
echo "</textarea></td></tr>\n";
548550
}
@@ -557,8 +559,8 @@ public function doEdit($msg = '')
557559
// Display function cost options
558560
if ($data->hasFunctionCosting()) {
559561
echo "<tr><th class=\"data required\" colspan=\"5\">{$this->lang['strfunctioncosting']}</th></tr>\n";
560-
echo "<td class=\"data1\" colspan=\"2\">{$this->lang['strexecutioncost']}: <input name=\"formCost\" size=\"16\" value=\"" .
561-
htmlspecialchars($_POST['formCost']) . '" /></td>';
562+
echo "<td class=\"data1\" colspan=\"2\">{$this->lang['strexecutioncost']}: <input name=\"formCost\" size=\"16\" value=\"".
563+
htmlspecialchars($_POST['formCost']).'" /></td>';
562564
echo "<td class=\"data1\" colspan=\"2\">{$this->lang['strresultrows']}: <input name=\"formRows\" size=\"16\" value=\"",
563565
htmlspecialchars($_POST['formRows']), '"', (!$fndata->fields['proretset']) ? 'disabled' : '', '/></td>';
564566
}
@@ -630,7 +632,7 @@ public function doProperties($msg = '')
630632
}
631633

632634
$funcdata->fields['proretset'] = $data->phpBool($funcdata->fields['proretset']);
633-
$func_full = $funcdata->fields['proname'] . '(' . $funcdata->fields['proarguments'] . ')';
635+
$func_full = $funcdata->fields['proname'].'('.$funcdata->fields['proarguments'].')';
634636
echo "<table style=\"width: 90%\">\n";
635637
echo sprintf('<tr><th class="data">%s</th>%s', $this->lang['strfunction'], "\n");
636638
echo sprintf('<th class="data">%s</th>%s', $this->lang['strarguments'], "\n");
@@ -707,7 +709,7 @@ public function doDrop($confirm)
707709
$this->printTrail('schema');
708710
$this->printTitle($this->lang['strdrop'], 'pg.function.drop');
709711

710-
echo '<form action="' . \SUBFOLDER . "/src/views/functions\" method=\"post\">\n";
712+
echo '<form action="'.\SUBFOLDER."/src/views/functions\" method=\"post\">\n";
711713

712714
//If multi drop
713715
if (isset($_REQUEST['ma'])) {
@@ -831,16 +833,16 @@ public function doCreate($msg = '', $szJS = '')
831833
$szSelected = ' selected="selected"';
832834
}
833835
// this variable is include in the JS code bellow, so we need to ENT_QUOTES
834-
$szTypes .= '<option value="' . htmlspecialchars($types->fields['typname'], ENT_QUOTES) . "\"{$szSelected}>";
835-
$szTypes .= htmlspecialchars($types->fields['typname'], ENT_QUOTES) . '</option>';
836+
$szTypes .= '<option value="'.htmlspecialchars($types->fields['typname'], ENT_QUOTES)."\"{$szSelected}>";
837+
$szTypes .= htmlspecialchars($types->fields['typname'], ENT_QUOTES).'</option>';
836838
$types->moveNext();
837839
}
838840

839-
$szFunctionName = "<td class=\"data1\"><input name=\"formFunction\" size=\"16\" maxlength=\"{$data->_maxNameLen}\" value=\"" .
840-
htmlspecialchars($_POST['formFunction']) . '" /></td>';
841+
$szFunctionName = "<td class=\"data1\"><input name=\"formFunction\" size=\"16\" maxlength=\"{$data->_maxNameLen}\" value=\"".
842+
htmlspecialchars($_POST['formFunction']).'" /></td>';
841843

842-
$szArguments = '<td class="data1"><input name="formArguments" style="width:100%;" size="16" value="' .
843-
htmlspecialchars($_POST['formArguments']) . '" /></td>';
844+
$szArguments = '<td class="data1"><input name="formArguments" style="width:100%;" size="16" value="'.
845+
htmlspecialchars($_POST['formArguments']).'" /></td>';
844846

845847
$szSetOfSelected = '';
846848
$szNotSetOfSelected = '';
@@ -855,7 +857,7 @@ public function doCreate($msg = '', $szJS = '')
855857
$szReturns .= "<option value=\"SETOF\"{$szSetOfSelected}>SETOF</option>";
856858
$szReturns .= '</select>';
857859

858-
$szReturns .= '<select class="select2" name="formReturns">' . $szTypes . '</select>';
860+
$szReturns .= '<select class="select2" name="formReturns">'.$szTypes.'</select>';
859861

860862
// Create string array type selector
861863

@@ -875,7 +877,7 @@ public function doCreate($msg = '', $szJS = '')
875877
// Create string for language
876878
$szLanguage = '<td class="data1">';
877879
if ('c' == $fnlang || 'internal' == $fnlang) {
878-
$szLanguage .= $_POST['formLanguage'] . "\n";
880+
$szLanguage .= $_POST['formLanguage']."\n";
879881
$szLanguage .= "<input type=\"hidden\" name=\"formLanguage\" value=\"{$_POST['formLanguage']}\" />\n";
880882
} else {
881883
$szLanguage .= "<select name=\"formLanguage\">\n";
@@ -885,8 +887,8 @@ public function doCreate($msg = '', $szJS = '')
885887
$szSelected = ' selected="selected"';
886888
}
887889
if ('c' != strtolower($langs->fields['lanname']) && 'internal' != strtolower($langs->fields['lanname'])) {
888-
$szLanguage .= '<option value="' . htmlspecialchars($langs->fields['lanname']) . "\"{$szSelected}>\n" .
889-
$this->misc->printVal($langs->fields['lanname']) . '</option>';
890+
$szLanguage .= '<option value="'.htmlspecialchars($langs->fields['lanname'])."\"{$szSelected}>\n".
891+
$this->misc->printVal($langs->fields['lanname']).'</option>';
890892
}
891893

892894
$langs->moveNext();
@@ -908,9 +910,9 @@ public function doCreate($msg = '', $szJS = '')
908910
$szArgReturns .= '</select>';
909911
$subfolder = \SUBFOLDER;
910912
if (!empty($this->conf['theme'])) {
911-
$szImgPath = \SUBFOLDER . "/assets/images/themes/{$this->conf['theme']}";
913+
$szImgPath = \SUBFOLDER."/assets/images/themes/{$this->conf['theme']}";
912914
} else {
913-
$szImgPath = \SUBFOLDER . '/assets/images/themes/default';
915+
$szImgPath = \SUBFOLDER.'/assets/images/themes/default';
914916
}
915917
if (empty($msg)) {
916918
// $this->prtrace($subfolder);
@@ -923,7 +925,7 @@ public function doCreate($msg = '', $szJS = '')
923925
$szJSAddTR .= "<img src=\"{$szImgPath}/AddArguments.png\" alt=\"Add Argument\" /></td>";
924926
$szJSAddTR .= "<td class=\"data3\"><span style=\"font-size: 8pt\">{$this->lang['strargadd']}</span></td></tr></table></td>\n</tr>\n";
925927

926-
echo '<script src="' . \SUBFOLDER . "/assets/js/functions.js\" type=\"text/javascript\"></script>
928+
echo '<script src="'.\SUBFOLDER."/assets/js/functions.js\" type=\"text/javascript\"></script>
927929
<script type=\"text/javascript\">
928930
//<![CDATA[
929931
var g_types_select = '<select class=\"select2\" name=\"formArgType[]\">{$szTypes}</select>{$szArgReturns}';
@@ -940,7 +942,7 @@ public function doCreate($msg = '', $szJS = '')
940942
//]]>
941943
</script>
942944
";
943-
echo '<form action="' . \SUBFOLDER . "/src/views/functions\" method=\"post\">\n";
945+
echo '<form action="'.\SUBFOLDER."/src/views/functions\" method=\"post\">\n";
944946
echo "<table><tbody id=\"args_table\">\n";
945947
echo "<tr><th class=\"data required\">{$this->lang['strname']}</th>\n";
946948
echo "<th class=\"data required\" colspan=\"2\">{$this->lang['strreturns']}</th>\n";
@@ -985,10 +987,10 @@ public function doCreate($msg = '', $szJS = '')
985987
// Display function cost options
986988
if ($data->hasFunctionCosting()) {
987989
echo "<tr><th class=\"data required\" colspan=\"4\">{$this->lang['strfunctioncosting']}</th></tr>\n";
988-
echo "<td class=\"data1\" colspan=\"2\">{$this->lang['strexecutioncost']}: <input name=\"formCost\" size=\"16\" value=\"" .
989-
htmlspecialchars($_POST['formCost']) . '" /></td>';
990-
echo "<td class=\"data1\" colspan=\"2\">{$this->lang['strresultrows']}: <input name=\"formRows\" size=\"16\" value=\"" .
991-
htmlspecialchars($_POST['formRows']) . '" /></td>';
990+
echo "<td class=\"data1\" colspan=\"2\">{$this->lang['strexecutioncost']}: <input name=\"formCost\" size=\"16\" value=\"".
991+
htmlspecialchars($_POST['formCost']).'" /></td>';
992+
echo "<td class=\"data1\" colspan=\"2\">{$this->lang['strresultrows']}: <input name=\"formRows\" size=\"16\" value=\"".
993+
htmlspecialchars($_POST['formRows']).'" /></td>';
992994
}
993995

994996
// Display function properties
@@ -1037,14 +1039,14 @@ public function doSaveCreate()
10371039

10381040
$szJS = '';
10391041

1040-
echo '<script src="' . \SUBFOLDER . '/assets/js/functions.js" type="text/javascript"></script>';
1041-
echo '<script type="text/javascript">' . $this->_buildJSData() . '</script>';
1042+
echo '<script src="'.\SUBFOLDER.'/assets/js/functions.js" type="text/javascript"></script>';
1043+
echo '<script type="text/javascript">'.$this->_buildJSData().'</script>';
10421044
if (!empty($_POST['formArgName'])) {
10431045
$szJS = $this->_buildJSRows($this->_buildFunctionArguments($_POST));
10441046
} else {
10451047
$subfolder = \SUBFOLDER;
10461048
// $this->prtrace($subfolder);
1047-
$szJS = '<script type="text/javascript" src="' . \SUBFOLDER . '/assets/js/functions.js">noArgsRebuild(addArg("' . $subfolder . '"));</script>';
1049+
$szJS = '<script type="text/javascript" src="'.\SUBFOLDER.'/assets/js/functions.js">noArgsRebuild(addArg("'.$subfolder.'"));</script>';
10481050
}
10491051

10501052
$cost = (isset($_POST['formCost'])) ? $_POST['formCost'] : null;
@@ -1067,7 +1069,7 @@ public function doSaveCreate()
10671069
$status = $data->createFunction(
10681070
$_POST['formFunction'],
10691071
empty($_POST['nojs']) ? $this->_buildFunctionArguments($_POST) : $_POST['formArguments'],
1070-
$_POST['formReturns'] . $_POST['formArray'],
1072+
$_POST['formReturns'].$_POST['formArray'],
10711073
$def,
10721074
$_POST['formLanguage'],
10731075
$_POST['formProperties'],
@@ -1097,7 +1099,7 @@ private function _buildFunctionArguments($arrayVars)
10971099
if (isset($_POST['formArgName'])) {
10981100
$arrayArgs = [];
10991101
foreach ($arrayVars['formArgName'] as $pK => $pV) {
1100-
$arrayArgs[] = $arrayVars['formArgModes'][$pK] . ' ' . trim($pV) . ' ' . trim($arrayVars['formArgType'][$pK]) . $arrayVars['formArgArray'][$pK];
1102+
$arrayArgs[] = $arrayVars['formArgModes'][$pK].' '.trim($pV).' '.trim($arrayVars['formArgType'][$pK]).$arrayVars['formArgArray'][$pK];
11011103
}
11021104

11031105
return implode(',', $arrayArgs);
@@ -1155,18 +1157,18 @@ private function _buildJSData()
11551157
$arrayPModes = [];
11561158

11571159
while (!$arrayTypes->EOF) {
1158-
$arrayPTypes[] = "'" . $arrayTypes->fields['typname'] . "'";
1160+
$arrayPTypes[] = "'".$arrayTypes->fields['typname']."'";
11591161
$arrayTypes->moveNext();
11601162
}
11611163

11621164
foreach ($arrayModes as $pV) {
11631165
$arrayPModes[] = "'{$pV}'";
11641166
}
11651167

1166-
$szTypes = 'g_main_types = new Array(' . implode(',', $arrayPTypes) . ');';
1167-
$szModes = 'g_main_modes = new Array(' . implode(',', $arrayPModes) . ');';
1168+
$szTypes = 'g_main_types = new Array('.implode(',', $arrayPTypes).');';
1169+
$szModes = 'g_main_modes = new Array('.implode(',', $arrayPModes).');';
11681170

1169-
return $szTypes . $szModes;
1171+
return $szTypes.$szModes;
11701172
}
11711173

11721174
/**
@@ -1221,7 +1223,7 @@ private function _getPropertiesArgs($funcdata)
12211223
}
12221224
if (isset($names_arr[$i]) && '' != $names_arr[$i]) {
12231225
$data->fieldClean($names_arr[$i]);
1224-
$args .= '"' . $names_arr[$i] . '" ';
1226+
$args .= '"'.$names_arr[$i].'" ';
12251227
}
12261228
$args .= $args_arr[$i];
12271229
}

src/controllers/MaterializedviewpropertiesController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function doSaveEdit()
103103
{
104104
$data = $this->misc->getDatabaseAccessor();
105105

106-
$status = $data->setView($_POST[$this->subject], $_POST['formDefinition'], $_POST['formComment']);
106+
$status = $data->setView($_POST[$this->subject], $_POST['formDefinition'], $_POST['formComment'], true);
107107
if (0 == $status) {
108108
$this->doDefinition($this->lang['strviewupdated']);
109109
} else {
@@ -339,7 +339,7 @@ public function doAlter($confirm = false, $msg = '')
339339

340340
$this->coalesceArr($_POST, 'newschema', null);
341341

342-
$status = $data->alterView($_POST[$this->subject], $_POST['name'], $_POST['owner'], $_POST['newschema'], $_POST['comment']);
342+
$status = $data->alterMatView($_POST[$this->subject], $_POST['name'], $_POST['owner'], $_POST['newschema'], $_POST['comment']);
343343
if (0 == $status) {
344344
// If matview has been renamed, need to change to the new name and
345345
// reload the browser frame.

src/controllers/MaterializedviewsController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ public function doSaveCreate()
731731
} elseif ('' == $_POST['formDefinition']) {
732732
$this->doCreate($this->lang['strviewneedsdef']);
733733
} else {
734-
$status = $data->createView($_POST['formView'], $_POST['formDefinition'], false, $_POST['formComment']);
734+
$status = $data->createView($_POST['formView'], $_POST['formDefinition'], false, $_POST['formComment'], true);
735735
if (0 == $status) {
736736
$this->misc->setReloadBrowser(true);
737737
$this->doDefault($this->lang['strviewcreated']);
@@ -864,7 +864,7 @@ public function doSaveCreateWiz()
864864
$viewQuery .= ' WHERE '.$addConditions;
865865
}
866866

867-
$status = $data->createView($_POST['formView'], $viewQuery, false, $_POST['formComment']);
867+
$status = $data->createView($_POST['formView'], $viewQuery, false, $_POST['formComment'], true);
868868
if (0 == $status) {
869869
$this->misc->setReloadBrowser(true);
870870
$this->doDefault($this->lang['strviewcreated']);

0 commit comments

Comments
 (0)