* Dave Beck
[...]
> > char insert_format[] = "INSERT INTO %s VALUES (%hhd%hhd%hhd%hhd,
> > %hhd%hhd%hhd%hhd, %hhd%hhd%hhd%hhd, %hhd%hhd%hhd%hhd,%hhd%hhd%hhd%hhd)";
The values should be quoted...
> > int build_real_insert(char *query, char *table, int frame, int
> atom, float
> > x, float y, float z) {
> > unsigned char *fbp = (unsigned char *)&frame;
> > unsigned char *abp = (unsigned char *)&atom;
> > unsigned char *xbp = (unsigned char *)&x;
> > unsigned char *ybp = (unsigned char *)&y;
> > unsigned char *zbp = (unsigned char *)&z;
> >
> > return sprintf(query, insert_format, table, fbp[0], fbp[1],
> > fbp[2], fbp[3], abp[0], abp[1], abp[2], abp[3], xbp[0], xbp[1], xbp[2],
> > xbp[3], ybp[0], ybp[1], ybp[2], ybp[3], zbp[0], zbp[1], zbp[2], zbp[3]);
> > }
...and some bytes may represent an 'illegal' character, and thus must be
escaped by a backslash... this goes for the quote character you use (" or
'), the backslash character itself, and null bytes.
--
Roger
sql
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php