Hi Ulrik,

picture this:

A user types a query with output of fields from 
two ore more tables. Now, before you output the
data, you'll check if the user has the right to
see the data in the fields. 

So I check if the columns name is in my
"allowed" list. Because two tables may have
a column with the same name I need the table
name to make it unique.

But SQLite does not deliver the table name to
the column returned.

MySQL for example delivers this information in MYSQL_FIELD
struct. Here you'll get the name, original name of column and
table of each coulumn in result set.

Regards,

Joerg

Hi Joerg,

Plenert, Joerg wrote:

>Hi !
>
>I need a possibility to get the table name
>(actual and/or original) from a column.
>
>There is a function sqlite3_column_name that
>returns the name of the column.
>How about a function sqlite3_column_tablename 
>that returns the tablename ?
>
>I need that function to check user rights on
>the data returned by sqlite.
>  
>
Column names are always local to a table, i.e., tables form 
orthogonal/independent name spaces with respect to column names.  This 
means that the same column name can be used in several different tables.

So clearly you are not asking "for any given column name, show me the 
table from which it came": This is not a one-to-one mapping, but a 
one-to-many mapping. 

In what circumstances do you know the column name but not the table 
name?  Please elaborate.

Regards,

Ulrik P.

-- 
Ulrik Petersen, MA, B.Sc.
University of Aalborg, Denmark



Reply via email to