Mapotempo / couchbase-orm

A Couchbase ORM based on ActiveModel for Rails compatibility
MIT License
4 stars 5 forks source link

Don't escape simple quote when string is double quote #57

Open giallon opened 2 years ago

giallon commented 2 years ago

For Now, "L'école" become "L''école" in query SQL. We need to support simple quote for french word.

https://github.com/Mapotempo/couchbase-orm/blob/a1fbeb24209dba3f49e6d4ca9766648e2d305b69/lib/couchbase-orm/n1ql.rb#L14

simkim commented 2 years ago

Can't reproduce, on master adding this test doesn't fail:

it "should allow storing quoting chars" do
        special_name = "O'Leary & Sons \"The best\" \\ between backslash \\"
        t = N1QLTest.create! name: special_name, rating: :awesome
        expect(N1QLTest.find(t.id).name).to eq(special_name)
        expect(N1QLTest.by_name(key: special_name).to_a.first).to eq(t)
        expect(N1QLTest.where(name: special_name).to_a.first).to eq(t)
        puts N1QLTest.where(name: special_name).to_n1ql
end

# output 
# select raw meta().id from `default` where type = 'n1_ql_test' AND name = 'O''Leary & Sons \"The best\" \\ between backslash \\' order by meta().id