/Users/deen/code/yugabyte-db/src/yb/yql/cql/cqlserver/cql_statement.cc
Line | Count | Source |
1 | | //-------------------------------------------------------------------------------------------------- |
2 | | // Copyright (c) YugaByte, Inc. |
3 | | // |
4 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
5 | | // in compliance with the License. You may obtain a copy of the License at |
6 | | // |
7 | | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
10 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
11 | | // or implied. See the License for the specific language governing permissions and limitations |
12 | | // under the License. |
13 | | // |
14 | | //-------------------------------------------------------------------------------------------------- |
15 | | |
16 | | #include "yb/yql/cql/cqlserver/cql_statement.h" |
17 | | |
18 | | #include <openssl/md5.h> |
19 | | |
20 | | namespace yb { |
21 | | namespace cqlserver { |
22 | | |
23 | | //------------------------------------------------------------------------------------------------ |
24 | | CQLStatement::CQLStatement( |
25 | | const string& keyspace, const string& query, const CQLStatementListPos pos) |
26 | 2.43k | : Statement(keyspace, query), pos_(pos) { |
27 | 2.43k | } |
28 | | |
29 | 422 | CQLStatement::~CQLStatement() { |
30 | 422 | } |
31 | | |
32 | 8.22k | ql::CQLMessage::QueryId CQLStatement::GetQueryId(const string& keyspace, const string& query) { |
33 | 8.22k | unsigned char md5[MD5_DIGEST_LENGTH]; |
34 | 8.22k | MD5_CTX md5ctx; |
35 | 8.22k | MD5_Init(&md5ctx); |
36 | 8.22k | MD5_Update(&md5ctx, to_uchar_ptr(keyspace.data()), keyspace.length()); |
37 | 8.22k | MD5_Update(&md5ctx, to_uchar_ptr(query.data()), query.length()); |
38 | 8.22k | MD5_Final(md5, &md5ctx); |
39 | 8.22k | return ql::CQLMessage::QueryId(to_char_ptr(md5), sizeof(md5)); |
40 | 8.22k | } |
41 | | |
42 | | } // namespace cqlserver |
43 | | } // namespace yb |