* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres.php,v 1.248 2004/10/11 10:27:33 jollytoad Exp $
+ * $Id: Postgres.php,v 1.249 2004/11/02 03:33:35 chriskl Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
* @param $column The name of the new column
* @param $type The type of the column
* @param $array True if array type, false otherwise
+ * @param $notnull True if NOT NULL, false otherwise
+ * @param $default The default for the column. '' for none.
* @param $length The optional size of the column (ie. 30 for varchar(30))
* @return 0 success
*/
- function addColumn($table, $column, $type, $array, $length, $comment) {
+ function addColumn($table, $column, $type, $array, $length, $notnull, $default, $comment) {
$this->fieldClean($table);
$this->fieldClean($column);
$this->clean($type);
// Add array qualifier, if requested
if ($array) $sql .= '[]';
+
+ // If we have advanced column adding, add the extra qualifiers
+ if ($this->hasAlterColumnType()) {
+ // NOT NULL clause
+ if ($notnull) $sql .= ' NOT NULL';
+
+ // DEFAULT clause
+ if ($default != '') $sql .= ' DEFAULT ' . $default;
+ }
$status = $this->beginTransaction();
if ($status != 0) return -1;
/**
* List tables in a database
*
- * $Id: tblproperties.php,v 1.61 2004/09/07 13:58:21 jollytoad Exp $
+ * $Id: tblproperties.php,v 1.62 2004/11/02 03:33:35 chriskl Exp $
*/
// Include application functions
echo "<td><input name=\"default\" size=\"20\" value=\"",
htmlspecialchars($_POST['default']), "\" /></td>";
}
+ else {
+ echo "<input type=\"hidden\" name=\"default\" value=\"\" />\n";
+ }
echo "<td><input name=\"comment\" size=\"40\" value=\"",
htmlspecialchars($_POST['comment']), "\" /></td></tr>";
echo "</table>\n";
doAddColumn($lang['strcolneedsname']);
return;
}
-
+
$status = $data->addColumn($_POST['table'], $_POST['field'],
- $_POST['type'], $_POST['array'] != '', $_POST['length'], $_POST['comment']);
+ $_POST['type'], $_POST['array'] != '', $_POST['length'], isset($_POST['notnull']),
+ $_POST['default'], $_POST['comment']);
if ($status == 0)
doDefault($lang['strcolumnadded']);
else {