#178 ✓resolved
Postmodern

INDEX names are not being SQL-quoted

Reported by Postmodern | March 7th, 2008 @ 08:14 PM

When creating indexes on classes within modules, I found DataMapper was not quoting the names of the SQL INDEXes.

Example code to reproduce bug:

DB = DataMapper::Database.setup({:adapter => 'sqlite3', :database => 'test.db'})

module Namespace
  class Thing < DataMapper::Base

    property :title, :string, :index => true

  end
end

Namespace::Thing.auto_migrate!

Would result in the following exception:

DataObject::QueryError: Your query failed.
near "/": syntax error
QUERY: "CREATE INDEX namespace/things_title_index ON "namespace/things" ("title")"
	from /usr/lib64/ruby/gems/1.8/gems/do_sqlite3-0.2.3/lib/do_sqlite3.rb:143:in `execute_non_query'
	from /usr/lib64/ruby/gems/1.8/gems/datamapper-0.2.5/lib/data_mapper/adapters/sql/mappings/table.rb:123:in `create!'

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Pages