[REBOL] ODBC problems
From: gchiu::compkarori::co::nz at: 10-Dec-2000 10:00
Can someone see what I'm doing wrong here - using the
Evaluation version of R/Command.
Rebol [
file: %testodbc.r
notes: { testing with the open source binaries of Interbase
6.1 ( http://www.interbase.org ) and
the Intersolv ODBC driver. Employee is a system dsn to
employee.gdb - a sample Interbase table
that gets installed into the examples\database directory
}
]
open-employee: func [] [
dbase: open odbc://SYSDBA:[masterkey--employee]
db-port: first dbase
]
create-table1: "insert db-port [ {create table reboltest (
fname char(20) not null primary key, birthday timestamp
default 'NOW' ) } ]"
create-table2: "insert db-port [ {create table reboltest (
fname char(20) not null primary key, birthday timestamp )} ]
drop-table:
insert db-port [ {drop table reboltest} ] "
getrecs: func [] [
insert db-port [ "select * from reboltest" ]
dbrecs: copy db-port
]
removeall: func [] [
insert db-port [ "delete from reboltest" ]
]
insertrecs: func [] [
insert db-port [ {insert into reboltest (fname ) values (?
)} "Graham" ]
insert db-port [ {insert into reboltest (fname, birthday)
values (?, ?)} "Joe" "31-Dec-1960" ]
insert db-port [ {insert into reboltest (fname, birthday)
values (?, ?)} "Jane" "31-Dec-1959" ]
]
test: func [] [
open-employee
either error? try [ getrecs ]
[ do create-table1 ]
[ removeall ]
insertrecs
getrecs
]
I get random characters being returned with the fname field,
and dates don't insert coming back as none. The birthday
comes back in record 1 where I don't insert a date but use
the default.
--
Graham Chiu