u2universemultivalue-databasepick

How do I find the column listing in UniVerse with RetrieVe or SQL?


I've got an issue where a table (file) is set up to return column foo on LIST table and SELECT * FROM table. I need to know the other possible columns in table. I'm pretty sure this was achieved by setting @ (behavoir definition of unqualified LIST), and @select (behavoir definition of * with very SELECT) but I don't know how to get the full list of columns. How do I read the table schema in uvsh and query for the physical table columns?

Running LIST.ITEM on the table shows me a list of all of the field numbers and values, but how do i find the DISPLAY NAME and column name of the numbered fields?


Solution

  • A previous answer I received on SO had mentioned LIST DICT as a way to get some metadata. This was in fact what I think I wanted. The official documentation uses LIST DICT; however, on my system I thought there wasn't LIST DICT, there is. It requires a file argument. It simply wasn't a separate command either (many commands have spaces in them), instead in (UniVerse 10.1) list is defined as:

    LIST [ DICT | USING [ DICT ] dictname ] filename [ records | FROM n ]
    [ selection ] [ output.limiter ] [ sort ] [ output ] [ report.qualifiers ] [TOXML
    [ELEMENTS] [WITHDTD] [XMLMAPPING mapping_file]]
    

    So in summary, The same verb (LIST) to query data is used to query the schema, with the same destination file.

    Originally when I presumed there wasn't a LIST DICT I went searching through the VOC file with RetrieVe using LIST VOC WITH NAME MATCHING LIST... I was able to identify a like-named LIST.DICT, a PAragraph that displays the contents of DICTIONARIES sorted by record type. This did exactly what I wanted except the result was a unmanageable list of 400 rows. I don't see the documentation for LIST.DICT anywhere, and it seems as if record qualifiers and report qualifiers don't work on the LIST.DICT like they do on LIST. This was all true and compounded my confusion, in UniVerse parlance: LIST.DICT is a phrase, a stored statement, LIST is the verb I needed.

    So now back to my questions:

    Any idea on how to make the output of LIST DICT manageable?

    You can use the report qualifier and explicitly state columns by using the positional F# syntax, or by stating the names of the columns.

    LIST DICT <file> <columns>
    

    on my system you can get a listing of the field names and their display names for instance by issuing

    LIST DICT <file> NAME
    

    The NAME comes from the master dictionary, which can be queried using LIST DICT DICT.DICT.

    Now, I can see the fields in a nice (fairly clean) list, but I haven't the slightest idea of how to query a file for all of its fields.