How do I handle a union of multiple tables in Xataface?

A place for users and developers of the Xataface to discuss and receive support.

How do I handle a union of multiple tables in Xataface?

Postby Jusmee » Mon Jul 05, 2010 9:32 pm

I have multiple tables, all with the same fields. mySQL/xataface just runs too slow if I put them into one big table. So how do I search across all of them at once, i.e. search a union of the tables? - or is this the wrong approach?
Last edited by Jusmee on Mon Jul 05, 2010 10:46 pm, edited 1 time in total.
Jusmee
 
Posts: 22
Joined: Mon Feb 01, 2010 5:11 pm

Re: How do I handle a union of multiple tables if Xataface?

Postby shannah » Mon Jul 05, 2010 9:38 pm

You could create a view with the union and search that.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: How do I handle a union of multiple tables if Xataface?

Postby Jusmee » Mon Jul 05, 2010 10:48 pm

shannah wrote:You could create a view with the union and search that.


OK, it's my lack of knowledge with xataface, but, will it list and search a view the same way as it does tables? Do you just put the view name in the ini file as if it was a table?
Jusmee
 
Posts: 22
Joined: Mon Feb 01, 2010 5:11 pm

Re: How do I handle a union of multiple tables in Xataface?

Postby shannah » Tue Jul 06, 2010 9:40 am

Yes. You just need to tell xataface which fields are part of the primary key. You do that in the fields.ini file with the Key=PRI directive.

e.g.
Code: Select all
[my_field]
    Key=PRI
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: How do I handle a union of multiple tables in Xataface?

Postby Jusmee » Tue Jul 06, 2010 4:19 pm

Yep that works, thanks. The only downside is that views with a UNION clause are non-updatable.
Jusmee
 
Posts: 22
Joined: Mon Feb 01, 2010 5:11 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 25 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved