Re: [sqlite] TCL Test failures on ARM

2013-03-12 Thread bkk
i tried putting break point at robust_ftruncate() but it was not successful 

(gdb) break robust_ftruncate 
Function "robust_ftruncate" not defined. 

the symbol table of testfixture was not having "robust_ftruncate" when i
read the testfixture(attached)". does it have anything to do with
crosscompiling ? 

below are the commands i used for cross compile  elfread
  

LDFLAGS=-L/home/philips/bk_tcl/usr/local/lib
CC=armv7l-timesys-linux-gnueabi-gcc ./configure
--host=armv7l-timesys-linux-gnueabi --enable-shared TARGET_READLINE_INC=" "
--with-tcl=/home/philips/bk_tcl/usr/local/lib 

make 

make test 

Thank you 
Brijesh 



--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/TCL-Test-failures-on-ARM-tp67612p67667.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] TCL Test failures on ARM

2013-03-12 Thread Dan Kennedy

On 03/13/2013 11:52 AM, bkk wrote:

i tried putting break point at robust_ftruncate() but it was not successful

(gdb) break robust_ftruncate
Function "robust_ftruncate" not defined.

the symbol table of testfixture was not having this i believe. does it have
anything to do with crosscompiling ?


Probably just optimized out. After running the configure command try
editing the Makefile and removing "-O2" from the "TCC = " line. Or
any other -O switches that are there.

Or you might just be able to add "CFLAGS=-g" to the command line.

Dan.





below are the commands i used for cross compile

LDFLAGS=-L/home/philips/bk_tcl/usr/local/lib
CC=armv7l-timesys-linux-gnueabi-gcc ./configure
--host=armv7l-timesys-linux-gnueabi --enable-shared TARGET_READLINE_INC=" "
--with-tcl=/home/philips/bk_tcl/usr/local/lib

make

make test

Thank you
Brijesh



--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/TCL-Test-failures-on-ARM-tp67612p67664.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


Re: [sqlite] Efficient way to store counters

2013-03-12 Thread Pavel Ivanov
On Tue, Mar 12, 2013 at 8:29 PM, David King  wrote:
> I'm trying to find an efficient way to store simple incrementing integers but 
> I'm having trouble finding an efficient way to do it
>
> My database looks like:
>
> CREATE TABLE counters
>   k1, k2,
>   count, -- how many we've seen
>   expires,
>   PRIMARY KEY (k1, k2)
> );
> CREATE INDEX counters_expires_idx ON counters(expires);
>
> It is about 1.9gb and contains ~22 million of these rows. A given transaction 
> updates or creates between 10k and 100k of them.
>
> At first I was just doing something like this pseducode:
>
> update_counter(k1, k2, count=count+1, expires=now+count*1day)
> if rows_updated != 1: insert_counter(k1, k2, count=1, expires=now+1day)

Assuming these 2 statements constitute each of the 10k-100k steps you
mentioned above and all of these steps are wrapped up in BEGIN-COMMIT
block this is probably the most efficient way of doing this. The only
improvement could be if you are doing creates more often than updates.
Then you can switch and do INSERT first and then UPDATE if necessary.
It could gain you a little time.

> but was having serious performance problems that seems to be confined to 
> those lines. So I converted ir to INSERT OR REPLACE which had no noticeable 
> impact on performance.

Actually my understanding would suggest that INSERT OR REPLACE should
execute slower than UPDATE + INSERT (or INSERT + UPDATE).

> Convinced the problem was in my code, I decided to offload as much as 
> possible to sqlite. Now my code looks like:
>
> === cut here =
>
> PRAGMA synchronous=OFF;
> PRAGMA temp_store=MEMORY;
>
>
>
> CREATE TEMPORARY TABLE trans_counters(k1, k2);
>
> -- (add all of the items to that temporary table)
>
> CREATE TEMPORARY VIEW trans_counters_v AS
> SELECT k1 AS k1,
> k2 AS k2,
> COUNT(*) AS count
> FROM trans_counters
> GROUP BY (k1, k2);
>
>
>
> INSERT OR REPLACE INTO counters
> SELECT c.k1 AS k1,
> c.k2 AS k2,
> COALESCE((SELECT count FROM counters WHERE k1 = c.k1 AND k2 = c.k2),
> 0)+c.count AS count,
> (COALESCE((SELECT count FROM counters WHERE k1 = c.k1 AND k2 = c.k2),
> 0)+c.count)*24*60*60+? AS expires
> FROM trans_counters_v AS c

This should be much-much slower than UPDATE + INSERT.

> === cut here =
>
> Now the code that inserts all of the rows into the memory table executes 
> nearly instantly, but the big INSERT takes 15+ minutes. Meanwhile the journal 
> (in either rollback or wal mode) balloons to over 300mb in size. The 
> temporary table itself is only about 1.8mb of data (102,603 rows, 94,064 
> unique) so where is all of the journal coming from?

First of all in the statement above you don't gain benefit from
uniqueness and replace about 10k rows twice. Second with such low
repeatability you don't gain much from doing it with such complicated
INSERT. And about journal size: imagine that you've got "lucky" and
all those 94k rows are each in it's own page in the counters table.
SQLite will have to save each of that pages in the journal which will
give journal size of about 94k * 4096 ~ 400M.

> The process takes nearly 0 CPU during this time, the disk becomes very active 
> (but low throughput, reading and writing maybe 200k/s judging by the rate of 
> growth of the journal), and sampling the process with OS X's Activity Monitor 
> while it's busy outputs:
>
> 100% 2869 _pysqlite_query_execute (in _sqlite3.so) + 1886 [0x101945e5e]
> 100% 2869 pysqlite_step (in _sqlite3.so) + 47 [0x10194893f]
> 100% 2869 sqlite3_step (in libsqlite3.dylib) + 1883 [0x7fff8d95ca5b]
> 100% 2869 sqlite3VdbeExec (in libsqlite3.dylib) + 3327 [0x7fff8d95e3af]
> 100% 2869 sqlite3BtreeMovetoUnpacked (in libsqlite3.dylib) + 761 
> [0x7fff8d97ab89]
> 100% 2869 moveToChild (in libsqlite3.dylib) + 146 [0x7fff8d96c872]
> 100% 2869 sqlite3PagerAcquire (in libsqlite3.dylib) + 194 [0x7fff8d93dc22]
> 100% 2869 sqlite3PcacheFetch (in libsqlite3.dylib) + 475 [0x7fff8d93e02b]
> 100% 2869 pagerStress (in libsqlite3.dylib) + 670 [0x7fff8d9c407e]
> 100% 2869 pager_write_pagelist (in libsqlite3.dylib) + 149 [0x7fff8d999a35]
> 100% 2869 unixWrite (in libsqlite3.dylib) + 83 [0x7fff8d98bd73]
> 100% 2869 pwrite (in libsystem_kernel.dylib) + 10 [0x7fff8130bab6]
>
>
>
> That is, 2869 of 2869 samples, 100% of the time, was spent in sqlite3_step 
> writing the data to disk. Further samples look basically the same with an 
> occasional read-path taking up to ~10% of the time.
>
> VACUUM ANALYZE doesn't look to have any effect. I'm running sqlite 3.7.7 on 
> Mac OS X 10.7.5 via the Python sqlite3 module
>
> So I feel like something about what I'm doing is fundamentally flawed given 
> something about sqlite's performance model. All I want is a count of the 
> number of times that I've seen each pair (k1, k2), is there a better way to 
> do this without storing them all individually and grouping them later? (This 
> would be prohibitively large.)

I don't think there's anything better than what you did 

Re: [sqlite] TCL Test failures on ARM

2013-03-12 Thread bkk
i tried putting break point at robust_ftruncate() but it was not successful

(gdb) break robust_ftruncate
Function "robust_ftruncate" not defined.

the symbol table of testfixture was not having this i believe. does it have
anything to do with crosscompiling ? 

below are the commands i used for cross compile 

LDFLAGS=-L/home/philips/bk_tcl/usr/local/lib
CC=armv7l-timesys-linux-gnueabi-gcc ./configure
--host=armv7l-timesys-linux-gnueabi --enable-shared TARGET_READLINE_INC=" "
--with-tcl=/home/philips/bk_tcl/usr/local/lib

make

make test

Thank you
Brijesh



--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/TCL-Test-failures-on-ARM-tp67612p67664.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] TCL Test failures on ARM

2013-03-12 Thread bkk
Below is the code path just before the error below is given out / getting
printed 
" 
Expected: [0 ok] 
 Got: [1 {nfail=1 rc=1 result=disk I/O error}] 

" 

Breakpoint 1, ts_ftruncate (fd=5, n=206456) at ./src/test_syscall.c:272 
272 static int ts_ftruncate(int fd, off_t n){ 
(gdb) step 
273  if( tsIsFailErrno("ftruncate") ){ 
(gdb) next 
272 static int ts_ftruncate(int fd, off_t n){ 
(gdb) 
273  if( tsIsFailErrno("ftruncate") ){ 
(gdb) 
276  return orig_ftruncate(fd, n); 
(gdb) 
unixTruncate (nByte=0, id=0x14c478) at sqlite3.c:26365 
26365pFile->lastErrno = errno; 
(gdb) 
26366return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate",
pFile->zPath); 
(gdb) 
unixTruncate (id=0x14c478, nByte=) at sqlite3.c:26383 
26383 } 
(gdb) 
unixTruncate (id=0x1, nByte=) at sqlite3.c:26348 
26348 static int unixTruncate(sqlite3_file *id, i64 nByte){ 
(gdb) 
unixLogErrorAtLine (errcode=1546, zFunc=0xc8920 "ftruncate", 
zPath=0x14c4e8 "/home/brijesh/mySQLtry/test.db-journal", iLine=26366) 
at sqlite3.c:23979 
23979 ){ 
(gdb) 
23981  int iErrno = errno; /* Saved syscall error number */ 
(gdb) 
24017  assert( errcode!=SQLITE_OK ); 
(gdb) 
23981  int iErrno = errno; /* Saved syscall error number */ 
(gdb) 
24017  assert( errcode!=SQLITE_OK ); 
(gdb) 
24018  if( zPath==0 ) zPath = ""; 
(gdb) 
24019  sqlite3_log(errcode, 
(gdb) 
24018  if( zPath==0 ) zPath = ""; 
(gdb) 
24019  sqlite3_log(errcode, 
(gdb) 
24025 } 
(gdb) 
pager_end_transaction (pPager=0x14c2e0, hasMaster=,
bCommit=1) 
at sqlite3.c:39301 
39301  pPager->journalOff = 0; 
(gdb) 
39331  sqlite3BitvecDestroy(pPager->pInJournal); 
(gdb) 
39332  pPager->pInJournal = 0; 
(gdb) 
39334  sqlite3PcacheCleanAll(pPager->pPCache); 
(gdb) 
39332  pPager->pInJournal = 0; 
(gdb) 
39333  pPager->nRec = 0; 
(gdb) 
39334  sqlite3PcacheCleanAll(pPager->pPCache); 
(gdb) 
39335  sqlite3PcacheTruncate(pPager->pPCache, pPager->dbSize); 
(gdb) 
39337  if( pagerUseWal(pPager) ){ 
(gdb) 
39344  }else if( rc==SQLITE_OK && bCommit &&
pPager->dbFileSize>pPager->dbSize ){ 
(gdb) 
39355  if( !pPager->exclusiveMode 
(gdb) 
39356   && (!pagerUseWal(pPager) || sqlite3WalExclusiveMode(pPager->pWal,
0)) 
(gdb) 
39358rc2 = pagerUnlockDb(pPager, SHARED_LOCK); 
(gdb) 
39359pPager->changeCountDone = 0; 
(gdb) 
39364  return (rc==SQLITE_OK?rc2:rc); 
(gdb) 
39361  pPager->eState = PAGER_READER; 
(gdb) 
39364  return (rc==SQLITE_OK?rc2:rc); 
(gdb) 
39361  pPager->eState = PAGER_READER; 
(gdb) 
39362  pPager->setMaster = 0; 
(gdb) 
39365 } 
(gdb) 
sqlite3PagerCommitPhaseTwo (pPager=0x14c2e0) at sqlite3.c:43389 
43389  return pager_error(pPager, rc); 
(gdb) 
43390 } 
(gdb) 
sqlite3PagerCommitPhaseTwo (pPager=0x1424c8) at sqlite3.c:43389 
43389  return pager_error(pPager, rc); 
(gdb) 
pager_error (pPager=0x14c2e0, rc=1546) at sqlite3.c:39190 
39190  assert( rc==SQLITE_OK || !MEMDB ); 
(gdb) 
39188 static int pager_error(Pager *pPager, int rc){ 
(gdb) 
39190  assert( rc==SQLITE_OK || !MEMDB ); 
(gdb) 
39191  assert( 
(gdb) 
39189  int rc2 = rc & 0xff; 
(gdb) 
39196  if( rc2==SQLITE_FULL || rc2==SQLITE_IOERR ){ 
(gdb) 
39198pPager->eState = PAGER_ERROR; 
(gdb) 
39197pPager->errCode = rc; 
(gdb) 
39198pPager->eState = PAGER_ERROR; 
(gdb) 
39201 } 
(gdb) 
sqlite3BtreeCommitPhaseTwo (bCleanup=0, p=0x1424c8) at sqlite3.c:51637 
51637if( rc!=SQLITE_OK && bCleanup==0 ){ 
(gdb) 
51641pBt->inTransaction = TRANS_READ; 
(gdb) 
51637if( rc!=SQLITE_OK && bCleanup==0 ){ 
(gdb) 
51645  sqlite3BtreeLeave(p); 
(gdb) 
sqlite3BtreeCommitPhaseTwo (p=0x1424c8, bCleanup=0) at sqlite3.c:51647 
51647 } 
(gdb) 
vdbeCommit (p=0x130688, db=0x140ea8) at sqlite3.c:60485 
60485for(i=0; rc==SQLITE_OK && inDb; i++){ 
(gdb) 
60633for(i=0; inDb; i++){ 
(gdb) 
sqlite3VdbeHalt (p=0x130688) at sqlite3.c:60879 
60879if( rc==SQLITE_BUSY && p->readOnly ){ 
(gdb) 
60882}else if( rc!=SQLITE_OK ){ 
(gdb) 
60883  p->rc = rc; 
(gdb) 
60884  sqlite3RollbackAll(db, SQLITE_OK); 
(gdb) 
60911if( eStatementOp ){ 
(gdb) 
60892  db->nStatement = 0; 
(gdb) 
60911if( eStatementOp ){ 
(gdb) 
60928if( p->changeCntOn ){ 
(gdb) 
60929  if( eStatementOp!=SAVEPOINT_ROLLBACK ){ 
(gdb) 
60930sqlite3VdbeSetChanges(db, p->nChange); 
(gdb) 
60932sqlite3VdbeSetChanges(db, 0); 
(gdb) 
60934  p->nChange = 0; 
60938sqlite3VdbeLeave(p); 
(gdb) 
60942  if( p->pc>=0 ){ 
(gdb) 
60943db->activeVdbeCnt--; 
(gdb) 
60942  if( p->pc>=0 ){ 
(gdb) 
60943db->activeVdbeCnt--; 
(gdb) 
60944if( !p->readOnly ){ 
(gdb) 
60945  db->writeVdbeCnt--; 
(gdb) 
60947assert( db->activeVdbeCnt>=db->writeVdbeCnt ); 
(gdb) 
60949  p->magic = VDBE_MAGIC_HALT; 
(gdb) 
60950  checkActiveVdbeCnt(db); 
(gdb) 
60949  p->magic = VDBE_MAGIC_HALT; 
(gdb) 
60950  checkActiveVdbeCnt(db); 
(gdb) 
60951  if( p->db->mallocFailed ){ 
(gdb) 
60952p->rc = SQLITE_NOMEM; 
(gdb) 
60963  assert( db->activeVdbeCnt>0 || db->autoCommit==0 || 

Re: [sqlite] TCL Test failures on ARM

2013-03-12 Thread bkk
below is the stack trace at the begining of second hit at the break point

Breakpoint 1, ts_ftruncate (fd=6, n=206456) at ./src/test_syscall.c:272
272 static int ts_ftruncate(int fd, off_t n){
(gdb) backtrace
#0  ts_ftruncate (fd=6, n=206456) at ./src/test_syscall.c:272
#1  0x000627f0 in robust_ftruncate (sz=0, h=6) at sqlite3.c:23589
#2  unixTruncate (nByte=0, id=0x150b60) at sqlite3.c:26363
#3  unixTruncate (id=0x150b60, nByte=) at sqlite3.c:26348
#4  0x00069284 in sqlite3OsTruncate (size=0, id=0x150b60) at sqlite3.c:15034
#5  pager_end_transaction (pPager=0x1509c8, hasMaster=, 
bCommit=1) at sqlite3.c:39294
#6  0x0006945c in sqlite3PagerCommitPhaseTwo (pPager=0x1509c8)
at sqlite3.c:43388
#7  0x0007a5dc in sqlite3BtreeCommitPhaseTwo (bCleanup=1, p=0x14bbe8)
at sqlite3.c:51636
#8  sqlite3BtreeCommitPhaseTwo (p=0x14bbe8, bCleanup=1) at sqlite3.c:51622
#9  0x0008bc38 in vdbeCommit (p=0x132040, db=0x140ea8) at sqlite3.c:60636
#10 sqlite3VdbeHalt (p=0x132040) at sqlite3.c:60877
#11 0x000b8a94 in sqlite3VdbeExec (p=0x132040) at sqlite3.c:66956
#12 0x000a50b8 in sqlite3Step (p=0x132040) at sqlite3.c:62344
#13 sqlite3_step (pStmt=) at sqlite3.c:62418
#14 0x00038a78 in dbEvalStep (p=0x7efff288) at ./src/tclsqlite.c:1400
#15 0x0003bde0 in DbObjCmd (cd=0x14b2e8, interp=0x107198, 
objc=, objv=0x10802c) at ./src/tclsqlite.c:2251
---Type  to continue, or q  to quit---
#16 0x2aaf4348 in ?? ()
#17 0x2aaf4348 in ?? ()




--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/TCL-Test-failures-on-ARM-tp67612p67661.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] Efficient way to store counters

2013-03-12 Thread David King
> > At first I was just doing something like this pseducode:
> > update_counter(k1, k2, count=count+1, expires=now+count*1day)
> > if rows_updated != 1: insert_counter(k1, k2, count=1, expires=now+1day)
> 
> Might I suggest that instead of trying to store an ever-changing value, you 
> simply figure it out when it's needed ? I don't quite understand the logic 
> you're applying to calculate your 'expires' value but I think it could be 
> calculated with a SELECT whenever you needed it rather than being stored.


The logic is, "keep a given (k1, k2) pair around for one day for each time it's 
been seen". I could calculate it when it's needed, but since it's a computed 
value, I couldn't then have an index on it. That said, I've removed this in 
several tests and it doesn't appear have any bearing on the performance issue.

> > Now the code that inserts all of the rows into the memory table executes 
> > nearly instantly, but the big INSERT takes 15+ minutes. Meanwhile the 
> > journal (in either rollback or wal mode) balloons to over 300mb in size.
> You don't list any indexes which would help with your WHERE clauses, so I 
> suspect SQLite is having to look through all the records in 'counters' in 
> order to find the rows it needs for each COALESCE. The large size of the 
> journal is because you are replacing every row in the databases.


Maybe I wasn't clear, the  ---cut here--- bit is in addition to the existing 
schema (after all, the INSERT OR REPLACE updates it, so surely it must already 
exist).

In the INSERT OR REPLACE operation there is no WHERE clause. (k1, k2) is the 
primary key on the 'counters' table, so the INSERT OR REPLACE takes each value 
out of the temporary trans_counters_v view of the in-memory trans_counters 
temporary table and either replaces or inserts a value for each corresponding 
entry in 'counters'. AFAICT, no amount of indexing here would help. There's no 
reason to index the temporary table, since the sort for the GROUP BY is 
n*log(n), and updating the index for each individual entry would still sum to 
n*log(n). The temporary table is single-use and will have to be scanned every 
time regardless. (And if I isolate that GROUP BY operation, it's blindingly 
fast.). Here's the EXPLAIN QUERY PLAN for the INSERT OR REPLACE:

(0, 0, 0, u'SCAN TABLE trans_counters (132971 rows)')
(0, 0, 0, u'USE TEMP B-TREE FOR GROUP BY')
(0, 0, 0, u'EXECUTE CORRELATED SCALAR SUBQUERY 1')
(1, 0, 0, u'SEARCH TABLE counters USING INDEX sqlite_autoindex_counters_1 (k1=? 
AND k2=?) (~1 rows)')
(0, 0, 0, u'EXECUTE CORRELATED SCALAR SUBQUERY 2')
(2, 0, 0, u'SEARCH TABLE counters USING INDEX sqlite_autoindex_counters_1 (k1=? 
AND k2=?) (~1 rows)')





So no, it's not having to replace every entry in the 'counters' table. Also, if 
it were replacing every row in the database, then the journal would grow to 
equal the (VACUUM'd) size of the database, but it doesn't get that big. It gets 
to 300mb+, but not to the full size of 1.9gb.
 
> > So I feel like something about what I'm doing is fundamentally flawed given 
> > something about sqlite's performance model. All I want is a count of the 
> > number of times that I've seen each pair (k1, k2), is there a better way to 
> > do this without storing them all individually and grouping them later?
> 
> If you have a table with two columns k1, k2 in, and you want to count the 
> times each pair occurs, you can do it in software far faster by having this 
> index and using this SELECT
> CREATE INDEX myTable_keypair ON myTable (k1,k2)
> SELECT k1,k2 from myTable ORDER BY k1,k2
> you might even use one of the following if you know it will always return a 
> unique value for unique keys
> SELECT k1||k2 from myTable ORDER BY k1,k2
> SELECT k1||':'||k2 from myTable ORDER BY k1,k2
> Just count the unique values in your programming language as they go past. 
> Yes, you can use horrendous complication to make SQLite present a neatly 
> formatted return with the counts included, but defining that in SQL makes 
> SQLite do more work than your programming language would need to do.


The problem isn't grouping them to count them. If I evaluate the TEMPORARY VIEW 
that does the GROUP BY clause above it completes in just under a second for all 
100k items in the table it references. That part is very fast. The slow bit is 
incorporating those counts into the versions on disk.



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] TCL Test failures on ARM

2013-03-12 Thread bkk
Below are the code path which is getting executed from the first hit of
breakpoint at "ts_ftruncate" to the next

i was wondering it was working fine with my ubuntu PC and now giving issue
in linux target.

Breakpoint 1, ts_ftruncate (fd=5, n=206456) at ./src/test_syscall.c:272
272 static int ts_ftruncate(int fd, off_t n){
(gdb) step
273   if( tsIsFailErrno("ftruncate") ){
(gdb) next
272 static int ts_ftruncate(int fd, off_t n){
(gdb) 
273   if( tsIsFailErrno("ftruncate") ){
(gdb) 
276   return orig_ftruncate(fd, n);
(gdb) 
unixTruncate (nByte=0, id=0x14c478) at sqlite3.c:26365
26365   pFile->lastErrno = errno;
(gdb) 
26366   return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate",
pFile->zPath);
(gdb) 
unixTruncate (id=0x14c478, nByte=) at sqlite3.c:26383
26383   }
(gdb) 
unixTruncate (id=0x1, nByte=) at sqlite3.c:26348
26348   static int unixTruncate(sqlite3_file *id, i64 nByte){
(gdb) 
unixLogErrorAtLine (errcode=1546, zFunc=0xc8920 "ftruncate", 
zPath=0x14c4e8 "/home/brijesh/mySQLtry/test.db-journal", iLine=26366)
at sqlite3.c:23979
23979   ){
(gdb) 
23981 int iErrno = errno; /* Saved syscall error number */
(gdb) 
24017 assert( errcode!=SQLITE_OK );
(gdb) 
23981 int iErrno = errno; /* Saved syscall error number */
(gdb) 
24017 assert( errcode!=SQLITE_OK );
(gdb) 
24018 if( zPath==0 ) zPath = "";
(gdb) 
24019 sqlite3_log(errcode,
(gdb) 
24018 if( zPath==0 ) zPath = "";
(gdb) 
24019 sqlite3_log(errcode,
(gdb) 
24025   }
(gdb) 
pager_end_transaction (pPager=0x14c2e0, hasMaster=,
bCommit=1)
at sqlite3.c:39301
39301 pPager->journalOff = 0;
(gdb) 
39331 sqlite3BitvecDestroy(pPager->pInJournal);
(gdb) 
39332 pPager->pInJournal = 0;
(gdb) 
39334 sqlite3PcacheCleanAll(pPager->pPCache);
(gdb) 
39332 pPager->pInJournal = 0;
(gdb) 
39333 pPager->nRec = 0;
(gdb) 
39334 sqlite3PcacheCleanAll(pPager->pPCache);
(gdb) 
39335 sqlite3PcacheTruncate(pPager->pPCache, pPager->dbSize);
(gdb) 
39337 if( pagerUseWal(pPager) ){
(gdb) 
39344 }else if( rc==SQLITE_OK && bCommit &&
pPager->dbFileSize>pPager->dbSize ){
(gdb) 
39355 if( !pPager->exclusiveMode 
(gdb) 
39356  && (!pagerUseWal(pPager) || sqlite3WalExclusiveMode(pPager->pWal,
0))
(gdb) 
39358   rc2 = pagerUnlockDb(pPager, SHARED_LOCK);
(gdb) 
39359   pPager->changeCountDone = 0;
(gdb) 
39364 return (rc==SQLITE_OK?rc2:rc);
(gdb) 
39361 pPager->eState = PAGER_READER;
(gdb) 
39364 return (rc==SQLITE_OK?rc2:rc);
(gdb) 
39361 pPager->eState = PAGER_READER;
(gdb) 
39362 pPager->setMaster = 0;
(gdb) 
39365   }
(gdb) 
sqlite3PagerCommitPhaseTwo (pPager=0x14c2e0) at sqlite3.c:43389
43389 return pager_error(pPager, rc);
(gdb) 
43390   }
(gdb) 
sqlite3PagerCommitPhaseTwo (pPager=0x1424c8) at sqlite3.c:43389
43389 return pager_error(pPager, rc);
(gdb) 
pager_error (pPager=0x14c2e0, rc=1546) at sqlite3.c:39190
39190 assert( rc==SQLITE_OK || !MEMDB );
(gdb) 
39188   static int pager_error(Pager *pPager, int rc){
(gdb) 
39190 assert( rc==SQLITE_OK || !MEMDB );
(gdb) 
39191 assert(
(gdb) 
39189 int rc2 = rc & 0xff;
(gdb) 
39196 if( rc2==SQLITE_FULL || rc2==SQLITE_IOERR ){
(gdb) 
39198   pPager->eState = PAGER_ERROR;
(gdb) 
39201   }
(gdb) 
sqlite3BtreeCommitPhaseTwo (bCleanup=1, p=0x1424c8) at sqlite3.c:51637
51637   if( rc!=SQLITE_OK && bCleanup==0 ){
(gdb) 
51641   pBt->inTransaction = TRANS_READ;
(gdb) 
51637   if( rc!=SQLITE_OK && bCleanup==0 ){
(gdb) 
51644 btreeEndTransaction(p);
(gdb) 
51646 return SQLITE_OK;
(gdb) 
51644 btreeEndTransaction(p);
(gdb) 
51645 sqlite3BtreeLeave(p);
(gdb) 
sqlite3BtreeCommitPhaseTwo (p=0x1424c8, bCleanup=1) at sqlite3.c:51647
51647   }
(gdb) 
vdbeCommit (p=0x132040, db=0x140ea8) at sqlite3.c:60633
60633   for(i=0; inDb; i++){ 
(gdb) 
60634 Btree *pBt = db->aDb[i].pBt;
(gdb) 
60635 if( pBt ){
(gdb) 
60633   for(i=0; inDb; i++){ 
(gdb) 
60634 Btree *pBt = db->aDb[i].pBt;
(gdb) 
60635 if( pBt ){
(gdb) 
60636   sqlite3BtreeCommitPhaseTwo(pBt, 1);
(gdb) 
Breakpoint 1, ts_ftruncate (fd=6, n=206456) at ./src/test_syscall.c:272
272 static int ts_ftruncate(int fd, off_t n){



--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/TCL-Test-failures-on-ARM-tp67612p67659.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] Efficient way to store counters

2013-03-12 Thread Simon Slavin

On 13 Mar 2013, at 3:29am, David King  wrote:

> At first I was just doing something like this pseducode:
> 
> update_counter(k1, k2, count=count+1, expires=now+count*1day)
> if rows_updated != 1: insert_counter(k1, k2, count=1, expires=now+1day)

Might I suggest that instead of trying to store an ever-changing value, you 
simply figure it out when it's needed ?  I don't quite understand the logic 
you're applying to calculate your 'expires' value but I think it could be 
calculated with a SELECT whenever you needed it rather than being stored.

> Now the code that inserts all of the rows into the memory table executes 
> nearly instantly, but the big INSERT takes 15+ minutes. Meanwhile the journal 
> (in either rollback or wal mode) balloons to over 300mb in size.

You don't list any indexes which would help with your WHERE clauses, so I 
suspect SQLite is having to look through all the records in 'counters' in order 
to find the rows it needs for each COALESCE.  The large size of the journal is 
because you are replacing every row in the databases.

> So I feel like something about what I'm doing is fundamentally flawed given 
> something about sqlite's performance model. All I want is a count of the 
> number of times that I've seen each pair (k1, k2), is there a better way to 
> do this without storing them all individually and grouping them later?

If you have a table with two columns k1, k2 in, and you want to count the times 
each pair occurs, you can do it in software far faster by having this index and 
using this SELECT

CREATE INDEX myTable_keypair ON myTable (k1,k2)

SELECT k1,k2 from myTable ORDER BY k1,k2

you might even use one of the following if you know it will always return a 
unique value for unique keys

SELECT k1||k2 from myTable ORDER BY k1,k2
SELECT k1||':'||k2 from myTable ORDER BY k1,k2

Just count the unique values in your programming language as they go past.  
Yes, you can use horrendous complication to make SQLite present a neatly 
formatted return with the counts included, but defining that in SQL makes 
SQLite do more work than your programming language would need to do.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Efficient way to store counters

2013-03-12 Thread David King
I'm trying to find an efficient way to store simple incrementing integers but 
I'm having trouble finding an efficient way to do it

My database looks like:

CREATE TABLE counters
  k1, k2,
  count, -- how many we've seen
  expires,
  PRIMARY KEY (k1, k2)
);
CREATE INDEX counters_expires_idx ON counters(expires);

It is about 1.9gb and contains ~22 million of these rows. A given transaction 
updates or creates between 10k and 100k of them.

At first I was just doing something like this pseducode:

update_counter(k1, k2, count=count+1, expires=now+count*1day)
if rows_updated != 1: insert_counter(k1, k2, count=1, expires=now+1day)

but was having serious performance problems that seems to be confined to those 
lines. So I converted ir to INSERT OR REPLACE which had no noticeable impact on 
performance. Convinced the problem was in my code, I decided to offload as much 
as possible to sqlite. Now my code looks like:

=== cut here =

PRAGMA synchronous=OFF;
PRAGMA temp_store=MEMORY;



CREATE TEMPORARY TABLE trans_counters(k1, k2);

-- (add all of the items to that temporary table)

CREATE TEMPORARY VIEW trans_counters_v AS
SELECT k1 AS k1,
k2 AS k2,
COUNT(*) AS count
FROM trans_counters
GROUP BY (k1, k2);



INSERT OR REPLACE INTO counters
SELECT c.k1 AS k1,
c.k2 AS k2,
COALESCE((SELECT count FROM counters WHERE k1 = c.k1 AND k2 = c.k2),
0)+c.count AS count,
(COALESCE((SELECT count FROM counters WHERE k1 = c.k1 AND k2 = c.k2),
0)+c.count)*24*60*60+? AS expires
FROM trans_counters_v AS c





=== cut here =

Now the code that inserts all of the rows into the memory table executes nearly 
instantly, but the big INSERT takes 15+ minutes. Meanwhile the journal (in 
either rollback or wal mode) balloons to over 300mb in size. The temporary 
table itself is only about 1.8mb of data (102,603 rows, 94,064 unique) so where 
is all of the journal coming from?. The process takes nearly 0 CPU during this 
time, the disk becomes very active (but low throughput, reading and writing 
maybe 200k/s judging by the rate of growth of the journal), and sampling the 
process with OS X's Activity Monitor while it's busy outputs:

100% 2869 _pysqlite_query_execute (in _sqlite3.so) + 1886 [0x101945e5e]
100% 2869 pysqlite_step (in _sqlite3.so) + 47 [0x10194893f]
100% 2869 sqlite3_step (in libsqlite3.dylib) + 1883 [0x7fff8d95ca5b]
100% 2869 sqlite3VdbeExec (in libsqlite3.dylib) + 3327 [0x7fff8d95e3af]
100% 2869 sqlite3BtreeMovetoUnpacked (in libsqlite3.dylib) + 761 
[0x7fff8d97ab89]
100% 2869 moveToChild (in libsqlite3.dylib) + 146 [0x7fff8d96c872]
100% 2869 sqlite3PagerAcquire (in libsqlite3.dylib) + 194 [0x7fff8d93dc22]
100% 2869 sqlite3PcacheFetch (in libsqlite3.dylib) + 475 [0x7fff8d93e02b]
100% 2869 pagerStress (in libsqlite3.dylib) + 670 [0x7fff8d9c407e]
100% 2869 pager_write_pagelist (in libsqlite3.dylib) + 149 [0x7fff8d999a35]
100% 2869 unixWrite (in libsqlite3.dylib) + 83 [0x7fff8d98bd73]
100% 2869 pwrite (in libsystem_kernel.dylib) + 10 [0x7fff8130bab6]



That is, 2869 of 2869 samples, 100% of the time, was spent in sqlite3_step 
writing the data to disk. Further samples look basically the same with an 
occasional read-path taking up to ~10% of the time.

VACUUM ANALYZE doesn't look to have any effect. I'm running sqlite 3.7.7 on Mac 
OS X 10.7.5 via the Python sqlite3 module

So I feel like something about what I'm doing is fundamentally flawed given 
something about sqlite's performance model. All I want is a count of the number 
of times that I've seen each pair (k1, k2), is there a better way to do this 
without storing them all individually and grouping them later? (This would be 
prohibitively large.) 


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite 3.7.16 beta

2013-03-12 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 12/03/13 17:28, Richard Hipp wrote:
> The next release is currently scheduled for Monday, 2013-03-18.
> 
> Please let us know as soon as possible if you see or suspect any issues
> in the current beta.  Thanks.

I can provide the opposite data.  My test suite extensively covers the
SQLite C API.  Everything looks good and I don't even remember the last
release there was a problem.

Roger

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAlE/2oUACgkQmOOfHg372QS3CwCfY/P+4IMyy6OCL3wrjkge3Z6k
MBUAoLtSOTTNjURgOAGH6HA77BDlHnH0
=/Evg
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite 3.7.16 beta

2013-03-12 Thread Richard Hipp
A logic bug was found today in the 3.7.16 beta.  The DESC operator was not
working on ORDER BY clauses under some obscure circumstances.  The bug has
now been fixed and new snapshots have have been uploaded.

New snapshots:  http://www.sqlite.org/draft/download.html
Bug details:http://www.sqlite.org/src/info/4dd95f6943fbd18

Thanks for all the documentation typo reports.  All of them should have
been fixed on the "draft" website and will be transferred over to the main
website when the release occurs.  Please feel free to send in further typo
reports at any time.

The next release is currently scheduled for Monday, 2013-03-18.

Please let us know as soon as possible if you see or suspect any issues in
the current beta.  Thanks.
-- 
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] create view doesn't work

2013-03-12 Thread James K. Lowden
On Tue, 12 Mar 2013 19:57:26 +
Simon Slavin  wrote:

> > Is my rewrite the same as the original?
> 
> No.  You can't use this construction:
> 
> > INNER JOIN (Categories INNER JOIN Object_Categories ON
> > "Categories"."Category_ID"="Object_Categories"."Category_ID")
> 
> The parser expects a table name immediately after INNER JOIN.
> Instead you are opening a bracket which is the way one would begin an
> expression.

That construction is perfectly valid except for one detail that Hugh
Darwen calls the TEETH_GNASHER.  

sqlite> .tables
sqlite> create table t (t int primary key);
sqlite> insert into t values (1);
sqlite> insert into t values (2);
sqlite> insert into t values (3);
sqlite> select * from t inner join (select min(t) from t) as T;
t   min(t)
--  --
1   1 
2   1 
3   1 

The table expression requires a name, even if the name isn't referenced
elsewhere in the query.  Of course, to get a correct result, the above
query needs a few corrections:

sqlite> select * from t as a 
join (select min(t) as t from t) as T 
on a.t = T.t; 
t   t 
--  --
1   1 

--jkl
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] create view doesn't work

2013-03-12 Thread Simon Slavin

On 12 Mar 2013, at 9:12pm, ven...@intouchmi.com wrote:

> The first select was the one that I retrieved from the MS Access DB.  That 
> one does NOT work in SQLite.  Thanks for explaining why it wasn't acceptable 
> by SQLite.

You're welcome.

> It was the second select, which I rewrote, that I was asking about.  That one 
> is acceptable by SQLite.  My question was if the second one accomplished the 
> same end results as the original (first) select.

We don't know because on this mailing list we understand SQLite but not 
especially MS Access.  You would need to ask on an Access mailing list what 
Access would do for such a query.  Or you could read the Access documentation 
yourself.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] create view doesn't work

2013-03-12 Thread veneff
Simon,

The first select was the one that I retrieved from the MS Access DB.  That one 
does NOT work in SQLite.  Thanks for explaining why it wasn't acceptable by 
SQLite.

It was the second select, which I rewrote, that I was asking about.  That one 
is acceptable by SQLite.  My question was if the second one accomplished the 
same end results as the original (first) select.

Vance

on Mar 12, 2013, Simon Slavin  wrote:
>
>
>On 12 Mar 2013, at 7:24pm, ven...@intouchmi.com wrote:
>
>> Is my rewrite the same as the original?
>
>No.  You can't use this construction:
>
>> INNER JOIN (Categories INNER JOIN Object_Categories ON 
>> "Categories"."Category_ID"="Object_Categories"."Category_ID")
>
>The parser expects a table name immediately after INNER JOIN.  Instead you are 
>opening
>a bracket which is the way one would begin an expression.
>
>Simon.
>___
>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] create view doesn't work

2013-03-12 Thread Simon Slavin

On 12 Mar 2013, at 7:24pm, ven...@intouchmi.com wrote:

> Is my rewrite the same as the original?

No.  You can't use this construction:

> INNER JOIN (Categories INNER JOIN Object_Categories ON 
> "Categories"."Category_ID"="Object_Categories"."Category_ID")

The parser expects a table name immediately after INNER JOIN.  Instead you are 
opening a bracket which is the way one would begin an expression.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] create view doesn't work

2013-03-12 Thread veneff
As a follow up, what I meant to ask is why it doesn't work.

I rewrote the original select:
SELECT "Categories"."Category_Name", "Strings"."Long_Text", 
"Units"."Long_Units", "Limits"."Lower_Limit", "Limits"."Upper_Limit"
FROM Objects INNER JOIN (Categories INNER JOIN Object_Categories ON 
"Categories"."Category_ID"="Object_Categories"."Category_ID") ON 
"Objects"."Object_ID"="Object_Categories"."Object_ID") INNER JOIN Units ON 
"Objects"."Unit_ID"="Units"."Unit_ID") INNER JOIN Strings ON 
"Objects"."String_ID"="Strings"."String_ID") INNER JOIN Addresses ON 
"Objects"."Address_ID"="Addresses"."Address_ID") INNER JOIN Limits ON 
"Objects"."Limit_ID"="Limits"."Limit_ID"
WHERE ((("Categories"."Category_Type_ID")=1));

To:
SELECT "Categories"."Category_Name", "Strings"."Long_Text", 
"Units"."Long_Units", "Limits"."Lower_Limit", "Limits"."Upper_Limit"
FROM (Categories INNER JOIN Object_Categories ON 
"Categories"."Category_ID"="Object_Categories"."Category_ID") INNER JOIN 
Objects ON "Objects"."Object_ID"="Object_Categories"."Object_ID") INNER JOIN 
Units ON "Objects"."Unit_ID"="Units"."Unit_ID") INNER JOIN Strings ON 
"Objects"."String_ID"="Strings"."String_ID") INNER JOIN Addresses ON 
"Objects"."Address_ID"="Addresses"."Address_ID") INNER JOIN Limits ON 
"Objects"."Limit_ID"="Limits"."Limit_ID"
WHERE ((("Categories"."Category_Type_ID")=1));

Which does seem to work.  Is my rewrite the same as the original?

Vance




on Mar 12, 2013, ven...@intouchmi.com wrote:
>
>Dominique,
>
>Thanks for your response and for breaking down the select into manageable 
>pieces!
>
>According to the limits info, there should be no problem with the # of terms 
>in that
>select statement (< 500).
>
>There are hundreds of these predefined queries that I am extracting out of the 
>MS
>access databases, so it is unlikely that I'd be able to break them down into 
>component
>queries, particularly since they are already referenced as named (predefined) 
>queries
>in the software out in the field.
>I was hoping to move away from Access toward SQLite if feasible.  I feel that 
>it would
>be faster and easier to port to other platforms.
>
>I'm not an SQL expert either, but you're certainly better at it than I am.  I 
>get
>lost after a couple of joins. I wonder if there is a way to re-arrange the 
>joins
>so that the select would be acceptable to SQLite.
>
>Vance
>
>on Mar 12, 2013, Dominique Devienne  wrote:
>>
>>I'm no expert, but I think your problem comes from the excessive
>>parentheses you are using.
>>
>>Below's a little experiment that reproduces your syntax, with its error,
>>and provides an alternative simpler syntax that works. --DD
>>
>>C:\Users\DDevienne>sqlite3
>>SQLite version 3.7.15.2 2013-01-09 11:53:05
>>Enter ".help" for instructions
>>Enter SQL statements terminated with a ";"
>>sqlite> create table a (id number);
>>sqlite> create table b (id number, a number);
>>sqlite> create table c (id number, b number);
>>sqlite> create view v1 as select a.id, b.id, c.id
>>   ...> from (c INNER JOIN (a INNER JOIN b on a.id = b.a) on c.b = b.id)
>>   ...> where (((a.id) = 1));
>>Error: no such column: a.id
>>sqlite>
>>sqlite> create view v1 as select a.id, b.id, c.id
>>   ...> from
>>   ...> a INNER JOIN b on a.id = b.a
>>   ...>   INNER JOIN c on b.id = c.b
>>   ...> where a.id = 1;
>>sqlite>
>>
>>
>>On Tue, Mar 12, 2013 at 3:42 PM,  wrote:
>>
>>>
>>> Hello,
>>>
>>> Using sqlite3, I entered this create view statement:
>>> CREATE VIEW IF NOT EXISTS "Annies Form" AS
>>> SELECT Categories.Category_Name, Strings.Long_Text, Units.Long_Units,
>>> Limits.Lower_Limit, Limits.Upper_Limit
>>> FROM Objects INNER JOIN (Categories INNER JOIN Object_Categories ON
>>> Categories.Category_ID=Object_Categories.Category_ID) ON
>>> Objects.Object_ID=Object_Categories.Object_ID) INNER JOIN Units ON
>>> Objects.Unit_ID=Units.Unit_ID) INNER JOIN Strings ON
>>> Objects.String_ID=Strings.String_ID) INNER JOIN Addresses ON
>>> Objects.Address_ID=Addresses.Address_ID) INNER JOIN Limits ON
>>> Objects.Limit_ID=Limits.Limit_ID
>>> WHERE (((Categories.Category_Type_ID)=1));
>>>
>>> sqlite3 complains that the column Categories.Category_Name does not exists.
>>> Yet, I can do a
>>> Select Categories.Category_Name From Categories
>>> with no problems.
>>>
>>> This create view worked as well:
>>> CREATE VIEW IF NOT EXISTS 'Select_Categories' AS
>>> SELECT Categories.Category_ID, Categories.Category_Name,
>>> Strings.Long_Text, Strings.Short_Text, Strings.Alternate_Text,
>>> Category_Types.Category_Type
>>> FROM (Categories INNER JOIN Strings ON Categories.String_ID =
>>> Strings.String_ID) INNER JOIN Category_Types ON Categories.Category_Type_ID
>>> = Category_Types.Category_Type_ID;
>>>
>>> As a side note, these were predefined queryDefs from an MS Access db that,
>>> I believe, work OK.
>>>
>>> Vance
>>> ___
>>> sqlite-users mailing list
>>> 

Re: [sqlite] create view doesn't work

2013-03-12 Thread veneff
Dominique,

Thanks for your response and for breaking down the select into manageable 
pieces!

According to the limits info, there should be no problem with the # of terms in 
that select statement (< 500).

There are hundreds of these predefined queries that I am extracting out of the 
MS access databases, so it is unlikely that I'd be able to break them down into 
component queries, particularly since they are already referenced as named 
(predefined) queries in the software out in the field.
I was hoping to move away from Access toward SQLite if feasible.  I feel that 
it would be faster and easier to port to other platforms.

I'm not an SQL expert either, but you're certainly better at it than I am.  I 
get lost after a couple of joins. I wonder if there is a way to re-arrange the 
joins so that the select would be acceptable to SQLite.

Vance

on Mar 12, 2013, Dominique Devienne  wrote:
>
>I'm no expert, but I think your problem comes from the excessive
>parentheses you are using.
>
>Below's a little experiment that reproduces your syntax, with its error,
>and provides an alternative simpler syntax that works. --DD
>
>C:\Users\DDevienne>sqlite3
>SQLite version 3.7.15.2 2013-01-09 11:53:05
>Enter ".help" for instructions
>Enter SQL statements terminated with a ";"
>sqlite> create table a (id number);
>sqlite> create table b (id number, a number);
>sqlite> create table c (id number, b number);
>sqlite> create view v1 as select a.id, b.id, c.id
>   ...> from (c INNER JOIN (a INNER JOIN b on a.id = b.a) on c.b = b.id)
>   ...> where (((a.id) = 1));
>Error: no such column: a.id
>sqlite>
>sqlite> create view v1 as select a.id, b.id, c.id
>   ...> from
>   ...> a INNER JOIN b on a.id = b.a
>   ...>   INNER JOIN c on b.id = c.b
>   ...> where a.id = 1;
>sqlite>
>
>
>On Tue, Mar 12, 2013 at 3:42 PM,  wrote:
>
>>
>> Hello,
>>
>> Using sqlite3, I entered this create view statement:
>> CREATE VIEW IF NOT EXISTS "Annies Form" AS
>> SELECT Categories.Category_Name, Strings.Long_Text, Units.Long_Units,
>> Limits.Lower_Limit, Limits.Upper_Limit
>> FROM Objects INNER JOIN (Categories INNER JOIN Object_Categories ON
>> Categories.Category_ID=Object_Categories.Category_ID) ON
>> Objects.Object_ID=Object_Categories.Object_ID) INNER JOIN Units ON
>> Objects.Unit_ID=Units.Unit_ID) INNER JOIN Strings ON
>> Objects.String_ID=Strings.String_ID) INNER JOIN Addresses ON
>> Objects.Address_ID=Addresses.Address_ID) INNER JOIN Limits ON
>> Objects.Limit_ID=Limits.Limit_ID
>> WHERE (((Categories.Category_Type_ID)=1));
>>
>> sqlite3 complains that the column Categories.Category_Name does not exists.
>> Yet, I can do a
>> Select Categories.Category_Name From Categories
>> with no problems.
>>
>> This create view worked as well:
>> CREATE VIEW IF NOT EXISTS 'Select_Categories' AS
>> SELECT Categories.Category_ID, Categories.Category_Name,
>> Strings.Long_Text, Strings.Short_Text, Strings.Alternate_Text,
>> Category_Types.Category_Type
>> FROM (Categories INNER JOIN Strings ON Categories.String_ID =
>> Strings.String_ID) INNER JOIN Category_Types ON Categories.Category_Type_ID
>> = Category_Types.Category_Type_ID;
>>
>> As a side note, these were predefined queryDefs from an MS Access db that,
>> I believe, work OK.
>>
>> Vance
>> ___
>> 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


[sqlite] sqlite3_close() documentation inconsistency

2013-03-12 Thread Shane Harrelson
Documentation for sqlite3_close() on
http://www.sqlite.org/c3ref/close.html has two conflicting statements:

"If the database connection is associated with unfinalized prepared
statements or unfinished sqlite3_backup objects then sqlite3_close()
will leave the database connection open and return SQLITE_BUSY."

and

"If sqlite3_close() is called on a database connection that still has
outstanding prepared statements, BLOB handles, and/or sqlite3_backup
objects then it returns SQLITE_OK but..."
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite4 questions

2013-03-12 Thread Richard Hipp
On Tue, Mar 12, 2013 at 1:57 PM, Warren Young  wrote:

> On 3/7/2013 16:14, Richard Hipp wrote:
>
>> On Thu, Mar 7, 2013 at 6:10 PM, Jeff Archer > **com 
>>
>>> wrote:
>>>
>>
>>  Will SQLite4 be capable of reading a SQLite3 database to facilitate
>>> upgrade?  (I'm guessing 'no')
>>>
>>>
>> No.
>>
>
> Is it expected to be language-compatible, at least, so you can slurp in a
> .dump file?
>

Yes, this should work:

sqlite3 old.db .dump | sqlite4 new.db



>
> I mean this question in the same sense that one always questions SQL
> compatibility: yes, there are standards, but only the naive believe all SQL
> implementations understand all SQL dialects.
>
>
> __**_
> 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] SQLite4 questions

2013-03-12 Thread Warren Young

On 3/7/2013 16:14, Richard Hipp wrote:

On Thu, Mar 7, 2013 at 6:10 PM, Jeff Archer 

Re: [sqlite] TCL Test failures on ARM

2013-03-12 Thread Dan Kennedy

On 03/12/2013 06:45 PM, bkk wrote:

Below is the backtrace from the gdb when the failure happened.


Seems odd to me. Assuming this is happening within the sysfault-2.1
test case, then the first stack should be setting errno to EINTR.
Causing the robust_ftruncate() function to retry ts_ftruncate().
The second call should succeed.

Is it invoking ts_ftruncate() a second time after the first (failing)
call returns. Is the failing call that we can see in the stack trace
below really setting errno to EINTR?

Dan.





#0  tsIsFail () at ./src/test_syscall.c:163
#1  0x000324b4 in tsIsFailErrno (zFunc=0xc8920 "ftruncate")
 at ./src/test_syscall.c:196
#2  0x0003268c in ts_ftruncate (fd=5, n=206456) at ./src/test_syscall.c:273
#3  0x000627f0 in robust_ftruncate (sz=0, h=5) at sqlite3.c:23589
#4  unixTruncate (nByte=0, id=0x12f2e0) at sqlite3.c:26363
#5  unixTruncate (id=0x12f2e0, nByte=) at sqlite3.c:26348
#6  0x00069284 in sqlite3OsTruncate (size=0, id=0x12f2e0) at sqlite3.c:15034
#7  pager_end_transaction (pPager=0x12f148, hasMaster=,
 bCommit=1) at sqlite3.c:39294
#8  0x0006945c in sqlite3PagerCommitPhaseTwo (pPager=0x12f148)
 at sqlite3.c:43388
#9  0x0007a5dc in sqlite3BtreeCommitPhaseTwo (bCleanup=0, p=0x131e50)
 at sqlite3.c:51636
#10 sqlite3BtreeCommitPhaseTwo (p=0x131e50, bCleanup=0) at sqlite3.c:51622
#11 0x0008bd2c in vdbeCommit (p=0x131c88, db=0x14c6c0) at sqlite3.c:60488
#12 sqlite3VdbeHalt (p=0x131c88) at sqlite3.c:60877
#13 0x000b6a84 in sqlite3VdbeExec (p=0x131c88) at sqlite3.c:64906
#14 0x000a50b8 in sqlite3Step (p=0x131c88) at sqlite3.c:62344
#15 sqlite3_step (pStmt=) at sqlite3.c:62418
#16 0x00038a78 in dbEvalStep (p=0x7efff288) at ./src/tclsqlite.c:1400
#17 0x0003bde0 in DbObjCmd (cd=0x130468, interp=0x107198,
 objc=, objv=0x10802c) at ./src/tclsqlite.c:2251

(gdb) backtrace
#0  unixTruncate (nByte=0, id=0x12f2e0) at sqlite3.c:26366
#1  unixTruncate (id=0x12f2e0, nByte=) at sqlite3.c:26348
#2  0x00069284 in sqlite3OsTruncate (size=0, id=0x12f2e0) at sqlite3.c:15034
#3  pager_end_transaction (pPager=0x12f148, hasMaster=,
 bCommit=1) at sqlite3.c:39294
#4  0x0006945c in sqlite3PagerCommitPhaseTwo (pPager=0x12f148)
 at sqlite3.c:43388
#5  0x0007a5dc in sqlite3BtreeCommitPhaseTwo (bCleanup=0, p=0x131e50)
 at sqlite3.c:51636
#6  sqlite3BtreeCommitPhaseTwo (p=0x131e50, bCleanup=0) at sqlite3.c:51622
#7  0x0008bd2c in vdbeCommit (p=0x131c88, db=0x14c6c0) at sqlite3.c:60488
#8  sqlite3VdbeHalt (p=0x131c88) at sqlite3.c:60877
#9  0x000b6a84 in sqlite3VdbeExec (p=0x131c88) at sqlite3.c:64906
#10 0x000a50b8 in sqlite3Step (p=0x131c88) at sqlite3.c:62344
#11 sqlite3_step (pStmt=) at sqlite3.c:62418
#12 0x00038a78 in dbEvalStep (p=0x7efff288) at ./src/tclsqlite.c:1400
#13 0x0003bde0 in DbObjCmd (cd=0x130468, interp=0x107198,
 objc=, objv=0x10802c) at ./src/tclsqlite.c:2251
#14 0x2aaf4348 in ?? ()
#15 0x2aaf4348 in ?? ()


(gdb) backtrace
#0  unixLogErrorAtLine (errcode=1546, zFunc=0xc8920 "ftruncate",
 zPath=0x12f350 "/home/brijesh/mySQLtry/test.db-journal", iLine=26366)
 at sqlite3.c:23979
#1  0x00069284 in sqlite3OsTruncate (size=0, id=0x12f2e0) at sqlite3.c:15034
#2  pager_end_transaction (pPager=0x12f148, hasMaster=,
 bCommit=1) at sqlite3.c:39294
