File: 40_use_system_sqlite.patch

package info (click to toggle)
vtk7 7.1.1%2Bdfsg2-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 127,396 kB
  • sloc: cpp: 1,539,584; ansic: 124,382; python: 78,038; tcl: 47,013; xml: 8,142; yacc: 5,040; java: 4,439; perl: 3,132; lex: 1,926; sh: 1,500; makefile: 126; objc: 83
file content (544 lines) | stat: -rw-r--r-- 17,399 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
Description: Use system sqlite
Bug-Debian: https://bugs.debian.org/750183
Author: Anton Gladky <gladk@debian.org>
Last-Update: 2014-06-03
--- a/IO/SQL/vtkSQLiteDatabase.cxx
+++ b/IO/SQL/vtkSQLiteDatabase.cxx
@@ -29,7 +29,7 @@
 #include <fstream>
 #include <sstream>
 
-#include <vtksqlite/vtk_sqlite3.h>
+#include <sqlite3.h>
 
 vtkStandardNewMacro(vtkSQLiteDatabase);
 
@@ -307,15 +307,15 @@
     }
   }
 
-  int result = vtk_sqlite3_open(this->DatabaseFileName, & (this->SQLiteInstance));
+  int result = sqlite3_open(this->DatabaseFileName, & (this->SQLiteInstance));
 
-  if (result != VTK_SQLITE_OK)
+  if (result != SQLITE_OK)
   {
     vtkDebugMacro(<<"SQLite open() failed.  Error code is "
                   << result << " and message is "
-                  << vtk_sqlite3_errmsg(this->SQLiteInstance) );
+                  << sqlite3_errmsg(this->SQLiteInstance) );
 
-    vtk_sqlite3_close(this->SQLiteInstance);
+    sqlite3_close(this->SQLiteInstance);
     return false;
   }
   else
@@ -334,8 +334,8 @@
   }
   else
   {
-    int result = vtk_sqlite3_close(this->SQLiteInstance);
-    if (result != VTK_SQLITE_OK)
+    int result = sqlite3_close(this->SQLiteInstance);
+    if (result != SQLITE_OK)
     {
       vtkWarningMacro(<< "Close(): SQLite returned result code " << result);
     }
@@ -368,13 +368,13 @@
   }
 
   vtkSQLQuery *query = this->GetQueryInstance();
-  query->SetQuery("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name");
+  query->SetQuery("SELECT name FROM sqlite3_master WHERE type='table' ORDER BY name");
   bool status = query->Execute();
 
   if (!status)
   {
     vtkErrorMacro(<< "GetTables(): Database returned error: "
-                  << vtk_sqlite3_errmsg(this->SQLiteInstance) );
+                  << sqlite3_errmsg(this->SQLiteInstance) );
     query->Delete();
     return this->Tables;
   }
@@ -403,7 +403,7 @@
   if (!status)
   {
     vtkErrorMacro(<< "GetRecord(" << table << "): Database returned error: "
-                  << vtk_sqlite3_errmsg(this->SQLiteInstance) );
+                  << sqlite3_errmsg(this->SQLiteInstance) );
     query->Delete();
     return NULL;
   }
@@ -467,10 +467,10 @@
 // ----------------------------------------------------------------------
 bool vtkSQLiteDatabase::HasError()
 {
-  return (vtk_sqlite3_errcode(this->SQLiteInstance)!=VTK_SQLITE_OK);
+  return (sqlite3_errcode(this->SQLiteInstance)!=SQLITE_OK);
 }
 
 const char* vtkSQLiteDatabase::GetLastErrorText()
 {
-  return vtk_sqlite3_errmsg(this->SQLiteInstance);
+  return sqlite3_errmsg(this->SQLiteInstance);
 }
--- a/IO/SQL/vtkSQLiteDatabase.h
+++ b/IO/SQL/vtkSQLiteDatabase.h
@@ -52,7 +52,7 @@
 class vtkSQLQuery;
 class vtkSQLiteQuery;
 class vtkStringArray;
