* A class that implements the DB interface for Postgres\r
* Note: This class uses ADODB and returns RecordSets.\r
*\r
- * $Id: Postgres.php,v 1.9 2002/09/23 06:11:38 chriskl Exp $\r
+ * $Id: Postgres.php,v 1.10 2002/09/23 06:18:55 chriskl Exp $\r
*/\r
\r
// @@@ THOUGHT: What about inherits? ie. use of ONLY???\r
* @return 0 success\r
*/\r
function dropTable($table) {\r
- $this->clean($table);\r
+ $this->fieldClean($table);\r
\r
$sql = "DROP TABLE \"{$table}\"";\r
\r
* @return 0 success\r
*/\r
function emptyTable($table) {\r
- $this->clean($table);\r
+ $this->fieldClean($table);\r
\r
$sql = "DELETE FROM \"{$table}\"";\r
\r
* @return 0 success\r
*/\r
function renameTable($table, $newName) {\r
- $this->clean($table);\r
- $this->clean($newName);\r
+ $this->fieldClean($table);\r
+ $this->fieldClean($newName);\r
+ \r
$sql = "ALTER TABLE \"{$table}\" RENAME TO \"{$newName}\"";\r
\r
// @@ How do you do this?\r
* @param $key The associative array holding the key to retrieve\r
* @return A recordset\r
*/\r
- function &browseRow($table, $key) { \r
+ function &browseRow($table, $key) {\r
+ $this->fieldClean($table);\r
+ \r
$sql = "SELECT * FROM \"{$table}\" WHERE true";\r
foreach ($key as $k => $v) {\r
- $this->clean($k);\r
+ $this->fieldClean($k);\r
$this->clean($v);\r
$sql .= " AND \"{$k}\"='{$v}'";\r
}\r
* @return 0 success\r
*/\r
function addCheckConstraint($table, $definition, $name = '') {\r
- $this->clean($table);\r
- $this->clean($name);\r
+ $this->fieldClean($table);\r
+ $this->fieldClean($name);\r
// @@ how the heck do you clean definition???\r
\r
if ($name != '')\r
* @return 0 success\r
*/\r
function addUniqueConstraint($table, $fields, $name = '') {\r
- $this->clean($table);\r
+ $this->fieldClean($table);\r
$this->arrayClean($fields);\r
- $this->clean($name);\r
+ $this->fieldClean($name);\r
\r
if ($name != '')\r
$sql = "CREATE UNIQUE INDEX \"{$name}\" ON \"{$table}\"(\"" . join('","', $fields) . "\")";\r
else return -99; // Not supported\r
\r
- // @@ How do you do this?\r
return $this->execute($sql);\r
}\r
\r
* @return 0 success\r
*/\r
function dropUniqueConstraint($table, $name) {\r
- $this->clean($table);\r
- $this->clean($name);\r
+ $this->fieldClean($name);\r
\r
$sql = "DROP INDEX \"{$name}\"";\r
\r
- // @@ How do you do this?\r
return $this->execute($sql);\r
} \r
\r
* @return 0 success\r
*/\r
function dropPrimaryKeyConstraint($table, $name) {\r
- $this->clean($table);\r
- $this->clean($name);\r
+ $this->fieldClean($name);\r
\r
$sql = "DROP INDEX \"{$name}\"";\r
\r
- // @@ How do you do this?\r
return $this->execute($sql);\r
} \r
\r
* @return 0 success\r
*/\r
function setOwnerOfTable($table, $owner) {\r
- $this->clean($table);\r
- $this->clean($owner);\r
+ $this->fieldClean($table);\r
+ $this->fieldClean($owner);\r
\r
$sql = "ALTER TABLE \"{$table}\" OWNER TO \"{$owner}\"";\r
\r
- // @@ How do you do this?\r
return $this->execute($sql);\r
}\r
\r
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres71.php,v 1.15 2002/09/17 12:40:01 chriskl Exp $
+ * $Id: Postgres71.php,v 1.16 2002/09/23 06:18:55 chriskl Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
// @@ Need create table - tricky!!
- /**
- * Removes a table from the database
- * @param $table
- * @return 0 success
- */
- function dropTable($table) {
- $this->clean($table);
-
- $sql = "DROP TABLE \"{$table}\"";
-
- // @@ How do you do this?
- return $this->execute($sql);
- }
-
/**
* Renames a table
* @param $table The table to be renamed