Bug 1313310 - Use SQLITE_OMIT_DEPRECATED. r=asuth

MozReview-Commit-ID: C4pZ6EP799G

--HG--
extra : rebase_source : 5d213471d4d6785abe5ac79a6696b47b6681cc6e
This commit is contained in:
Marco Bonardo 2016-11-03 20:14:03 +01:00
Родитель 342e5e3816
Коммит 462eaac7b8
3 изменённых файлов: 41 добавлений и 12 удалений

Просмотреть файл

@ -80,6 +80,10 @@ if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_MEMORY']:
DEFINES['HAVE_MALLOC_USABLE_SIZE'] = True
DEFINES['SQLITE_WITHOUT_MSIZE'] = True
# Omit unused functions to save some library footprint.
DEFINES['SQLITE_OMIT_DEPRECATED'] = True
DEFINES['SQLITE_OMIT_BUILTIN_TEST'] = True
# Suppress warnings in third-party code.
if CONFIG['GNU_CC']:
CFLAGS += [

Просмотреть файл

@ -3,7 +3,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
sqlite3_aggregate_context
sqlite3_aggregate_count
sqlite3_auto_extension
sqlite3_bind_blob
sqlite3_bind_double
@ -59,7 +58,7 @@ sqlite3_errcode
sqlite3_errmsg
sqlite3_errmsg16
sqlite3_exec
sqlite3_expired
sqlite3_expanded_sql
sqlite3_extended_result_codes
sqlite3_file_control
sqlite3_finalize
@ -68,7 +67,6 @@ sqlite3_free_table
sqlite3_get_autocommit
sqlite3_get_auxdata
sqlite3_get_table
sqlite3_global_recover
sqlite3_initialize
sqlite3_interrupt
sqlite3_last_insert_rowid
@ -76,7 +74,6 @@ sqlite3_libversion
sqlite3_libversion_number
sqlite3_load_extension
sqlite3_malloc
sqlite3_memory_alarm
sqlite3_memory_highwater
sqlite3_memory_used
sqlite3_mutex_alloc
@ -94,7 +91,6 @@ sqlite3_prepare
sqlite3_prepare16
sqlite3_prepare16_v2
sqlite3_prepare_v2
sqlite3_profile
sqlite3_progress_handler
sqlite3_realloc
sqlite3_release_memory
@ -128,10 +124,8 @@ sqlite3_stmt_status
#ifdef XP_UNIX
sqlite3_temp_directory
#endif
sqlite3_thread_cleanup
sqlite3_total_changes
sqlite3_trace
sqlite3_transfer_bindings
sqlite3_trace_v2
sqlite3_unlock_notify
sqlite3_update_hook
sqlite3_uri_parameter

Просмотреть файл

@ -194,10 +194,39 @@ Module gModules[] = {
////////////////////////////////////////////////////////////////////////////////
//// Local Functions
void tracefunc (void *aClosure, const char *aStmt)
int tracefunc (unsigned aReason, void *aClosure, void *aP, void *aX)
{
MOZ_LOG(gStorageLog, LogLevel::Debug, ("sqlite3_trace on %p for '%s'", aClosure,
aStmt));
switch (aReason) {
case SQLITE_TRACE_STMT: {
// aP is a pointer to the prepared statement.
sqlite3_stmt* stmt = static_cast<sqlite3_stmt*>(aP);
// aX is a pointer to a string containing the unexpanded SQL or a comment,
// starting with "--"" in case of a trigger.
char* expanded = static_cast<char*>(aX);
// Simulate what sqlite_trace was doing.
if (!::strncmp(expanded, "--", 2)) {
MOZ_LOG(gStorageLog, LogLevel::Debug,
("TRACE_STMT on %p: '%s'", aClosure, expanded));
} else {
char* sql = ::sqlite3_expanded_sql(stmt);
MOZ_LOG(gStorageLog, LogLevel::Debug,
("TRACE_STMT on %p: '%s'", aClosure, sql));
::sqlite3_free(sql);
}
break;
}
case SQLITE_TRACE_PROFILE: {
// aX is pointer to a 64bit integer containing nanoseconds it took to
// execute the last command.
sqlite_int64 time = *(static_cast<sqlite_int64*>(aX)) / 1000000;
if (time > 0) {
MOZ_LOG(gStorageLog, LogLevel::Debug,
("TRACE_TIME on %p: %dms", aClosure, time));
}
break;
}
}
return 0;
}
void
@ -701,7 +730,9 @@ Connection::initializeInternal()
// SQLite tracing can slow down queries (especially long queries)
// significantly. Don't trace unless the user is actively monitoring SQLite.
if (MOZ_LOG_TEST(gStorageLog, LogLevel::Debug)) {
::sqlite3_trace(mDBConn, tracefunc, this);
::sqlite3_trace_v2(mDBConn,
SQLITE_TRACE_STMT | SQLITE_TRACE_PROFILE,
tracefunc, this);
MOZ_LOG(gStorageLog, LogLevel::Debug, ("Opening connection to '%s' (%p)",
mTelemetryFilename.get(), this));