]> git.pld-linux.org Git - packages/3store3.git/blob - 3store3-rasqal.patch
- updated db patch to support db up to 5.0
[packages/3store3.git] / 3store3-rasqal.patch
1 --- 3store3-3.0.17/src/sql-compile.c.orig       2006-07-17 12:29:26.000000000 +0200
2 +++ 3store3-3.0.17/src/sql-compile.c    2008-08-25 18:57:16.490120063 +0200
3 @@ -1376,7 +1376,7 @@ static void ts_expression_descend(ts_sym
4      case RASQAL_EXPR_REM:
5         prom = ts_expression_promoted_type(RASQAL_LITERAL_UNKNOWN, e->arg1);
6         prom = ts_expression_promoted_type(prom, e->arg2);
7 -       if (prom == RASQAL_LITERAL_UNKNOWN) prom = RASQAL_LITERAL_FLOATING;
8 +       if (prom == RASQAL_LITERAL_UNKNOWN) prom = RASQAL_LITERAL_DOUBLE;
9         g_string_append(s, "(");
10         ts_expression_descend(st, e->arg1, s, prom, block);
11         g_string_append(s, ts_sql_operator(e->op));
12 @@ -1386,9 +1386,9 @@ static void ts_expression_descend(ts_sym
13  
14      case RASQAL_EXPR_SLASH:
15         g_string_append(s, "(");
16 -       ts_expression_descend(st, e->arg1, s, RASQAL_LITERAL_FLOATING, block);
17 +       ts_expression_descend(st, e->arg1, s, RASQAL_LITERAL_DOUBLE, block);
18         g_string_append(s, ts_sql_operator(e->op));
19 -       ts_expression_descend(st, e->arg2, s, RASQAL_LITERAL_FLOATING, block);
20 +       ts_expression_descend(st, e->arg2, s, RASQAL_LITERAL_DOUBLE, block);
21         g_string_append(s, ")");
22         break;
23  
24 @@ -1437,8 +1437,8 @@ static void ts_expression_descend(ts_sym
25             g_string_sprintfa(s, "%i", e->literal->value.integer);
26             break;
27  
28 -       case RASQAL_LITERAL_FLOATING:
29         case RASQAL_LITERAL_FLOAT:
30 +       case RASQAL_LITERAL_DOUBLE:
31         case RASQAL_LITERAL_DECIMAL:
32             g_string_sprintfa(s, "%0.16g", e->literal->value.floating);
33             break;
34 @@ -1472,7 +1472,7 @@ static void ts_expression_descend(ts_sym
35  
36             if (prom == TS_ORDER_EXPRESSION_ASC || prom == TS_ORDER_EXPRESSION_DESC) {
37                 char *dir = (prom == TS_ORDER_EXPRESSION_ASC) ? "ASC" : "DESC";
38 -               const char *vftable = ts_symbol_valtbl_type(lsym, TS_ORDER_BLOCK, RASQAL_LITERAL_FLOATING);
39 +               const char *vftable = ts_symbol_valtbl_type(lsym, TS_ORDER_BLOCK, RASQAL_LITERAL_DOUBLE);
40                 const char *fcolumn = "val";
41  
42                 ts_symbol_valtbl_reqd(lsym, TS_ORDER_BLOCK);
43 @@ -1790,8 +1790,8 @@ static int ts_expression_latebind(ts_sym
44         case RASQAL_LITERAL_STRING:
45         case RASQAL_LITERAL_DATETIME:
46         case RASQAL_LITERAL_INTEGER:
47 -       case RASQAL_LITERAL_FLOATING:
48         case RASQAL_LITERAL_FLOAT:
49 +       case RASQAL_LITERAL_DOUBLE:
50         case RASQAL_LITERAL_DECIMAL:
51         case RASQAL_LITERAL_BOOLEAN:
52         case RASQAL_LITERAL_QNAME:
53 @@ -1949,7 +1949,7 @@ static rasqal_literal_type ts_expression
54         if (!strncmp(XSD_NAMESPACE, typeuri, 33)) {
55             if (!strcmp(typeuri, XSD_FLOAT) ||
56                 !strcmp(typeuri, XSD_DOUBLE)) {
57 -               return RASQAL_LITERAL_FLOATING;
58 +               return RASQAL_LITERAL_DOUBLE;
59             } else if (!strcmp(typeuri, XSD_INTEGER)) {
60                 return RASQAL_LITERAL_INTEGER;
61             } else if (!strcmp(typeuri, XSD_DATE) ||
62 @@ -1965,7 +1965,7 @@ static rasqal_literal_type ts_expression
63         return RASQAL_LITERAL_INTEGER;
64      }
65      if (e->op == RASQAL_EXPR_SLASH) {
66 -       return RASQAL_LITERAL_FLOATING;
67 +       return RASQAL_LITERAL_DOUBLE;
68      }
69      if (ts_binary_numerical_op(e)) {
70         rasqal_literal_type nt = ts_expression_promoted_type(t, e->arg1);
71 --- 3store3-3.0.17/src/symtab.c.orig    2005-12-06 11:36:42.000000000 +0100
72 +++ 3store3-3.0.17/src/symtab.c 2008-08-25 18:57:43.642126767 +0200
73 @@ -83,7 +83,7 @@ const char *ts_symbol_valtbl_type(ts_sym
74         tag = "i";
75         idx = 0;
76         break;
77 -    case RASQAL_LITERAL_FLOATING:
78 +    case RASQAL_LITERAL_DOUBLE:
79         table = T_F;
80         tag = "f";
81         idx = 1;
82 --- 3store3-3.0.17/src/connection.c.orig        2005-10-17 14:55:25.000000000 +0200
83 +++ 3store3-3.0.17/src/connection.c     2008-08-25 19:08:08.950121739 +0200
84 @@ -22,18 +22,17 @@
85  #include "config.h"
86  #include "tstore.h"
87  
88 -static int ts_inited = 0;
89 +static rasqal_world *rasqalp = NULL;
90  
91  void ts_init()
92  {
93 -    ts_inited = 1;
94 -    rasqal_init();
95 +    rasqalp = rasqal_new_world();
96  }
97  
98  void ts_finish()
99  {
100 -    ts_inited = 0;
101 -    rasqal_finish();
102 +    rasqal_free_world(rasqalp);
103 +    rasqalp = NULL;
104  }
105  
106  ts_connection *ts_connect(const char *host, const char *db,
107 @@ -44,10 +43,11 @@ ts_connection *ts_connect(const char *ho
108      char tmp[TS_CF_VAL_SIZE];
109      int table_version = 0;
110  
111 -    if (!ts_inited) {
112 +    if (rasqalp == NULL) {
113         fprintf(stderr, "fatal error: lib3store not initialised\n");
114         return NULL;
115      }
116 +    c->rasqalp = rasqalp;
117  
118      if (!(c->db = mysql_init(NULL))) {
119          fprintf(stderr, "Could not initialise database connection\n");
120 --- 3store3-3.0.17/src/ts-explain.c.orig        2005-12-06 14:57:58.000000000 +0100
121 +++ 3store3-3.0.17/src/ts-explain.c     2008-08-25 19:10:48.498123415 +0200
122 @@ -71,19 +71,20 @@ int main(int argc, char*argv[])
123         const char *lang;
124         const char *label;
125  
126 -       rasqal_init();
127 +       rasqal_world *rasqalp = rasqal_new_world();
128  
129          fprintf(stderr, "Usage: %s "TSP_OPTIONS" <query>\n" TSP_HELP, basename(argv[0]));
130         fprintf(stderr, "   -l, --language  use language for this explanation\n");
131         fprintf(stderr, "    where language is one of:");
132         for (i=0; 1; i++) {
133 -           if (rasqal_languages_enumerate(i, &lang, &label, NULL)) {
134 +           if (rasqal_languages_enumerate(rasqalp, i, &lang, &label, NULL)) {
135                 break;
136             }
137             fprintf(stderr, " %s", lang);
138         }
139         fprintf(stderr, "\n");
140         fprintf(stderr, "See man pages for more details\n");
141 +       rasqal_free_world(rasqalp);
142          return 1;
143      }
144  
145 --- 3store3-3.0.17/src/query.c.orig     2005-12-06 14:57:58.000000000 +0100
146 +++ 3store3-3.0.17/src/query.c  2008-08-25 19:08:23.010117548 +0200
147 @@ -54,7 +54,7 @@ ts_query *ts_query_prepare(ts_connection
148  
149      tq = calloc(1, sizeof(ts_query));
150      bu = raptor_new_uri((unsigned char *)base_uri);
151 -    rq = rasqal_new_query(lang, NULL);
152 +    rq = rasqal_new_query(c->rasqalp, lang, NULL);
153      rasqal_query_set_error_handler(rq, tq, parser_error_handler);
154      ret = rasqal_query_prepare(rq, (unsigned char *)query, bu);
155      if (ret) {
156 --- 3store3-3.0.17/src/ts-query.c.orig  2005-12-21 15:29:09.000000000 +0100
157 +++ 3store3-3.0.17/src/ts-query.c       2008-08-25 19:11:28.282113358 +0200
158 @@ -91,7 +91,7 @@ int main(int argc, char*argv[])
159         const char *lang;
160         const char *label;
161  
162 -       rasqal_init();
163 +       rasqal_world *rasqalp = rasqal_new_world();
164  
165          fprintf(stderr, "Usage: %s "TSP_OPTIONS" [-l language] "
166                 "[-f format] [-O level] [<query>]\n" TSP_HELP, basename(argv[0]));
167 @@ -101,7 +101,7 @@ int main(int argc, char*argv[])
168         fprintf(stderr, "                   0=none, 1=normal, 2=high, 3=experimental\n");
169         fprintf(stderr, "    where language is one of:");
170         for (i=0; 1; i++) {
171 -           if (rasqal_languages_enumerate(i, &lang, &label, NULL)) {
172 +           if (rasqal_languages_enumerate(rasqalp, i, &lang, &label, NULL)) {
173                 break;
174             }
175             fprintf(stderr, " %s", lang);
176 @@ -116,6 +116,7 @@ int main(int argc, char*argv[])
177         }
178         fprintf(stderr, "\n\n");
179         fprintf(stderr, "See man pages for more details\n");
180 +       rasqal_free_world(rasqalp);
181         
182          return 1;
183      }
184 --- 3store3-3.0.17/src/datatypes.h.orig 2005-12-06 11:28:10.000000000 +0100
185 +++ 3store3-3.0.17/src/datatypes.h      2008-08-25 19:07:27.614128443 +0200
186 @@ -7,6 +7,7 @@
187  #include <stdint.h>
188  #include <limits.h>
189  #include <db.h>
190 +#include <rasqal.h>
191  
192  #include "config.h"
193  
194 @@ -106,6 +107,7 @@ typedef struct ts_connection_s {
195                                  * assertions */
196         int lock_tables;
197         ts_bulk_import_data *bid;
198 +       rasqal_world *rasqalp;
199  } ts_connection;
200  
201  typedef struct ts_binding_desc_s {
This page took 0.107494 seconds and 3 git commands to generate.