#3  0x0006945c in sqlite3PagerCommitPhaseTwo (pPager=0x12f148)
 at sqlite3.c:43388
#4  0x0007a5dc in sqlite3BtreeCommitPhaseTwo (bCleanup=0, p=0x131e50)
 at sqlite3.c:51636
#5  sqlite3BtreeCommitPhaseTwo (p=0x131e50, bCleanup=0) at sqlite3.c:51622
#6  0x0008bd2c in vdbeCommit (p=0x131c88, db=0x14c6c0) at sqlite3.c:60488
#7  sqlite3VdbeHalt (p=0x131c88) at sqlite3.c:60877
#8  0x000b6a84 in sqlite3VdbeExec (p=0x131c88) at sqlite3.c:64906
#9  0x000a50b8 in sqlite3Step (p=0x131c88) at sqlite3.c:62344
#10 sqlite3_step (pStmt=) at sqlite3.c:62418
#11 0x00038a78 in dbEvalStep (p=0x7efff288) at ./src/tclsqlite.c:1400
#12 0x0003bde0 in DbObjCmd (cd=0x130468, interp=0x107198,
 objc=, objv=0x10802c) at ./src/tclsqlite.c:2251
#13 0x2aaf4348 in ?? ()
#14 0x2aaf4348 in ?? ()

