Oracle 5.0 Reference Manual page 2180

Table of Contents

Advertisement

20.6.6.34.
mysql_hex_string()
unsigned long mysql_hex_string(char *to, const char *from, unsigned long
length)
Description
This function is used to create a legal SQL string that you can use in an SQL statement. See
Section 9.1.1, "String
The string in
hexadecimal digits. The result is placed in
The string pointed to by
least
length*2+1
terminated string. The return value is the length of the encoded string, not including the terminating null
character.
The return value can be placed into an SQL statement using either
However, the return value does not include the
those is desired.
Example
char query[1000],*end;
end = strmov(query,"INSERT INTO test_table values(");
end = strmov(end,"0x");
end += mysql_hex_string(end,"What is this",12);
end = strmov(end,",0x");
end += mysql_hex_string(end,"binary data: \0\r\n",16);
*end++ = ')';
if (mysql_real_query(&mysql,query,(unsigned int) (end - query)))
{
fprintf(stderr, "Failed to insert row, Error: %s\n",
}
The
strmov()
like
strcpy()
Return Values
The length of the value placed into to, not including the terminating null character.
Errors
None.
20.6.6.35.
mysql_info()
const char *mysql_info(MYSQL *mysql)
Description
Retrieves a string providing information about the most recently executed statement, but only for the
statements listed here. For other statements,
varies depending on the type of statement, as described here. The numbers are illustrative only; the
string contains values appropriate for the statement.
INSERT INTO ... SELECT ...
C API Function Descriptions
Literals".
is encoded to hexadecimal format, with each character encoded as two
from
must be
from
bytes long. When
mysql_error(&mysql));
function used in the example is included in the
but returns a pointer to the terminating null of the first parameter.
and a terminating null byte is appended.
to
bytes long. You must allocate the
length
mysql_hex_string()
or X'...'. The caller must supply whichever of
0x
mysql_info()
2160
to
returns, the contents of
or
0xvalue
X'value'
library and works
libmysqlclient
returns NULL. The format of the string
buffer to be at
is a null-
to
format.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents