Pergunta

I'm developing a C++ application which needs to connect to MySQL server for some information but my app doesn't run queries frequently. So As C++ connector uses C API behind the scenes... I got this doubt.I'm in dilemma whether to go with C API or C++ API??

Foi útil?

Solução

From my experience it doesn't make that much of a difference. The C++ API just wraps the C API – so you're left with an additional function call using the C++ API. Most of the time the compiler can optimize that out and a function call does not have a real perceivable overhead.

Outras dicas

Compared to the millions of clock cycles that even the smallest database query requires, a wrapper around a few C functions is not going to make the least difference.

You're writing an app in C++. There's a C++ wrapper for MYSQL. Just use it.

Performance is very unlikely to be an issue, but if it does become so in the future you can address it then. Keep it simple.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top