#0  sqlite3Step (p=) at sqlite3.c:62366
#1  sqlite3_step (pStmt=) at sqlite3.c:62418
#2  0x00038a78 in dbEvalStep (p=0x7efff288) at ./src/tclsqlite.c:1400
#3  0x0003bde0 in DbObjCmd (cd=0x130468, interp=0x107198,
 objc=, objv=0x10802c) at ./src/tclsqlite.c:2251
#4  0x2aaf4348 in ?? ()
#5  0x2aaf4348 in ?? ()



--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/TCL-Test-failures-on-ARM-tp67612p67641.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 

Re: [sqlite] create view doesn't work

2013-03-12 Thread Dominique Devienne
I'm no expert, but I think your problem comes from the excessive
parentheses you are using.

Below's a little experiment that reproduces your syntax, with its error,
and provides an alternative simpler syntax that works. --DD

C:\Users\DDevienne>sqlite3
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table a (id number);
sqlite> create table b (id number, a number);
sqlite> create table c (id number, b number);
sqlite> create view v1 as select a.id, b.id, c.id
   ...> from (c INNER JOIN (a INNER JOIN b on a.id = b.a) on c.b = b.id)
   ...> where (((a.id) = 1));
Error: no such column: a.id
sqlite>
sqlite> create view v1 as select a.id, b.id, c.id
   ...> from
   ...> a INNER JOIN b on a.id = b.a
   ...>   INNER JOIN c on b.id = c.b
   ...> where a.id = 1;
