Skip to content

Commit

Permalink
In case of copying, defalut-values are prior to schema default.
Browse files Browse the repository at this point in the history
  • Loading branch information
msyk committed Sep 1, 2024
1 parent 6fb2c9e commit b358744
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions dist-docs/change_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Ver.13 (In Development)
- The "Update" button in pagination doesn't shown in default. It can show with customizing INTERMediator.navigationLabel.
- The page number text field in pagination has the up and down button. It means the type of it set to "number".
- Apache2 conf file for hiding some files as like *.yaml and .git directory. It stored in dist-docs/apache2-config.
- In case of copy, the default-values are prior to the defaults of schema.
- [BUG FIX] On the Ver.12, SAML authentication didn't work in spite of Ver.11 can do. It didn't check with SAML manual
test on Ver.12 after added types to php codes. Ver.13 works SAML.

Expand Down
4 changes: 3 additions & 1 deletion src/php/DB/Support/DB_PDO_MySQL_Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,16 @@ protected function getFieldListsForCopy(string $tableName, string $keyField, ?st
$fieldArray = array();
$listArray = array();
foreach ($result as $row) {
if ($keyField === $row['Field'] || !is_null($row['Default'])) {
if ($keyField === $row['Field']) {
// skip key field to assign value.
} else if ($assocField === $row['Field']) {
$fieldArray[] = $this->quotedEntityName($row['Field']);
$listArray[] = $this->dbClassObj->link->quote($assocValue);
} else if (isset($defaultValues[$row['Field']])) {
$fieldArray[] = $this->quotedEntityName($row['Field']);
$listArray[] = $this->dbClassObj->link->quote($defaultValues[$row['Field']]);
} else if (!is_null($row['Default'])){
// skip if field has a default value
} else {
$fieldArray[] = $this->quotedEntityName($row['Field']);
$listArray[] = $this->quotedEntityName($row['Field']);
Expand Down
4 changes: 3 additions & 1 deletion src/php/DB/Support/DB_PDO_PostgreSQL_Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,16 @@ protected function getFieldListsForCopy(string $tableName, string $keyField, ?st
$fieldArray = array();
$listArray = array();
foreach ($result as $row) {
if ($keyField === $row['column_name'] || !is_null($row['column_default'])) {
if ($keyField === $row['column_name']) {

} else if ($assocField === $row['column_name']) {
$fieldArray[] = $this->quotedEntityName($row['column_name']);
$listArray[] = $this->setValue($assocValue, $row);
} else if (isset($defaultValues[$row['column_name']])) {
$fieldArray[] = $this->quotedEntityName($row['column_name']);
$listArray[] = $this->setValue($defaultValues[$row['column_name']], $row);
} else if (!is_null($row['column_default'])){

} else {
$fieldArray[] = $this->quotedEntityName($row['column_name']);
$listArray[] = $this->quotedEntityName($row['column_name']);
Expand Down
4 changes: 3 additions & 1 deletion src/php/DB/Support/DB_PDO_SQLServer_Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ protected function getFieldListsForCopy(string $tableName, string $keyField, ?st
$listArray = array();
foreach ($result as $row) {
$quatedFieldName = $this->quotedEntityName($row['name']);
if ($keyField === $row['name'] || $row['is_identity'] === 1) {
if ($keyField === $row['name']) {
// skip key field to asign value.
} else if ($assocField === $row['name']) {
if (!in_array($quatedFieldName, $fieldArray)) {
Expand All @@ -265,6 +265,8 @@ protected function getFieldListsForCopy(string $tableName, string $keyField, ?st
$fieldArray[] = $quatedFieldName;
$listArray[] = $this->dbClassObj->link->quote($defaultValues[$row['name']]);
}
} else if ($row['is_identity'] === 1) {

} else {
if (!in_array($quatedFieldName, $fieldArray)) {
$fieldArray[] = $quatedFieldName;
Expand Down
4 changes: 3 additions & 1 deletion src/php/DB/Support/DB_PDO_SQLite_Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,16 @@ protected function getFieldListsForCopy(string $tableName, string $keyField, ?st
$fieldArray = array();
$listArray = array();
foreach ($result as $row) {
if ($keyField === $row['name'] || !is_null($row['dflt_value'])) {
if ($keyField === $row['name']) {

} else if ($assocField === $row['name']) {
$fieldArray[] = $this->quotedEntityName($row['name']);
$listArray[] = $this->dbClassObj->link->quote($assocValue);
} else if (isset($defaultValues[$row['name']])) {
$fieldArray[] = $this->quotedEntityName($row['name']);
$listArray[] = $this->dbClassObj->link->quote($defaultValues[$row['name']]);
} else if (!is_null($row['dflt_value'])) {

} else {
$fieldArray[] = $this->quotedEntityName($row['name']);
$listArray[] = $this->quotedEntityName($row['name']);
Expand Down

0 comments on commit b358744

Please sign in to comment.