renamed sql_command enum names
This commit is contained in:
parent
d13ccc861e
commit
15f959b24e
|
|
@ -8,22 +8,22 @@
|
|||
|
||||
namespace matador::sql {
|
||||
enum class sql_command {
|
||||
SQL_UNKNOWN,
|
||||
SQL_CREATE,
|
||||
SQL_CREATE_TABLE,
|
||||
SQL_CREATE_SCHEMA,
|
||||
SQL_CREATE_DATABASE,
|
||||
SQL_UPDATE,
|
||||
SQL_INSERT,
|
||||
SQL_DELETE,
|
||||
SQL_SELECT,
|
||||
SQL_DROP,
|
||||
SQL_DROP_TABLE,
|
||||
SQL_DROP_SCHEMA,
|
||||
SQL_DROP_DATABASE,
|
||||
SQL_ALTER,
|
||||
SQL_ALTER_TABLE,
|
||||
SQL_ALTER_SCHEMA
|
||||
Unknown,
|
||||
Create,
|
||||
CreateTable,
|
||||
CreateSchema,
|
||||
CreateDatabase,
|
||||
Update,
|
||||
Insert,
|
||||
Delete,
|
||||
Select,
|
||||
Drop,
|
||||
DropTable,
|
||||
DropSchema,
|
||||
DropDatabase,
|
||||
Alter,
|
||||
AlterTable,
|
||||
AlterSchema
|
||||
};
|
||||
|
||||
struct sql_command_info {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void query_builder::visit(internal::query_alter_part& part) {
|
|||
}
|
||||
|
||||
void query_builder::visit(internal::query_alter_table_part& part) {
|
||||
query_.command = sql::sql_command::SQL_ALTER_TABLE;
|
||||
query_.command = sql::sql_command::AlterTable;
|
||||
query_.sql += " " + dialect_->token_at(part.token()) + " " +
|
||||
dialect_->prepare_identifier_string(part.table().name());
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ void query_builder::visit(internal::query_drop_key_constraint_part_by_constraint
|
|||
}
|
||||
|
||||
void query_builder::visit(internal::query_select_part &part) {
|
||||
query_.command = sql::sql_command::SQL_SELECT;
|
||||
query_.command = sql::sql_command::Select;
|
||||
query_.sql = dialect_->select() + " ";
|
||||
|
||||
query_.prototype.clear();
|
||||
|
|
@ -212,7 +212,7 @@ void query_builder::visit(internal::query_limit_part &part) {
|
|||
}
|
||||
|
||||
void query_builder::visit(internal::query_insert_part &/*insert_part*/) {
|
||||
query_.command = sql::sql_command::SQL_INSERT;
|
||||
query_.command = sql::sql_command::Insert;
|
||||
query_.sql = dialect_->insert();
|
||||
}
|
||||
|
||||
|
|
@ -274,14 +274,14 @@ void query_builder::visit(internal::query_values_part &part) {
|
|||
|
||||
void query_builder::visit(internal::query_update_part &part)
|
||||
{
|
||||
query_.command = sql::sql_command::SQL_UPDATE;
|
||||
query_.command = sql::sql_command::Update;
|
||||
query_.table_name = part.table().name();
|
||||
query_.sql += query_builder::build_table_name(part.token(), *dialect_, query_.table_name);
|
||||
}
|
||||
|
||||
void query_builder::visit(internal::query_delete_part &/*delete_part*/)
|
||||
{
|
||||
query_.command = sql::sql_command::SQL_DELETE;
|
||||
query_.command = sql::sql_command::Delete;
|
||||
query_.sql = dialect_->remove();
|
||||
}
|
||||
|
||||
|
|
@ -293,7 +293,7 @@ void query_builder::visit(internal::query_delete_from_part &part)
|
|||
|
||||
void query_builder::visit(internal::query_create_part &/*create_part*/)
|
||||
{
|
||||
query_.command = sql::sql_command::SQL_CREATE_TABLE;
|
||||
query_.command = sql::sql_command::CreateTable;
|
||||
query_.sql = dialect_->create();
|
||||
}
|
||||
|
||||
|
|
@ -329,12 +329,12 @@ void query_builder::visit(internal::query_create_table_constraints_part& part) {
|
|||
}
|
||||
|
||||
void query_builder::visit( internal::query_create_schema_part& part ) {
|
||||
query_.command = sql::sql_command::SQL_CREATE_SCHEMA;
|
||||
query_.command = sql::sql_command::CreateSchema;
|
||||
query_.sql += " " + dialect_->schema() + " " + dialect_->prepare_identifier_string(part.schema());
|
||||
}
|
||||
|
||||
void query_builder::visit(internal::query_drop_part &part) {
|
||||
query_.command = sql::sql_command::SQL_DROP_TABLE;
|
||||
query_.command = sql::sql_command::DropTable;
|
||||
query_.sql = dialect_->token_at(part.token());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ std::shared_ptr<class producer_resolver_factory> connection::resolver_factory()
|
|||
}
|
||||
|
||||
utils::result<std::unique_ptr<statement_impl>, utils::error> connection::perform_prepare(const query_context& ctx) const {
|
||||
if (ctx.command != sql_command::SQL_CREATE_TABLE && (ctx.prototype.empty() || has_unknown_columns(ctx.prototype))) {
|
||||
if (ctx.command != sql_command::CreateTable && (ctx.prototype.empty() || has_unknown_columns(ctx.prototype))) {
|
||||
if (const auto result = describe(ctx.table_name); result.is_ok()) {
|
||||
for (auto &col: ctx.prototype) {
|
||||
const auto rit = std::find_if(
|
||||
|
|
|
|||
Loading…
Reference in New Issue