sqlite>


On Tue, Mar 12, 2013 at 3:42 PM,  wrote:

>
> Hello,
>
> Using sqlite3, I entered this create view statement:
> CREATE VIEW IF NOT EXISTS "Annies Form" AS
> SELECT Categories.Category_Name, Strings.Long_Text, Units.Long_Units,
> Limits.Lower_Limit, Limits.Upper_Limit
> FROM Objects INNER JOIN (Categories INNER JOIN Object_Categories ON
> Categories.Category_ID=Object_Categories.Category_ID) ON
> Objects.Object_ID=Object_Categories.Object_ID) INNER JOIN Units ON
> Objects.Unit_ID=Units.Unit_ID) INNER JOIN Strings ON
> Objects.String_ID=Strings.String_ID) INNER JOIN Addresses ON
> Objects.Address_ID=Addresses.Address_ID) INNER JOIN Limits ON
> Objects.Limit_ID=Limits.Limit_ID
> WHERE (((Categories.Category_Type_ID)=1));
>
> sqlite3 complains that the column Categories.Category_Name does not exists.
> Yet, I can do a
> Select Categories.Category_Name From Categories
> with no problems.
>
> This create view worked as well:
> CREATE VIEW IF NOT EXISTS 'Select_Categories' AS
> SELECT Categories.Category_ID, Categories.Category_Name,
> Strings.Long_Text, Strings.Short_Text, Strings.Alternate_Text,
> Category_Types.Category_Type
> FROM (Categories INNER JOIN Strings ON Categories.String_ID =
> Strings.String_ID) INNER JOIN Category_Types ON Categories.Category_Type_ID
> = Category_Types.Category_Type_ID;
>
> As a side note, these were predefined queryDefs from an MS Access db that,
> I believe, work OK.
>
> Vance
> ___
> 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] create view doesn't work

