Skip to content
This repository
Browse code

Removing cpp files.

  • Loading branch information...
commit 05d93f34237d8cb118ed380940f68e6a1694ee76 1 parent 4eacddb
authored March 08, 2011
25  CMakeLists.txt
... ...
@@ -1,25 +0,0 @@
1  
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2  
-list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
3  
-
4  
-PROJECT(mbutil)
5  
-
6  
-ADD_DEFINITIONS(-g -O2 -Wall -W -Werror -lsqlite3)
7  
-SET(CMAKE_EXE_LINKER_FLAGS "-undefined dynamic_lookup")
8  
-ADD_EXECUTABLE(mbutil mbutil.cpp)
9  
-
10  
-FIND_PACKAGE(Boost REQUIRED COMPONENTS system program_options filesystem regex)
11  
-FIND_PACKAGE(Sqlite3 REQUIRED)
12  
-
13  
-link_directories(
14  
-    ${Boost_LIBRARY_DIRS}
15  
-    ${SQLITE_LIBRARIES}
16  
-    )
17  
-include_directories(
18  
-    ${Boost_INCLUDE_DIRS}
19  
-    include)
20  
-
21  
-target_link_libraries (
22  
-    mbutil
23  
-    ${SQLITE_LIBRARIES}
24  
-    ${Boost_LIBRARIES}
25  
-    )
56  cmake/FindSqlite3.cmake
... ...
@@ -1,56 +0,0 @@
1  
-# - find Sqlite 3
2  
-# SQLITE3_INCLUDE_DIR - Where to find Sqlite 3 header files (directory)
3  
-# SQLITE3_LIBRARIES - Sqlite 3 libraries
4  
-# SQLITE3_LIBRARY_RELEASE - Where the release library is
5  
-# SQLITE3_LIBRARY_DEBUG - Where the debug library is
6  
-# SQLITE3_FOUND - Set to TRUE if we found everything (library, includes and executable)
7  
-
8  
-# Copyright (c) 2010 Pau Garcia i Quiles, <pgquiles@elpauer.org>
9  
-#
10  
-# Redistribution and use is allowed according to the terms of the BSD license.
11  
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
12  
-#
13  
-# Generated by CModuler, a CMake Module Generator - http://gitorious.org/cmoduler
14  
-
15  
-IF( SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY_RELEASE AND SQLITE3_LIBRARY_DEBUG )
16  
-    SET(SQLITE3_FIND_QUIETLY TRUE)
17  
-ENDIF( SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY_RELEASE AND SQLITE3_LIBRARY_DEBUG )
18  
-
19  
-FIND_PATH( SQLITE3_INCLUDE_DIR sqlite3.h  )
20  
-
21  
-FIND_LIBRARY(SQLITE3_LIBRARY_RELEASE NAMES sqlite3 )
22  
-
23  
-FIND_LIBRARY(SQLITE3_LIBRARY_DEBUG NAMES sqlite3 sqlite3d  HINTS /usr/lib/debug/usr/lib/ )
24  
-
25  
-IF( SQLITE3_LIBRARY_RELEASE OR SQLITE3_LIBRARY_DEBUG AND SQLITE3_INCLUDE_DIR )
26  
-	SET( SQLITE3_FOUND TRUE )
27  
-ENDIF( SQLITE3_LIBRARY_RELEASE OR SQLITE3_LIBRARY_DEBUG AND SQLITE3_INCLUDE_DIR )
28  
-
29  
-IF( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
30  
-	# if the generator supports configuration types then set
31  
-	# optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
32  
-	IF( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
33  
-		SET( SQLITE3_LIBRARIES optimized ${SQLITE3_LIBRARY_RELEASE} debug ${SQLITE3_LIBRARY_DEBUG} )
34  
-	ELSE( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
35  
-    # if there are no configuration types and CMAKE_BUILD_TYPE has no value
36  
-    # then just use the release libraries
37  
-		SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_RELEASE} )
38  
-	ENDIF( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
39  
-ELSEIF( SQLITE3_LIBRARY_RELEASE )
40  
-	SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_RELEASE} )
41  
-ELSE( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
42  
-	SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_DEBUG} )
43  
-ENDIF( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
44  
-
45  
-IF( SQLITE3_FOUND )
46  
-	IF( NOT SQLITE3_FIND_QUIETLY )
47  
-		MESSAGE( STATUS "Found Sqlite3 header file in ${SQLITE3_INCLUDE_DIR}")
48  
-		MESSAGE( STATUS "Found Sqlite3 libraries: ${SQLITE3_LIBRARIES}")
49  
-	ENDIF( NOT SQLITE3_FIND_QUIETLY )
50  
-ELSE(SQLITE3_FOUND)
51  
-	IF( SQLITE3_FIND_REQUIRED)
52  
-		MESSAGE( FATAL_ERROR "Could not find Sqlite3" )
53  
-	ELSE( SQLITE3_FIND_REQUIRED)
54  
-		MESSAGE( STATUS "Optional package Sqlite3 was not found" )
55  
-	ENDIF( SQLITE3_FIND_REQUIRED)
56  
-ENDIF(SQLITE3_FOUND)
119,636  include/sqlite3.c
0 additions, 119636 deletions not shown
186  include/sqlite3.def
... ...
@@ -1,186 +0,0 @@
1  
-EXPORTS
2  
-sqlite3_aggregate_context
3  
-sqlite3_aggregate_count
4  
-sqlite3_auto_extension
5  
-sqlite3_backup_finish
6  
-sqlite3_backup_init
7  
-sqlite3_backup_pagecount
8  
-sqlite3_backup_remaining
9  
-sqlite3_backup_step
10  
-sqlite3_bind_blob
11  
-sqlite3_bind_double
12  
-sqlite3_bind_int
13  
-sqlite3_bind_int64
14  
-sqlite3_bind_null
15  
-sqlite3_bind_parameter_count
16  
-sqlite3_bind_parameter_index
17  
-sqlite3_bind_parameter_name
18  
-sqlite3_bind_text
19  
-sqlite3_bind_text16
20  
-sqlite3_bind_value
21  
-sqlite3_bind_zeroblob
22  
-sqlite3_blob_bytes
23  
-sqlite3_blob_close
24  
-sqlite3_blob_open
25  
-sqlite3_blob_read
26  
-sqlite3_blob_write
27  
-sqlite3_busy_handler
28  
-sqlite3_busy_timeout
29  
-sqlite3_changes
30  
-sqlite3_clear_bindings
31  
-sqlite3_close
32  
-sqlite3_collation_needed
33  
-sqlite3_collation_needed16
34  
-sqlite3_column_blob
35  
-sqlite3_column_bytes
36  
-sqlite3_column_bytes16
37  
-sqlite3_column_count
38  
-sqlite3_column_database_name
39  
-sqlite3_column_database_name16
40  
-sqlite3_column_decltype
41  
-sqlite3_column_decltype16
42  
-sqlite3_column_double
43  
-sqlite3_column_int
44  
-sqlite3_column_int64
45  
-sqlite3_column_name
46  
-sqlite3_column_name16
47  
-sqlite3_column_origin_name
48  
-sqlite3_column_origin_name16
49  
-sqlite3_column_table_name
50  
-sqlite3_column_table_name16
51  
-sqlite3_column_text
52  
-sqlite3_column_text16
53  
-sqlite3_column_type
54  
-sqlite3_column_value
55  
-sqlite3_commit_hook
56  
-sqlite3_compileoption_get
57  
-sqlite3_compileoption_used
58  
-sqlite3_complete
59  
-sqlite3_complete16
60  
-sqlite3_config
61  
-sqlite3_context_db_handle
62  
-sqlite3_create_collation
63  
-sqlite3_create_collation16
64  
-sqlite3_create_collation_v2
65  
-sqlite3_create_function
66  
-sqlite3_create_function16
67  
-sqlite3_create_module
68  
-sqlite3_create_module_v2
69  
-sqlite3_data_count
70  
-sqlite3_db_config
71  
-sqlite3_db_handle
72  
-sqlite3_db_mutex
73  
-sqlite3_db_status
74  
-sqlite3_declare_vtab
75  
-sqlite3_enable_load_extension
76  
-sqlite3_enable_shared_cache
77  
-sqlite3_errcode
78  
-sqlite3_errmsg
79  
-sqlite3_errmsg16
80  
-sqlite3_exec
81  
-sqlite3_expired
82  
-sqlite3_extended_errcode
83  
-sqlite3_extended_result_codes
84  
-sqlite3_file_control
85  
-sqlite3_finalize
86  
-sqlite3_free
87  
-sqlite3_free_table
88  
-sqlite3_get_autocommit
89  
-sqlite3_get_auxdata
90  
-sqlite3_get_table
91  
-sqlite3_global_recover
92  
-sqlite3_initialize
93  
-sqlite3_interrupt
94  
-sqlite3_last_insert_rowid
95  
-sqlite3_libversion
96  
-sqlite3_libversion_number
97  
-sqlite3_limit
98  
-sqlite3_load_extension
99  
-sqlite3_log
100  
-sqlite3_malloc
101  
-sqlite3_memory_alarm
102  
-sqlite3_memory_highwater
103  
-sqlite3_memory_used
104  
-sqlite3_mprintf
105  
-sqlite3_mutex_alloc
106  
-sqlite3_mutex_enter
107  
-sqlite3_mutex_free
108  
-sqlite3_mutex_leave
109  
-sqlite3_mutex_try
110  
-sqlite3_next_stmt
111  
-sqlite3_open
112  
-sqlite3_open16
113  
-sqlite3_open_v2
114  
-sqlite3_os_end
115  
-sqlite3_os_init
116  
-sqlite3_overload_function
117  
-sqlite3_prepare
118  
-sqlite3_prepare16
119  
-sqlite3_prepare16_v2
120  
-sqlite3_prepare_v2
121  
-sqlite3_profile
122  
-sqlite3_progress_handler
123  
-sqlite3_randomness
124  
-sqlite3_realloc
125  
-sqlite3_release_memory
126  
-sqlite3_reset
127  
-sqlite3_reset_auto_extension
128  
-sqlite3_result_blob
129  
-sqlite3_result_double
130  
-sqlite3_result_error
131  
-sqlite3_result_error16
132  
-sqlite3_result_error_code
133  
-sqlite3_result_error_nomem
134  
-sqlite3_result_error_toobig
135  
-sqlite3_result_int
136  
-sqlite3_result_int64
137  
-sqlite3_result_null
138  
-sqlite3_result_text
139  
-sqlite3_result_text16
140  
-sqlite3_result_text16be
141  
-sqlite3_result_text16le
142  
-sqlite3_result_value
143  
-sqlite3_result_zeroblob
144  
-sqlite3_rollback_hook
145  
-sqlite3_set_authorizer
146  
-sqlite3_set_auxdata
147  
-sqlite3_shutdown
148  
-sqlite3_sleep
149  
-sqlite3_snprintf
150  
-sqlite3_soft_heap_limit
151  
-sqlite3_sourceid
152  
-sqlite3_sql
153  
-sqlite3_status
154  
-sqlite3_step
155  
-sqlite3_stmt_status
156  
-sqlite3_strnicmp
157  
-sqlite3_table_column_metadata
158  
-sqlite3_test_control
159  
-sqlite3_thread_cleanup
160  
-sqlite3_threadsafe
161  
-sqlite3_total_changes
162  
-sqlite3_trace
163  
-sqlite3_transfer_bindings
164  
-sqlite3_update_hook
165  
-sqlite3_user_data
166  
-sqlite3_value_blob
167  
-sqlite3_value_bytes
168  
-sqlite3_value_bytes16
169  
-sqlite3_value_double
170  
-sqlite3_value_int
171  
-sqlite3_value_int64
172  
-sqlite3_value_numeric_type
173  
-sqlite3_value_text
174  
-sqlite3_value_text16
175  
-sqlite3_value_text16be
176  
-sqlite3_value_text16le
177  
-sqlite3_value_type
178  
-sqlite3_version
179  
-sqlite3_vfs_find
180  
-sqlite3_vfs_register
181  
-sqlite3_vfs_unregister
182  
-sqlite3_vmprintf
183  
-sqlite3_wal_autocheckpoint
184  
-sqlite3_wal_checkpoint
185  
-sqlite3_wal_hook
186  
-sqlite3_win32_mbcs_to_utf8
5,963  include/sqlite3.h
0 additions, 5963 deletions not shown
378  include/sqlite3ext.h
... ...
@@ -1,378 +0,0 @@
1  
-/*
2  
-** 2006 June 7
3  
-**
4  
-** The author disclaims copyright to this source code.  In place of
5  
-** a legal notice, here is a blessing:
6  
-**
7  
-**    May you do good and not evil.
8  
-**    May you find forgiveness for yourself and forgive others.
9  
-**    May you share freely, never taking more than you give.
10  
-**
11  
-*************************************************************************
12  
-** This header file defines the SQLite interface for use by
13  
-** shared libraries that want to be imported as extensions into
14  
-** an SQLite instance.  Shared libraries that intend to be loaded
15  
-** as extensions by SQLite should #include this file instead of 
16  
-** sqlite3.h.
17  
-*/
18  
-#ifndef _SQLITE3EXT_H_
19  
-#define _SQLITE3EXT_H_
20  
-#include "sqlite3.h"
21  
-
22  
-typedef struct sqlite3_api_routines sqlite3_api_routines;
23  
-
24  
-/*
25  
-** The following structure holds pointers to all of the SQLite API
26  
-** routines.
27  
-**
28  
-** WARNING:  In order to maintain backwards compatibility, add new
29  
-** interfaces to the end of this structure only.  If you insert new
30  
-** interfaces in the middle of this structure, then older different
31  
-** versions of SQLite will not be able to load each others' shared
32  
-** libraries!
33  
-*/
34  
-struct sqlite3_api_routines {
35  
-  void * (*aggregate_context)(sqlite3_context*,int nBytes);
36  
-  int  (*aggregate_count)(sqlite3_context*);
37  
-  int  (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));
38  
-  int  (*bind_double)(sqlite3_stmt*,int,double);
39  
-  int  (*bind_int)(sqlite3_stmt*,int,int);
40  
-  int  (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);
41  
-  int  (*bind_null)(sqlite3_stmt*,int);
42  
-  int  (*bind_parameter_count)(sqlite3_stmt*);
43  
-  int  (*bind_parameter_index)(sqlite3_stmt*,const char*zName);
44  
-  const char * (*bind_parameter_name)(sqlite3_stmt*,int);
45  
-  int  (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));
46  
-  int  (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));
47  
-  int  (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);
48  
-  int  (*busy_handler)(sqlite3*,int(*)(void*,int),void*);
49  
-  int  (*busy_timeout)(sqlite3*,int ms);
50  
-  int  (*changes)(sqlite3*);
51  
-  int  (*close)(sqlite3*);
52  
-  int  (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,int eTextRep,const char*));
53  
-  int  (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,int eTextRep,const void*));
54  
-  const void * (*column_blob)(sqlite3_stmt*,int iCol);
55  
-  int  (*column_bytes)(sqlite3_stmt*,int iCol);
56  
-  int  (*column_bytes16)(sqlite3_stmt*,int iCol);
57  
-  int  (*column_count)(sqlite3_stmt*pStmt);
58  
-  const char * (*column_database_name)(sqlite3_stmt*,int);
59  
-  const void * (*column_database_name16)(sqlite3_stmt*,int);
60  
-  const char * (*column_decltype)(sqlite3_stmt*,int i);
61  
-  const void * (*column_decltype16)(sqlite3_stmt*,int);
62  
-  double  (*column_double)(sqlite3_stmt*,int iCol);
63  
-  int  (*column_int)(sqlite3_stmt*,int iCol);
64  
-  sqlite_int64  (*column_int64)(sqlite3_stmt*,int iCol);
65  
-  const char * (*column_name)(sqlite3_stmt*,int);
66  
-  const void * (*column_name16)(sqlite3_stmt*,int);
67  
-  const char * (*column_origin_name)(sqlite3_stmt*,int);
68  
-  const void * (*column_origin_name16)(sqlite3_stmt*,int);
69  
-  const char * (*column_table_name)(sqlite3_stmt*,int);
70  
-  const void * (*column_table_name16)(sqlite3_stmt*,int);
71  
-  const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);
72  
-  const void * (*column_text16)(sqlite3_stmt*,int iCol);
73  
-  int  (*column_type)(sqlite3_stmt*,int iCol);
74  
-  sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);
75  
-  void * (*commit_hook)(sqlite3*,int(*)(void*),void*);
76  
-  int  (*complete)(const char*sql);
77  
-  int  (*complete16)(const void*sql);
78  
-  int  (*create_collation)(sqlite3*,const char*,int,void*,int(*)(void*,int,const void*,int,const void*));
79  
-  int  (*create_collation16)(sqlite3*,const void*,int,void*,int(*)(void*,int,const void*,int,const void*));
80  
-  int  (*create_function)(sqlite3*,const char*,int,int,void*,void (*xFunc)(sqlite3_context*,int,sqlite3_value**),void (*xStep)(sqlite3_context*,int,sqlite3_value**),void (*xFinal)(sqlite3_context*));
81  
-  int  (*create_function16)(sqlite3*,const void*,int,int,void*,void (*xFunc)(sqlite3_context*,int,sqlite3_value**),void (*xStep)(sqlite3_context*,int,sqlite3_value**),void (*xFinal)(sqlite3_context*));
82  
-  int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);
83  
-  int  (*data_count)(sqlite3_stmt*pStmt);
84  
-  sqlite3 * (*db_handle)(sqlite3_stmt*);
85  
-  int (*declare_vtab)(sqlite3*,const char*);
86  
-  int  (*enable_shared_cache)(int);
87  
-  int  (*errcode)(sqlite3*db);
88  
-  const char * (*errmsg)(sqlite3*);
89  
-  const void * (*errmsg16)(sqlite3*);
90  
-  int  (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);
91  
-  int  (*expired)(sqlite3_stmt*);
92  
-  int  (*finalize)(sqlite3_stmt*pStmt);
93  
-  void  (*free)(void*);
94  
-  void  (*free_table)(char**result);
95  
-  int  (*get_autocommit)(sqlite3*);
96  
-  void * (*get_auxdata)(sqlite3_context*,int);
97  
-  int  (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);
98  
-  int  (*global_recover)(void);
99  
-  void  (*interruptx)(sqlite3*);
100  
-  sqlite_int64  (*last_insert_rowid)(sqlite3*);
101  
-  const char * (*libversion)(void);
102  
-  int  (*libversion_number)(void);
103  
-  void *(*malloc)(int);
104  
-  char * (*mprintf)(const char*,...);
105  
-  int  (*open)(const char*,sqlite3**);
106  
-  int  (*open16)(const void*,sqlite3**);
107  
-  int  (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
108  
-  int  (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
109  
-  void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*);
110  
-  void  (*progress_handler)(sqlite3*,int,int(*)(void*),void*);
111  
-  void *(*realloc)(void*,int);
112  
-  int  (*reset)(sqlite3_stmt*pStmt);
113  
-  void  (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));
114  
-  void  (*result_double)(sqlite3_context*,double);
115  
-  void  (*result_error)(sqlite3_context*,const char*,int);
116  
-  void  (*result_error16)(sqlite3_context*,const void*,int);
117  
-  void  (*result_int)(sqlite3_context*,int);
118  
-  void  (*result_int64)(sqlite3_context*,sqlite_int64);
119  
-  void  (*result_null)(sqlite3_context*);
120  
-  void  (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));
121  
-  void  (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));
122  
-  void  (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));
123  
-  void  (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));
124  
-  void  (*result_value)(sqlite3_context*,sqlite3_value*);
125  
-  void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);
126  
-  int  (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,const char*,const char*),void*);
127  
-  void  (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));
128  
-  char * (*snprintf)(int,char*,const char*,...);
129  
-  int  (*step)(sqlite3_stmt*);
130  
-  int  (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,char const**,char const**,int*,int*,int*);
131  
-  void  (*thread_cleanup)(void);
132  
-  int  (*total_changes)(sqlite3*);
133  
-  void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);
134  
-  int  (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);
135  
-  void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,sqlite_int64),void*);
136  
-  void * (*user_data)(sqlite3_context*);
137  
-  const void * (*value_blob)(sqlite3_value*);
138  
-  int  (*value_bytes)(sqlite3_value*);
139  
-  int  (*value_bytes16)(sqlite3_value*);
140  
-  double  (*value_double)(sqlite3_value*);
141  
-  int  (*value_int)(sqlite3_value*);
142  
-  sqlite_int64  (*value_int64)(sqlite3_value*);
143  
-  int  (*value_numeric_type)(sqlite3_value*);
144  
-  const unsigned char * (*value_text)(sqlite3_value*);
145  
-  const void * (*value_text16)(sqlite3_value*);
146  
-  const void * (*value_text16be)(sqlite3_value*);
147  
-  const void * (*value_text16le)(sqlite3_value*);
148  
-  int  (*value_type)(sqlite3_value*);
149  
-  char *(*vmprintf)(const char*,va_list);
150  
-  /* Added ??? */
151  
-  int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);
152  
-  /* Added by 3.3.13 */
153  
-  int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
154  
-  int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
155  
-  int (*clear_bindings)(sqlite3_stmt*);
156  
-  /* Added by 3.4.1 */
157  
-  int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,void (*xDestroy)(void *));
158  
-  /* Added by 3.5.0 */
159  
-  int (*bind_zeroblob)(sqlite3_stmt*,int,int);
160  
-  int (*blob_bytes)(sqlite3_blob*);
161  
-  int (*blob_close)(sqlite3_blob*);
162  
-  int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,int,sqlite3_blob**);
163  
-  int (*blob_read)(sqlite3_blob*,void*,int,int);
164  
-  int (*blob_write)(sqlite3_blob*,const void*,int,int);
165  
-  int (*create_collation_v2)(sqlite3*,const char*,int,void*,int(*)(void*,int,const void*,int,const void*),void(*)(void*));
166  
-  int (*file_control)(sqlite3*,const char*,int,void*);
167  
-  sqlite3_int64 (*memory_highwater)(int);
168  
-  sqlite3_int64 (*memory_used)(void);
169  
-  sqlite3_mutex *(*mutex_alloc)(int);
170  
-  void (*mutex_enter)(sqlite3_mutex*);
171  
-  void (*mutex_free)(sqlite3_mutex*);
172  
-  void (*mutex_leave)(sqlite3_mutex*);
173  
-  int (*mutex_try)(sqlite3_mutex*);
174  
-  int (*open_v2)(const char*,sqlite3**,int,const char*);
175  
-  int (*release_memory)(int);
176  
-  void (*result_error_nomem)(sqlite3_context*);
177  
-  void (*result_error_toobig)(sqlite3_context*);
178  
-  int (*sleep)(int);
179  
-  void (*soft_heap_limit)(int);
180  
-  sqlite3_vfs *(*vfs_find)(const char*);
181  
-  int (*vfs_register)(sqlite3_vfs*,int);
182  
-  int (*vfs_unregister)(sqlite3_vfs*);
183  
-  int (*xthreadsafe)(void);
184  
-  void (*result_zeroblob)(sqlite3_context*,int);
185  
-  void (*result_error_code)(sqlite3_context*,int);
186  
-  int (*test_control)(int, ...);
187  
-  void (*randomness)(int,void*);
188  
-  sqlite3 *(*context_db_handle)(sqlite3_context*);
189  
-  int (*extended_result_codes)(sqlite3*,int);
190  
-  int (*limit)(sqlite3*,int,int);
191  
-  sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);
192  
-  const char *(*sql)(sqlite3_stmt*);
193  
-  int (*status)(int,int*,int*,int);
194  
-};
195  
-
196  
-/*
197  
-** The following macros redefine the API routines so that they are
198  
-** redirected throught the global sqlite3_api structure.
199  
-**
200  
-** This header file is also used by the loadext.c source file
201  
-** (part of the main SQLite library - not an extension) so that
202  
-** it can get access to the sqlite3_api_routines structure
203  
-** definition.  But the main library does not want to redefine
204  
-** the API.  So the redefinition macros are only valid if the
205  
-** SQLITE_CORE macros is undefined.
206  
-*/
207  
-#ifndef SQLITE_CORE
208  
-#define sqlite3_aggregate_context      sqlite3_api->aggregate_context
209  
-#ifndef SQLITE_OMIT_DEPRECATED
210  
-#define sqlite3_aggregate_count        sqlite3_api->aggregate_count
211  
-#endif
212  
-#define sqlite3_bind_blob              sqlite3_api->bind_blob
213  
-#define sqlite3_bind_double            sqlite3_api->bind_double
214  
-#define sqlite3_bind_int               sqlite3_api->bind_int
215  
-#define sqlite3_bind_int64             sqlite3_api->bind_int64
216  
-#define sqlite3_bind_null              sqlite3_api->bind_null
217  
-#define sqlite3_bind_parameter_count   sqlite3_api->bind_parameter_count
218  
-#define sqlite3_bind_parameter_index   sqlite3_api->bind_parameter_index
219  
-#define sqlite3_bind_parameter_name    sqlite3_api->bind_parameter_name
220  
-#define sqlite3_bind_text              sqlite3_api->bind_text
221  
-#define sqlite3_bind_text16            sqlite3_api->bind_text16
222  
-#define sqlite3_bind_value             sqlite3_api->bind_value
223  
-#define sqlite3_busy_handler           sqlite3_api->busy_handler
224  
-#define sqlite3_busy_timeout           sqlite3_api->busy_timeout
225  
-#define sqlite3_changes                sqlite3_api->changes
226  
-#define sqlite3_close                  sqlite3_api->close
227  
-#define sqlite3_collation_needed       sqlite3_api->collation_needed
228  
-#define sqlite3_collation_needed16     sqlite3_api->collation_needed16
229  
-#define sqlite3_column_blob            sqlite3_api->column_blob
230  
-#define sqlite3_column_bytes           sqlite3_api->column_bytes
231  
-#define sqlite3_column_bytes16         sqlite3_api->column_bytes16
232  
-#define sqlite3_column_count           sqlite3_api->column_count
233  
-#define sqlite3_column_database_name   sqlite3_api->column_database_name
234  
-#define sqlite3_column_database_name16 sqlite3_api->column_database_name16
235  
-#define sqlite3_column_decltype        sqlite3_api->column_decltype
236  
-#define sqlite3_column_decltype16      sqlite3_api->column_decltype16
237  
-#define sqlite3_column_double          sqlite3_api->column_double
238  
-#define sqlite3_column_int             sqlite3_api->column_int
239  
-#define sqlite3_column_int64           sqlite3_api->column_int64
240  
-#define sqlite3_column_name            sqlite3_api->column_name
241  
-#define sqlite3_column_name16          sqlite3_api->column_name16
242  
-#define sqlite3_column_origin_name     sqlite3_api->column_origin_name
243  
-#define sqlite3_column_origin_name16   sqlite3_api->column_origin_name16
244  
-#define sqlite3_column_table_name      sqlite3_api->column_table_name
245  
-#define sqlite3_column_table_name16    sqlite3_api->column_table_name16
246  
-#define sqlite3_column_text            sqlite3_api->column_text
247  
-#define sqlite3_column_text16          sqlite3_api->column_text16
248  
-#define sqlite3_column_type            sqlite3_api->column_type
249  
-#define sqlite3_column_value           sqlite3_api->column_value
250  
-#define sqlite3_commit_hook            sqlite3_api->commit_hook
251  
-#define sqlite3_complete               sqlite3_api->complete
252  
-#define sqlite3_complete16             sqlite3_api->complete16
253  
-#define sqlite3_create_collation       sqlite3_api->create_collation
254  
-#define sqlite3_create_collation16     sqlite3_api->create_collation16
255  
-#define sqlite3_create_function        sqlite3_api->create_function
256  
-#define sqlite3_create_function16      sqlite3_api->create_function16
257  
-#define sqlite3_create_module          sqlite3_api->create_module
258  
-#define sqlite3_create_module_v2       sqlite3_api->create_module_v2
259  
-#define sqlite3_data_count             sqlite3_api->data_count
260  
-#define sqlite3_db_handle              sqlite3_api->db_handle
261  
-#define sqlite3_declare_vtab           sqlite3_api->declare_vtab
262  
-#define sqlite3_enable_shared_cache    sqlite3_api->enable_shared_cache
263  
-#define sqlite3_errcode                sqlite3_api->errcode
264  
-#define sqlite3_errmsg                 sqlite3_api->errmsg
265  
-#define sqlite3_errmsg16               sqlite3_api->errmsg16
266  
-#define sqlite3_exec                   sqlite3_api->exec
267  
-#ifndef SQLITE_OMIT_DEPRECATED
268  
-#define sqlite3_expired                sqlite3_api->expired
269  
-#endif
270  
-#define sqlite3_finalize               sqlite3_api->finalize
271  
-#define sqlite3_free                   sqlite3_api->free
272  
-#define sqlite3_free_table             sqlite3_api->free_table
273  
-#define sqlite3_get_autocommit         sqlite3_api->get_autocommit
274  
-#define sqlite3_get_auxdata            sqlite3_api->get_auxdata
275  
-#define sqlite3_get_table              sqlite3_api->get_table
276  
-#ifndef SQLITE_OMIT_DEPRECATED
277  
-#define sqlite3_global_recover         sqlite3_api->global_recover
278  
-#endif
279  
-#define sqlite3_interrupt              sqlite3_api->interruptx
280  
-#define sqlite3_last_insert_rowid      sqlite3_api->last_insert_rowid
281  
-#define sqlite3_libversion             sqlite3_api->libversion
282  
-#define sqlite3_libversion_number      sqlite3_api->libversion_number
283  
-#define sqlite3_malloc                 sqlite3_api->malloc
284  
-#define sqlite3_mprintf                sqlite3_api->mprintf
285  
-#define sqlite3_open                   sqlite3_api->open
286  
-#define sqlite3_open16                 sqlite3_api->open16
287  
-#define sqlite3_prepare                sqlite3_api->prepare
288  
-#define sqlite3_prepare16              sqlite3_api->prepare16
289  
-#define sqlite3_prepare_v2             sqlite3_api->prepare_v2
290  
-#define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2
291  
-#define sqlite3_profile                sqlite3_api->profile
292  
-#define sqlite3_progress_handler       sqlite3_api->progress_handler
293  
-#define sqlite3_realloc                sqlite3_api->realloc
294  
-#define sqlite3_reset                  sqlite3_api->reset
295  
-#define sqlite3_result_blob            sqlite3_api->result_blob
296  
-#define sqlite3_result_double          sqlite3_api->result_double
297  
-#define sqlite3_result_error           sqlite3_api->result_error
298  
-#define sqlite3_result_error16         sqlite3_api->result_error16
299  
-#define sqlite3_result_int             sqlite3_api->result_int
300  
-#define sqlite3_result_int64           sqlite3_api->result_int64
301  
-#define sqlite3_result_null            sqlite3_api->result_null
302  
-#define sqlite3_result_text            sqlite3_api->result_text
303  
-#define sqlite3_result_text16          sqlite3_api->result_text16
304  
-#define sqlite3_result_text16be        sqlite3_api->result_text16be
305  
-#define sqlite3_result_text16le        sqlite3_api->result_text16le
306  
-#define sqlite3_result_value           sqlite3_api->result_value
307  
-#define sqlite3_rollback_hook          sqlite3_api->rollback_hook
308  
-#define sqlite3_set_authorizer         sqlite3_api->set_authorizer
309  
-#define sqlite3_set_auxdata            sqlite3_api->set_auxdata
310  
-#define sqlite3_snprintf               sqlite3_api->snprintf
311  
-#define sqlite3_step                   sqlite3_api->step
312  
-#define sqlite3_table_column_metadata  sqlite3_api->table_column_metadata
313  
-#define sqlite3_thread_cleanup         sqlite3_api->thread_cleanup
314  
-#define sqlite3_total_changes          sqlite3_api->total_changes
315  
-#define sqlite3_trace                  sqlite3_api->trace
316  
-#ifndef SQLITE_OMIT_DEPRECATED
317  
-#define sqlite3_transfer_bindings      sqlite3_api->transfer_bindings
318  
-#endif
319  
-#define sqlite3_update_hook            sqlite3_api->update_hook
320  
-#define sqlite3_user_data              sqlite3_api->user_data
321  
-#define sqlite3_value_blob             sqlite3_api->value_blob
322  
-#define sqlite3_value_bytes            sqlite3_api->value_bytes
323  
-#define sqlite3_value_bytes16          sqlite3_api->value_bytes16
324  
-#define sqlite3_value_double           sqlite3_api->value_double
325  
-#define sqlite3_value_int              sqlite3_api->value_int
326  
-#define sqlite3_value_int64            sqlite3_api->value_int64
327  
-#define sqlite3_value_numeric_type     sqlite3_api->value_numeric_type
328  
-#define sqlite3_value_text             sqlite3_api->value_text
329  
-#define sqlite3_value_text16           sqlite3_api->value_text16
330  
-#define sqlite3_value_text16be         sqlite3_api->value_text16be
331  
-#define sqlite3_value_text16le         sqlite3_api->value_text16le
332  
-#define sqlite3_value_type             sqlite3_api->value_type
333  
-#define sqlite3_vmprintf               sqlite3_api->vmprintf
334  
-#define sqlite3_overload_function      sqlite3_api->overload_function
335  
-#define sqlite3_prepare_v2             sqlite3_api->prepare_v2
336  
-#define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2
337  
-#define sqlite3_clear_bindings         sqlite3_api->clear_bindings
338  
-#define sqlite3_bind_zeroblob          sqlite3_api->bind_zeroblob
339  
-#define sqlite3_blob_bytes             sqlite3_api->blob_bytes
340  
-#define sqlite3_blob_close             sqlite3_api->blob_close
341  
-#define sqlite3_blob_open              sqlite3_api->blob_open
342  
-#define sqlite3_blob_read              sqlite3_api->blob_read
343  
-#define sqlite3_blob_write             sqlite3_api->blob_write
344  
-#define sqlite3_create_collation_v2    sqlite3_api->create_collation_v2
345  
-#define sqlite3_file_control           sqlite3_api->file_control
346  
-#define sqlite3_memory_highwater       sqlite3_api->memory_highwater
347  
-#define sqlite3_memory_used            sqlite3_api->memory_used
348  
-#define sqlite3_mutex_alloc            sqlite3_api->mutex_alloc
349  
-#define sqlite3_mutex_enter            sqlite3_api->mutex_enter
350  
-#define sqlite3_mutex_free             sqlite3_api->mutex_free
351  
-#define sqlite3_mutex_leave            sqlite3_api->mutex_leave
352  
-#define sqlite3_mutex_try              sqlite3_api->mutex_try
353  
-#define sqlite3_open_v2                sqlite3_api->open_v2
354  
-#define sqlite3_release_memory         sqlite3_api->release_memory
355  
-#define sqlite3_result_error_nomem     sqlite3_api->result_error_nomem
356  
-#define sqlite3_result_error_toobig    sqlite3_api->result_error_toobig
357  
-#define sqlite3_sleep                  sqlite3_api->sleep
358  
-#define sqlite3_soft_heap_limit        sqlite3_api->soft_heap_limit
359  
-#define sqlite3_vfs_find               sqlite3_api->vfs_find
360  
-#define sqlite3_vfs_register           sqlite3_api->vfs_register
361  
-#define sqlite3_vfs_unregister         sqlite3_api->vfs_unregister
362  
-#define sqlite3_threadsafe             sqlite3_api->xthreadsafe
363  
-#define sqlite3_result_zeroblob        sqlite3_api->result_zeroblob
364  
-#define sqlite3_result_error_code      sqlite3_api->result_error_code
365  
-#define sqlite3_test_control           sqlite3_api->test_control
366  
-#define sqlite3_randomness             sqlite3_api->randomness
367  
-#define sqlite3_context_db_handle      sqlite3_api->context_db_handle
368  
-#define sqlite3_extended_result_codes  sqlite3_api->extended_result_codes
369  
-#define sqlite3_limit                  sqlite3_api->limit
370  
-#define sqlite3_next_stmt              sqlite3_api->next_stmt
371  
-#define sqlite3_sql                    sqlite3_api->sql
372  
-#define sqlite3_status                 sqlite3_api->status
373  
-#endif /* SQLITE_CORE */
374  
-
375  
-#define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api = 0;
376  
-#define SQLITE_EXTENSION_INIT2(v)  sqlite3_api = v;
377  
-
378  
-#endif /* _SQLITE3EXT_H_ */
158  include/sqlite_types.hpp
... ...
@@ -1,158 +0,0 @@
1  
-/*****************************************************************************
2  
- * 
3  
- * This file is part of Mapnik (c++ mapping toolkit)
4  
- *
5  
- * Copyright (C) 2007 Artem Pavlenko
6  
- *
7  
- * This library is free software; you can redistribute it and/or
8  
- * modify it under the terms of the GNU Lesser General Public
9  
- * License as published by the Free Software Foundation; either
10  
- * version 2.1 of the License, or (at your option) any later version.
11  
- *
12  
- * This library is distributed in the hope that it will be useful,
13  
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  
- * Lesser General Public License for more details.
16  
- *
17  
- * You should have received a copy of the GNU Lesser General Public
18  
- * License along with this library; if not, write to the Free Software
19  
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  
- *
21  
- *****************************************************************************/
22  
-//$Id$
23  
-
24  
-#ifndef SQLITE_TYPES_HPP
25  
-#define SQLITE_TYPES_HPP
26  
-
27  
-// boost
28  
-#include <boost/shared_ptr.hpp>
29  
-
30  
-// sqlite
31  
-extern "C" {
32  
-  #include <sqlite3.h>
33  
-}
34  
-
35  
-
36  
-class sqlite_resultset
37  
-{
38  
-public:
39  
-
40  
-    sqlite_resultset (sqlite3_stmt* stmt)
41  
-        : stmt_(stmt)
42  
-    {
43  
-    }
44  
-
45  
-    ~sqlite_resultset ()
46  
-    {
47  
-        if (stmt_)
48  
-            sqlite3_finalize (stmt_);
49  
-    }
50  
-
51  
-    bool is_valid ()
52  
-    {
53  
-        return stmt_ != 0;
54  
-    }
55  
-
56  
-    bool step_next ()
57  
-    {
58  
-        return (sqlite3_step (stmt_) == SQLITE_ROW);
59  
-    }
60  
-
61  
-    int column_count ()
62  
-    {
63  
-        return sqlite3_column_count (stmt_);
64  
-    }
65  
-
66  
-    int column_type (int col)
67  
-    {
68  
-        return sqlite3_column_type (stmt_, col);
69  
-    }
70  
-    
71  
-    const char* column_name (int col)
72  
-    {
73  
-        return sqlite3_column_name (stmt_, col);
74  
-    }
75  
-
76  
-    bool column_isnull (int col)
77  
-    {
78  
-        return sqlite3_column_type (stmt_, col) == SQLITE_NULL;
79  
-    }
80  
-
81  
-    int column_integer (int col)
82  
-    {
83  
-        return sqlite3_column_int (stmt_, col);
84  
-    }
85  
-
86  
-    double column_double (int col)
87  
-    {
88  
-        return sqlite3_column_double (stmt_, col);
89  
-    }
90  
-
91  
-    const char* column_text (int col)
92  
-    {
93  
-        return (const char*) sqlite3_column_text (stmt_, col);
94  
-    }
95  
-
96  
-    const void* column_blob (int col, int& bytes)
97  
-    {
98  
-        bytes = sqlite3_column_bytes (stmt_, col);
99  
-    
100  
-        return sqlite3_column_blob (stmt_, col);
101  
-    }
102  
-
103  
-    sqlite3_stmt* get_statement()
104  
-    {
105  
-        return stmt_;
106  
-    }
107  
-
108  
-private:
109  
-
110  
-    sqlite3_stmt* stmt_;
111  
-};
112  
-
113  
-
114  
-
115  
-class sqlite_connection
116  
-{
117  
-public:
118  
-
119  
-    sqlite_connection (const std::string& file)
120  
-        : db_(0)
121  
-    {
122  
-        if (sqlite3_open (file.c_str(), &db_))
123  
-            std::cout << "bad news bears\n";
124  
-            //throw mapnik::datasource_exception (sqlite3_errmsg (db_));
125  
-
126  
-        //sqlite3_enable_load_extension(db_, 1);
127  
-    }
128  
-
129  
-    ~sqlite_connection ()
130  
-    {
131  
-        if (db_)
132  
-            sqlite3_close (db_);
133  
-    }
134  
-
135  
-    sqlite_resultset* execute_query (const std::string& sql)
136  
-    {
137  
-        sqlite3_stmt* stmt = 0;
138  
-
139  
-        int rc = sqlite3_prepare_v2 (db_, sql.c_str(), -1, &stmt, 0);
140  
-        if (rc != SQLITE_OK)
141  
-        {
142  
-            std::clog << "Sqlite Plugin: " << sqlite3_errmsg(db_) << std::endl;
143  
-        }
144  
-
145  
-        return new sqlite_resultset (stmt);
146  
-	}
147  
-
148  
-    sqlite3* operator*()
149  
-    {
150  
-        return db_;
151  
-    }
152  
-
153  
-private:
154  
-
155  
-    sqlite3* db_;
156  
-};
157  
-
158  
-#endif //SQLITE_TYPES_HPP
197  mbutil.cpp
... ...
@@ -1,197 +0,0 @@
1  
-// Copyright Tom MacWright 2011 Development Seed (BSD)
2  
-#include <boost/program_options.hpp>
3  
-#include <boost/filesystem.hpp>
4  
-#include <boost/filesystem/fstream.hpp>
5  
-#include <boost/format.hpp>
6  
-#include <boost/regex.hpp>
7  
-#include <boost/property_tree/ptree.hpp>
8  
-#include <boost/property_tree/json_parser.hpp>
9  
-#include <boost/foreach.hpp>
10  
-#include <sqlite3.h>
11  
-#include <string>
12  
-#include <set>
13  
-#include "include/sqlite_types.hpp"
14  
-
15  
-void setup_mbtiles(std::string filename) {
16  
-    char* zErrMsg;
17  
-    namespace fs = boost::filesystem;
18  
-    sqlite3 *db;
19  
-    sqlite3_open(filename.c_str(), &db);
20  
-    sqlite3_exec(db, "create table tiles (zoom_level integer, tile_column "
21  
-    "integer, tile_row integer, tile_data blob); create table metadata "
22  
-    "(name text, value text); create unique index name on metadata (name);"
23  
-    "create unique index tile_index on tiles "
24  
-    "(zoom_level, tile_column, tile_row);",
25  
-    NULL, 0, &zErrMsg);
26  
-    sqlite3_close(db);
27  
-}
28  
-
29  
-void add_metadata(sqlite3* db, std::string k, std::string v) {
30  
-    static sqlite3_stmt *insert_statement;
31  
-    std::string s = "INSERT INTO metadata (name, value) "
32  
-        " VALUES (?1, ?2);";
33  
-    sqlite3_prepare_v2(db, s.c_str(), -1, &insert_statement, 0);
34  
-
35  
-    sqlite3_bind_text(insert_statement, 1, k.c_str(), -1, SQLITE_STATIC);
36  
-    sqlite3_bind_text(insert_statement, 2, v.c_str(), -1, SQLITE_STATIC);
37  
-
38  
-    sqlite3_step(insert_statement);
39  
-    sqlite3_reset(insert_statement);
40  
-    sqlite3_clear_bindings(insert_statement);
41  
-}
42  
-
43  
-void disk_to_mbtiles(std::string input_filename, std::string output_filename) {
44  
-    namespace fs = boost::filesystem;
45  
-    double fsize;
46  
-    sqlite3 *db;
47  
-    sqlite3_open(output_filename.c_str(), &db);
48  
-    static sqlite3_stmt *insert_statement;
49  
-    std::string s = "INSERT INTO tiles "
50  
-        "(zoom_level, tile_column, tile_row, tile_data) "
51  
-        " VALUES (?1, ?2, ?3, ?4);";
52  
-
53  
-    sqlite3_prepare_v2(db, s.c_str(), -1, &insert_statement, 0);
54  
-
55  
-    if (!fs::is_regular_file(output_filename)) {
56  
-        setup_mbtiles(output_filename);
57  
-    }
58  
-
59  
-    std::string metadata_location = str(boost::format("%s/metadata.json") %
60  
-            input_filename);
61  
-
62  
-    if (fs::is_regular_file(metadata_location)) {
63  
-        boost::property_tree::ptree pt;
64  
-        boost::property_tree::read_json(metadata_location, pt);
65  
-        std::set<std::string> metadata_entries;
66  
-
67  
-        BOOST_FOREACH(boost::property_tree::ptree::value_type &v,
68  
-                pt.get_child("metadata"))
69  
-            add_metadata(db, v.first.data(), v.second.data());
70  
-    } else {
71  
-        fprintf(stderr, "metadata.json not found\n");
72  
-    }
73  
-
74  
-    // TODO(tmcw) weak regex.
75  
-    static const boost::regex e("(\\w+)\\/(\\d+)\\/(\\d+)\\/(\\d+)\\.png");
76  
-    for (boost::filesystem::recursive_directory_iterator end,
77  
-        dir(input_filename);
78  
-        dir != end; ++dir ) {
79  
-        if (fs::is_regular_file(*dir)) {
80  
-            boost::smatch what;
81  
-#if (BOOST_FILESYSTEM_VERSION == 3)
82  
-            if (boost::regex_match((*dir).path().string(),
83  
-                what, e, boost::match_any)) {
84  
-#else
85  
-            if (boost::regex_match((*dir).string(),
86  
-                what, e, boost::match_any)) {
87  
-#endif
88  
-                fsize = fs::file_size(*dir);
89  
-                char* data = (char*) malloc(sizeof(char) * fsize);
90  
-                fs::ifstream f(*dir);
91  
-                while (!f.eof()) {
92  
-                    f >> data;
93  
-                }
94  
-                f.close();
95  
-
96  
-                int z = atoi(what[1].str().c_str());
97  
-                int x = atoi(what[3].str().c_str());
98  
-                int y = atoi(what[4].str().c_str());
99  
-
100  
-                sqlite3_bind_int(insert_statement, 1, z);
101  
-                sqlite3_bind_int(insert_statement, 2, x);
102  
-                sqlite3_bind_int(insert_statement, 3, y);
103  
-                sqlite3_bind_blob(insert_statement, 4, data,
104  
-                  fsize, SQLITE_TRANSIENT);
105  
-                sqlite3_step(insert_statement);
106  
-                sqlite3_reset(insert_statement);
107  
-                sqlite3_clear_bindings(insert_statement);
108  
-                free(data);
109  
-            } else {
110  
-                // std::cout << "no match\n";
111  
-#if (BOOST_FILESYSTEM_VERSION == 3)
112  
-                // std::cout << (*dir).path().string() << "\n";
113  
-#else
114  
-                // std::cout << (*dir).string() << "\n";
115  
-#endif
116  
-            }
117  
-        }
118  
-    }
119  
-    sqlite3_finalize(insert_statement);
120  
-    sqlite3_close(db);
121  
-}
122  
-
123  
-void mbtiles_to_disk(std::string input_filename, std::string output_filename) {
124  
-    namespace fs = boost::filesystem;
125  
-    sqlite_connection* dataset_ = new sqlite_connection(input_filename);
126  
-
127  
-    std::ostringstream s;
128  
-    s << "SELECT zoom_level, tile_column, tile_row, tile_data FROM tiles;";
129  
-    sqlite_resultset* rs(dataset_->execute_query(s.str()));
130  
-
131  
-    while (rs->is_valid() && rs->step_next()) {
132  
-        double z = rs->column_double(0);
133  
-        double x = rs->column_double(1);
134  
-        double y = rs->column_double(2);
135  
-        int size;
136  
-        std::ostringstream data;
137  
-        std::string image_data;
138  
-        char* addr = reinterpret_cast<char*>(rs->column_blob(3, size));
139  
-        memcpy(&image_data, addr, size);
140  
-        fs::create_directories(str(boost::format("%s/%d/%d") %
141  
-            output_filename % z % x));
142  
-        fs::ofstream file(str(boost::format("%s/%d/%d/%d.png") %
143  
-            output_filename % z % x % y));
144  
-        file << image_data;
145  
-        file.close();
146  
-    }
147  
-
148  
-    std::string metadata_location = str(boost::format("%s/metadata.json") %
149  
-            output_filename);
150  
-
151  
-    boost::property_tree::ptree pt;
152  
-    std::ostringstream mq;
153  
-    mq << "SELECT name, value FROM metadata;";
154  
-    sqlite_resultset* ms(dataset_->execute_query(mq.str()));
155  
-    while (ms->is_valid() && ms->step_next()) {
156  
-        std::string k = ms->column_text(0);
157  
-        std::string v = ms->column_text(1);
158  
-        pt.put(str(boost::format("metadata.%s") % k), v);
159  
-    }
160  
-    boost::property_tree::write_json(metadata_location, pt);
161  
-}
162  
-
163  
-int main(int ac, char** av) {
164  
-    namespace po = boost::program_options;
165  
-    namespace fs = boost::filesystem;
166  
-    po::options_description desc("Allowed options");
167  
-    desc.add_options()
168  
-        ("input", po::value<std::string>(), "input file")
169  
-        ("output", po::value<std::string>(), "output file")
170  
-        ("m", po::value<std::string>(), "metadata")
171  
-        ("help", "produce help message");
172  
-
173  
-    po::variables_map vm;
174  
-    po::store(po::command_line_parser(ac, av).
175  
-            options(desc).run(), vm);
176  
-
177  
-    po::notify(vm);
178  
-
179  
-    if (vm.count("input") && vm.count("output")) {
180  
-        std::string input_filename = vm["input"].as<std::string>();
181  
-        std::string output_filename = vm["output"].as<std::string>();
182  
-
183  
-        if (fs::is_regular_file(input_filename)) {
184  
-            mbtiles_to_disk(input_filename, output_filename);
185  
-        } else if (fs::is_directory(input_filename)) {
186  
-            disk_to_mbtiles(input_filename, output_filename);
187  
-        }
188  
-    }
189  
-
190  
-    if (vm.count("help")) {
191  
-        std::ostringstream d;
192  
-        desc.print(d);
193  
-        fprintf(stdout, "%s\n", d.str().c_str());
194  
-        return 1;
195  
-    }
196  
-    return 0;
197  
-}

0 notes on commit 05d93f3

Please sign in to comment.
Something went wrong with that request. Please try again.