88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
case 132: sqlite3_result_int(cxt,cl->cflags&CF_COMPATIBLE?1:0); break;
}
}
static void fn_cvalue(sqlite3_context*cxt,int argc,sqlite3_value**argv) {
int a;
if(sqlite3_value_type(*argv)==SQLITE_NULL) return;
a=sqlite3_value_int(*argv)&0xFFFF;
sqlite3_result_int64(cxt,a|((sqlite3_int64)TY_CLASS<<32));
}
static void fn_heromesh_escape(sqlite3_context*cxt,int argc,sqlite3_value**argv) {
const unsigned char*u=sqlite3_value_blob(*argv);
int un=sqlite3_value_bytes(*argv);
char*e;
int en=0;
|
>
>
>
>
>
>
>
|
>
>
|
|
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
case 132: sqlite3_result_int(cxt,cl->cflags&CF_COMPATIBLE?1:0); break;
}
}
static void fn_cvalue(sqlite3_context*cxt,int argc,sqlite3_value**argv) {
int a;
if(sqlite3_value_type(*argv)==SQLITE_NULL) return;
if(sqlite3_value_type(*argv)==SQLITE_TEXT || sqlite3_value_type(*argv)==SQLITE_BLOB) {
const char*s=sqlite3_value_text(*argv);
for(a=1;a<0x4000;a++) {
if(classes[a] && !(classes[a]->cflags&CF_NOCLASS2) && !strcmp(s,classes[a]->name)) goto found;;
}
return;
} else {
a=sqlite3_value_int(*argv)&0xFFFF;
if(!a || (a&~0x3FFF) || !classes[a] || (classes[a]->cflags&CF_NOCLASS2)) return;
}
found: sqlite3_result_int64(cxt,a|((sqlite3_int64)TY_CLASS<<32));
}
static void fn_heromesh_escape(sqlite3_context*cxt,int argc,sqlite3_value**argv) {
const unsigned char*u=sqlite3_value_blob(*argv);
int un=sqlite3_value_bytes(*argv);
char*e;
int en=0;
|
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
|
if(sqlite3_value_type(argv[3])==SQLITE_NULL) return SQLITE_CONSTRAINT_NOTNULL;
if(sqlite3_value_type(argv[7])==SQLITE_NULL) return SQLITE_CONSTRAINT_NOTNULL;
if(sqlite3_value_type(argv[11])!=SQLITE_NULL) return SQLITE_CONSTRAINT_VTAB;
if(sqlite3_value_type(argv[12])!=SQLITE_NULL) return SQLITE_CONSTRAINT_VTAB;
x=sqlite3_value_int(argv[9]);
y=sqlite3_value_int(argv[10]);
if(x<1 || x>pfwidth || y<1 || y>pfheight) return SQLITE_CONSTRAINT_CHECK;
z=sqlite3_value_type(argv[3]);
if(z<=0 || z>=0x4000 || !classes[z]) return SQLITE_CONSTRAINT_FOREIGNKEY;
if(sqlite3_value_int(argv[7])<0 || sqlite3_value_int(argv[7])>=classes[z]->nimages) return SQLITE_CONSTRAINT_CHECK;
id=objalloc(z);
if(id==VOIDLINK) return SQLITE_CONSTRAINT_VTAB;
goto update;
} else {
// UPDATE
|
|
|
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
|
if(sqlite3_value_type(argv[3])==SQLITE_NULL) return SQLITE_CONSTRAINT_NOTNULL;
if(sqlite3_value_type(argv[7])==SQLITE_NULL) return SQLITE_CONSTRAINT_NOTNULL;
if(sqlite3_value_type(argv[11])!=SQLITE_NULL) return SQLITE_CONSTRAINT_VTAB;
if(sqlite3_value_type(argv[12])!=SQLITE_NULL) return SQLITE_CONSTRAINT_VTAB;
x=sqlite3_value_int(argv[9]);
y=sqlite3_value_int(argv[10]);
if(x<1 || x>pfwidth || y<1 || y>pfheight) return SQLITE_CONSTRAINT_CHECK;
z=sqlite3_value_int(argv[3]);
if(z<=0 || z>=0x4000 || !classes[z]) return SQLITE_CONSTRAINT_FOREIGNKEY;
if(sqlite3_value_int(argv[7])<0 || sqlite3_value_int(argv[7])>=classes[z]->nimages) return SQLITE_CONSTRAINT_CHECK;
id=objalloc(z);
if(id==VOIDLINK) return SQLITE_CONSTRAINT_VTAB;
goto update;
} else {
// UPDATE
|