2013-03-12 Thread veneff

Hello,

Using sqlite3, I entered this create view statement:
CREATE VIEW IF NOT EXISTS "Annies Form" AS 
SELECT Categories.Category_Name, Strings.Long_Text, Units.Long_Units, 
Limits.Lower_Limit, Limits.Upper_Limit
FROM Objects INNER JOIN (Categories INNER JOIN Object_Categories ON 
Categories.Category_ID=Object_Categories.Category_ID) ON 
Objects.Object_ID=Object_Categories.Object_ID) INNER JOIN Units ON 
Objects.Unit_ID=Units.Unit_ID) INNER JOIN Strings ON 
Objects.String_ID=Strings.String_ID) INNER JOIN Addresses ON 
Objects.Address_ID=Addresses.Address_ID) INNER JOIN Limits ON 
Objects.Limit_ID=Limits.Limit_ID
WHERE (((Categories.Category_Type_ID)=1));

sqlite3 complains that the column Categories.Category_Name does not exists.
Yet, I can do a 
Select Categories.Category_Name From Categories
with no problems.

This create view worked as well:
CREATE VIEW IF NOT EXISTS 'Select_Categories' AS 
SELECT Categories.Category_ID, Categories.Category_Name, Strings.Long_Text, 
Strings.Short_Text, Strings.Alternate_Text, Category_Types.Category_Type
FROM (Categories INNER JOIN Strings ON Categories.String_ID = 
Strings.String_ID) INNER JOIN Category_Types ON Categories.Category_Type_ID = 
Category_Types.Category_Type_ID;

