![]() |
#2
bczgvip2013-12-29 19:56
|
我的引用为:

Public Declare Function mysql_real_escape_string Lib "libmySQL" (ByVal lMysql As Long, _
ByRef lTo As String, _
ByVal lFrom As String, _
ByVal lLength As Long) As Long
ByRef lTo As String, _
ByVal lFrom As String, _
ByVal lLength As Long) As Long
mysql源码中对该函数的定义如下:

/*
Add escape characters to a string (blob?) to make it suitable for a insert
to should at least have place for length*2+1 chars
Returns the length of the to string
*/
ulong STDCALL
mysql_escape_string(char *to,const char *from,ulong length)
{
return (uint) escape_string_for_mysql(default_charset_info, to, 0, from, length);
}
ulong STDCALL
mysql_real_escape_string(MYSQL *mysql, char *to,const char *from,
ulong length)
{
if (mysql->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES)
return (uint) escape_quotes_for_mysql(mysql->charset, to, 0, from, length);
return (uint) escape_string_for_mysql(mysql->charset, to, 0, from, length);
}
Add escape characters to a string (blob?) to make it suitable for a insert
to should at least have place for length*2+1 chars
Returns the length of the to string
*/
ulong STDCALL
mysql_escape_string(char *to,const char *from,ulong length)
{
return (uint) escape_string_for_mysql(default_charset_info, to, 0, from, length);
}
ulong STDCALL
mysql_real_escape_string(MYSQL *mysql, char *to,const char *from,
ulong length)
{
if (mysql->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES)
return (uint) escape_quotes_for_mysql(mysql->charset, to, 0, from, length);
return (uint) escape_string_for_mysql(mysql->charset, to, 0, from, length);
}
大家帮忙看看,在VB6中怎么调用mysql_real_escape_string函数呢?万分感谢!