Skip to content

Commit

Permalink
🐛 fixed #8 Fixed insert, update, delete
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Jun 18, 2018
1 parent c05e329 commit a794c03
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions classes/TCreateDAO.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public function __construct($strTableName = null, $strkeyColumnName = null, $str
$this->keyColumnName = $strkeyColumnName;
$this->path = $strPath;
$this->databaseManagementSystem = strtoupper($databaseManagementSystem);
if ($databaseManagementSystem == DBMS_POSTGRES) {
$this->charParam = '$1';
}
}
//-----------------------------------------------------------------------------------
public function setTableName($strTableName)
Expand Down Expand Up @@ -364,12 +361,12 @@ public function addSqlUpdate()
$count=0;
foreach ($this->getColumns() as $k => $v) {
if (strtolower($v) != strtolower($this->keyColumnName)) {
$param = $this->databaseManagementSystem == DBMS_POSTGRES ? '$'.($count+1) : '?';
$param = $this->charParam;
$this->addLine(TAB.TAB.TAB.TAB.TAB.TAB.TAB.TAB.( $count==0 ? ' ' : ',').$v.' = '.$param);
$count++;
}
}
$param = $this->databaseManagementSystem == DBMS_POSTGRES ? '$'.($count+1) : '?';
$param = $this->charParam;
$this->addLine(TAB.TAB.TAB.TAB.TAB.TAB.TAB.TAB.'where '.$this->keyColumnName.' = '.$param.'\',$values);');
$this->addLine(TAB.'}');
}
Expand Down Expand Up @@ -478,11 +475,7 @@ public function getParams()
for ($i = 1; $i <= $qtd; $i++) {
if ($cols[$i-1] != strtolower($this->keyColumnName)) {
$result .= ($result=='') ? '' : ',';
if ($this->databaseManagementSystem == DBMS_POSTGRES) {
$result .= '$'.$i;
} else {
$result.='?';
}
$result.='?';
}
}
return $result;
Expand Down

0 comments on commit a794c03

Please sign in to comment.