# Path: antioch/util/sql.py
# def strftime(dt, fmt):
#     def _findall(text, substr):
# def build_insert(table, data=None, **kwargs):
# def build_set(data=None, **kwargs):
# def build_update(table, data, constraints):
# def build_select(table, data=None, **kwargs):
# def build_delete(table, constraints=None, **kwargs):
# def build_where(data=None, use_where=True, **kwargs):
# def make_list(items):
# def escape_sequence(seq, conv):
# def escape_item(item, conv):
# def quoted_string_literal(s, d):
# def mysql_string_literal(s, d):
# def interp(query, *args):
#     def __init__(self, value):
#     def __repr__(self):
# class RAW(object):
# class NOT(RAW):
# class GT(RAW):
# class LT(RAW):


from django.test import TestCase
from antioch.util import sql
        query = sql.build_insert('table', [{'col2':'col2_data', 'col1':sql.RAW("ENCRYPT('something')")}, {'col2':'col2_data', 'col1':sql.RAW("ENCRYPT('something')")}]);
        expecting = "INSERT INTO table (col1, col2) VALUES (ENCRYPT('something'), 'col2_data'), (ENCRYPT('something'), 'col2_data')"
        self.assertEqual(query, expecting, 'Got "%s" when expecting "%s"' % (query, expecting))
    
    def test_build_insert_dot_syntax(self):
        query = sql.build_insert('db.table', {'col2':'col2_data', 'col1':sql.RAW("ENCRYPT('something')")});
        expecting = "INSERT INTO db.table (col1, col2) VALUES (ENCRYPT('something'), 'col2_data')"
        self.assertEqual(query, expecting, 'Got "%s" when expecting "%s"' % (query, expecting))
    
    def test_build_insert_raw(self):
        query = sql.build_insert('table', {'col2':'col2_data', 'col1':'col1_data'});
        expecting = "INSERT INTO table (col1, col2) VALUES ('col1_data', 'col2_data')"
        self.assertEqual(query, expecting, 'Got "%s" when expecting "%s"' % (query, expecting))
    
    def test_build_select_dot_syntax(self):
        query = sql.build_select('db.table', {'t.col2':'col2_data', 's.col1':'col1_data'});
        expecting = "SELECT * FROM db.table WHERE s.col1 = 'col1_data' AND t.col2 = 'col2_data'"
        self.assertEqual(query, expecting, 'Got "%s" when expecting "%s"' % (query, expecting))
    
    def test_build_select(self):
        query = sql.build_select('table', {'col2':'col2_data', 'col1':'col1_data'});
        expecting = "SELECT * FROM table WHERE col1 = 'col1_data' AND col2 = 'col2_data'"
        self.assertEqual(query, expecting, 'Got "%s" when expecting "%s"' % (query, expecting))
    
    def test_build_select2(self):
        query = sql.build_select('table', col2='col2_data', col1='col1_data');
        expecting = "SELECT * FROM table WHERE col1 = 'col1_data' AND col2 = 'col2_data'"
        self.assertEqual(query, expecting, 'Got "%s" when expecting "%s"' % (query, expecting))
    
    def test_build_select_order(self):

# Path: antioch/util/sql.py
# def strftime(dt, fmt):
#     def _findall(text, substr):
# def build_insert(table, data=None, **kwargs):
# def build_set(data=None, **kwargs):
# def build_update(table, data, constraints):
# def build_select(table, data=None, **kwargs):
# def build_delete(table, constraints=None, **kwargs):
# def build_where(data=None, use_where=True, **kwargs):
# def make_list(items):
# def escape_sequence(seq, conv):
# def escape_item(item, conv):
# def quoted_string_literal(s, d):
# def mysql_string_literal(s, d):
# def interp(query, *args):
#     def __init__(self, value):
#     def __repr__(self):
# class RAW(object):
# class NOT(RAW):
# class GT(RAW):
# class LT(RAW):


# Path: antioch/test/test_sql.py
from django.test import TestCase
from antioch.util import sql

        query = sql.build_insert('table', [{'col2':'col2_data', 'col1':sql.RAW("ENCRYPT('something')")}, {'col2':'col2_data', 'col1':sql.RAW("ENCRYPT('something')")}]);
        expecting = "INSERT INTO table (col1, col2) VALUES (ENCRYPT('something'), 'col2_data'), (ENCRYPT('something'), 'col2_data')"
        self.assertEqual(query, expecting, 'Got "%s" when expecting "%s"' % (query, expecting))
    
    def test_build_insert_dot_syntax(self):
        query = sql.build_insert('db.table', {'col2':'col2_data', 'col1':sql.RAW("ENCRYPT('something')")});
        expecting = "INSERT INTO db.table (col1, col2) VALUES (ENCRYPT('something'), 'col2_data')"
        self.assertEqual(query, expecting, 'Got "%s" when expecting "%s"' % (query, expecting))
    
    def test_build_insert_raw(self):
        query = sql.build_insert('table', {'col2':'col2_data', 'col1':'col1_data'});
        expecting = "INSERT INTO table (col1, col2) VALUES ('col1_data', 'col2_data')"
        self.assertEqual(query, expecting, 'Got "%s" when expecting "%s"' % (query, expecting))
    
    def test_build_select_dot_syntax(self):
        query = sql.build_select('db.table', {'t.col2':'col2_data', 's.col1':'col1_data'});
        expecting = "SELECT * FROM db.table WHERE s.col1 = 'col1_data' AND t.col2 = 'col2_data'"
        self.assertEqual(query, expecting, 'Got "%s" when expecting "%s"' % (query, expecting))
    
    def test_build_select(self):
        query = sql.build_select('table', {'col2':'col2_data', 'col1':'col1_data'});
        expecting = "SELECT * FROM table WHERE col1 = 'col1_data' AND col2 = 'col2_data'"
        self.assertEqual(query, expecting, 'Got "%s" when expecting "%s"' % (query, expecting))
    
    def test_build_select2(self):
        query = sql.build_select('table', col2='col2_data', col1='col1_data');
        expecting = "SELECT * FROM table WHERE col1 = 'col1_data' AND col2 = 'col2_data'"
        self.assertEqual(query, expecting, 'Got "%s" when expecting "%s"' % (query, expecting))
    
    def test_build_select_order(self):

        query = sql.build_select('table', {'col1':'col1_data', 'col2':'col2_data', '__order_by':'id DESC'});