[sqlite] How to Use Dot Commands from the Library

2009-03-16 Thread HG


I want to get a dump of an sqlite3 database using the sqlite3 library without 
adding a dependency on the sqlite3 executable.

Does the sqlite3 library support execution of dot commands. The following fails 
for me :-

--
import sqlite3

conn = sqlite3.connect('media_db.db')
c = conn.cursor()
c.execute('.dump\n')
c.execute('.dump')
conn.commit()
c.close()

Traceback (most recent call last):
  File "test.py", line 5, in 
c.execute('.dump\n')
sqlite3.OperationalError: near ".": syntax error
--

Kindly suggest.

Thank You,
Himanshu


  Add more friends to your messenger and enjoy! Go to 
http://messenger.yahoo.com/invite/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] p in sclp in parse.y

2008-02-06 Thread HG
Hello,

  Could you tell me what the 'p' in 'sclp' in 'parse.y' stands for? I am
trying to make a modification to the grammar file.

  Also the rule for sclp uses selcollist and the rule for selcollist
uses sclp in some kind of mutual recursion. Is this a lemon feature or
normal with LALR grammars.

Thank You,
HG
[snipped parse.y beginning]

%type sclp {ExprList*}
%destructor sclp {sqlite3ExprListDelete($$);}
sclp(A) ::= selcollist(X) COMMA. {A = X;}
sclp(A) ::= .{A = 0;}
selcollist(A) ::= sclp(P) expr(X) as(Y). {
   A = sqlite3ExprListAppend(pParse,P,X,Y.n?&Y:0);
}
selcollist(A) ::= sclp(P) STAR. {
  Expr *p = sqlite3PExpr(pParse, TK_ALL, 0, 0, 0);
  A = sqlite3ExprListAppend(pParse, P, p, 0);
}
selcollist(A) ::= sclp(P) nm(X) DOT STAR. {
  Expr *pRight = sqlite3PExpr(pParse, TK_ALL, 0, 0, 0);
  Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &X);
  Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);
  A = sqlite3ExprListAppend(pParse,P, pDot, 0);
}
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users