Re Database Toolbox: quicker way to determine read-only columns

1 Ansicht (letzte 30 Tage)
David Goldsmith
David Goldsmith am 30 Dez. 2011
Hi! I'm writing an automated database application, including automated inserts and updates; I'm trying to anticipate and deal with "failure modes" before they happen, rather than after. :-) Accordingly, I'd like to ensure that the program doesn't try to insert to/update read-only columns (e.g., primary keys); I've figured out how to do this by creating a cursor, querying the column(s) in question, and then examining its (their) attributes, but this seems like a lot of overhead, especially w.r.t. its time requirement. Before I figured out that way to do it, I spent quite a bit of time unsuccessfully trying to figure out if there was some object, method, or property associated w/ the database object (or one of its children) which either already had or quickly generated a list of primary keys (or, more generally, read-only columns). However, not really knowing what there might be, let me pose the question rather generally: is there a quicker and/or more elegant way to either generate a global list of read-only columns and/or determine if any given column is read-only? Thanks!

Antworten (1)

the cyclist
the cyclist am 30 Dez. 2011
I am by no means an expert in this, and I do not know the specific answer to your question. However, I know that in PostgreSQL, there are "metatables" that contain information about the tables in the database. Here is a web page that shows how to find various bits of information about a PostgreSQL database. It looks like some of the comments talk about finding primary keys.
Since your question doesn't really have anything to do with MATLAB, you might be better off finding a forum that covers database questions.
  1 Kommentar
David Goldsmith
David Goldsmith am 30 Dez. 2011
Actually, I'm writing the application in MATLAB (I thought that was clear) so it has everything to do w/ MATLAB: I know about such tables, but I can't figure out how to get information from them using MATLAB's database toolbox. Thanks for trying.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by