[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 03/04: better indentation, nicer formatting of SQL
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 03/04: better indentation, nicer formatting of SQL |
Date: |
Wed, 06 Jun 2018 07:56:16 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
commit f651dba097585be06d05592a6246c71e5cb1c936
Author: Christian Grothoff <address@hidden>
AuthorDate: Wed Jun 6 07:54:01 2018 +0200
better indentation, nicer formatting of SQL
---
src/datastore/plugin_datastore_postgres.c | 32 ++++++++++++++++---------------
src/datastore/plugin_datastore_sqlite.c | 8 ++++++--
2 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/src/datastore/plugin_datastore_postgres.c
b/src/datastore/plugin_datastore_postgres.c
index 0dc22b0f2..30013ef76 100644
--- a/src/datastore/plugin_datastore_postgres.c
+++ b/src/datastore/plugin_datastore_postgres.c
@@ -96,23 +96,23 @@ init_connection (struct Plugin *plugin)
#define RESULT_COLUMNS "repl, type, prio, anonLevel, expire, hash, value, oid"
struct GNUNET_PQ_PreparedStatement ps[] = {
GNUNET_PQ_make_prepare ("get",
- "SELECT " RESULT_COLUMNS " FROM gn090 "
- "WHERE oid >= $1::bigint AND "
- "(rvalue >= $2 OR 0 = $3::smallint) AND "
- "(hash = $4 OR 0 = $5::smallint) AND "
- "(type = $6 OR 0 = $7::smallint) "
- "ORDER BY oid ASC LIMIT 1",
+ "SELECT " RESULT_COLUMNS " FROM gn090"
+ " WHERE oid >= $1::bigint AND"
+ " (rvalue >= $2 OR 0 = $3::smallint) AND"
+ " (hash = $4 OR 0 = $5::smallint) AND"
+ " (type = $6 OR 0 = $7::smallint)"
+ " ORDER BY oid ASC LIMIT 1",
7),
GNUNET_PQ_make_prepare ("put",
"INSERT INTO gn090 (repl, type, prio, anonLevel,
expire, rvalue, hash, vhash, value) "
"VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
9),
GNUNET_PQ_make_prepare ("update",
- "UPDATE gn090 "
- "SET prio = prio + $1, "
- "repl = repl + $2, "
- "expire = GREATEST(expire, $3) "
- "WHERE hash = $4 AND vhash = $5",
+ "UPDATE gn090"
+ " SET prio = prio + $1,"
+ " repl = repl + $2,"
+ " expire = GREATEST(expire, $3)"
+ " WHERE hash = $4 AND vhash = $5",
5),
GNUNET_PQ_make_prepare ("decrepl",
"UPDATE gn090 SET repl = GREATEST (repl - 1, 0) "
@@ -136,11 +136,13 @@ init_connection (struct Plugin *plugin)
"ORDER BY repl DESC,RANDOM() LIMIT 1",
0),
GNUNET_PQ_make_prepare ("delrow",
- "DELETE FROM gn090 " "WHERE oid=$1",
+ "DELETE FROM gn090 "
+ "WHERE oid=$1",
1),
- GNUNET_PQ_make_prepare ("remove", "DELETE FROM gn090 "
- "WHERE hash = $1 AND "
- "value = $2",
+ GNUNET_PQ_make_prepare ("remove",
+ "DELETE FROM gn090"
+ " WHERE hash = $1 AND"
+ " value = $2",
2),
GNUNET_PQ_make_prepare ("get_keys",
"SELECT hash FROM gn090",
diff --git a/src/datastore/plugin_datastore_sqlite.c
b/src/datastore/plugin_datastore_sqlite.c
index 331b9f7f1..862977b9a 100644
--- a/src/datastore/plugin_datastore_sqlite.c
+++ b/src/datastore/plugin_datastore_sqlite.c
@@ -704,12 +704,16 @@ sqlite_plugin_put (void *cls,
break;
case SQLITE_BUSY:
GNUNET_break (0);
- LOG_SQLITE_MSG (plugin, &msg, GNUNET_ERROR_TYPE_ERROR |
GNUNET_ERROR_TYPE_BULK,
+ LOG_SQLITE_MSG (plugin,
+ &msg,
+ GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
"sqlite3_step");
ret = GNUNET_SYSERR;
break;
default:
- LOG_SQLITE_MSG (plugin, &msg, GNUNET_ERROR_TYPE_ERROR |
GNUNET_ERROR_TYPE_BULK,
+ LOG_SQLITE_MSG (plugin,
+ &msg,
+ GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
"sqlite3_step");
GNUNET_SQ_reset (plugin->dbh,
stmt);
--
To stop receiving notification emails like this one, please contact
address@hidden