Each of the three functions has a specific application, which can be guessed from their return type.
Execute
This feature is the most common. It returns a boolean whose value is true if the query returns multiple results, or false if the query returns either nothing or an update count.
This is the function you want to use if you want to use it as general as possible.
If it returns true, you want to use ResultSet * getResultSet() to get the results.
If it returns false, you want to use uint64_t getUpdateCount() to get the number of rows updated.
ExecuteQuery
This function directly returns a ResultSet , which is useful for SELECT , and assumes that there really is a return result.
This is equivalent to calling execute() , followed by getResultSet() .
You want to use this function when you know that you are using SQL code that returns results, such as strings.
executeUpdate
This function returns an integer value, which is useful for UPDATE and assumes that the number of updates will be returned.
This is equivalent to calling execute() , followed by getUpdateCount() , although for some reason the return types are different (int vs uint64_t).
This is the function used to execute SQL statements that modify data, and you need to know if some data has been modified.
So,
why are there so many execution functions and not simple and unified?
actually unified execute , which can be used to execute arbitrary SQL and properly process the result, while the other two are convenient shells when you know which query you are doing.
which performs the function should I use to specify SQL statements?
In your case, since you are writing a wrapper around the SQL language, each of your functions knows what kind of execution will be performed, so using convenient functions will allow you to write shorter code.
For instance:
insert(), update(), delete()