Commit d6817049 authored by Maciej Sobczak's avatar Maciej Sobczak

Fixed handling of DDL alter column syntax.

parent 1eb4c293
......@@ -327,12 +327,12 @@ struct oracle_session_backend : details::session_backend
" where table_name = :t";
}
virtual std::string create_column(const std::string & columnName, data_type dt,
virtual std::string create_column_type(data_type dt,
int precision, int scale)
{
// Oracle-specific SQL syntax:
std::string res = columnName + " ";
std::string res;
switch (dt)
{
case dt_string:
......@@ -388,14 +388,14 @@ struct oracle_session_backend : details::session_backend
int precision, int scale)
{
return "alter table " + tableName + " add " +
create_column(columnName, dt, precision, scale);
columnName + " " + create_column_type(dt, precision, scale);
}
virtual std::string alter_column(const std::string & tableName,
const std::string & columnName, data_type dt,
int precision, int scale)
{
return "alter table " + tableName + " modify " +
create_column(columnName, dt, precision, scale);
columnName + " " + create_column_type(dt, precision, scale);
}
virtual std::string get_backend_name() const { return "oracle"; }
......
......@@ -311,12 +311,12 @@ public:
{
return "truncate table " + tableName;
}
virtual std::string create_column(const std::string & columnName, data_type dt,
virtual std::string create_column_type(data_type dt,
int precision, int scale)
{
// PostgreSQL was selected as a baseline for the syntax:
std::string res = columnName + " ";
std::string res;
switch (dt)
{
case dt_string:
......@@ -371,15 +371,16 @@ public:
const std::string & columnName, data_type dt,
int precision, int scale)
{
return "alter table " + tableName + " add column " +
create_column(columnName, dt, precision, scale);
return "alter table " + tableName + " add column " + columnName +
create_column_type(dt, precision, scale);
}
virtual std::string alter_column(const std::string & tableName,
const std::string & columnName, data_type dt,
int precision, int scale)
{
return "alter table " + tableName + " alter column " +
create_column(columnName, dt, precision, scale);
columnName + " type " +
create_column_type(dt, precision, scale);
}
virtual std::string drop_column(const std::string & tableName,
const std::string & columnName)
......
......@@ -114,9 +114,11 @@ ddl_type & ddl_type::column(const std::string & columnName, data_type dt,
{
rcst_->accumulate(", ");
}
rcst_->accumulate(s_->get_backend()->create_column(
columnName, dt, precision, scale));
rcst_->accumulate(columnName);
rcst_->accumulate(" ");
rcst_->accumulate(
s_->get_backend()->create_column_type(dt, precision, scale));
rcst_->set_need_comma(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment