| 1045 | } |
| 1046 | |
| 1047 | void StringFunctions::RegexpPrepare( |
| 1048 | FunctionContext* context, FunctionContext::FunctionStateScope scope) { |
| 1049 | if (scope != FunctionContext::THREAD_LOCAL) return; |
| 1050 | if (!context->IsArgConstant(1)) return; |
| 1051 | DCHECK_EQ(context->GetArgType(1)->type, FunctionContext::TYPE_STRING); |
| 1052 | StringVal* pattern = reinterpret_cast<StringVal*>(context->GetConstantArg(1)); |
| 1053 | if (pattern->is_null) return; |
| 1054 | |
| 1055 | string error_str; |
| 1056 | re2::RE2* re = CompileRegex(*pattern, &error_str, StringVal::null()); |
| 1057 | if (re == NULL) { |
| 1058 | context->SetError(error_str.c_str()); |
| 1059 | return; |
| 1060 | } |
| 1061 | context->SetFunctionState(scope, re); |
| 1062 | } |
| 1063 | |
| 1064 | void StringFunctions::RegexpClose( |
| 1065 | FunctionContext* context, FunctionContext::FunctionStateScope scope) { |
nothing calls this directly
no test coverage detected