Class: FlareUp::Command::DropTable
- Inherits:
-
Base
- Object
- Base
- FlareUp::Command::DropTable
show all
- Defined in:
- lib/flare_up/command/drop_table.rb
Instance Attribute Summary
Attributes inherited from Base
#table_name
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#execute(connection) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/flare_up/command/drop_table.rb', line 10
def execute(connection)
begin
connection.execute(get_command)
[]
rescue PG::InternalError => e
case e.message
when /Check 'stl_load_errors' system table for details/
return STLLoadErrorFetcher.fetch_errors(connection)
when /PG::SyntaxError/
matches = /syntax error (.+) \(PG::SyntaxError\)/.match(e.message)
raise SyntaxError, "Syntax error in the DROP TABLE command: [#{matches[1]}]."
else
raise e
end
end
end
|
#get_command ⇒ Object
6
7
8
|
# File 'lib/flare_up/command/drop_table.rb', line 6
def get_command
"DROP TABLE #{@table_name} #{@options}"
end
|