Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix some type related issues
Fix some owner change related issues


git-svn-id: svn://svn.pgadmin.org/trunk@3823 a7884b65-44f6-0310-8a51-81a127f17b15
  • Loading branch information
Andreas Pflug committed Nov 2, 2004
1 parent a188598 commit 7d62448
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 26 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Expand Up @@ -17,6 +17,8 @@ The following list contains all changes to pgAdmin3, as present in cvs.
</ul>
<br>
<ul>
<li>2004-11-02 AP 1.2B4 Fix some type related issues (r: Alexander Borkowski)
<li>2004-11-02 AP 1.2B4 Fix some owner change related issues (r: Alexander Borkowski)
<li>2004-10-29 AP 1.2B4 full casting in utffile fixing some compilers
<li>2004-10-27 AP 1.2B4 Workaround for wxGrid bug not returning selected rows
<li>2004-10-27 AP 1.2B4 Fix user/group selection in privileges (r: Walter Haslbeck, Gary Doades)
Expand Down
2 changes: 1 addition & 1 deletion src/include/dlgProperty.h
Expand Up @@ -57,7 +57,7 @@ class dlgProperty : public DialogWithHelp
void CheckValid(bool &enable, const bool condition, const wxString &msg);
static dlgProperty *CreateDlg(frmMain *frame, pgObject *node, bool asNew, int type=-1);
void AppendNameChange(wxString &sql);
void AppendOwnerChange(wxString &sql);
void AppendOwnerChange(wxString &sql, const wxString &objName=wxEmptyString);
void AppendOwnerNew(wxString &sql, const wxString &objname);
void AppendComment(wxString &sql, const wxString &objType, pgSchema *schema, pgObject *obj);
void AppendComment(wxString &sql, const wxString &objName, pgObject *obj);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/ctlComboBox.cpp
Expand Up @@ -27,7 +27,7 @@ ctlComboBox::ctlComboBox(wxWindow *wnd, int id, wxPoint pos, wxSize siz, long at

int ctlComboBox::GuessSelection()
{
wxString str=GetValue();
wxString str=wxComboBox::GetValue();
if (str.Length())
{
long pos=GetInsertionPoint();
Expand Down
2 changes: 1 addition & 1 deletion src/ui/dlgAggregate.cpp
Expand Up @@ -208,7 +208,7 @@ wxString dlgAggregate::GetSql()
{
// edit mode
AppendNameChange(sql);
AppendOwnerChange(sql);
AppendOwnerChange(sql, wxT("AGGREGATE ") + schema->GetQuotedPrefix() + qtIdent(name));
}
else
{
Expand Down
18 changes: 13 additions & 5 deletions src/ui/dlgColumn.cpp
Expand Up @@ -185,11 +185,19 @@ wxString dlgColumn::GetSql()
+ wxT(" TO ") + qtIdent(name)
+ wxT(";\n");

wxString len;
if (txtLength->IsEnabled())
len = txtLength->GetValue();

wxString prec;
if (txtPrecision->IsEnabled())
prec = txtPrecision->GetValue();

if (connection->BackendMinimumVersion(7, 5))
{
if (cbDatatype->GetValue() != column->GetRawTypename() ||
(isVarLen && StrToLong(txtLength->GetValue()) != column->GetLength()) ||
(isVarPrec && StrToLong(txtPrecision->GetValue()) != column->GetPrecision()))
(isVarLen && txtLength->IsEnabled() && StrToLong(len) != column->GetLength()) ||
(isVarPrec && txtPrecision->IsEnabled() && StrToLong(prec) != column->GetPrecision()))
{
sql += wxT("ALTER TABLE ") + table->GetQuotedFullIdentifier()
+ wxT(" ALTER ") + qtIdent(name) + wxT(" TYPE ")
Expand All @@ -205,10 +213,10 @@ wxString dlgColumn::GetSql()


if (!sqlPart.IsEmpty() ||
(isVarLen && StrToLong(txtLength->GetValue()) != column->GetLength()) ||
(isVarPrec && StrToLong(txtPrecision->GetValue()) != column->GetPrecision()))
(isVarLen && txtLength->IsEnabled() && StrToLong(prec) != column->GetLength()) ||
(isVarPrec && txtPrecision->IsEnabled() && StrToLong(prec) != column->GetPrecision()))
{
long typmod = pgDatatype::GetTypmod(column->GetRawTypename(), txtLength->GetValue(), txtPrecision->GetValue());
long typmod = pgDatatype::GetTypmod(column->GetRawTypename(), len, prec);

if (!sqlPart.IsEmpty())
sqlPart += wxT(", ");
Expand Down
2 changes: 1 addition & 1 deletion src/ui/dlgConversion.cpp
Expand Up @@ -172,7 +172,7 @@ wxString dlgConversion::GetSql()
// edit mode

AppendNameChange(sql);
AppendOwnerChange(sql);
AppendOwnerChange(sql, wxT("CONVERSION ") + schema->GetQuotedPrefix() + qtIdent(name));
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/ui/dlgDomain.cpp
Expand Up @@ -181,7 +181,7 @@ wxString dlgDomain::GetSql()
else
sql += wxT(" SET DEFAULT ") + txtDefault->GetValue() + wxT(";\n");
}
AppendOwnerChange(sql);
AppendOwnerChange(sql, wxT("DOMAIN ") + qtIdent(name));
}
else
{
Expand Down
12 changes: 10 additions & 2 deletions src/ui/dlgFunction.cpp
Expand Up @@ -440,10 +440,18 @@ wxString dlgFunction::GetArgs(bool withNames, bool quoted)
args += lstArguments->GetText(i) + wxT(" ");
}
}
wxString typname=lstArguments->GetText(i, typeColNo);
wxString braces;
if (typname.Right(2) == wxT("[]"))
{
braces = wxT("[]");
typname = typname.Left(typname.Length()-2);
}
if (quoted)
AppendQuoted(args, lstArguments->GetText(i, typeColNo));
AppendQuoted(args, typname);
else
args += lstArguments->GetText(i, typeColNo);
args += typname;
args += braces;
}

return args;
Expand Down
22 changes: 12 additions & 10 deletions src/ui/dlgOperator.cpp
Expand Up @@ -130,6 +130,8 @@ int dlgOperator::Go(bool modal)
cbProcedure->Disable();
cbLeftType->Disable();
cbRightType->Disable();
if (!connection->BackendMinimumVersion(8, 0))
cbOwner->Disable();
}
else
{
Expand Down Expand Up @@ -384,16 +386,16 @@ wxString dlgOperator::GetSql()
{
// create mode
name = schema->GetQuotedPrefix() + GetName() + wxT("(");
if (cbLeftType->GetGuessedSelection() > 0)
name += GetQuotedTypename(cbLeftType->GetGuessedSelection());
else
name += wxT("NONE");
name += wxT(", ");
if (cbRightType->GetGuessedSelection() > 0)
name += GetQuotedTypename(cbRightType->GetGuessedSelection());
else
name += wxT("NONE");
name += wxT(")");
if (cbLeftType->GetGuessedSelection() > 0)
name += GetQuotedTypename(cbLeftType->GetGuessedSelection());
else
name += wxT("NONE");
name += wxT(", ");
if (cbRightType->GetGuessedSelection() > 0)
name += GetQuotedTypename(cbRightType->GetGuessedSelection());
else
name += wxT("NONE");
name += wxT(")");


sql = wxT("CREATE OPERATOR ") + schema->GetQuotedPrefix() + GetName()
Expand Down
7 changes: 4 additions & 3 deletions src/ui/dlgProperty.cpp
Expand Up @@ -260,13 +260,14 @@ void dlgProperty::AppendNameChange(wxString &sql)
}


void dlgProperty::AppendOwnerChange(wxString &sql)
void dlgProperty::AppendOwnerChange(wxString &sql, const wxString &objName)
{
if (GetObject()->GetOwner() != cbOwner->GetValue())
sql += wxT("ALTER ") + GetObject()->GetTypeName()
+ wxT(" ") + qtIdent(GetName())
{
sql += wxT("ALTER ") + objName
+ wxT(" OWNER TO ") + qtIdent(cbOwner->GetValue())
+ wxT(";\n");
}
}


Expand Down
2 changes: 1 addition & 1 deletion src/ui/dlgTable.cpp
Expand Up @@ -335,7 +335,7 @@ wxString dlgTable::GetSql()
}

AppendNameChange(sql);
AppendOwnerChange(sql);
AppendOwnerChange(sql, wxT("TABLE ") + tabname);

for (index=0 ; index < (int)tmpDef.GetCount() ; index++)
{
Expand Down
1 change: 1 addition & 0 deletions src/ui/dlgType.cpp
Expand Up @@ -215,6 +215,7 @@ void dlgType::OnSelChangeTypOrLen(wxCommandEvent &ev)
CheckLenEnable();
txtLength->Enable(isVarLen);
CheckChange();
OnChangeMember(ev);
}
}

Expand Down

0 comments on commit 7d62448

Please sign in to comment.