[手游项目2]-15-单引号导致mysql存储失败问题

//过滤特殊字符会导致数据库存储失败
inline bool CheckNameVaild( const char* pStrName )
{
	int nLen = strlen(pStrName);
	if(nLen < 1)
		return false;

	for (int i=0; i < nLen; i++) 
	{
		char c = pStrName[i];
		switch (c)
		{
		case '\'':
		case ';':
		case '(':
		case ')':
		case '\\':
		case '/':
		case ' ':
			return false;
			break;
		}
	}
	return true;
}

 

 

posted @ 2018-09-13 17:55  byfei  阅读(64)  评论(0)    收藏  举报