Re: someone please explain weird getforeignkeys

From: Date: Wed, 22 Aug 2001 23:11:29 +0000
Subject: Re: someone please explain weird getforeignkeys
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-63995@lists.php.net to get a copy of this message
> I need to look up a table's foreign keys using the unified ODBC-functions. > 'odbc_foreignkeys()' requires me to pass seven parameters, each of them being > mandatory, to archive this. Yes. > Because the approach is not intuitive anyhow and there is no documentation > available except of the PHP-manual's prototype, neither me nor my co-workers > have any idea of how to apply the function. There *IS* some explanatory text about what happens depending on which args you fill in. Presumably you use "" for any args you don't care to fill in. > The manual states that three of the arguments are superfluous, depending on > the application; but the prototype contradicts this, declaring them mandatory. Use "" on args you don't care about. The function doesn't need them, but PHP only allows leaving out arguments at the end of the list, not the middle, so the "optional" argument language feature was probably not all that useful. > Can anyone please point me to a working code example or provide one? That I can't do... As near as I can figure, the pk_qualifier and pk_owner, and fk_qualifier and fk_owner args are not needed? Or, perhaps, if you specify them, the result set is filtered down some way... Try calling it with "" for all the arguments you don't understand, and see what you get. > Btw, how are the inter-table relationships defined at all? I cannot think of > a way to determine foreign keys without complete knowledge of all joins and > subqueries potentially run against the database. When you CREATE a table, you can declare a given COLUMN as a "FOREIGN KEY". If you didn't do that, this function is pretty useless to you... PS If you do figure something out, contribute to the notes, eh? -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#63995) next »