示例#1
0
wxString pgForeignServer::GetSql(ctlTree *browser)
{
	if (sql.IsNull())
	{
		sql = wxT("-- Server: ") + GetQuotedFullIdentifier() + wxT("\n\n")
		      + wxT("-- DROP SERVER ") + GetQuotedFullIdentifier() + wxT(";")
		      + wxT("\n\nCREATE SERVER ") + GetQuotedFullIdentifier()
		      + wxT("\n   FOREIGN DATA WRAPPER ") + qtIdent(GetForeignDataWrapper()->GetName());

		if (!GetType().IsEmpty())
			sql += wxT("\n  TYPE ") + qtDbString(GetType());

		if (!GetVersion().IsEmpty())
			sql += wxT("\n  VERSION ") + qtDbString(GetVersion());

		if (!GetOptions().IsEmpty())
			sql += wxT("\n  OPTIONS (") + GetCreateOptions() + wxT(")");

		sql += wxT(";\n")
		       +  GetOwnerSql(8, 4, wxT("SERVER ") + GetQuotedFullIdentifier())
		       +  GetGrant(wxT("U"), wxT("FOREIGN SERVER ") + GetQuotedFullIdentifier());
	}
	return sql;
}
示例#2
0
wxString pgForeignDataWrapper::GetSql(ctlTree *browser)
{
	if (sql.IsNull())
	{
		sql = wxT("-- Foreign Data Wrapper: ") + GetQuotedFullIdentifier() + wxT("\n\n")
		      + wxT("-- DROP FOREIGN DATA WRAPPER ") + GetQuotedFullIdentifier() + wxT(";")
		      + wxT("\n\nCREATE ");
		sql += wxT("FOREIGN DATA WRAPPER ") + GetName();

		if (!GetHandlerProc().IsEmpty())
			sql += wxT("\n  HANDLER ") + GetHandlerProc();

		if (!GetValidatorProc().IsEmpty())
			sql += wxT("\n  VALIDATOR ") + GetValidatorProc();

		if (!GetOptions().IsEmpty())
			sql += wxT("\n  OPTIONS (") + GetCreateOptions() + wxT(")");

		sql += wxT(";\n")
		       +  GetOwnerSql(8, 4, wxT("FOREIGN DATA WRAPPER ") + GetName())
		       +  GetGrant(wxT("U"), wxT("FOREIGN DATA WRAPPER ") + GetQuotedFullIdentifier());
	}
	return sql;
}