Re: [sqlite] Using Eclipse on Windows XP
Hi, what you need are first Eclipse, the C Development Tools (CDT) and a compiler for Example the MinGW Here are the links for the tools I used for my project. http://getamosaic.sourceforge.net/links.php regards, Tobias Alex Krzos schrieb: > Is there an easy way to develop on sqlite using eclipse for C/C++ on a > Windows XP machine? I have eclipse open on a source directory but can not > compile. Is there a possible faq or wiki on this? Thanks. > > Alex > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Delete Trigger on INSERT OR REPLACE?
Hi Jay, thank you for your quick answer. I will now probably code the insert or replace by myself using the delete. To solve this is in my application not a big issue, but I like referential integrity. /Tobias Jay A. Kreibich schrieb: > That's the documented behavior: > http://www.sqlite.org/lang_conflict.html ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Delete Trigger on INSERT OR REPLACE?
Hello Martin, wow 7 Minutes to scan the manual. Yes I know RTFM :o The update trigger is not issued if this test is correct here: sqlite> create trigger fku before update on ch for each row begin delete from blobdata where chId=old.id; end; sqlite> select fname from ch limit 1; 100_5763.JPG.JPG sqlite> select * from ch limit 1; 1|100_5763.JPG.JPG|137|118|127|512 sqlite> insert or replace into ch(fname, red, green, blue, dsize) values ('xxx', 0, 0, 0, 0); sqlite> select chId from blobdata where chId = 1; 1 The entry is still here. Tobias Martin Engelschalk schrieb: > Hello Tobi, > > See http://www.sqlite.org/lang_conflict.html, near the bottom: > > "When this conflict resolution strategy deletes rows in order to satisfy > a constraint, it does not invoke delete triggers on those rows. This > behavior might change in a future release." > > I would be interested if an UPDATE - Trigger is invoked instead. Perhaps > you could try it? > > Martin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Inserting an image file?
Hello, I have an open source application using that. You can look at the complete source here: http://getamosaic.svn.sourceforge.net/viewvc/getamosaic/trunk/GetAMosaic/dbAccess.c?revision=28=markup Method name: dbAddCharacteristicWData regards, Tobias aditya siram schrieb: > How do I insert an image file into sqlite table? Can I just use a > path-specifier? For instance, > create table ("name" varchar, "data" blob); > insert into table ("someBlob", "./blob.jpg"); ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Delete Trigger on INSERT OR REPLACE?
Hello, i have a question. In my application I issue an insert or replace operation. It seems that the delete trigger is not executed here. Is there a special replace trigger? Thanks for your help. regards, Tobias Here my Session: sqlite> select * from ch; 1|100_4664.JPG|103|94|98|64 2|100_4665.JPG|94|87|88|64 sqlite> select chId from blobdata; 1 2 sqlite> insert or replace into ch(fname) values ('100_4664.JPG'); sqlite> select chId from blobdata; 1 2 My scheme is: table|ch|ch|2|CREATE TABLE ch(id INTEGER PRIMARY KEY, fname TEXT UNIQUE, red INTEGER, green INTEGER, blue INTEGER, dsize INTEGER) index|sqlite_autoindex_ch_1|ch|3| table|blobdata|blobdata|4|CREATE TABLE blobdata(id INTEGER PRIMARY KEY,data BLOB, chId INTEGER) trigger|fkd|ch|0|CREATE TRIGGER fkd BEFORE DELETE ON ch FOR EACH ROW BEGIN DELETE from blobdata WHERE chId = OLD.id; END trigger|fki|blobdata|0|CREATE TRIGGER fki BEFORE INSERT ON blobdata FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert invalid') WHERE (SELECT id FROM ch WHERE id = NEW.chId) IS NULL; END index|chIdIdx|blobdata|5|CREATE UNIQUE INDEX chIdIdx ON blobdata(chId) ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sqlite3_get_table question
Hi, thanks Dan. This was certainly the problem, since there are a lot of zeros in the data. In the meahnwhile I tried out something different. I heard from the incremental blob API. And it worked!!! Here is how I solved it: if(sqlite3_prepare_v2(db, cmd, strlen(cmd), , 0) != SQLITE_OK) { printf("Could not prepare statement.\n"); return; } rc = sqlite3_step(pStmt); if( rc==SQLITE_ROW ) { newBlobSize = sqlite3_column_bytes(pStmt, 2); if(newBlobSize > blobSize || blobData == NULL) { printf("(re)allocating buffer\n"); if(blobData != NULL) free(blobData); blobData = malloc(newBlobSize); blobSize = newBlobSize; } memcpy(blobData, sqlite3_column_blob(pStmt, 2), newBlobSize); } Now I only need to solve a speed problem, but this I will first try out by myself:-) Thanks for your help Tobias >>> Date: Mon, 29 Dec 2008 11:20:58 +0700 >>> From: Dan>>> Subject: Re: [sqlite] sqlite3_get_table question >>> To: General Discussion of SQLite Database >>> Message-ID: <65fa0cc6-4248-4675-8100-f069423e0...@gmail.com >> >>> Why (ncol+2)? >> >> I make the following select statement: >> >> SELECT fname, dsize, data, ABS(red-%d)+ABS(green-%d)+ABS(blue-%d) err >> FROM ch ORDER BY err LIMIT 1; >> >> If I want to have the data then this would be 2 + the number of >> heading >> columns (ncol) > > Right. Obviously. > > Note that sqlite3_get_table() won't work for data with embedded 0x00 > bytes. > It will truncate each value at the first one encountered. That could be > the problem. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sqlite3_get_table question
> Date: Mon, 29 Dec 2008 11:20:58 +0700 > From: Dan> Subject: Re: [sqlite] sqlite3_get_table question > To: General Discussion of SQLite Database > Message-ID: <65fa0cc6-4248-4675-8100-f069423e0...@gmail.com > Why (ncol+2)? I make the following select statement: SELECT fname, dsize, data, ABS(red-%d)+ABS(green-%d)+ABS(blue-%d) err FROM ch ORDER BY err LIMIT 1; If I want to have the data then this would be 2 + the number of heading columns (ncol) The database structure is like the following: CREATE TABLE IF NOT EXISTS ch( fname TEXT UNIQUE, red INTEGER, green INTEGER, blue INTEGER, dsize INTEGER, data BLOB); Does anybody sees a possible solution for accessing the data (blob) for indexes (rgb) higher than 4k Pixels? Regards, Tobias ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] sqlite3_get_table question
Hi, I retrieve data (1 row only) via the handy getTable function. Inside this row is one blob object with pixeldata. The size is: 256*256 Pixels with 3 bytes each -> 256*256*3 = 196608 Bytes select length(data) from ch; gives me exactly this number. No I try this: typedef struct { unsigned char red; unsigned char green; unsigned char blue; }Pixel; Pixel *dbData; Pixel *pSrcP; rc = sqlite3_get_table(db, cmd, , , , ); if(rc != SQLITE_OK || nrow!= 1 || zErrMsg!=NULL) { printf("Error in getting data from the db\n"); return; } dbData = (Pixel *) result[ncol+2]; pSrcP = &(dbData[4096]); This should be well below the limit of 256*256=65536 pixels, but i get an segmentation fault now: r = pSrcP->red; So now this limit (4096) is probaly the limit for near pointers on win32, right? What way would be the best to access the whole data inside the table, is there a way to get the data in chunks? My compiler is mingw32 Thank you for any hint, Tobias ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users