Another possibility could be to use a query on the execute statement. This way the query is done async when the data is executed. The IP would not then be in any C++ code.
This would also solve the need for querying the IP on AccountIPLogAction
Not sure if should use complex SQL though?

Example:
`INSERT INTO (col1, col2) SELECT %u, theIP FROM account where guid = %u;`