2022-07-06 16:42:53 +08:00
|
|
|
|
/*
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>ʵ<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
#include"BaseDAO.h"
|
|
|
|
|
|
|
|
|
|
_RecordsetPtr executeSql(_ConnectionPtr connection, const char* sql, vector<string>* v) {
|
|
|
|
|
if (v == NULL) {
|
|
|
|
|
return connection->Execute(sql, NULL, (long)0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_CommandPtr command(__uuidof(Command));
|
|
|
|
|
command->ActiveConnection = connection;
|
|
|
|
|
command->CommandText = sql;
|
|
|
|
|
command->CommandType = adCmdText;
|
|
|
|
|
size_t size = v->size();
|
|
|
|
|
for (size_t i = 0; i < size; i++)
|
|
|
|
|
{
|
2022-07-07 16:21:37 +08:00
|
|
|
|
_ParameterPtr p = command->CreateParameter("var" + i, adVarChar, adParamInput, sizeof((*v)[i]), (*v)[i].c_str());
|
2022-07-06 16:42:53 +08:00
|
|
|
|
command->Parameters->Append(p);
|
|
|
|
|
}
|
|
|
|
|
return command->Execute(NULL, NULL, long(0));
|
|
|
|
|
}
|