17.03.2015 22:08, liviusliv...@poczta.onet.pl wrote:
>>> It would be easy if you share your current code in a github.
>
>
>>> Adriano
>
> Nothing to share for this little problem ;-)
> try this:
>
> //bufor
> GenRowsInMessage = Array[0..100] of Byte;
>
> //proc in db
>      create procedure gen_rows_pascal (
>      iValue integer not null,
>      sValue Smallint not null,
>      iValue2 integer not null,
>      iValue3 integer not null
> ) returns (
>      result integer not null
> )
>      external name 'pascaludr!gen_rows'
>      engine udr;
>
>
> //select statement
>      SELECT p.RESULT
> FROM GEN_ROWS_PASCAL (
> 296401868, /* iValue 11AA BBCC */
> 13277, /* sValue 33DD */
> 582733021, /* iValue2  22BB CCDD */
> 582733021 /* iValue3  22BB CCDD */
> ) p;
>
> content of GenRowsInMessage  array
> ($CC, $BB, $AA, $11, 0, 0, $DD, $33, 0, 0, 0, 0, $DD, $CC, $BB, $22, 0, 0,
> 0, 0, $DD, $CC, $BB, $22, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4,
> 0, 4, 0, 4, 0, 4, 0, 0, 0, 0, 0, 0, 0, $FF, $FF, 0, 0, 0, 0, 0, 0, 0, 0, 1,
> 0, 0, 0, 0, 0, 0, 0, 8, 0, 2, 0, 0, 0, 0, 0, $74, $1B, $54, 8, 0, 0, 0, 0,
> 9, 0, 4, 0, 0, 0, 0, 0, $70, $1B, $54, 8, 0)
>
> as you can see alignment has nothing to do - this is not record but array of
> bytes
>
> and here we have
> $CC, $BB, $AA, $11, 0, 0, <== iValue
> $DD, $33, 0, 0, 0, 0, <== sValue
> $DD, $CC, $BB, $22, 0, 0, 0, 0, <== iValue2
>
> why iValue2 have 4 zeros? not two as iValue?
> This is not "Delphi compiler problem" but buffer fill - what do you think?

   Looks like 2-byte null-indicator's after every input parameter:

offset          value                   name
0               $CC, $BB, $AA, $11      iValue
4               0, 0                    <null-indicator for iValue>
6               $DD, $33                sValue
8               0, 0                    <null-indicator for sValue>
10              0, 0                    <alignment gap before iValue2>
12              $DD, $CC, $BB, $22      iValue2
16              0, 0                    <null-indicator for iValue2>
18              0, 0                    <alignment gap before iValue3>
20              $DD, $CC, $BB, $22      iValue3
22              0, 0                    <null-indicator for iValue3>
...

Regards,
Vlad

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to