33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
static void fn_basename(sqlite3_context*cxt,int argc,sqlite3_value**argv) {
sqlite3_result_text(cxt,basefilename,-1,SQLITE_STATIC);
}
static void fn_cacheid(sqlite3_context*cxt,int argc,sqlite3_value**argv) {
sqlite3_result_int64(cxt,*(sqlite3_int64*)sqlite3_user_data(cxt));
}
static void fn_class_data(sqlite3_context*cxt,int argc,sqlite3_value**argv) {
int id=sqlite3_value_int(argv[0]);
Class*cl;
if(id<0 || id>=0x4000 || !classes[id]) return;
cl=classes[id];
switch(sqlite3_value_int(argv[1])&255) {
|
>
>
>
>
>
>
>
>
>
>
>
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
static void fn_basename(sqlite3_context*cxt,int argc,sqlite3_value**argv) {
sqlite3_result_text(cxt,basefilename,-1,SQLITE_STATIC);
}
static void fn_cacheid(sqlite3_context*cxt,int argc,sqlite3_value**argv) {
sqlite3_result_int64(cxt,*(sqlite3_int64*)sqlite3_user_data(cxt));
}
static void fn_cl(sqlite3_context*cxt,int argc,sqlite3_value**argv) {
int a;
const char*s=sqlite3_value_text(*argv);
if(!s) return;
for(a=1;a<0x4000;a++) {
if(classes[a] && !(classes[a]->cflags&CF_NOCLASS2) && !strcmp(s,classes[a]->name)) goto found;
}
return;
found: sqlite3_result_int(cxt,a);
}
static void fn_class_data(sqlite3_context*cxt,int argc,sqlite3_value**argv) {
int id=sqlite3_value_int(argv[0]);
Class*cl;
if(id<0 || id>=0x4000 || !classes[id]) return;
cl=classes[id];
switch(sqlite3_value_int(argv[1])&255) {
|
948
949
950
951
952
953
954
955
956
957
958
959
960
961
|
.xFilter=vt1_objects_filter,
.xNext=vt1_objects_next,
.xUpdate=vt1_objects_update,
);
void init_sql_functions(sqlite3_int64*ptr0,sqlite3_int64*ptr1) {
sqlite3_create_function(userdb,"BASENAME",0,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_basename,0,0);
sqlite3_create_function(userdb,"CLASS_DATA",2,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_class_data,0,0);
sqlite3_create_function(userdb,"CVALUE",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_cvalue,0,0);
sqlite3_create_function(userdb,"HEROMESH_ESCAPE",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_heromesh_escape,0,0);
sqlite3_create_function(userdb,"HEROMESH_TYPE",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_heromesh_type,0,0);
sqlite3_create_function(userdb,"HEROMESH_UNESCAPE",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_heromesh_unescape,0,0);
sqlite3_create_function(userdb,"LEVEL",0,SQLITE_UTF8,&level_ord,fn_level,0,0);
sqlite3_create_function(userdb,"LEVEL_CACHEID",0,SQLITE_UTF8|SQLITE_DETERMINISTIC,ptr0,fn_cacheid,0,0);
|
>
|
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
|
.xFilter=vt1_objects_filter,
.xNext=vt1_objects_next,
.xUpdate=vt1_objects_update,
);
void init_sql_functions(sqlite3_int64*ptr0,sqlite3_int64*ptr1) {
sqlite3_create_function(userdb,"BASENAME",0,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_basename,0,0);
sqlite3_create_function(userdb,"CL",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_cl,0,0);
sqlite3_create_function(userdb,"CLASS_DATA",2,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_class_data,0,0);
sqlite3_create_function(userdb,"CVALUE",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_cvalue,0,0);
sqlite3_create_function(userdb,"HEROMESH_ESCAPE",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_heromesh_escape,0,0);
sqlite3_create_function(userdb,"HEROMESH_TYPE",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_heromesh_type,0,0);
sqlite3_create_function(userdb,"HEROMESH_UNESCAPE",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_heromesh_unescape,0,0);
sqlite3_create_function(userdb,"LEVEL",0,SQLITE_UTF8,&level_ord,fn_level,0,0);
sqlite3_create_function(userdb,"LEVEL_CACHEID",0,SQLITE_UTF8|SQLITE_DETERMINISTIC,ptr0,fn_cacheid,0,0);
|