Metadata from rebol/command with ODBC

10 views
Skip to first unread message

cr8...@hotmail.com

unread,
Apr 27, 2005, 3:26:53 AM4/27/05
to Re...@googlegroups.com
hi,

i would like to have metadata ( field description of a request) from a
connection made with rebol/command on a ODBC database.

how can i can get this informations ?

i know that ODBC return this metadata information from a resultset.

in rebol/command i do like that :

db: open ODBC://MyServerDatabase
stm: firts db
insert stm {select * from mytable}
resulset: copy stm
metadate: ?????????

thanks for your help !!!

SQLAB

unread,
Apr 27, 2005, 3:39:34 AM4/27/05
to Re...@googlegroups.com
Hi Claude?

I answered your question already in ALTME.

Following is the copy.

AR
--------------------------

Hi Claude,
do you want to get the names of the columns?

You do not get them by default.
If you want just the names of the columns of a table, you should do like
this
insert stm ['columns "filexxx"]
foreach column copy stm [probe column]

look at
sdk/doc/database.html#section-4.2

But beware, Rebol/Command does not support all datatypes, so maybe you
will get some problems.
Also depending how strict/relaxed your db system is "filexxx" should be
written "FILEXXX" or as a fully qualified name.
So better check with
insert stm ['tables]
what your db system expects.

If you write a program, it is recommended, to name every column you want
to get in your result set. Then you know the names too .
------------------------------

SQLAB

unread,
Apr 27, 2005, 3:45:30 AM4/27/05
to Re...@googlegroups.com

> If you write a program, it is recommended, to name every column you
> want to get in your result set. Then you know the names too .
> ------------------------------
>
Should read
it is recommended, to name every column you use in your select statement.
Use
"select column-name1, column-name2, column-name3 from from mytable"

AR

cr8...@hotmail.com

unread,
Apr 27, 2005, 5:34:39 AM4/27/05
to Re...@googlegroups.com
hi, AR

i know this possibility. but :
1 i don't want to parse the user request to have columns name
2 it can be difficult to retreive columns name if the request is like
this one:

{Select * from table1 join table2 on table1.key = table2.key}

i would like to know if somewhere in my STM word! i can find metadata
of the request !!!!

SQLAB

unread,
Apr 27, 2005, 6:00:35 AM4/27/05
to Re...@googlegroups.com
Hi Claude

As far as I know, there is no way to get that.

Rebol normally just hides the complexity of data access, sometimes at
the cost of some flexibility.
If you need the full ODBC abilities, you have to code your own ODBC
access via the .dll libraries.

In the early days of /Command I wrote my own ODBC data access via
loading the ODBC.dll.
There I had a switch for metadata as first row of a select statement.

AR
Reply all
Reply to author
Forward
0 new messages