From 9d8aca4a2a7b59dbc8554186739987fb4bc2b400 Mon Sep 17 00:00:00 2001 From: "phajdan.jr" Date: Tue, 1 Sep 2015 03:20:25 -0700 Subject: Revert of [sqlite] Respect the gyp and gn component switch. (patchset #6 id:100001 of https://codereview.chromium.org/1306863006/ ) Reason for revert: Suspected of breaking chromium.webkit Mac builders, see https://code.google.com/p/chromium/issues/detail?id=526208 Summary: Incompatible library version: httpd requires version 9.0.0 or later, but libsqlite3.dylib provides version 0.0.0 /b/build/slave/WebKit_Mac10_6__dbg_/build/src/out/Debug/libsqlite3.dylib seems to be used instead of expected/intended /usr/lib/libsqlite3.dylib Original issue's description: > [sqlite] Respect the gyp and gn component switch. > > SQLITE_API is the existing mechanism SQLite provides, and is used in > preference to inventing a new SQLITE_EXPORT symbol (like > sql/sql_export.h and other examples). > > CoreServices.framework is necessary on OSX because of the Time Machine > patch. > > Remove sql/proxy.{h,cc}, which was necessary to work around SQLite > linking statically into both component shlibs and unit test executables. > > [Relanding https://codereview.chromium.org/1322463002/ ] > > BUG=489444 > TBR=michaeln@chromium.org, thakis@chromium.org, brettw@chromium.org > > Committed: https://crrev.com/f71db5c36625ff00feb8283028631303ae5caa7c > Cr-Commit-Position: refs/heads/master@{#346536} TBR=michaeln@chromium.org,thakis@chromium.org,brettw@chromium.org,shess@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=489444 Review URL: https://codereview.chromium.org/1325833003 Cr-Commit-Position: refs/heads/master@{#346615} --- sql/BUILD.gn | 2 ++ sql/connection_unittest.cc | 13 +++++++------ sql/proxy.cc | 28 ++++++++++++++++++++++++++++ sql/proxy.h | 39 +++++++++++++++++++++++++++++++++++++++ sql/sql.gyp | 2 ++ 5 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 sql/proxy.cc create mode 100644 sql/proxy.h (limited to 'sql') diff --git a/sql/BUILD.gn b/sql/BUILD.gn index 57f1b38..38f85b4 100644 --- a/sql/BUILD.gn +++ b/sql/BUILD.gn @@ -13,6 +13,8 @@ component("sql") { "init_status.h", "meta_table.cc", "meta_table.h", + "proxy.cc", + "proxy.h", "recovery.cc", "recovery.h", "statement.cc", diff --git a/sql/connection_unittest.cc b/sql/connection_unittest.cc index aa9dbeb..df35dd1 100644 --- a/sql/connection_unittest.cc +++ b/sql/connection_unittest.cc @@ -12,6 +12,7 @@ #include "sql/connection.h" #include "sql/correct_sql_test_base.h" #include "sql/meta_table.h" +#include "sql/proxy.h" #include "sql/statement.h" #include "sql/test/error_callback_support.h" #include "sql/test/scoped_error_ignorer.h" @@ -85,12 +86,12 @@ class ScopedScalarFunction { int args, base::Callback cb) : db_(db.db_), function_name_(function_name), cb_(cb) { - ::sqlite3_create_function_v2(db_, function_name, args, SQLITE_UTF8, - this, &Run, NULL, NULL, NULL); + sql::sqlite3_create_function_v2(db_, function_name, args, SQLITE_UTF8, + this, &Run, NULL, NULL, NULL); } ~ScopedScalarFunction() { - ::sqlite3_create_function_v2(db_, function_name_, 0, SQLITE_UTF8, - NULL, NULL, NULL, NULL, NULL); + sql::sqlite3_create_function_v2(db_, function_name_, 0, SQLITE_UTF8, + NULL, NULL, NULL, NULL, NULL); } private: @@ -114,10 +115,10 @@ class ScopedCommitHook { base::Callback cb) : db_(db.db_), cb_(cb) { - ::sqlite3_commit_hook(db_, &Run, this); + sql::sqlite3_commit_hook(db_, &Run, this); } ~ScopedCommitHook() { - ::sqlite3_commit_hook(db_, NULL, NULL); + sql::sqlite3_commit_hook(db_, NULL, NULL); } private: diff --git a/sql/proxy.cc b/sql/proxy.cc new file mode 100644 index 0000000..5104812 --- /dev/null +++ b/sql/proxy.cc @@ -0,0 +1,28 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "sql/proxy.h" + +namespace sql { + +int sqlite3_create_function_v2( + sqlite3 *db, + const char *zFunctionName, + int nArg, + int eTextRep, + void *pApp, + void (*xFunc)(sqlite3_context*,int,sqlite3_value**), + void (*xStep)(sqlite3_context*,int,sqlite3_value**), + void (*xFinal)(sqlite3_context*), + void (*xDestroy)(void*)) { + return ::sqlite3_create_function_v2( + db, zFunctionName, nArg, eTextRep, pApp, + xFunc, xStep, xFinal, xDestroy); +} + +void *sqlite3_commit_hook(sqlite3* db, int(*func)(void*), void* arg) { + return ::sqlite3_commit_hook(db, func, arg); +} + +} // namespace sql diff --git a/sql/proxy.h b/sql/proxy.h new file mode 100644 index 0000000..7a2863b --- /dev/null +++ b/sql/proxy.h @@ -0,0 +1,39 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SQL_PROXY_H_ +#define SQL_PROXY_H_ + +#include "sql/sql_export.h" +#include "third_party/sqlite/sqlite3.h" + +// TODO(shess): third_party/sqlite does not track component build correctly, so +// each shared library gets a private copy of everything, so sqlite3_* calls +// outside of the main sql/ component don't work right. Hack around this by +// adding pass-through functions while I land a separate fix for the component +// issue. + +// This is only required for tests - if these abilities are desired for +// production code, they should probably do obvious things like live in +// sql::Connection and use C++ wrappers. + +// http://crbug.com/489444 + +namespace sql { + +SQL_EXPORT int sqlite3_create_function_v2( + sqlite3 *db, + const char *zFunctionName, + int nArg, + int eTextRep, + void *pApp, + void (*xFunc)(sqlite3_context*,int,sqlite3_value**), + void (*xStep)(sqlite3_context*,int,sqlite3_value**), + void (*xFinal)(sqlite3_context*), + void (*xDestroy)(void*)); +SQL_EXPORT void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*); + +} // namespace sql + +#endif // SQL_PROXY_H_ diff --git a/sql/sql.gyp b/sql/sql.gyp index 018b287..d983a45 100644 --- a/sql/sql.gyp +++ b/sql/sql.gyp @@ -27,6 +27,8 @@ 'init_status.h', 'meta_table.cc', 'meta_table.h', + 'proxy.cc', + 'proxy.h', 'recovery.cc', 'recovery.h', 'statement.cc', -- cgit v1.1