[sqlite] Mistake in threadtest3.c
Hi, I was looking at the diff to threadtest3.c in recent commit at http://www.sqlite.org/src/fdiff?v1=58df1e3c060f534fv2=d6d209190c7110f9, and I think I may have spotted an mistake in the code at the end of the function static void dynamic_triggers(int nMs). The code here runs as follows: [... snip ...] sqlite3_enable_shared_cache(1); launch_thread(err, threads, dynamic_triggers_2, 0); launch_thread(err, threads, dynamic_triggers_2, 0); sqlite3_enable_shared_cache(0); sleep(2); launch_thread(err, threads, dynamic_triggers_2, 0); launch_thread(err, threads, dynamic_triggers_1, 0); [... snip ...] Should it not be launching both dynamic_triggers_1 and dynamic_triggers_2 in the first instance, like it does in the second instance? Cheers Andy ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Mistake in threadtest3.c
On Nov 2, 2010, at 5:12 PM, Andy Gibbs wrote: Hi, I was looking at the diff to threadtest3.c in recent commit at http://www.sqlite.org/src/fdiff?v1=58df1e3c060f534fv2=d6d209190c7110f9 , and I think I may have spotted an mistake in the code at the end of the function static void dynamic_triggers(int nMs). The code here runs as follows: [... snip ...] sqlite3_enable_shared_cache(1); launch_thread(err, threads, dynamic_triggers_2, 0); launch_thread(err, threads, dynamic_triggers_2, 0); sqlite3_enable_shared_cache(0); sleep(2); launch_thread(err, threads, dynamic_triggers_2, 0); launch_thread(err, threads, dynamic_triggers_1, 0); [... snip ...] Should it not be launching both dynamic_triggers_1 and dynamic_triggers_2 in the first instance, like it does in the second instance? Fair question. But in this case no. The idea was to have one thread modifying the triggers. Then several other reader threads using the database with the reader threads using both shared and unshared caches. Dan. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Mistake in threadtest3.c
On Tuesday, November 02, 2010 11:23 AM, Dan Kennedy wrote: Fair question. But in this case no. The idea was to have one thread modifying the triggers. Then several other reader threads using the database with the reader threads using both shared and unshared caches. Then that's good. Thought I'd ask anyway, just in case... Cheers Andy ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] 'no such column' error returned in a CASE statement
The following error 'no such column: A' is returned when i execute the following statement. SELECT 'test' as A,CASE WHEN A = 'test' THEN 'true' ELSE 'false' END as ERRVAL Is this the expected result or should the generated column be available to the case statement. Thanks. -- View this message in context: http://old.nabble.com/%27no-such-column%27-error-returned-in-a-CASE-statement-tp30113686p30113686.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] 'no such column' error returned in a CASE statement
This works: sqlite select a,case when a='test' then 'true' else 'false' end from (sele ct 'test' as a) as errval; test|true sqlite select a,case when a='test' then 'true' else 'false' end from (sele ct 'test2' as a) as errval; test2|false I suppose there's another solution too... Michael D. Black Senior Scientist Advanced Analytics Directorate Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org on behalf of Ioannis Epaminonda Sent: Tue 11/2/2010 8:19 AM To: sqlite-users@sqlite.org Subject: EXTERNAL:[sqlite] 'no such column' error returned in a CASE statement The following error 'no such column: A' is returned when i execute the following statement. SELECT 'test' as A,CASE WHEN A = 'test' THEN 'true' ELSE 'false' END as ERRVAL Is this the expected result or should the generated column be available to the case statement. Thanks. -- View this message in context: http://old.nabble.com/%27no-such-column%27-error-returned-in-a-CASE-statement-tp30113686p30113686.html Sent from the SQLite mailing list archive at Nabble.com. ___ 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
[sqlite] R*Tree module and double precision?
Hi everyone, I want to use an R*tree table in sqlite. Unfortunately, it turned out that it saves data always as single precision (32-bit) float, no matter what type is specified. For my application, that is not precise enough. Does anyone know of an r*tree implementation for sqlite that supports higher precision? Or is there a patch about somewhere? Thanks, Wiebke ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] 'no such column' error returned in a CASE statement
This works: sqlite select a,case when a='test' then 'true' else 'false' end from (sele ct 'test' as a) as errval; I guess OP meant it like this: select a,case when a='test' then 'true' else 'false' end as errval from (select 'test' as a); And to answer the question: Is this the expected result or should the generated column be available to the case statement. Yes, it's expected. Column aliases are visible only in GROUP BY/ORDER BY/HAVING clauses and outer selects. All other places should use exact column expression instead. Pavel On Tue, Nov 2, 2010 at 10:39 AM, Black, Michael (IS) michael.bla...@ngc.com wrote: This works: sqlite select a,case when a='test' then 'true' else 'false' end from (sele ct 'test' as a) as errval; test|true sqlite select a,case when a='test' then 'true' else 'false' end from (sele ct 'test2' as a) as errval; test2|false I suppose there's another solution too... Michael D. Black Senior Scientist Advanced Analytics Directorate Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org on behalf of Ioannis Epaminonda Sent: Tue 11/2/2010 8:19 AM To: sqlite-users@sqlite.org Subject: EXTERNAL:[sqlite] 'no such column' error returned in a CASE statement The following error 'no such column: A' is returned when i execute the following statement. SELECT 'test' as A,CASE WHEN A = 'test' THEN 'true' ELSE 'false' END as ERRVAL Is this the expected result or should the generated column be available to the case statement. Thanks. -- View this message in context: http://old.nabble.com/%27no-such-column%27-error-returned-in-a-CASE-statement-tp30113686p30113686.html Sent from the SQLite mailing list archive at Nabble.com. ___ 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 ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] R*Tree module and double precision?
I made a patch which seems to do this for you...once in a while it's fun to do a bit of programming like this...I didn't do extensive testing on this so you may want to do some yourself. It's going to just about double the RTREE size of course. SQLite version 3.7.3 Enter .help for instructions Enter SQL statements terminated with a ; sqlite CREATE VIRTUAL TABLE demo_index USING rtree( ...id, -- Integer primary key ...minX, maxX, -- Minimum and maximum X coordinate ...minY, maxY -- Minimum and maximum Y coordinate ... ); sqlite INSERT INTO demo_index VALUES( ... 1, -- Primary key ... -80.7749, -80.7747, -- Longitude range ... 30.3776, 30.3778 -- Latitude range ... ); sqlite INSERT INTO demo_index VALUES( ... 2, ... -81.0, -79.6, ... 35.0, 36.2 ... ); sqlite INSERT INTO demo_index VALUES(3,-80.77491234,-80.77471234,30.37761234,30 .37781234); sqlite select * from demo_index; 1|-80.7749|-80.7747|30.3776|30.3778 2|-81.0|-79.6|35.0|36.2 3|-80.77491234|-80.77471234|30.37761234|30.37781234 Use this switch to enable double precision on RTREE /DRTREE_DOUBLE *** ..\..\sqlite3.c Thu Oct 07 22:36:26 2010 --- sqlite3.c Tue Nov 02 10:43:16 2010 *** *** 116902,116909 --- 116902,116914 }; union RtreeCoord { + #ifndef RTREE_DOUBLE float f; int i; + #else + double f; + u64 i; + #endif }; /* *** *** 117006,117011 --- 117011,117017 return (p[0]8) + p[1]; } static void readCoord(u8 *p, RtreeCoord *pCoord){ + #ifndef RTREE_DOUBLE u32 i = ( (((u32)p[0]) 24) + (((u32)p[1]) 16) + *** *** 117013,117018 --- 117019,117037 (((u32)p[3]) 0) ); *(u32 *)pCoord = i; + #else + u64 i = ( + (((u64)p[0]) 56) + + (((u64)p[1]) 48) + + (((u64)p[2]) 40) + + (((u64)p[3]) 32) + + (((u64)p[4]) 24) + + (((u64)p[5]) 16) + + (((u64)p[6]) 8) + + (((u64)p[7]) 0) + ); + *(u64 *)pCoord = i; + #endif } static i64 readInt64(u8 *p){ return ( *** *** 117038,117043 --- 117057,117063 return 2; } static int writeCoord(u8 *p, RtreeCoord *pCoord){ + #ifndef RTREE_DOUBLE u32 i; assert( sizeof(RtreeCoord)==4 ); assert( sizeof(u32)==4 ); *** *** 117047,117052 --- 117067,117087 p[2] = (i 8)0xFF; p[3] = (i 0)0xFF; return 4; + #else + u64 i; + assert( sizeof(RtreeCoord)==8 ); + assert( sizeof(u64)==8 ); + i = *(u64 *)pCoord; + p[0] = (i56)0xFF; + p[1] = (i48)0xFF; + p[2] = (i40)0xFF; + p[3] = (i32)0xFF; + p[4] = (i24)0xFF; + p[5] = (i16)0xFF; + p[6] = (i 8)0xFF; + p[7] = (i 0)0xFF; + return 8; + #endif } static int writeInt64(u8 *p, i64 i){ p[0] = (i56)0xFF; *** *** 117365,117371 --- 117400,117410 int iCoord, RtreeCoord *pCoord /* Space to write result to */ ){ + #ifndef RTREE_DOUBLE readCoord(pNode-zData[12 + pRtree-nBytesPerCell*iCell + 4*iCoord], pCoord); + #else + readCoord(pNode-zData[12 + pRtree-nBytesPerCell*iCell + 8*iCoord], pCoord); + #endif } /* *** *** 119463,119470 --- 119502,119514 assert( nData==(pRtree-nDim*2 + 3) ); if( pRtree-eCoordType==RTREE_COORD_REAL32 ){ for(ii=0; ii(pRtree-nDim*2); ii+=2){ + #ifndef RTREE_DOUBLE cell.aCoord[ii].f = (float)sqlite3_value_double(azData[ii+3]); cell.aCoord[ii+1].f = (float)sqlite3_value_double(azData[ii+4]); + #else + cell.aCoord[ii].f = sqlite3_value_double(azData[ii+3]); + cell.aCoord[ii+1].f = sqlite3_value_double(azData[ii+4]); + #endif if( cell.aCoord[ii].fcell.aCoord[ii+1].f ){ rc = SQLITE_CONSTRAINT; goto constraint; *** *** 119746,119752 --- 119790,119800 pRtree-zDb = (char *)pRtree[1]; pRtree-zName = pRtree-zDb[nDb+1]; pRtree-nDim = (argc-4)/2; + #ifndef RTREE_DOUBLE pRtree-nBytesPerCell = 8 + pRtree-nDim*4*2; + #else + pRtree-nBytesPerCell = 8 + pRtree-nDim*8*2; + #endif pRtree-eCoordType = eCoordType; memcpy(pRtree-zDb, argv[1], nDb); memcpy(pRtree-zName, argv[2], nName); *** *** 119818,119824 --- 119866,119877 memset(node, 0, sizeof(RtreeNode)); memset(tree, 0, sizeof(Rtree)); tree.nDim = sqlite3_value_int(apArg[0]); + #ifndef RTREE_DOUBLE tree.nBytesPerCell = 8 + 8 * tree.nDim; + #else + tree.nBytesPerCell = 8 + 16 * tree.nDim; + #endif + node.zData = (u8 *)sqlite3_value_blob(apArg[1]); for(ii=0; iiNCELL(node); ii++){ Michael D. Black Senior Scientist Advanced Analytics Directorate Northrop Grumman Information Systems ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] iPhone/iPad Database Disk Image Malformed
Hi All, My application was working fine, but now I get this message consistantly in the iPad simulator and on the device too when I try and run my updated database since iOS 4.0. My database was built on the PC and copied to the Mac and then into my xCode project which I've never had a problem with before. Is anyone else seeing this behavior? Any tips for debugging? Thanks Ray -- View this message in context: http://old.nabble.com/iPhone-iPad-Database-Disk-Image-Malformed-tp30118432p30118432.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] iPhone/iPad Database Disk Image Malformed
I believe you. The main problem is in the iPad simulator... funny thing is that the same database opens fine on the iPhone device and iPhone simulator. BareFeetWare-2 wrote: Hi Ray, In reply to: My application was working fine, but now I get this message consistantly in the iPad simulator and on the device too when I try and run my updated database since iOS 4.0. Is anyone else seeing this behavior? Any tips for debugging? For what it's worth I have several databases in an iPad/iPhone projects that I have been running for weeks in my Cocoa app on both iOS3.2 and iOS 4.x without a problem. Thanks, Tom BareFeetWare -- Comparison of SQLite GUI tools: http://www.barefeetware.com/sqlite/compare/?ml ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- View this message in context: http://old.nabble.com/iPhone-iPad-Database-Disk-Image-Malformed-tp30118432p30118566.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] iPhone/iPad Database Disk Image Malformed
On Tue, Nov 2, 2010 at 7:05 PM, Raeldor ray.pr...@gartner.com wrote: I believe you. The main problem is in the iPad simulator... funny thing is that the same database opens fine on the iPhone device and iPhone simulator. There is a bug in the iPad/iPhone simulator that causes SQLite to malfunction. The same bug is described here: http://www.openradar.me/8140890 Apple knows about the problem and will soon release a fix (if they have not already done so), I am told. BareFeetWare-2 wrote: Hi Ray, In reply to: My application was working fine, but now I get this message consistantly in the iPad simulator and on the device too when I try and run my updated database since iOS 4.0. Is anyone else seeing this behavior? Any tips for debugging? For what it's worth I have several databases in an iPad/iPhone projects that I have been running for weeks in my Cocoa app on both iOS3.2 and iOS 4.x without a problem. Thanks, Tom BareFeetWare -- Comparison of SQLite GUI tools: http://www.barefeetware.com/sqlite/compare/?ml ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- View this message in context: http://old.nabble.com/iPhone-iPad-Database-Disk-Image-Malformed-tp30118432p30118566.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] iPhone/iPad Database Disk Image Malformed
Ah, that's great to know... thank you for the link. I was going crazy trying to figure out what setting I'd screwed up. Thanks Ray On Tue, Nov 2, 2010 at 7:05 PM, Raeldor ray.pr...@gartner.com wrote: I believe you. The main problem is in the iPad simulator... funny thing is that the same database opens fine on the iPhone device and iPhone simulator. There is a bug in the iPad/iPhone simulator that causes SQLite to malfunction. The same bug is described here: http://www.openradar.me/8140890 Apple knows about the problem and will soon release a fix (if they have not already done so), I am told. -- View this message in context: http://old.nabble.com/iPhone-iPad-Database-Disk-Image-Malformed-tp30118432p30118608.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] HELP:The database disk image is malformed
Dear Sir: I am writing to enquire about a bug we found. Now the SQLITE3 database we use is version 3.6.23.1, which running in the red hat compiler and the hardware system is Linux(version 2.6).We have a problem that for select database(SQL),return The database disk image is malformed ,How to solve my trouble? (1)The reason of coming out The database disk image is malformed: In my system, the code that I carry out: sprintf(sql, select log_time,id,log_type,log_string from logrecord); renSql = sqlite3_get_table(BuDatabaseHandle, sql, azResult, nRow, nColumn, zErrMsg); it returns error11. After my analysis, I found anomalous data in the database table logrecord. In my attachment, the error data id=27490 in logrecord, I think the reason is carring out the function update. My function of update(sql) is: { sqlite3 * BuDatabaseHandle; if(open_database()==-1) return -1; sprintf(sql,update logrecord set upload_sign=1 where upload_sign=0 and id=%ld;,LogMaxId); renSql=sqlite3_exec( BuDatabaseHandle , sql , 0 , 0 , zErrMsg ); if(renSql!=0) { close_database(); return -4; } close_database(); } (2)Using the latest version3.7.2 to compile, when I carry out my function to insert data, I found that the Utilization rate of RAM(linux: /proc cat meminfo) have been reduced quickly. I don' kown, is it a BUG for the version3.7.2, because when I used version3.6.23 to compile my code, it had no problem. question? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] sqlite from fossil
Running fossil update recently on my sqlite sources, and trying to build I get $ ./configure configure: error: configure script is out of date: configure $PACKAGE_VERSION = 3.7.3 top level VERSION file = 3.7.4 please regen with autoconf After running autoconf, I get: If I update it manually, make complains about manifest.uuid missing. What am I missing? Regards, Benjamin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sqlite from fossil
Benjamin Peterson benja...@... writes: Running fossil update recently on my sqlite sources, and trying to build I get $ ./configure configure: error: configure script is out of date: configure $PACKAGE_VERSION = 3.7.3 top level VERSION file = 3.7.4 please regen with autoconf After running autoconf, I get: If I update it manually, make complains about manifest.uuid missing. What am I missing? You need to set: fossil setting manifest on Please check details at: http://www.fossil-scm.org/fossil/event?name=d6ba73e22 Peter Regards, Benjamin ___ sqlite-users mailing list sqlite-us...@... 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