|
|
|
|
|
by SQLite
3915 days ago
|
|
(1) Consistent, repeatable results across all platforms - the library will not fail or degrade because of a platforms dodgy printf() implementation. (2) SQLite's printf includes extensions like %q and %Q that help prevent SQL injection attacks. These are used internally. (grep for '%q' and '%Q' in the SQLite sources and see for yourself.) (3) Nothing like sqlite3_mprintf() is available from standard libraries. And yet it is a very useful and important interface. (4) SQLite has a printf() SQL function for formatting text. I don't know of any way to build that using a standard-library printf() implementation - you need to have direct access to the printf() source code to make it work from SQL. (5) Library printf() implementations are often subject to LOCALE, which means that if "3.14159" is render as "3,14159" (as it is for some LOCALEs) it will break SQL syntax rules when used to construct an SQL statement. I can probably think of other reasons, but those are the ones that come quickly to mind. |
|