What about fixing this bug in SAP DB? Are there plans to do this before end of March where version 7.3 is only further supported for SAP customers? Does version 7.4 have this bug?
Regards,
CTB
Bernard Clement schrieb:
Hi CTB,
Well the example you were providing was ASCII only and that is why I suggest strcpy to replace memcpy.
With the fact that the field may also contain binary I would suggest that you issue 2 updates.
The first one containing 0s in the buffer and the second one the new value in the buffer.
That should work.
However, you are adding some overhead to your application.
Maybe somebody else has a better solution.
Regards,
Bernard
On Wednesday 28 January 2004 06:17, Claus-Thomas Buhl wrote:
Hi Bernard and Gustav,
This is not the solution, since I also might store binary data in a LONG BYTE column and then strcpy() would truncate my data. If I add the 0 byte like you proposed the 0 byte will be part of my LONG value and this is not what I want. The 0-byte solution would be correct if the hostvartype would be sqlvchar.
Regards,
CTB
Bernard Clement schrieb:
Hi Claus,
Gustav is right...
In your code you have param1.buf = malloc(sizeof(buf1)); memcpy(param1.buf, buf1, sizeof(buf1)); param1.size = sizeof(buf1); ... param2.buf = malloc(sizeof(buf2)); memcpy(param2.buf, buf2, sizeof(buf2)); param2.size = sizeof(buf2);
Try with param1.buf = malloc(sizeof(buf1)+1); memcpy(param1.buf, buf1, sizeof(buf1)+1); param1.size = sizeof(buf1)+1; ... param2.buf = malloc(sizeof(buf2)+1); memcpy(param2.buf, buf2, sizeof(buf2)+1); param2.size = sizeof(buf2)+1;
The +1 will get the \0 at the end of the array of characters and you will be in business.
You can also replace the memcpy by a strcpy, e.g. strcpy((param1.buf, buf1); strcpy((param2.buf, buf2); if it exist in the precompiler, note that I do not have experience with the precompiler but I do have experience with C and C++.
Bernard
On Tuesday 27 January 2004 12:35, Claus-Thomas Buhl wrote:
I am using the C/C++ precompiler of SAP DB 7.3.0.46 and want to update the data of a LONG column.
I recognized that if the new value is shorter than the old value, the updated column has the length of the old value, and the value is the new value plus the part of the old value that is longer than the new value.
I can reproduce this behaviour with the appended program. The program creates a table X with columns k INTEGER and f LONG BYTE. It then inserts a row with k=1 and f='HELLO' and finally updates the row with f='BELL'. If I query the table, I get the value 'BELLO' for column f.
Regards,
CTB
-- _______ \o/|\o/ Claus-Thomas Buhl
| Diplom-Informatiker
\_____/ mailto:[EMAIL PROTECTED]
H.E.I. GmbH | Wimpfener Strasse 23 | D-68259 Mannheim Fon: +49-(0)621-795141 | Fax: +49-(0)621-795161 | mailto:[EMAIL PROTECTED] http://www.h-e-i.de && http://www.hei.biz && http://www.radpage.com
-- _______ \o/|\o/ Claus-Thomas Buhl | Diplom-Informatiker \_____/ mailto:[EMAIL PROTECTED]
H.E.I. GmbH | Wimpfener Strasse 23 | D-68259 Mannheim Fon: +49-(0)621-795141 | Fax: +49-(0)621-795161 | mailto:[EMAIL PROTECTED] http://www.h-e-i.de && http://www.hei.biz && http://www.radpage.com
-- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
