Subject | Re: [firebird-support] Empty strings in API |
---|---|
Author | Ivan Prenosil |
Post date | 2005-05-23T06:36:25Z |
"Ann W. Harrison" wrote:
although they get both pointer to string containing statement and its length,
zero in length parameter does not mean zero length statement
but null terminated string.
And if you pass zero as statement length, and empty statement represented
as zero pointer, you get access violation instead of expected
"Unexpected end of command" error.
Ivan
> Ivan Prenosil wrote:But isc_dsql_prepare() and isc_dsql_execute_immediate() are exception -
>>
>> Can empty string be represented both as
>> - pointer to zero
>> - zero pointer
>> or is the later one illegal ?
>>
>
> It's not illegal - but it's not the same either. A string is an array
> and an empty string is an array of one byte containing the value zero.
> In some places (e.g. dpb, tpb, etc.) the API will take a pointer value
> of zero if the length of the structure is also passed and is zero.
although they get both pointer to string containing statement and its length,
zero in length parameter does not mean zero length statement
but null terminated string.
And if you pass zero as statement length, and empty statement represented
as zero pointer, you get access violation instead of expected
"Unexpected end of command" error.
Ivan