Overview
Comment: | Implement INSERT/UPDATE/DELETE for OBJECTS virtual table (untested) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
ec1c70d3d16ce8fb99ebdd5526821ec2 |
User & Date: | user on 2018-09-10 01:16:35 |
Other Links: | manifest | tags |
Context
2018-10-07
| ||
04:25 | Make some improvements to compile script, and start edit.c (just a stub so far) check-in: 3f12058d2d user: user tags: trunk | |
2018-09-10
| ||
01:16 | Implement INSERT/UPDATE/DELETE for OBJECTS virtual table (untested) check-in: ec1c70d3d1 user: user tags: trunk | |
2018-08-24
| ||
15:12 | Add OF_BIZARRO flag, change OF_TRACEIN/OF_TRACEOUT to CF_TRACEIN/CF_TRACEOUT, fix a bug in update logic for CLASSES vtab check-in: 966114bc2f user: user tags: trunk | |
Changes
Modified function.c from [b0c90043b3] to [1a656a59ae].
︙ | |||
847 848 849 850 851 852 853 854 | 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + | arg=sqlite3_str_errcode(str); info->idxStr=sqlite3_str_finish(str); info->needToFreeIdxStr=1; return arg; } static int vt1_objects_update(sqlite3_vtab*vt,int argc,sqlite3_value**argv,sqlite3_int64*rowid) { sqlite3_int64 id; int x,y,z; if(!main_options['e']) return SQLITE_LOCKED; if(argc==1) { // DELETE id=sqlite3_value_int64(argv[0]); pfunlink(id); free(objects[id]); objects[id]=0; } else if(sqlite3_value_type(argv[0])==SQLITE_NULL) { // INSERT if(sqlite3_value_type(argv[1])!=SQLITE_NULL || sqlite3_value_type(argv[2])!=SQLITE_NULL) return SQLITE_CONSTRAINT_VTAB; 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 id=sqlite3_value_int64(argv[0]); if(id!=sqlite3_value_int64(argv[1]) || id!=sqlite3_value_int64(argv[2])) return SQLITE_CONSTRAINT_VTAB; if(sqlite3_value_type(argv[3])==SQLITE_NULL) return SQLITE_CONSTRAINT_NOTNULL; if(sqlite3_value_type(argv[7])==SQLITE_NULL) return SQLITE_CONSTRAINT_NOTNULL; 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; if(sqlite3_value_int(argv[3])!=objects[id]->class) return SQLITE_CONSTRAINT_VTAB; if(sqlite3_value_int(argv[13])!=objects[id]->density) return SQLITE_CONSTRAINT_VTAB; z=objects[id]->class; if(sqlite3_value_int(argv[7])<0 || sqlite3_value_int(argv[7])>=classes[z]->nimages) return SQLITE_CONSTRAINT_CHECK; if(x!=objects[id]->x || y!=objects[id]->y) { pfunlink(id); update: objects[id]->x=x; objects[id]->y=y; pflink(id); |
︙ |
Modified heromesh.h from [f8558aace9] to [bef1fa2bb9].
︙ | |||
188 189 190 191 192 193 194 | 188 189 190 191 192 193 194 | - | extern Uint8 pfwidth,pfheight; void pfunlink(Uint32 n); void pflink(Uint32 n); Uint32 objalloc(Uint16 c); void annihilate(void); const char*execute_turn(int key); |