On Tue, 1 Jan 2008 17:16:45 -0600, "Jay Sprenkle"
<[EMAIL PROTECTED]> wrote:

>Almost. If the join isn't done using the primary key then knowing the
>primary key isn't helpful.

You told us you needed that information to know which row and
column to update (edit). You already know the column.
To identify the row, the primary key is the only thing you need.
By definition. It doesn't matter why the original JOIN picked
that specific row, it was selected because it met your criteria.
Alternatively, you can get the ROWID, but that's not protable.

>Parsing the textual output from a pragma doesn't 
>seem very elegant, fast, or like a good long term practice.

PRAGMA are mostly SQLite specific and should be considered
non-portable, that's true. Other databases have other means,
like an INFORMATION_SCHEMA database.

http://www.sqlite.org/pragma.html#schema :
:PRAGMA table_info(table-name);
:
:For each column in the named table, invoke 
:the callback function once with information
:about that column, including the column name, 
:data type, whether or not the column can be 
:NULL, and the default value for the column.

Even if the set of column-metadata was extended to include
index- or primary key attributes, you would only get those if
you SELECT those columns to begin with.

I fail to see why you can't simply include the PRIMARY KEY
(portable) or ROWID (not portable) in your SELECT statement if
you apparently need them later.

Perhaps you should study the source code of some SQLite GUI
front ends to see how they do it?
-- 
  (  Kees Nuyt
  )
c[_]

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to