On 12/12/2011 11:34, Alex Peshkoff wrote: > On 12/12/11 15:43, Pierre Y. wrote: >> Hi All, >> >> Thanks to Vlad, we achieved the translation of the FB3 OO API in UIB >> Components for Delphi. >> >> You can checkout the code from SourceForge repository : >> >> https://uib.svn.sourceforge.net/svnroot/uib/trunk >> >> Now, we only miss hints to deal with FbMessage, it seems that the >> examples (fbstuff on github) made by Adriano heavily relies on BOOST >> and as we don't have such possibilities with Delphi we must understand >> what is exactly an FbMessage and see what we can do. > I've reordered filed in struct in order to put them in logically correct > order. [One really present is OK from alignment POV] > > struct FbMessage > { > unsigned char* buffer; // contains data and NULL flags to > be transfered to/from engine. > unsigned int bufferLength; // length of that buffer > const unsigned char* blr; // describes format of data in a > form, easily understood by engine > unsigned int blrLength; // length of that format description > }; > > A sample. Imagine you > create table test (a int, f double precision); > and after some inserts want to > select a, f from test; > Buffer should have following data: > 4 bytes for integer 'a' > 2 bytes for it's NULL flag (NULL flag is always 2-byte integer) > 2 bytes - alignment to 8-bytes boundary for next floating point value, > unused > 8 bytes for floating point 'f' > 2 bytes for it's NULL flag > Therefore the length of buffer is 18 bytes. > > BLR is actually binary language representation for engine. All > procedures, view, etc. a first translated to BLR. BLR in FbMessage is > used to transfer data to/from message's buffer. Both BLR generation and > rules how to align data in buffer correctly can be found in > src/yvalve/why.cpp, function sqldaParse. Let me not try to repeat that C > code here in plain english - I'm afraid this can be buggy process :) > > This message requires a BLR more or less as:
unsigned char blr[] = { blr_version5, blr_begin, blr_message, 0, (2 * 2 /* number of fields */) & 0xFF, (2 * 2 /* number of fields */) >> 8, blr_long, 0, /* first field, scale */ blr_short, 0, /* null indicator for first field */ blr_double, /* second field */ blr_short, 0, /* null indicator for second field */ blr_end, blr_eoc }; ------------------------------------------------------------------------------ Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel