Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL error raised when SQL keywords are used in collection or field name #2

Closed
pekeq opened this issue Dec 12, 2014 · 0 comments
Closed
Assignees
Labels

Comments

@pekeq
Copy link
Owner

pekeq commented Dec 12, 2014

SQL error raised when SQL keywords are used in collection or field name.

import unittest
import nosqlite

class Test(unittest.TestCase):
    def setUp(self):
        self.client = nosqlite.Client('.')
        self.database = self.client.memory
        self.collection = self.database.index

    def test_keyword_escape(self):
        collection = self.database.index

        data = {'index':'index'}

        # insert
        collection.insert(data)

        # find
        self.assertDictEqual(data, collection.find_one(index='index'))
        self.assertDictEqual(data, collection.find_one(index='index', fields=["index"]))

        # update
        collection.update(data, index='index')

        # rename
        collection.rename('table')
        collection.rename('index')

        # copy
        collection.copy('create')

        # delete
        collection.delete(index='index')
        collection.delete()
@pekeq pekeq added the bug label Dec 12, 2014
@pekeq pekeq self-assigned this Dec 12, 2014
@pekeq pekeq closed this as completed in e92e3bf Dec 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant