127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
static int vt_graph_rowid(sqlite3_vtab_cursor*cc,sqlite3_int64*p) {
Cursor*cur=(void*)cc;
*p=cur->pos;
return SQLITE_OK;
}
static int vt_graph_update(sqlite3_vtab*vt,int argc,sqlite3_value**argv,sqlite3_int64*rowid) {
if(argc!=5 || sqlite3_value_type(argv[0])==SQLITE_NULL) return SQLITE_ERROR;
cur_pic->data[cur_pic->size+sqlite3_value_int(argv[0])]=sqlite3_value_int(argv[4]);
return SQLITE_OK;
}
static const sqlite3_module vt_graph={
.iVersion=1,
.xBestIndex=vt_graph_index,
.xClose=vt_graph_close,
|
>
>
|
>
>
>
>
>
|
>
>
|
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
static int vt_graph_rowid(sqlite3_vtab_cursor*cc,sqlite3_int64*p) {
Cursor*cur=(void*)cc;
*p=cur->pos;
return SQLITE_OK;
}
static int vt_graph_update(sqlite3_vtab*vt,int argc,sqlite3_value**argv,sqlite3_int64*rowid) {
int x,y;
if(argc!=5) return SQLITE_CONSTRAINT_VTAB;
if(sqlite3_value_type(argv[0])==SQLITE_NULL) {
x=sqlite3_value_int(argv[2]);
y=sqlite3_value_int(argv[3]);
if(x<0 || x>=cur_pic->size || y<0 || y>=cur_pic->size) return SQLITE_CONSTRAINT_VTAB;
x+=y*cur_pic->size;
} else {
x=sqlite3_value_int(argv[0]);
}
cur_pic->data[cur_pic->size+x]=sqlite3_value_int(argv[4]);
return SQLITE_OK;
}
static const sqlite3_module vt_graph={
.iVersion=1,
.xBestIndex=vt_graph_index,
.xClose=vt_graph_close,
|