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

1 次查看(过去 30 天)
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!

回答(1 个)

the cyclist
the cyclist 2011-12-30
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 个评论
David Goldsmith
David Goldsmith 2011-12-30
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Database Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by