As a side note, these were predefined queryDefs from an MS Access db that, I 
believe, work OK.

Vance
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Windows-Specific 2-c-files Amalgamation?

2013-03-12 Thread Bert Huijben


> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
> boun...@sqlite.org] On Behalf Of Dominique Devienne
> Sent: maandag 11 maart 2013 17:17
> To: General Discussion of SQLite Database
> Subject: [sqlite] Windows-Specific 2-c-files Amalgamation?
> 
> I understand the "deployment" ease and performance advantage of the
> amalgamation. I like it.
> 
> Except I can't debug it... 'Cause I'm primarily on Windows, which has a
> well-known limitation in the way it stores Debug Information (uses 16-bit
> integer for the line number, so limited to ~64K lines, whereas the
> amalgamation is much larger).
> 
> Could there be another amalgamation, perhaps Windows specific, that
> spreads
> the sole .c file into 2 or 3?
> 
> I'm sure it's work, and perhaps even requires another "private" header to
> share non-public data structures between the two or more C files, but
given
> SQLite's clean architecture and layers (Pager, VDBE, etc...), I'm assuming
> it's at least "possible", no? Might even not loose much of that little
> performance advantage the amalgamation brings???
> 
> I for one would be able to dive deeper into the code, without resorting to
> the not-recommended full build (which is more Linux than Windows friendly)
> 
> I don't have much hope for this (any more than MS fixing its
> tool-chain...), but I thought I might as well ask ;). Perhaps someone
knows
> a trick or two to work-around that MS debugging issue?

