コード例 #1
0
 def prepare(self, query, *args):
     prepared_query = prepare(query, *args)
     match = connection._cfamily_re.match(prepared_query)
     if match:
         self.column_family = match.group(1)
     else:
         match = connection._keyspace_re.match(prepared_query)
         if match:
             self.keyspace = match.group(1)
     return prepared_query
コード例 #2
0
    def prepare(self, query, params):
        prepared_query = prepare(query, params)
        self._schema_update_needed = False

        # Snag the keyspace or column family and stash it for later use in
        # decoding columns.  These regexes don't match every query, but the
        # current column family only needs to be current for SELECTs.
        match = Cursor._cfamily_re.match(prepared_query)
        if match:
            self._query_cf = match.group(1)
            return prepared_query
        match = Cursor._keyspace_re.match(prepared_query)
        if match:
            self._query_ks = match.group(1)
            return prepared_query

        # If this is a CREATE, then refresh the schema for decoding purposes.
        match = Cursor._ddl_re.match(prepared_query)
        if match:
            self._schema_update_needed = True
        return prepared_query
コード例 #3
0
ファイル: cursor.py プロジェクト: esatterly/splunk-cassandra
    def prepare(self, query, params):
        prepared_query = prepare(query, params)
        self._schema_update_needed = False

        # Snag the keyspace or column family and stash it for later use in
        # decoding columns.  These regexes don't match every query, but the
        # current column family only needs to be current for SELECTs.
        match = Cursor._cfamily_re.match(prepared_query)
        if match:
            self._query_cf = match.group(1)
            return prepared_query
        match = Cursor._keyspace_re.match(prepared_query)
        if match:
            self._query_ks = match.group(1)
            return prepared_query

        # If this is a CREATE, then refresh the schema for decoding purposes.
        match = Cursor._ddl_re.match(prepared_query)
        if match:
            self._schema_update_needed = True
        return prepared_query
コード例 #4
0
 def test_prepares(self):
     "test prepared queries against known standards"
     for (i, test) in enumerate(TESTS):
         a = prepare(test, *ARGUMENTS[i])
         b = STANDARDS[i]
         assert a == b, "\n%s !=\n%s" % (a, b)
コード例 #5
0
 def test_prepares(self):
     "test prepared queries against known standards"
     for (i, test) in enumerate(TESTS):
         a = prepare(test, *ARGUMENTS[i])
         b = STANDARDS[i]
         assert a == b, "\n%s !=\n%s" % (a, b)