a guest Apr 6th, 2020 173 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- void insertEmployee(MYSQL* conn, Employee const& emp)
- if (conn != nullptr)
- std::string fmt = "INSERT INTO employees(employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle) "
- "VALUES (%d, \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", %s, \"%s\")";
- std::vector<char> v(2000);
- sprintf(&v, v.size(), fmt,
- if (mysql_query(conn, const_cast<char const*>(v.data())) == 0)
- std::cout << "Employee successfully added, check to verify by checking the number of the employee from the main menu, or using your DBMS application" << std::endl;
- std::cout << "Error occurred: " << mysql_errno(conn) << " " << mysql_error(conn) << std::endl;
RAW Paste Data