summaryrefslogtreecommitdiffstats
path: root/sql/proxy.h
diff options
context:
space:
mode:
authorshess <shess@chromium.org>2015-06-02 17:19:32 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-03 00:19:59 +0000
commit58b8df8572e25ff91b3073213651aed4ebd675b5 (patch)
tree8e92bdbc754f347c05515489799fc798baa17e19 /sql/proxy.h
parented09d907684cb6209090cf9dcbad91bfc2b11f56 (diff)
downloadchromium_src-58b8df8572e25ff91b3073213651aed4ebd675b5.zip
chromium_src-58b8df8572e25ff91b3073213651aed4ebd675b5.tar.gz
chromium_src-58b8df8572e25ff91b3073213651aed4ebd675b5.tar.bz2
[sql] Stats gathering for sql/ APIs.
Generate stats for how many SQL statements are executed, how many results they return, and how many changes they make. Generate timing values for how long is spent doing all queries, doing updating operations, doing autocommit updates, and commiting transactions. The goal of these metrics is to quantify results of decisions like enabling write-ahead log or memory-mapped I/O. BUG=489788,489444 Review URL: https://codereview.chromium.org/1145833002 Cr-Commit-Position: refs/heads/master@{#332503}
Diffstat (limited to 'sql/proxy.h')
-rw-r--r--sql/proxy.h39
1 files changed, 39 insertions, 0 deletions
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_