Ask help to convert a php function into harbour

Ask help to convert a php function into harbour

Postby ShumingWang » Sun Jul 11, 2010 5:46 am

Hi!
This is for eascape Illegal chars in sql , for I use mysql_real_eascape() in libmysql.dll not cuccess.

function escape($str)
{
$search=array("\\","\0","\n","\r","\x1a","'",'"');
$replace=array("\\\\","\\0","\\n","\\r","\Z","\'",'\"');
return str_replace($search,$replace,$str);
}


Or :
mysql.c add
HB_FUNC( SQLEASCAPE )
{
mysql_real_escape_string( (MYSQL *)_parnl(1), _parc(2), _parc(3), _parnl(4) ) ;
hb_retc( _parc(2)) ;
}

in prg


?SQLEASCAPE(oserver:nsocket,,"Zak's")
Want to be: "Zak\'s "



Regards !
Shuming Wang
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 74 guests