Board index » delphi » API - Getting primary Key Def

API - Getting primary Key Def

Yo,

Anyone suggest an API call to return the primary key /constraint
definition of a table?

I could do a show table statement (and parse), but i'm a little too lazy
(and too old).

Thanks for any input.

Very cool DB.

Bret

 

Re:API - Getting primary Key Def


Quote
Bret Stern wrote:
> Anyone suggest an API call to return the primary key /constraint
> definition of a table?

        There's no API for this, but the TIBExtract component from IBX will do
what you want.

        -Craig

Re:API - Getting primary Key Def


Quote
> > Anyone suggest an API call to return the primary key /constraint
> > definition of a table?

> There's no API for this, but the TIBExtract component from IBX will do
> what you want.

> -Craig

Or you can query the system tables yourself. Have a look at the
Language Reference - they're described in there.

--

With regards,

Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com

Re:API - Getting primary Key Def


Quote
Martijn Tonies wrote:
> > There's no API for this, but the TIBExtract component from IBX will
> > do what you want.

> Or you can query the system tables yourself.

        Sure, but getting DDL (what I presumed he wanted) is somewhat involved.

        -Craig

--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
  Delphi/InterBase Weblog : http://delphi.weblogs.com
Useful articles about InterBase and Delphi development:
  http://delphi.weblogs.com/articles

Re:API - Getting primary Key Def


Quote
> > > There's no API for this, but the TIBExtract component from IBX will
> > > do what you want.

> > Or you can query the system tables yourself.

> Sure, but getting DDL (what I presumed he wanted) is somewhat involved.

> -Craig

True - if he wants DDL, then TIBExtract (assuming the use of IBX
components) would be easier.

--

With regards,

Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com

Re:API - Getting primary Key Def


.. good discussion.

I'm an old Paradox junkie who really liked the table

structure view for Paradox tables. I'm writing a table

definition funtion; C-api; no objects, for Interbase

for my own use.

Using the SQLDA elements, I have most of it, except the

key/constraints attributes.

I'll look at the DDL. You guys have a good weekend!

Bret Stern

Re:API - Getting primary Key Def


to verify...you are suggesting the RDB$... values?

Quote
"Martijn Tonies" <m.tonies@upscene!nospam!.com> wrote in message

news:3ece6ed4@newsgroups.borland.com...
Quote

> > > > There's no API for this, but the TIBExtract component from IBX will
> > > > do what you want.

> > > Or you can query the system tables yourself.

> > Sure, but getting DDL (what I presumed he wanted) is somewhat involved.

> > -Craig

> True - if he wants DDL, then TIBExtract (assuming the use of IBX
> components) would be easier.

> --

> With regards,

> Martijn Tonies
> Database Workbench - the developer tool for InterBase & Firebird
> Upscene Productions
> http://www.upscene.com

Re:API - Getting primary Key Def


Quote
Bret Stern wrote:
> Using the SQLDA elements, I have most of it, except the

> key/constraints attributes.

> I'll look at the DDL.

        You can get all the elements (tables, columns, order) of the
constraints from the system tables, but actually constructing DDL is a
manual process.  If you want to see existing code which does it, look
at the source to TIBExtract(Delphi) or ISQL (C -- on
http://sourceforge.net/projects/interbase)

        -Craig

--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
  Delphi/InterBase Weblog : http://delphi.weblogs.com
InterBase Performance Monitor -- Analyze and control your IB7
  server: http://delphi.weblogs.com/IBPerformanceMonitor

Re:API - Getting primary Key Def


Quote
> to verify...you are suggesting the RDB$... values?

Yes, the system tables.

--

With regards,

Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com

Quote
> "Martijn Tonies" <m.tonies@upscene!nospam!.com> wrote in message
> news:3ece6ed4@newsgroups.borland.com...

> > > > > There's no API for this, but the TIBExtract component from IBX will
> > > > > do what you want.

> > > > Or you can query the system tables yourself.

> > > Sure, but getting DDL (what I presumed he wanted) is somewhat involved.

> > > -Craig

> > True - if he wants DDL, then TIBExtract (assuming the use of IBX
> > components) would be easier.

> > --

> > With regards,

> > Martijn Tonies
> > Database Workbench - the developer tool for InterBase & Firebird
> > Upscene Productions
> > http://www.upscene.com

Other Threads