[REBOL] Re: RE : Re: MSSQL results
From: rebol:optushome:au at: 2-Oct-2002 23:28
I haven't got REBOL/Command on this machine so I'm just going from memory
here.
These are two separate (unrelated & unjoined) SQL statements, they should be
inserted and retrieved separately. The driver returns 1 recordset (multiple
records) per executed SQL request, not multiple recordsets. (some languages
have wrapper objects that do this for you)
(I'm surprised you didn't get an error, some/most ODBC drivers would report
a Syntax error for two separate Select statements in one string, if they
weren't joined or nested. e.g conn.execute() under ASP does)
If you really want to emulate returning two or more recordsets in the totals
block you could do something like this. (not tested)
return-recordsets: func [
db-port [port!] "DB Command Port"
SQL-Statements [block!] "Block of SQL statement strings"
/local datasets
][
datasets: copy []
for each SQL SQL-Statements [
insert db-port SQL
append/only datasets copy db-port
]
datasets
]
; --- Run the function
SQL-Cmds: [{select count(*) from first_table} {select count(*) from
second_table} ]
totals: return-recordsets db-command-port sql-cmds
Cheers,
Allen K