Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sqlite output rows
#3
I get invalid index if I reverse 'c' and 'r'
Below I created a test macro for SQLITE. It creates database in windows tempdir, creates table then inserts data.
But still can not get the desired output:
Code:
Copy      Help
-------------------------------------
TOON_ID  |  FIRST_NAME       |  LAST_NAME
-------------------------------------
   1     |      Daffy          |    Duck
   2     |      Elmer          |    Fudd
   3     |      Yosemite        |   Sam
   4     |      Pepe           |    Le Pew
   5     |      Speedy         |    Gonzales
   6     |      Bugs           |    Bunny
   7     |      Sylvester      |    Jr



Macro Macro9
Code:
Copy      Help
str dbfile="$Temp$\toons_test.db" ;; File has NO extension.
if(FileExists(dbfile))del- dbfile ;; If re-running this script, need to delete exesting or else error

str table="toons"
str sql_create_table=
F
;CREATE TABLE {table} (
;;toon_id integer PRIMARY KEY,
;;first_name text NOT NULL,
;;last_name text NOT NULL
;);

str sql_insert=
F
;INSERT INTO {table} VALUES (1, 'Daffy', 'Duck');
;INSERT INTO {table} VALUES (2, 'Elmer', 'Fudd');
;INSERT INTO {table} VALUES (3, 'Yosemite', 'Sam');
;INSERT INTO {table} VALUES (4, 'Pepe', 'Le Pew');
;INSERT INTO {table} VALUES (5, 'Speedy', 'Gonzales');
;INSERT INTO {table} VALUES (6, 'Bugs', 'Bunny');
;INSERT INTO {table} VALUES (7, 'Sylvester', 'Jr');

Sqlite db3.Open(dbfile) ;; Connect or Create database
db3.Exec(F"{sql_create_table}") ;; Create table
db3.Exec(F"{sql_insert}") ;; Insert data


ARRAY(str) ar; int r c
db3.Exec(F"SELECT * FROM {table}" ar)
for r 0 ar.len ;;for each row
,out ar[0 r]
,out ar[1 r]
,out ar[2 r]
,out "---"


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)