File: mysqltest.bas

package info (click to toggle)
parrot 6.6.0-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 25,164 kB
  • ctags: 16,050
  • sloc: ansic: 110,715; perl: 94,382; yacc: 1,911; lex: 1,529; lisp: 1,163; cpp: 782; python: 646; ruby: 335; sh: 140; makefile: 129; cs: 49; asm: 30
file content (36 lines) | stat: -rw-r--r-- 1,268 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
1 rem Copyright (C) 2008, Parrot Foundation.
3 rem
10 rem +----------------------------------------------------------------------+
20 rem + mysqltest.bas                                                        +
30 rem + A test of the pirric basic interpreter                               +
40 rem + First build the Mysql module in examples/nci                         +
50 rem + Then do:                                                             +
60 rem + ../../parrot -L /yourparrotdir/examples/nci pirric.pir mysqltest.bas +
70 rem +----------------------------------------------------------------------+
80 rem
90 on error goto 10100
100 load "Mysql.pbc",b
110 on error goto 10200
120 my = new("Mysql")
130 a = my.connect("localhost","parrot","baDworD","parrot")
140 q = my.query("select * from hello")
150 result = my.use_result()
160 e = result.field_count()
170 print "Fields: "; e
1000 rows = 0
1010 row = result.fetch_row()
1020 if row then goto 1100
1030 print "Rows: "; rows
1040 exit
1100 rows = rows + 1
1140 for i= 1 to e
1160 print "'"; row.get(i - 1); "'";
1180 if i < e then print ", ";
1190 next
2000 print
2010 goto 1010
10000 rem Errors
10100 print "Cannot load mysql client library"
10110 exit 1
10200 print "Error in mysql usage"
10210 exit 1