sql-query3.m 1.97 KB
Newer Older
bp's avatar
bp committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#! xbigforth
\ automatic generated code
\ do not edit

also editor also minos also forth

include sql-classes.fs
component class sql
public:
  tableinfotextfield ptr db
  tableinfotextfield ptr table
  tableinfotextfield ptr #name
  tableinfotextfield ptr #street
  tableinfotextfield ptr #country
  tableinfotextfield ptr #zip
  tableinfotextfield ptr #town
 ( [varstart] ) method do-insert
database ptr sql-db
cell var db-name ( [varend] ) 
how:
bp's avatar
bp committed
21
  : params   DF[ 0 ]DF X" SQL insert" ;
bp's avatar
bp committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
class;

include sql.fs
sql implements
 ( [methodstart] ) : do-insert
  db-name @ IF  db get db-name $@ compare 0=  ELSE  true  THEN
  IF  db get 2dup db-name $!  database new bind sql-db  THEN
  s" max(id)" sql-db select
  table get sql-db with from ) endwith
  0 0 sql-db with tuple@ s>number clear endwith
  table get sql-db insert(
  drop 1+ sql-db int,
  #name get sql-db string,
  #street get sql-db string,
  #country get sql-db string,
  #zip get drop sql-db int,
  #town get sql-db string,
  sql-db ) ;
: dispose
  sql-db self  IF  sql-db dispose  THEN
  super dispose ; ( [methodend] ) 
  : widget  ( [dumpstart] )
bp's avatar
bp committed
44 45 46 47 48
        T" test" ^^ ST[  ]ST ( MINOS ) X" Data base:" tableinfotextfield new  ^^bind db
        T" customer" ^^ ST[  ]ST ( MINOS ) X" Table" tableinfotextfield new  ^^bind table
        T" " ^^ ST[  ]ST ( MINOS ) X" Name" tableinfotextfield new  ^^bind #name
        T" " ^^ ST[  ]ST ( MINOS ) X" Street" tableinfotextfield new  ^^bind #street
        T" " ^^ ST[  ]ST ( MINOS ) X" Country" tableinfotextfield new  ^^bind #country
49
        #0. ]N ( MINOS ) ^^ SN[  ]SN ( MINOS ) X" Zip" tableinfotextfield new  ^^bind #zip
bp's avatar
bp committed
50 51 52 53 54
        T" " ^^ ST[  ]ST ( MINOS ) X" Town" tableinfotextfield new  ^^bind #town
          ^^ S[ do-insert ]S ( MINOS ) X" Insert" button new 
          ^^ S[ close ]S ( MINOS ) X" Close" button new 
        #2 hatbox new #1 hskips
      #8 vabox new panel
bp's avatar
bp committed
55 56 57 58 59
    ( [dumpend] ) ;
class;

: main
  sql open-app
bp's avatar
bp committed
60
  event-loop bye ;
bp's avatar
bp committed
61 62
script? [IF]  main  [THEN]
previous previous previous