Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] standards question

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: Michael Meskes <meskes(at)topsystem(dot)de>
Cc: PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] standards question
Date: 1998-03-18 16:07:05
Message-ID: 350FF129.E85F2FA9@alumni.caltech.edu (view raw or flat)
Thread:
Lists: pgsql-hackers
> Could you please enlighten me Tom? :-)

*grin* As you could see I was trying to get out of doing work...

OK, here is a short series of extracts from the book:

Summary list of SQL statements having to do with SQL descriptor areas:
  ALLOCATE DESCRIPTOR, DEALLOCATE DESCRIPTOR
  GET DESCRIPTOR, SET DESCRIPTOR
  DESCRIBE

"SQLDA" is a useful abbreviation (for the SQL descriptor area) but it is
not an official standard term. Note clearly, moreover, that several SQL
products do already support some kind of SQLDA, and even refer to it by
that name, but those SQLDAs are typically not the same as the "SQLDA"
defined in the standard. In particular, the SQLDA in the standard is
*encapsulated* (meaning that its internal structure is not specified in
the standard and is thus *a fortiori* hidden from the user), whereas the
same is typically not true of the SQLDAs in current products.

We list below some of the more important of these components (the
retrievable and settable components of the SQL92 SQLDA):

NAME	character string
UNAMED	exact numeric with scale 0 (tgl- I'll call this int)
TYPE	int
LENGTH	int
RETURNED_LENGTH int
RETURNED_OCTET_LENGTH int
PRECISION int
SCALE	int
DATA	(depends on type, length, etc)
INDICATOR int

If the INDICATOR value is negative, the DATA value is undefined
("null"). The UNAMED component is set to 1 if the NAME value is
implementation-dependent (loosely, if the corresponding column is
unnamed).

Syntax:
  ALLOCATE DESCRIPTOR [LOCAL|GLOBAL] descriptor [WITH MAX occurences]

(descriptor is specified inside single quotes). The GLOBAL is default if
not specified.

There are several ways to populate a descriptor:

1) Specify
  INTO SQL DESCRIPTOR descriptor
in an EXECUTE statement (in which case the prepared statement must be a
single-row select).

2) Specify the same in a dynamic FETCH statement.

3) Specify
  USING SQL DESCRIPTOR descriptor
in a DESCRIBE INPUT or DESCRIBE OUTPUT statement. This is the
recommended method for the most highly generalized type of application.

4) Execute
  SET DESCRIPTOR descriptor ...

Each such statement will assign values to components within a *single
item descriptor* within the SQLDA.

...

GET DESCRIPTOR descriptor target = COUNT

where target is a parameter or host variable of type exact numeric with
scale 0 (int??).


My book has quite a bit more information on this, but much more will be
too much to type :(

                        - Tom

In response to

pgsql-hackers by date

Next:From: Thomas G. LockhartDate: 1998-03-18 16:23:26
Subject: Re: [HACKERS] another standards question
Previous:From: Maurice GittensDate: 1998-03-18 15:50:32
Subject: Re: Buffer overruns with the Electric Fence debugging library

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group