Discussion:
EmptyResult & DataReceived
Mr. Bart Pietercil
2007-01-22 15:08:39 UTC
Permalink
Hi,

rather confused on this one:

when we run a query to our pg_server that returns an empty result,
the emptyresult is triggered as expected but at the same time
datareceived is triggerer.
the data array then shows something like data(-1,16)
Is this normal?
Do we always need to check the data-array for empty results?


TIA

Bart Pietercil
Aliacta Support
2007-01-22 17:26:23 UTC
Permalink
Hi Bart,
Post by Mr. Bart Pietercil
when we run a query to our pg_server that returns an empty result,
the emptyresult is triggered as expected but at the same time
datareceived is triggerer.
the data array then shows something like data(-1,16)
Is this normal?
Yes this is normal. There are no rows, hence the -1, but there are
17 columns, hence the 16! The number of columns of the data array
reflects the columns you should have received should there have been
data and is consistent with the other one-dimensional arrays like
pgSQLfieldNames and pgSQLfieldTypes which will have 17 'cells' as
well.

So data was indeed received, i.e. the number of columns, the column
names, types, and so on. And the DataReceived event tells you that
it all has come in.
Post by Mr. Bart Pietercil
Do we always need to check the data-array for empty results?
No, there's no need in general. You'll most commonly have a for-next
loop in the DataReceived event that will not start at all since it
would say something like "for i = 0 to -1" in this particular case.

Cheers,

Marc

Loading...