Esempio n. 1
0
void Session::_BindParameter(sqlite3_stmt *statement, const Param &param, int position)
{
	Param::ParamType type = param.GetType();
	int result;
	switch(type)
	{
	case Param::TYPE_STRING:
#ifdef UNICODE
		result = sqlite3_bind_text16(statement, position, param.GetValue(),-1,NULL);
#else 
		sqlite3_bind_text(statement, position, (TCHAR)param.GetValue()),-1,NULL);
#endif
		break;
	case Param::TYPE_INT:
		result = sqlite3_bind_int(statement, position, *((int*)param.GetValue()));
		break;
	default:
		result = sqlite3_bind_double(statement, position, *((double*)param.GetValue()));
		break;
	}

	if(result != SQLITE_OK)
	{
		throw SessionException(_T("Could not bind parameter"));
	}

}