-struct vtk_sqlite3;
+struct sqlite3;
 
 class VTKIOSQL_EXPORT vtkSQLiteDatabase : public vtkSQLDatabase
 {
@@ -167,7 +167,7 @@
   virtual bool ParseURL(const char* url);
 
 private:
-  vtk_sqlite3 *SQLiteInstance;
+  sqlite3 *SQLiteInstance;
 
   // We want this to be private, a user of this class
   // should not be setting this for any reason
--- a/IO/SQL/vtkSQLiteQuery.cxx
+++ b/IO/SQL/vtkSQLiteQuery.cxx
@@ -25,7 +25,7 @@
 #include "vtkVariant.h"
 #include "vtkVariantArray.h"
 
-#include <vtksqlite/vtk_sqlite3.h>
+#include <sqlite3.h>
 
 #include <cassert>
 
@@ -43,7 +43,7 @@
 {
   this->Statement = NULL;
   this->InitialFetch = true;
-  this->InitialFetchResult=VTK_SQLITE_DONE;
+  this->InitialFetchResult=SQLITE_DONE;
   this->LastErrorText = NULL;
   this->TransactionInProgress = false;
 }
@@ -61,7 +61,7 @@
   {
     if (this->Database != NULL)
     {
-      vtk_sqlite3_finalize(this->Statement);
+      sqlite3_finalize(this->Statement);
       this->Statement = NULL;
     }
   }
@@ -128,8 +128,8 @@
   if (this->Statement)
   {
     vtkDebugMacro(<<"Finalizing old statement");
-    int finalizeStatus = vtk_sqlite3_finalize(this->Statement);
-    if (finalizeStatus != VTK_SQLITE_OK)
+    int finalizeStatus = sqlite3_finalize(this->Statement);
+    if (finalizeStatus != SQLITE_OK)
     {
       vtkWarningMacro(<<"SetQuery(): Finalize returned unexpected code "
                       << finalizeStatus);
@@ -148,19 +148,19 @@
       return false;
     }
 
-    vtk_sqlite3 *db = dbContainer->SQLiteInstance;
+    sqlite3 *db = dbContainer->SQLiteInstance;
     const char *unused_statement;
 
-    int prepareStatus = vtk_sqlite3_prepare_v2(db,
+    int prepareStatus = sqlite3_prepare_v2(db,
                                                this->Query,
                                                static_cast<int>(strlen(this->Query)),
                                                &this->Statement,
                                                &unused_statement);
 
-    if (prepareStatus != VTK_SQLITE_OK)
+    if (prepareStatus != SQLITE_OK)
     {
-      this->SetLastErrorText(vtk_sqlite3_errmsg(db));
-      vtkWarningMacro(<<"SetQuery(): vtk_sqlite3_prepare_v2() failed with error message "
+      this->SetLastErrorText(sqlite3_errmsg(db));
+      vtkWarningMacro(<<"SetQuery(): sqlite3_prepare_v2() failed with error message "
                     << this->GetLastErrorText()
                     << " on statement: '"
                     << this->Query << "'");
@@ -191,31 +191,31 @@
   }
   else
   {
-    vtk_sqlite3_reset(this->Statement);
+    sqlite3_reset(this->Statement);
   }
 
   vtkDebugMacro(<<"Execute(): Query ready to execute.");
 
   this->InitialFetch = true;
-  int result = vtk_sqlite3_step(this->Statement);
+  int result = sqlite3_step(this->Statement);
   this->InitialFetchResult = result;
 
-  if (result == VTK_SQLITE_DONE)
+  if (result == SQLITE_DONE)
   {
     this->SetLastErrorText(NULL);
     this->Active = true;
     return true;
   }
-  else if (result != VTK_SQLITE_ROW)
+  else if (result != SQLITE_ROW)
   {
     vtkSQLiteDatabase *dbContainer =
       vtkSQLiteDatabase::SafeDownCast(this->Database);
     assert(dbContainer != NULL);
 
-    vtk_sqlite3 *db = dbContainer->SQLiteInstance;
+    sqlite3 *db = dbContainer->SQLiteInstance;
 
-    this->SetLastErrorText(vtk_sqlite3_errmsg(db));
-    vtkDebugMacro(<< "Execute(): vtk_sqlite3_step() returned error message "
+    this->SetLastErrorText(sqlite3_errmsg(db));
+    vtkDebugMacro(<< "Execute(): sqlite3_step() returned error message "
                   << this->GetLastErrorText());
     this->Active = false;
     return false;
@@ -236,7 +236,7 @@
   }
   else
   {
-    return vtk_sqlite3_column_count(this->Statement);
+    return sqlite3_column_count(this->Statement);
   }
 }
 
@@ -256,7 +256,7 @@
   }
   else
   {
-    return vtk_sqlite3_column_name(this->Statement, column);
+    return sqlite3_column_name(this->Statement, column);
   }
 }
 
@@ -276,22 +276,22 @@
   }
   else
   {
-    switch (vtk_sqlite3_column_type(this->Statement, column))
+    switch (sqlite3_column_type(this->Statement, column))
     {
-      case VTK_SQLITE_INTEGER:
+      case SQLITE_INTEGER:
         return VTK_INT;
-      case VTK_SQLITE_FLOAT:
+      case SQLITE_FLOAT:
         return VTK_FLOAT;
-      case VTK_SQLITE_TEXT:
+      case SQLITE_TEXT:
         return VTK_STRING;
-      case VTK_SQLITE_BLOB:
+      case SQLITE_BLOB:
         return VTK_STRING; // until we have a BLOB type of our own
-      case VTK_SQLITE_NULL:
+      case SQLITE_NULL:
         return VTK_VOID; // ??? what makes sense here?
       default:
       {
       vtkErrorMacro(<<"GetFieldType(): Unknown data type "
-                    << vtk_sqlite3_column_type(this->Statement, column)
+                    << sqlite3_column_type(this->Statement, column)
                     <<" from SQLite.");
       return VTK_VOID;
       }
@@ -312,7 +312,7 @@
   {
     vtkDebugMacro(<<"NextRow(): Initial fetch being handled.");
     this->InitialFetch = false;
-    if (this->InitialFetchResult == VTK_SQLITE_DONE)
+    if (this->InitialFetchResult == SQLITE_DONE)
     {
       return false;
     }
@@ -323,12 +323,12 @@
   }
   else
   {
-    int result = vtk_sqlite3_step(this->Statement);
-    if (result == VTK_SQLITE_DONE)
+    int result = sqlite3_step(this->Statement);
+    if (result == SQLITE_DONE)
     {
       return false;
     }
-    else if (result == VTK_SQLITE_ROW)
+    else if (result == SQLITE_ROW)
     {
       return true;
     }
@@ -336,8 +336,8 @@
     {
       vtkSQLiteDatabase *dbContainer = vtkSQLiteDatabase::SafeDownCast( this->Database );
       assert(dbContainer != NULL);
-      vtk_sqlite3 *db = dbContainer->SQLiteInstance;
-      this->SetLastErrorText(vtk_sqlite3_errmsg(db));
+      sqlite3 *db = dbContainer->SQLiteInstance;
+      this->SetLastErrorText(sqlite3_errmsg(db));
       vtkErrorMacro(<<"NextRow(): Database returned error code "
                     << result << " with the following message: "
                     << this->GetLastErrorText());
@@ -363,33 +363,33 @@
   }
   else
   {
-    switch (vtk_sqlite3_column_type(this->Statement, column))
+    switch (sqlite3_column_type(this->Statement, column))
     {
-      case VTK_SQLITE_INTEGER:
-        return vtkVariant(vtk_sqlite3_column_int(this->Statement, column));
+      case SQLITE_INTEGER:
+        return vtkVariant(sqlite3_column_int(this->Statement, column));
 
-      case VTK_SQLITE_FLOAT:
-        return vtkVariant(vtk_sqlite3_column_double(this->Statement, column));
+      case SQLITE_FLOAT:
+        return vtkVariant(sqlite3_column_double(this->Statement, column));
 
-      case VTK_SQLITE_TEXT:
+      case SQLITE_TEXT:
       {
       std::ostringstream str;
-      str << vtk_sqlite3_column_text(this->Statement, column);
+      str << sqlite3_column_text(this->Statement, column);
       return vtkVariant(vtkStdString(str.str()));
       }
 
-      case VTK_SQLITE_BLOB:
+      case SQLITE_BLOB:
       {
       // This is a hack ... by passing the BLOB to vtkStdString with an explicit
       // byte count, we ensure that the string will store all of the BLOB's bytes,
       // even if there are NULL values.
 
       return vtkVariant(vtkStdString(
-        static_cast<const char*>(vtk_sqlite3_column_blob(this->Statement, column)),
-        vtk_sqlite3_column_bytes(this->Statement, column)));
+        static_cast<const char*>(sqlite3_column_blob(this->Statement, column)),
+        sqlite3_column_bytes(this->Statement, column)));
       }
 
-      case VTK_SQLITE_NULL:
+      case SQLITE_NULL:
       default:
         return vtkVariant();
     }
@@ -420,11 +420,11 @@
   vtkSQLiteDatabase *dbContainer = vtkSQLiteDatabase::SafeDownCast( this->Database );
   assert(dbContainer != NULL);
 
-  vtk_sqlite3 *db = dbContainer->SQLiteInstance;
+  sqlite3 *db = dbContainer->SQLiteInstance;
   char *errorMessage = NULL;
-  int result = vtk_sqlite3_exec(db, BEGIN_TRANSACTION, NULL, NULL, &errorMessage);
+  int result = sqlite3_exec(db, BEGIN_TRANSACTION, NULL, NULL, &errorMessage);
 
-  if (result == VTK_SQLITE_OK)
+  if (result == SQLITE_OK)
   {
     this->TransactionInProgress = true;
     this->SetLastErrorText(NULL);
@@ -448,7 +448,7 @@
 {
   if (this->Statement)
   {
-    vtk_sqlite3_finalize(this->Statement);
+    sqlite3_finalize(this->Statement);
     this->Statement = NULL;
   }
 
@@ -460,11 +460,11 @@
 
   vtkSQLiteDatabase *dbContainer = vtkSQLiteDatabase::SafeDownCast( this->Database );
   assert(dbContainer != NULL);
-  vtk_sqlite3 *db = dbContainer->SQLiteInstance;
+  sqlite3 *db = dbContainer->SQLiteInstance;
   char *errorMessage = NULL;
-  int result = vtk_sqlite3_exec(db, COMMIT_TRANSACTION, NULL, NULL, &errorMessage);
+  int result = sqlite3_exec(db, COMMIT_TRANSACTION, NULL, NULL, &errorMessage);
 
-  if (result == VTK_SQLITE_OK)
+  if (result == SQLITE_OK)
   {
     this->TransactionInProgress = false;
     this->SetLastErrorText(NULL);
@@ -496,11 +496,11 @@
 
   vtkSQLiteDatabase *dbContainer = vtkSQLiteDatabase::SafeDownCast( this->Database );
   assert(dbContainer != NULL);
-  vtk_sqlite3 *db = dbContainer->SQLiteInstance;
+  sqlite3 *db = dbContainer->SQLiteInstance;
   char *errorMessage = NULL;
-  int result = vtk_sqlite3_exec(db, ROLLBACK_TRANSACTION, NULL, NULL, &errorMessage);
+  int result = sqlite3_exec(db, ROLLBACK_TRANSACTION, NULL, NULL, &errorMessage);
 
-  if (result == VTK_SQLITE_OK)
+  if (result == SQLITE_OK)
   {
     this->TransactionInProgress = false;
     this->SetLastErrorText(NULL);
@@ -644,14 +644,14 @@
   if (this->Active)
   {
     this->Active = false;
-    vtk_sqlite3_reset(this->Statement);
+    sqlite3_reset(this->Statement);
   }
-  int status = vtk_sqlite3_bind_int(this->Statement, index+1, value);
+  int status = sqlite3_bind_int(this->Statement, index+1, value);
 
-  if (status != VTK_SQLITE_OK)
+  if (status != SQLITE_OK)
   {
     std::ostringstream errormessage;
-    errormessage << "sqlite_bind_int returned error: " << status;
+    errormessage << "sqlite3_bind_int returned error: " << status;
     this->SetLastErrorText(errormessage.str().c_str());
     vtkErrorMacro(<<errormessage.str().c_str());
     return false;
@@ -673,14 +673,14 @@
   if (this->Active)
   {
     this->Active = false;
-    vtk_sqlite3_reset(this->Statement);
+    sqlite3_reset(this->Statement);
   }
-  int status = vtk_sqlite3_bind_int(this->Statement, index+1, static_cast<vtk_sqlite_int64>(value));
+  int status = sqlite3_bind_int(this->Statement, index+1, static_cast<sqlite3_int64>(value));
 
-  if (status != VTK_SQLITE_OK)
+  if (status != SQLITE_OK)
   {
     std::ostringstream errormessage;
-    errormessage << "sqlite_bind_int64 returned error: " << status;
+    errormessage << "sqlite3_bind_int64 returned error: " << status;
     this->SetLastErrorText(errormessage.str().c_str());
     vtkErrorMacro(<<this->GetLastErrorText());
     return false;
@@ -702,15 +702,15 @@
   if (this->Active)
   {
     this->Active = false;
-    vtk_sqlite3_reset(this->Statement);
+    sqlite3_reset(this->Statement);
   }
 
-  int status = vtk_sqlite3_bind_double(this->Statement, index+1, value);
+  int status = sqlite3_bind_double(this->Statement, index+1, value);
 
-  if (status != VTK_SQLITE_OK)
+  if (status != SQLITE_OK)
   {
     std::ostringstream errormessage;
-    errormessage << "sqlite_bind_double returned error: " << status;
+    errormessage << "sqlite3_bind_double returned error: " << status;
     this->SetLastErrorText(errormessage.str().c_str());
     vtkErrorMacro(<<this->GetLastErrorText());
     return false;
@@ -731,15 +731,15 @@
   if (this->Active)
   {
     this->Active = false;
-    vtk_sqlite3_reset(this->Statement);
+    sqlite3_reset(this->Statement);
   }
 
-  int status = vtk_sqlite3_bind_text(this->Statement, index+1, value, length, VTK_SQLITE_TRANSIENT);
+  int status = sqlite3_bind_text(this->Statement, index+1, value, length, SQLITE_TRANSIENT);
 
-  if (status != VTK_SQLITE_OK)
+  if (status != SQLITE_OK)
   {
     std::ostringstream errormessage;
-    errormessage << "sqlite_bind_text returned error: " << status;
+    errormessage << "sqlite3_bind_text returned error: " << status;
     this->SetLastErrorText(errormessage.str().c_str());
     vtkErrorMacro(<<this->GetLastErrorText());
     return false;
@@ -760,20 +760,20 @@
   if (this->Active)
   {
     this->Active = false;
-    vtk_sqlite3_reset(this->Statement);
+    sqlite3_reset(this->Statement);
   }
 
   int status =
-    vtk_sqlite3_bind_blob(this->Statement,
+    sqlite3_bind_blob(this->Statement,
                           index+1,
                           data,
                           length,
-                          VTK_SQLITE_TRANSIENT);
+                          SQLITE_TRANSIENT);
 
-  if (status != VTK_SQLITE_OK)
+  if (status != SQLITE_OK)
   {
     std::ostringstream errormessage;
-    errormessage << "sqlite_bind_blob returned error: " << status;
+    errormessage << "sqlite3_bind_blob returned error: " << status;
     this->SetLastErrorText(errormessage.str().c_str());
     vtkErrorMacro(<<this->GetLastErrorText());
     return false;
@@ -794,15 +794,15 @@
   if (this->Active)
   {
     this->Active = false;
-    vtk_sqlite3_reset(this->Statement);
+    sqlite3_reset(this->Statement);
   }
 
-  int status = vtk_sqlite3_clear_bindings(this->Statement);
+  int status = sqlite3_clear_bindings(this->Statement);
 
-  if (status != VTK_SQLITE_OK)
+  if (status != SQLITE_OK)
   {
     std::ostringstream errormessage;
-    errormessage << "sqlite_clear_bindings returned error: " << status;
+    errormessage << "sqlite3_clear_bindings returned error: " << status;
     this->SetLastErrorText(errormessage.str().c_str());
     vtkErrorMacro(<<this->GetLastErrorText());
     return false;
--- a/IO/SQL/vtkSQLiteQuery.h
+++ b/IO/SQL/vtkSQLiteQuery.h
@@ -50,7 +50,7 @@
 class vtkSQLiteDatabase;
 class vtkVariant;
 class vtkVariantArray;
-struct vtk_sqlite3_stmt;
+struct sqlite3_stmt;
 
 class VTKIOSQL_EXPORT vtkSQLiteQuery : public vtkSQLQuery
 {
@@ -175,7 +175,7 @@
   vtkSQLiteQuery(const vtkSQLiteQuery &) VTK_DELETE_FUNCTION;
   void operator=(const vtkSQLiteQuery &) VTK_DELETE_FUNCTION;
 
-  vtk_sqlite3_stmt *Statement;
+  sqlite3_stmt *Statement;
   bool InitialFetch;
   int InitialFetchResult;
   char *LastErrorText;
--- a/ThirdParty/sqlite/CMakeLists.txt
+++ b/ThirdParty/sqlite/CMakeLists.txt
@@ -1,4 +1,4 @@
 set(vtksqlite_THIRD_PARTY 1)
-set(vtksqlite_LIBRARIES vtksqlite)
+set(vtksqlite_LIBRARIES sqlite3)
 vtk_module_export_info()
-add_subdirectory(vtksqlite)
+