Since Visual C++ 2005 the limit in PDB files was increased to 24 bit. You
might still get a warning for compatibility with older tools, but the 'well
known limitation' was resolved over 8 years ago; 4 major compiler versions
ago.

Bert 

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] TCL Test failures on ARM

2013-03-12 Thread bkk
Below is the backtrace from the gdb when the failure happened.

#0  tsIsFail () at ./src/test_syscall.c:163
#1  0x000324b4 in tsIsFailErrno (zFunc=0xc8920 "ftruncate")
at ./src/test_syscall.c:196
#2  0x0003268c in ts_ftruncate (fd=5, n=206456) at ./src/test_syscall.c:273
#3  0x000627f0 in robust_ftruncate (sz=0, h=5) at sqlite3.c:23589
#4  unixTruncate (nByte=0, id=0x12f2e0) at sqlite3.c:26363
#5  unixTruncate (id=0x12f2e0, nByte=) at sqlite3.c:26348
#6  0x00069284 in sqlite3OsTruncate (size=0, id=0x12f2e0) at sqlite3.c:15034
#7  pager_end_transaction (pPager=0x12f148, hasMaster=, 
bCommit=1) at sqlite3.c:39294
#8  0x0006945c in sqlite3PagerCommitPhaseTwo (pPager=0x12f148)
at sqlite3.c:43388
#9  0x0007a5dc in sqlite3BtreeCommitPhaseTwo (bCleanup=0, p=0x131e50)
at sqlite3.c:51636
#10 sqlite3BtreeCommitPhaseTwo (p=0x131e50, bCleanup=0) at sqlite3.c:51622
#11 0x0008bd2c in vdbeCommit (p=0x131c88, db=0x14c6c0) at sqlite3.c:60488
#12 sqlite3VdbeHalt (p=0x131c88) at sqlite3.c:60877
#13 0x000b6a84 in sqlite3VdbeExec (p=0x131c88) at sqlite3.c:64906
#14 0x000a50b8 in sqlite3Step (p=0x131c88) at sqlite3.c:62344
#15 sqlite3_step (pStmt=) at sqlite3.c:62418
#16 0x00038a78 in dbEvalStep (p=0x7efff288) at ./src/tclsqlite.c:1400
#17 0x0003bde0 in DbObjCmd (cd=0x130468, interp=0x107198, 
objc=, objv=0x10802c) at ./src/tclsqlite.c:2251

(gdb) backtrace
#0  unixTruncate (nByte=0, id=0x12f2e0) at sqlite3.c:26366
#1  unixTruncate (id=0x12f2e0, nByte=) at sqlite3.c:26348
#2  0x00069284 in sqlite3OsTruncate (size=0, id=0x12f2e0) at sqlite3.c:15034
#3  pager_end_transaction (pPager=0x12f148, hasMaster=, 
bCommit=1) at sqlite3.c:39294
#4  0x0006945c in sqlite3PagerCommitPhaseTwo (pPager=0x12f148)
at sqlite3.c:43388
#5  0x0007a5dc in sqlite3BtreeCommitPhaseTwo (bCleanup=0, p=0x131e50)
at sqlite3.c:51636
#6  sqlite3BtreeCommitPhaseTwo (p=0x131e50, bCleanup=0) at sqlite3.c:51622
#7  0x0008bd2c in vdbeCommit (p=0x131c88, db=0x14c6c0) at sqlite3.c:60488
#8  sqlite3VdbeHalt (p=0x131c88) at sqlite3.c:60877
#9  0x000b6a84 in sqlite3VdbeExec (p=0x131c88) at sqlite3.c:64906
#10 0x000a50b8 in sqlite3Step (p=0x131c88) at sqlite3.c:62344
#11 sqlite3_step (pStmt=) at sqlite3.c:62418
#12 0x00038a78 in dbEvalStep (p=0x7efff288) at ./src/tclsqlite.c:1400
#13 0x0003bde0 in DbObjCmd (cd=0x130468, interp=0x107198, 
objc=, objv=0x10802c) at ./src/tclsqlite.c:2251
#14 0x2aaf4348 in ?? ()
#15 0x2aaf4348 in ?? ()


(gdb) backtrace
#0  unixLogErrorAtLine (errcode=1546, zFunc=0xc8920 "ftruncate", 
zPath=0x12f350 "/home/brijesh/mySQLtry/test.db-journal", iLine=26366)
at sqlite3.c:23979
#1  0x00069284 in sqlite3OsTruncate (size=0, id=0x12f2e0) at sqlite3.c:15034
#2  pager_end_transaction (pPager=0x12f148, hasMaster=, 
bCommit=1) at sqlite3.c:39294
#3  0x0006945c in sqlite3PagerCommitPhaseTwo (pPager=0x12f148)
at sqlite3.c:43388
#4  0x0007a5dc in sqlite3BtreeCommitPhaseTwo (bCleanup=0, p=0x131e50)
at sqlite3.c:51636
#5  sqlite3BtreeCommitPhaseTwo (p=0x131e50, bCleanup=0) at sqlite3.c:51622
#6  0x0008bd2c in vdbeCommit (p=0x131c88, db=0x14c6c0) at sqlite3.c:60488
#7  sqlite3VdbeHalt (p=0x131c88) at sqlite3.c:60877
#8  0x000b6a84 in sqlite3VdbeExec (p=0x131c88) at sqlite3.c:64906
#9  0x000a50b8 in sqlite3Step (p=0x131c88) at sqlite3.c:62344
#10 sqlite3_step (pStmt=) at sqlite3.c:62418
#11 0x00038a78 in dbEvalStep (p=0x7efff288) at ./src/tclsqlite.c:1400
#12 0x0003bde0 in DbObjCmd (cd=0x130468, interp=0x107198, 
objc=, objv=0x10802c) at ./src/tclsqlite.c:2251
#13 0x2aaf4348 in ?? ()
#14 0x2aaf4348 in ?? ()

#0  sqlite3Step (p=) at sqlite3.c:62366
#1  sqlite3_step (pStmt=) at sqlite3.c:62418
#2  0x00038a78 in dbEvalStep (p=0x7efff288) at ./src/tclsqlite.c:1400
#3  0x0003bde0 in DbObjCmd (cd=0x130468, interp=0x107198, 
objc=, objv=0x10802c) at ./src/tclsqlite.c:2251
#4  0x2aaf4348 in ?? ()
#5  0x2aaf4348 in ?? ()



--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/TCL-Test-failures-on-ARM-tp67612p67641.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] extra added special character

2013-03-12 Thread Simon Slavin

On 12 Mar 2013, at 9:08am, jigyanshu.raj  wrote:

> we have using sqlite framework in c#.net. When we are going to insert new
> row value "» InBox «" into table. They had added some extra character "»
> InBox «" with value.

This is a Windows problem.  The double-arrow characters have different codes 
depending on which code page you are using.  You have defined your characters 
using a Windows codepage which isn't Unicode.  SQLite deals only with ASCII and 
Unicode characters.  Either switch to a Unicode page when entering your string 
"» InBox «" or have your program convert from one character encoding to another 
before passing the string to SQLite.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] extra added special character

2013-03-12 Thread jigyanshu.raj
hello,

we have using sqlite framework in c#.net. When we are going to insert new
row value "» InBox «" into table. They had added some extra character "»
InBox «" with value.
Please give me the solutions how to insert value into table with any
special character. No any extra character.



thanks & regards
Jigyanshu
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users