'Test basic PreparedStatement usage'

def test_basic(self):

    self.session.execute('\n                                                DROP    KEYSPACE    IF    EXISTS    preparedtests\n                                                ')
    self.session.execute("\n                                                CREATE    KEYSPACE    preparedtests\n                                                WITH    replication    =    {'class':    'SimpleStrategy',    'replication_factor':    '1'}\n                                                ")
    self.session.set_keyspace('preparedtests')
    self.session.execute('\n                                                CREATE    TABLE    cf0    (\n                                                                a    text,\n                                                                b    text,\n                                                                c    text,\n                                                                PRIMARY    KEY    (a,    b)\n                                                )\n                                                ')
    prepared = self.session.prepare('\n                                                INSERT    INTO    cf0    (a,    b,    c)    VALUES        (?,    ?,    ?)\n                                                ')
    self.assertIsInstance(prepared, PreparedStatement)
    bound = prepared.bind(('a', 'b', 'c'))
    self.session.execute(bound)
    prepared = self.session.prepare('\n                                                SELECT    *    FROM    cf0    WHERE    a=?\n                                                ')
    self.assertIsInstance(prepared, PreparedStatement)
    bound = prepared.bind('a')
    results = self.session.execute(bound)
    self.assertEqual(results, [('a', 'b', 'c')])
    prepared = self.session.prepare('\n                                                INSERT    INTO    cf0    (a,    b,    c)    VALUES        (?,    ?,    ?)\n                                                ')
    self.assertIsInstance(prepared, PreparedStatement)
    bound = prepared.bind({'a': 'x', 'b': 'y', 'c': 'z'})
    self.session.execute(bound)
    prepared = self.session.prepare('\n                                                SELECT    *    FROM    cf0    WHERE    a=?\n                                                ')
    self.assertIsInstance(prepared, PreparedStatement)
    bound = prepared.bind({'a': 'x'})
    results = self.session.execute(bound)
    self.assertEqual(results, [('x', 'y', 'z')])
