Module: ActiveRecord::ConnectionAdapters::SQLServer::DatabaseTasks
- Included in:
- ActiveRecord::ConnectionAdapters::SQLServerAdapter
- Defined in:
- lib/active_record/connection_adapters/sqlserver/database_tasks.rb
Instance Method Summary collapse
- #charset ⇒ Object
- #collation ⇒ Object
- #create_database(database, options = {}) ⇒ Object
- #current_database ⇒ Object
- #drop_database(database) ⇒ Object
Instance Method Details
#charset ⇒ Object
22 23 24 |
# File 'lib/active_record/connection_adapters/sqlserver/database_tasks.rb', line 22 def charset select_value "SELECT DATABASEPROPERTYEX(DB_NAME(), 'SqlCharSetName')" end |
#collation ⇒ Object
26 27 28 |
# File 'lib/active_record/connection_adapters/sqlserver/database_tasks.rb', line 26 def collation select_value "SELECT DATABASEPROPERTYEX(DB_NAME(), 'Collation')" end |
#create_database(database, options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/active_record/connection_adapters/sqlserver/database_tasks.rb', line 6 def create_database(database, = {}) name = SQLServer::Utils.extract_identifiers(database) = () = () do_execute "CREATE DATABASE #{name} #{} #{}" end |
#current_database ⇒ Object
18 19 20 |
# File 'lib/active_record/connection_adapters/sqlserver/database_tasks.rb', line 18 def current_database select_value 'SELECT DB_NAME()' end |
#drop_database(database) ⇒ Object
13 14 15 16 |
# File 'lib/active_record/connection_adapters/sqlserver/database_tasks.rb', line 13 def drop_database(database) name = SQLServer::Utils.extract_identifiers(database) do_execute "DROP DATABASE #{name}" end |