January 15, 2006 BUG: wrong automatic conversion to char* string | ||||
---|---|---|---|---|
| ||||
I use this code to execute mysql query: mysql_query(mySQL, "SELECT host_Id FROM hosts WHERE host_Id NOT IN (" ~ seenHosts ~ ")"); And sometimes get error in mysql syntax because of extra character (code 08) at the end of line, according to mysql log. I used to manual conversion by toStringz() function, and this worked ok: char* z = toStringz("SELECT host_Id FROM hosts WHERE host_Id NOT IN (" ~ seenHosts ~ ")"); mysql_query(mySQL, z); So I think this is caused by bug in the D compiler. |
January 16, 2006 Re: BUG: wrong automatic conversion to char* string | ||||
---|---|---|---|---|
| ||||
Posted in reply to KUV Attachments: | KUV schrieb am 2006-01-15:
> I use this code to execute mysql query:
>
> mysql_query(mySQL, "SELECT host_Id FROM hosts WHERE host_Id NOT IN (" ~
> seenHosts ~ ")");
>
> And sometimes get error in mysql syntax because of extra character (code 08) at
> the end of line, according to mysql log.
> I used to manual conversion by toStringz() function, and this worked ok:
>
> char* z = toStringz("SELECT host_Id FROM hosts WHERE host_Id NOT IN (" ~
> seenHosts ~ ")");
> mysql_query(mySQL, z);
>
> So I think this is caused by bug in the D compiler.
Only constant character arrays are zero terminated.
Thomas
|
Copyright © 1999-2021 by the D Language Foundation