Commit 397608d0 authored by yiwenshao's avatar yiwenshao

add token for asheagg

parent 14b2485c
...@@ -1334,6 +1334,20 @@ static udf_func u_sum_a = { ...@@ -1334,6 +1334,20 @@ static udf_func u_sum_a = {
NULL, NULL,
0L, 0L,
}; };
static udf_func u_sumashe_a = {
LEXSTRING("cryptdb_asheagg"),
STRING_RESULT,
UDFTYPE_AGGREGATE,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
0L,
};
static udf_func u_sum_f = { static udf_func u_sum_f = {
LEXSTRING("cryptdb_func_add_set"), LEXSTRING("cryptdb_func_add_set"),
...@@ -1603,6 +1617,7 @@ const std::vector<udf_func*> udf_list = { ...@@ -1603,6 +1617,7 @@ const std::vector<udf_func*> udf_list = {
&u_decDETStr, &u_decDETStr,
&u_sum_f, &u_sum_f,
&u_sum_a, &u_sum_a,
&u_sumashe_a,
&u_search, &u_search,
&u_cryptdb_version &u_cryptdb_version
}; };
......
...@@ -78,3 +78,4 @@ CREATE FUNCTION cryptdb_func_add_set RETURNS STRING SONAME 'edb.so'; ...@@ -78,3 +78,4 @@ CREATE FUNCTION cryptdb_func_add_set RETURNS STRING SONAME 'edb.so';
CREATE AGGREGATE FUNCTION cryptdb_agg RETURNS STRING SONAME 'edb.so'; CREATE AGGREGATE FUNCTION cryptdb_agg RETURNS STRING SONAME 'edb.so';
CREATE FUNCTION cryptdb_searchSWP RETURNS INTEGER SONAME 'edb.so'; CREATE FUNCTION cryptdb_searchSWP RETURNS INTEGER SONAME 'edb.so';
CREATE FUNCTION cryptdb_version RETURNS STRING SONAME 'edb.so'; CREATE FUNCTION cryptdb_version RETURNS STRING SONAME 'edb.so';
CREATE AGGREGATE FUNCTION cryptdb_asheagg RETURNS STRING SONAME 'edb.so';
...@@ -27,6 +27,7 @@ typedef long long longlong; ...@@ -27,6 +27,7 @@ typedef long long longlong;
#include <mysql/mysql.h> #include <mysql/mysql.h>
#include <ctype.h> #include <ctype.h>
//SEM INT
my_bool cryptdb_decrypt_int_sem_init(UDF_INIT *const initid, my_bool cryptdb_decrypt_int_sem_init(UDF_INIT *const initid,
UDF_ARGS *const args, UDF_ARGS *const args,
char *const message); char *const message);
...@@ -34,12 +35,14 @@ ulonglong cryptdb_decrypt_int_sem(UDF_INIT *const initid, ...@@ -34,12 +35,14 @@ ulonglong cryptdb_decrypt_int_sem(UDF_INIT *const initid,
UDF_ARGS *const args, UDF_ARGS *const args,
char *const is_null, char *const error); char *const is_null, char *const error);
//DET INT
my_bool cryptdb_decrypt_int_det_init(UDF_INIT *const initid, my_bool cryptdb_decrypt_int_det_init(UDF_INIT *const initid,
UDF_ARGS *const args, UDF_ARGS *const args,
char *const message); char *const message);
ulonglong cryptdb_decrypt_int_det(UDF_INIT *const initid, UDF_ARGS *const args, ulonglong cryptdb_decrypt_int_det(UDF_INIT *const initid, UDF_ARGS *const args,
char *const is_null, char *const error); char *const is_null, char *const error);
//SEM STR
my_bool cryptdb_decrypt_text_sem_init(UDF_INIT *const initid, my_bool cryptdb_decrypt_text_sem_init(UDF_INIT *const initid,
UDF_ARGS *const args, char *const message); UDF_ARGS *const args, char *const message);
void cryptdb_decrypt_text_sem_deinit(UDF_INIT *const initid); void cryptdb_decrypt_text_sem_deinit(UDF_INIT *const initid);
...@@ -47,6 +50,7 @@ char * cryptdb_decrypt_text_sem(UDF_INIT *const initid, UDF_ARGS *const args, ...@@ -47,6 +50,7 @@ char * cryptdb_decrypt_text_sem(UDF_INIT *const initid, UDF_ARGS *const args,
char *const result, unsigned long *const length, char *const result, unsigned long *const length,
char *const is_null, char *const error); char *const is_null, char *const error);
//DET STR
my_bool cryptdb_decrypt_text_det_init(UDF_INIT *const initid, my_bool cryptdb_decrypt_text_det_init(UDF_INIT *const initid,
UDF_ARGS *const args, UDF_ARGS *const args,
char *const message); char *const message);
...@@ -55,12 +59,14 @@ char * cryptdb_decrypt_text_det(UDF_INIT *const initid, UDF_ARGS *const args, ...@@ -55,12 +59,14 @@ char * cryptdb_decrypt_text_det(UDF_INIT *const initid, UDF_ARGS *const args,
char *const result, unsigned long *const length, char *const result, unsigned long *const length,
char *const is_null, char *const error); char *const is_null, char *const error);
//SWP
my_bool cryptdb_searchSWP_init(UDF_INIT *const initid, UDF_ARGS *const args, my_bool cryptdb_searchSWP_init(UDF_INIT *const initid, UDF_ARGS *const args,
char *const message); char *const message);
void cryptdb_searchSWP_deinit(UDF_INIT *const initid); void cryptdb_searchSWP_deinit(UDF_INIT *const initid);
ulonglong cryptdb_searchSWP(UDF_INIT *const initid, UDF_ARGS *const args, ulonglong cryptdb_searchSWP(UDF_INIT *const initid, UDF_ARGS *const args,
char *const is_null, char *const error); char *const is_null, char *const error);
//agg
my_bool cryptdb_agg_init(UDF_INIT *const initid, UDF_ARGS *const args, my_bool cryptdb_agg_init(UDF_INIT *const initid, UDF_ARGS *const args,
char *const message); char *const message);
void cryptdb_agg_deinit(UDF_INIT *const initid); void cryptdb_agg_deinit(UDF_INIT *const initid);
...@@ -72,6 +78,19 @@ char * cryptdb_agg(UDF_INIT *const initid, UDF_ARGS *const args, ...@@ -72,6 +78,19 @@ char * cryptdb_agg(UDF_INIT *const initid, UDF_ARGS *const args,
char *const result, unsigned long *const length, char *const result, unsigned long *const length,
char *const is_null, char *const error); char *const is_null, char *const error);
//ashe
my_bool cryptdb_asheagg_init(UDF_INIT *const initid, UDF_ARGS *const args,
char *const message);
void cryptdb_asheagg_deinit(UDF_INIT *const initid);
void cryptdb_asheagg_clear(UDF_INIT *const initid, char *const is_null,
char *const error);
my_bool cryptdb_asheagg_add(UDF_INIT *const initid, UDF_ARGS *const args,
char *const is_null, char *const error);
char* cryptdb_asheagg(UDF_INIT *const initid, UDF_ARGS *const args,
char *const result, unsigned long *const length,
char *const is_null, char *const error);
//add_set
my_bool cryptdb_func_add_set_init(UDF_INIT *const initid, UDF_ARGS *const args, my_bool cryptdb_func_add_set_init(UDF_INIT *const initid, UDF_ARGS *const args,
char *const message); char *const message);
void cryptdb_func_add_set_deinit(UDF_INIT *const initid); void cryptdb_func_add_set_deinit(UDF_INIT *const initid);
...@@ -79,12 +98,18 @@ char * cryptdb_func_add_set(UDF_INIT *const initid, UDF_ARGS *const args, ...@@ -79,12 +98,18 @@ char * cryptdb_func_add_set(UDF_INIT *const initid, UDF_ARGS *const args,
char *const result, unsigned long *const length, char *const result, unsigned long *const length,
char *const is_null, char *const error); char *const is_null, char *const error);
//version
my_bool cryptdb_version_init(UDF_INIT *const initid, UDF_ARGS *const args, my_bool cryptdb_version_init(UDF_INIT *const initid, UDF_ARGS *const args,
char *const message); char *const message);
void cryptdb_version_deinit(UDF_INIT *const initid); void cryptdb_version_deinit(UDF_INIT *const initid);
char * cryptdb_version(UDF_INIT *const initid, UDF_ARGS *const args, char * cryptdb_version(UDF_INIT *const initid, UDF_ARGS *const args,
char *const result, unsigned long *const length, char *const result, unsigned long *const length,
char *const is_null, char *const error); char *const is_null, char *const error);
//token
//long long myadd(UDF_INIT *initid, UDF_ARGS *args,
// char *is_null, char *error);
//my_bool myadd_init(UDF_INIT *initid, UDF_ARGS *args,
// char *message);
} /* extern "C" */ } /* extern "C" */
...@@ -525,6 +550,41 @@ cryptdb_agg(UDF_INIT *const initid, UDF_ARGS *const args, char *const result, ...@@ -525,6 +550,41 @@ cryptdb_agg(UDF_INIT *const initid, UDF_ARGS *const args, char *const result,
} }
//begin ashe sum
my_bool cryptdb_asheagg_init(UDF_INIT *const initid, UDF_ARGS *const args,
char *const message) {
long long * i = new long long;
initid->ptr = (char*)i;
return 0;
}
void cryptdb_asheagg_deinit(UDF_INIT *const initid) {
delete initid->ptr;
}
void cryptdb_asheagg_clear(UDF_INIT *const initid, char *const is_null,
char *const error) {
*((long long *)(initid->ptr)) = 0;
}
my_bool cryptdb_asheagg_add(UDF_INIT *const initid, UDF_ARGS *const args,
char *const is_null, char *const error) {
*((long long *)(initid->ptr)) = *((long long *)(initid->ptr)) +
*((long long *)args->args[0]);
return 0;
}
char* cryptdb_asheagg(UDF_INIT *const initid, UDF_ARGS *const args,
char *const result, unsigned long *const length,
char *const is_null, char *const error) {
return NULL;
}
/* /*
***************************************************************************** *****************************************************************************
*/ */
...@@ -631,3 +691,24 @@ cryptdb_version(UDF_INIT *const initid, UDF_ARGS *const args, ...@@ -631,3 +691,24 @@ cryptdb_version(UDF_INIT *const initid, UDF_ARGS *const args,
return static_cast<char*>(initid->ptr); return static_cast<char*>(initid->ptr);
} }
//token
/*
my_bool myadd_init(UDF_INIT *initid, UDF_ARGS *args,
char *message){
return 0;
}
long long myadd(UDF_INIT *initid, UDF_ARGS *args,
char *is_null, char *error) {
int a = *((long long *)args->args[0]);
int b = *((long long *)args->args[1]);
return a + b;
}
*/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment