projects
/
ftsbench.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Small optimizing of query generation
[ftsbench.git]
/
pgdriver.c
diff --git
a/pgdriver.c
b/pgdriver.c
index
0c4c59d
..
0f01827
100644
(file)
--- a/
pgdriver.c
+++ b/
pgdriver.c
@@
-194,7
+194,6
@@
checkEmptyQuery(ftsPG *db, PGresult *res) {
static void
execQuery(ftsDB* adb, char ** words, int flags) {
ftsPG *db = (ftsPG*)adb;
static void
execQuery(ftsDB* adb, char ** words, int flags) {
ftsPG *db = (ftsPG*)adb;
- const char *paramValues[1];
int i = 0;
PGresult *res;
int i = 0;
PGresult *res;
@@
-224,25
+223,25
@@
execQuery(ftsDB* adb, char ** words, int flags) {
if ( i!= 0 )
sb_add(&db->b, (db->flags & FLG_OR) ? " | '" : " & '", 4);
else
if ( i!= 0 )
sb_add(&db->b, (db->flags & FLG_OR) ? " | '" : " & '", 4);
else
- sb_add
(&db->b, "'", 1
);
+ sb_add
char(&db->b, '\''
);
while( *ptr ) {
if (*ptr == '\'')
while( *ptr ) {
if (*ptr == '\'')
- sb_add
(&db->b, "'", 1
);
- sb_add
(&db->b, ptr, 1
);
+ sb_add
char(&db->b, '\''
);
+ sb_add
char(&db->b, *ptr
);
ptr++;
}
ptr++;
}
- sb_add
(&db->b, "'", 1
);
+ sb_add
char(&db->b, '\''
);
i++;
words++;
}
i++;
words++;
}
-
paramValues[0] = db->b.str
;
+
i = 1
;
res = PQexecPrepared( db->conn, "search_ftsbench",
res = PQexecPrepared( db->conn, "search_ftsbench",
- 1,
paramValues
,
-
NULL, NULL
, 0);
+ 1,
(const char**)&(db->b.str)
,
+
&(db->b.strlen), &i
, 0);
if (PQresultStatus(res) != PGRES_TUPLES_OK) {
/* skip error ' all words are a stop word' for GIN index -
if (PQresultStatus(res) != PGRES_TUPLES_OK) {
/* skip error ' all words are a stop word' for GIN index -