I've added a function number 9 to the SQL library. This function takes the name of a table and returns information about the columns in that table. The function has no name in
SQL.apl yet, because I am currently overseas and my laptop has no Postgres, which means that it only works for SQLite so far.
I'm sending this email because I have two questions for you guys:
What should the function be called? SQL∆ColumnInfo, SQL∆Cols? Something better?
The second issue I have is how to present the information. Currently, I'm simply returning a two-column matrix where column 1 contains the name and column 2 is a string that describes the type. SQLite at least returns some extra information, such as the uniqueness of the column, or non-nullability.
Right now, the output looks like this:
8⎕CR db SQL[9] 'bar'
┌→──────────────────────────┐
↓┌→─┐ ┌→──┐ │
││id│ │int│ │
│└──┘ └───┘ │
│┌→───┐ ┌→───────────┐│
││name│ │varchar(200)││
│└────┘ └────────────┘│
│┌→────┐ ┌→──┐ │
││value│ │int│ │
│└─────┘ └───┘ │
│┌→─────────┐ ┌→──────┐ │
││extra_data│ │varchar│ │
│└──────────┘ └───────┘ │
└∊──────────────────────────┘
Regards,
Elias