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

后端 未结 4 455
慢半拍i
慢半拍i 2021-01-23 03:13

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

4条回答
  •  醉话见心
    2021-01-23 03:43

    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  
    

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

    LIST DICT  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.

提交回复
热议问题