void InsertEmployeeRec(PGconn *conn, char * fullname)
{
// Append the SQL statment
std::string sSQL;
sSQL.append("INSERT INTO Worker VALUES ('");
sSQL.append(fullname);
sSQL.append("')");
// Execute with sql statement
PGresult *res = PQexec(conn, sSQL.c_str());
if (PQresultStatus(res) != PGRES_COMMAND_OK)
{
printf("Insert employee record failed");
PQclear(res);
CloseConn(conn);
}
printf("Insert employee record - OK\n");
// Clear result
PQclear(res);
}
これは、dbを挿入してそのように呼び出す私の関数です
InsertEmployeeRec(conn,"n");
最後に、エラーが発生します:
glibc が検出されました* /home/mert/workspace1/Project/Debug/Project: 二重解放または破損 (!prev): 0x0000000001df4050 *
何が問題なのですか?