@@ -31,8 +31,8 @@ class App:
3131 """the GUI graphic application"""
3232 def __init__ (self ):
3333 """create a tkk graphic interface with a main window tk_win"""
34- self .__version__ = '0.8.10 '
35- self ._title = "2015-08-12a : 'F9 runs !'"
34+ self .__version__ = '0.8.11 '
35+ self ._title = "2016-03-06a : 'Combine Functions !'"
3636 self .conn = None # Baresql database object
3737 self .database_file = ""
3838 self .tk_win = Tk ()
@@ -1393,12 +1393,12 @@ def get_tokens(self, sql, start=0, shell_tokens=False):
13931393 length = len (sql )
13941394 i = start
13951395 can_be_shell_command = True
1396- token = 'TK_OTHER'
13971396 dico = {' ' : 'TK_SP' , '\t ' : 'TK_SP' , '\n ' : 'TK_SP' , '\f ' : 'TK_SP' ,
13981397 '\r ' : 'TK_SP' , '(' : 'TK_LP' , ')' : 'TK_RP' , ';' : 'TK_SEMI' ,
13991398 ',' : 'TK_COMMA' , '/' : 'TK_OTHER' , "'" : 'TK_STRING' ,
14001399 "-" : 'TK_OTHER' , '"' : 'TK_STRING' , "`" : 'TK_STRING' }
14011400 while length > start :
1401+ token = 'TK_OTHER'
14021402 if shell_tokens and can_be_shell_command and i < length and (
14031403 (sql [i ] == "." and i == start ) or
14041404 (i > start and sql [i - 1 :i ] == "\n ." )):
@@ -1541,11 +1541,14 @@ def _main():
15411541 app .new_db (":memory:" )
15421542 welcome_text = """-- SQLite Memo (Demo = click on green "->" and "@" icons)
15431543\n -- to CREATE a table 'items' and a table 'parts' :
1544- create table item (ItemNo, Description,Kg , PRIMARY KEY (ItemNo));
1545- create table part(ParentNo, ChildNo , Description TEXT , Qty_per REAL);
1544+ DROP TABLE IF EXISTS item; DROP TABLE IF EXISTS part;
1545+ CREATE TABLE item (ItemNo, Description,Kg , PRIMARY KEY (ItemNo));
1546+ CREATE TABLE part(ParentNo, ChildNo , Description TEXT , Qty_per REAL);
15461547\n -- to CREATE an index :
1548+ DROP INDEX IF EXISTS parts_id1;
15471549CREATE INDEX parts_id1 ON part(ParentNo Asc, ChildNo Desc);
1548- -- to CREATE a view 'v1':
1550+ \n -- to CREATE a view 'v1':
1551+ DROP VIEW IF EXISTS v1;
15491552CREATE VIEW v1 as select * from item inner join part as p ON ItemNo=p.ParentNo;
15501553\n -- to INSERT datas
15511554INSERT INTO item values("T","Ford",1000);
@@ -1560,8 +1563,12 @@ def _main():
15601563 "fibonacci : example with function call (may only be internal) "
15611564 fib = lambda n: n if n < 2 else fib(n-1) + fib(n-2)
15621565 return("%s" % fib(n*1));
1563- \n -- to USE a python embedded function :
1564- select py_sin(1) as sinus_1, py_fib(8) as fib_8, sqlite_version() ;
1566+ pydef py_power(x,y):
1567+ "power function : example loading module, handling input/output as strings"
1568+ import math as py_math
1569+ return ("%s" % ((x*1) ** (y*1)) );
1570+ \n -- to USE a python embedded function and nesting of embedded functions:
1571+ select py_sin(1) as sinus, py_power(2, 1*py_fib(6)) as power, sqlite_version();
15651572\n -- to EXPORT :
15661573-- a TABLE, select TABLE, then click on icon 'SQL->CSV'
15671574-- a QUERY RESULT, select the SCRIPT text, then click on icon '???->CSV',
0 commit comments