Resetting a PChar variable

Posted by scott-thornton on Stack Overflow See other posts from Stack Overflow or by scott-thornton
Published on 2010-03-22T03:32:09Z Indexed on 2010/03/22 3:41 UTC
Read the original article Hit count: 319

Filed under:
|

Hi,

I don't know much about delphi win 32 programming, but I hope someone can answer my question.

I get duplicate l_sGetUniqueIdBuffer saved into the database which I want to avoid.

The l_sGetUniqueIdBuffer is actually different ( the value of l_sAuthorisationContent is xml, and I can see a different value generated by the call to getUniqueId) between rows. This problem is intermittant ( duplicates are rare...) There is only milliseconds difference between the update date between the rows.

Given:

( unnesseary code cut out)

l_sGetUniqueIdBuffer: PChar; FOutputBufferSize : integer;

FOutputBufferSize := 1024;

while( not dmAccomClaim.ADOQuClaimIdentification.Eof ) do begin

    // Get a unique id for the request
    l_sGetUniqueIdBuffer := AllocMem (FOutputBufferSize);

    l_returnCode := getUniqueId (m_APISessionId^, l_sGetUniqueIdBuffer, FOutputBufferSize);

    dmAccomClaim.ADOQuAddContent.Active := False;
    dmAccomClaim.ADOQuAddContent.Parameters.ParamByName('pContent').Value := (WideString(l_sAuthorisationContent));
    dmAccomClaim.ADOQuAddContent.Parameters.ParamByName('pClaimId').Value := dmAccomClaim.ADOQuClaimIdentification.FieldByName('SB_CLAIM_ID').AsString;
    dmAccomClaim.ADOQuAddContent.Parameters.ParamByName('pUniqueId').Value := string(l_sGetUniqueIdBuffer);
    dmAccomClaim.ADOQuAddContent.ExecSQL;

    FreeMem( l_sAuthorisationContent, l_iAuthoriseContentSize );

    FreeMem( l_sGetUniqueIdBuffer, FOutputBufferSize );

end;

I guess i need to know, is the value in l_sGetUniqueIdBuffer being reset for every row??

© Stack Overflow or respective owner

Related posts about delphi

Related posts about win32