00001
00002
00003
00004
00005 #ifndef IBIS_CAPI_H
00006 #define IBIS_CAPI_H
00021
00022 #if _MSC_VER >= 1000
00023 #pragma once
00024 #endif // _MSC_VER >= 1000
00025
00026 #if !defined(WITHOUT_FASTBIT_CONFIG_H) && !(defined(_WIN32)&&defined(_MSC_VER))
00027 #include "fastbit-config.h"
00028 #endif
00029 #if defined(HAVE_INTTYPES_H) || defined(sun) || defined(__APPLE__) || defined(__FreeBSD__)
00030 #include <inttypes.h>
00031 #elif defined(HAVE_STDINT_H) || defined(unix) || defined(__APPLE__)
00032 #include <stdint.h>
00033 #elif defined(_WIN32)
00034
00035 # ifndef int16_t
00036 # define int16_t __int16
00037 # endif
00038 # ifndef uint16_t
00039 # define uint16_t unsigned __int16
00040 # endif
00041 # ifndef int32_t
00042 # define int32_t __int32
00043 # endif
00044 # ifndef uint32_t
00045 # define uint32_t unsigned __int32
00046 # endif
00047 # ifndef int64_t
00048 # define int64_t __int64
00049 # endif
00050 # ifndef uint64_t
00051 # define uint64_t unsigned __int64
00052 # endif
00053 #else
00054 #error Donot know how to find the exact width data types!
00055 #endif
00056 #if defined(_WIN32) && (defined(_MSC_VER) || defined(__MINGW32__))
00057 # if defined(_USRDLL) || defined(CXX_USE_DLL)
00058 # if defined(DLL_EXPORT)
00059 # define FASTBIT_DLLSPEC __declspec(dllexport)
00060 # else
00061 # define FASTBIT_DLLSPEC __declspec(dllimport)
00062 # endif
00063 # else
00064 # define FASTBIT_DLLSPEC
00065 # endif
00066 #else
00067 # define FASTBIT_DLLSPEC
00068 #endif
00069 #include <stdio.h>
00070
00073 #ifdef __cplusplus
00074 extern "C" {
00075 #endif
00077 FASTBIT_DLLSPEC int
00078 fastbit_build_indexes(const char *indexLocation,
00079 const char *indexOptions);
00081 FASTBIT_DLLSPEC int fastbit_purge_indexes(const char *indexLocation);
00083 FASTBIT_DLLSPEC int
00084 fastbit_build_index(const char *indexLocation, const char* cname,
00085 const char *indexOptions);
00087 FASTBIT_DLLSPEC int
00088 fastbit_purge_index(const char *indexLocation, const char* cname);
00089
00091 struct FastBitQuery;
00093 typedef struct FastBitQuery* FastBitQueryHandle;
00094
00101 FASTBIT_DLLSPEC FastBitQueryHandle
00102 fastbit_build_query(const char *selectClause, const char *indexLocation,
00103 const char *queryConditions);
00106 FASTBIT_DLLSPEC int fastbit_destroy_query(FastBitQueryHandle query);
00107
00111 FASTBIT_DLLSPEC int fastbit_get_result_rows(FastBitQueryHandle query);
00114 FASTBIT_DLLSPEC int fastbit_get_result_columns(FastBitQueryHandle query);
00116 FASTBIT_DLLSPEC const char*
00117 fastbit_get_select_clause(FastBitQueryHandle query);
00119 FASTBIT_DLLSPEC const char*
00120 fastbit_get_from_clause(FastBitQueryHandle query);
00122 FASTBIT_DLLSPEC const char*
00123 fastbit_get_where_clause(FastBitQueryHandle query);
00124
00134 FASTBIT_DLLSPEC const float*
00135 fastbit_get_qualified_floats(FastBitQueryHandle query,
00136 const char* cname);
00137 FASTBIT_DLLSPEC const double*
00138 fastbit_get_qualified_doubles(FastBitQueryHandle query,
00139 const char* cname);
00140 FASTBIT_DLLSPEC const char*
00141 fastbit_get_qualified_bytes(FastBitQueryHandle query,
00142 const char* cname);
00143 FASTBIT_DLLSPEC const int16_t*
00144 fastbit_get_qualified_shorts(FastBitQueryHandle query,
00145 const char* cname);
00146 FASTBIT_DLLSPEC const int32_t*
00147 fastbit_get_qualified_ints(FastBitQueryHandle query,
00148 const char* cname);
00149 FASTBIT_DLLSPEC const int64_t*
00150 fastbit_get_qualified_longs(FastBitQueryHandle query,
00151 const char* cname);
00152 FASTBIT_DLLSPEC const unsigned char*
00153 fastbit_get_qualified_ubytes(FastBitQueryHandle query,
00154 const char* cname);
00155 FASTBIT_DLLSPEC const uint16_t*
00156 fastbit_get_qualified_ushorts(FastBitQueryHandle query,
00157 const char* cname);
00158 FASTBIT_DLLSPEC const uint32_t*
00159 fastbit_get_qualified_uints(FastBitQueryHandle query,
00160 const char* cname);
00161 FASTBIT_DLLSPEC const uint64_t*
00162 fastbit_get_qualified_ulongs(FastBitQueryHandle query,
00163 const char* cname);
00165
00170 struct FastBitResultSet;
00172 typedef struct FastBitResultSet* FastBitResultSetHandle;
00173
00175 FASTBIT_DLLSPEC FastBitResultSetHandle
00176 fastbit_build_result_set(FastBitQueryHandle query);
00178 FASTBIT_DLLSPEC int
00179 fastbit_destroy_result_set(FastBitResultSetHandle rset);
00180
00182 FASTBIT_DLLSPEC int fastbit_result_set_next(FastBitResultSetHandle rset);
00184 FASTBIT_DLLSPEC int
00185 fastbit_result_set_get_int(FastBitResultSetHandle rset, const char *cname);
00187 FASTBIT_DLLSPEC unsigned
00188 fastbit_result_set_get_unsigned(FastBitResultSetHandle rset,
00189 const char *cname);
00192 FASTBIT_DLLSPEC float
00193 fastbit_result_set_get_float(FastBitResultSetHandle rset,
00194 const char *cname);
00197 FASTBIT_DLLSPEC double
00198 fastbit_result_set_get_double(FastBitResultSetHandle rset,
00199 const char *cname);
00201 FASTBIT_DLLSPEC const char*
00202 fastbit_result_set_get_string(FastBitResultSetHandle rset,
00203 const char *cname);
00208 FASTBIT_DLLSPEC int32_t
00209 fastbit_result_set_getInt(FastBitResultSetHandle rset,
00210 unsigned position);
00212 FASTBIT_DLLSPEC uint32_t
00213 fastbit_result_set_getUnsigned(FastBitResultSetHandle rset,
00214 unsigned position);
00217 FASTBIT_DLLSPEC float
00218 fastbit_result_set_getFloat(FastBitResultSetHandle rset,
00219 unsigned position);
00222 FASTBIT_DLLSPEC double
00223 fastbit_result_set_getDouble(FastBitResultSetHandle rset,
00224 unsigned position);
00226 FASTBIT_DLLSPEC const char*
00227 fastbit_result_set_getString(FastBitResultSetHandle rset,
00228 unsigned position);
00230
00232 FASTBIT_DLLSPEC int fastbit_flush_buffer(const char *dir);
00235 FASTBIT_DLLSPEC int
00236 fastbit_add_values(const char *colname, const char *coltype,
00237 void *vals, uint32_t nelem, uint32_t start);
00239 FASTBIT_DLLSPEC int fastbit_rows_in_partition(const char *dir);
00241 FASTBIT_DLLSPEC int fastbit_columns_in_partition(const char *dir);
00242
00244 FASTBIT_DLLSPEC void fastbit_init(const char *rcfile);
00246 FASTBIT_DLLSPEC void fastbit_cleanup(void);
00248 FASTBIT_DLLSPEC int fastbit_set_verbose_level(int v);
00250 FASTBIT_DLLSPEC int fastbit_get_verbose_level(void);
00252 FASTBIT_DLLSPEC int fastbit_set_logfile(const char* filename);
00254 FASTBIT_DLLSPEC const char* fastbit_get_logfile();
00256 FASTBIT_DLLSPEC FILE* fastbit_get_logfilepointer();
00257 #ifdef __cplusplus
00258 }
00259 #endif
00261 #endif // ifndef IBIS_CAPI_H