Twitter Feed

Xataface Maillist

Sign up to receive the Xataface news letter with weekly updates and development tips.

 
Found 1 of 138 records in table Wiki
Now Showing 1 of 1

Current Record: Key

fields.ini Directive: Key

[Permalink]

The Key directive is used only when the table is a view and you need to explicitly define which columns are part of the primary key. For example, if we created a view on the books table to only show books in a given year as follows:

create view books_2000 as
select * from books where year='2000'

And we wanted to use this view as a table in our Xataface application we would need to tell it that the primary key of this view is the book_id field. So in the fields.ini file we would add:

[book_id]
    Key=PRI

Note that this is case sensitive. key=PRI will not work.

Compound Primary Keys

For primary keys comprising multiple columns we would add this directive for each field in the key. E.g. if our books_2000 view had 2 fields in the primary key, say author_id and book_index, we would have in the books_2000 fields.ini file:

[author_id]
    Key=PRI

[book_index]
    Key=PRI

Links:

Return to fields.ini file

blog comments powered by Disqus
Powered by Xataface
(c) 2005-2018 All rights reserved