Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

sal.h

Go to the documentation of this file.
00001 /********************************************************************
00002 
00003 Copyright 2006, ACCESS Systems Americas, Inc. All rights reserved.
00004 
00005 The contents of this file are subject to the Mozilla Public License Version
00006 1.1 (the "License"); you may not use this file except in compliance with
00007 the License. You may obtain a copy of the License at
00008 http://www.mozilla.org/MPL/
00009 
00010 Software distributed under the License is distributed on an "AS IS" basis,
00011 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012 for the specific language governing rights and limitations under the
00013 License.
00014 
00015 The Original Code is the entire contents of this file.
00016 
00017 The Initial Developer of the Original Code is ACCESS Systems Americas, Inc.
00018 
00019 Portions created by ACCESS Systems Americas, Inc. are Copyright © 2006. All
00020 Rights Reserved.
00021 
00022 Contributor(s): none.
00023 
00024 ********************************************************************/
00039 /*Includes********************************************************************/
00040 #ifndef ALP_SAL_H_
00041 #define ALP_SAL_H_       1
00042 
00043 #include <stdio.h>
00044 #include <string.h>
00045 #include <stdlib.h>
00046 #include <sqlite3.h>
00047 #include <hiker/types.h>
00048 #include <hiker/sysclass.h>
00049 
00050 
00051 /*Defines*********************************************************************/
00058 #define ALP_STATUS_SAL_BUSY                     (ALP_CLASS_SAL | 0x00010000)
00059 #define ALP_STATUS_SAL_LOCKED           (ALP_CLASS_SAL | 0x00020000)
00060 #define ALP_STATUS_SAL_NOMEM            (ALP_CLASS_SAL | 0x00030000)
00061 #define ALP_STATUS_SAL_READONLY         (ALP_CLASS_SAL | 0x00040000)
00062 #define ALP_STATUS_SAL_INTERRUPT        (ALP_CLASS_SAL | 0x00050000)
00063 #define ALP_STATUS_SAL_IOERR            (ALP_CLASS_SAL | 0x00060000)
00064 #define ALP_STATUS_SAL_CORRUPT          (ALP_CLASS_SAL | 0x00070000)
00065 #define ALP_STATUS_SAL_FULL             (ALP_CLASS_SAL | 0x00080000)
00066 #define ALP_STATUS_SAL_CANTOPEN         (ALP_CLASS_SAL | 0x00090000)
00067 #define ALP_STATUS_SAL_TOOBIG           (ALP_CLASS_SAL | 0x000A0000)
00068 #define ALP_STATUS_SAL_CONSTRAINT       (ALP_CLASS_SAL | 0x000B0000)
00069 #define ALP_STATUS_SAL_MISMATCH         (ALP_CLASS_SAL | 0x000C0000)
00070 #define ALP_STATUS_SAL_AUTH             (ALP_CLASS_SAL | 0x000D0000)
00071 #define ALP_STATUS_SAL_ERROR            (ALP_CLASS_SAL | 0x000E0000)
00072 #define ALP_STATUS_SAL_MISUSE           (ALP_CLASS_SAL | 0x000F0000)
00073 #define ALP_STATUS_SAL_NOLFS            (ALP_CLASS_SAL | 0x00100000)
00074 #define ALP_STATUS_SAL_PROTOCOL         (ALP_CLASS_SAL | 0x00110000)
00075 #define ALP_STATUS_SAL_EMPTY            (ALP_CLASS_SAL | 0x00120000)
00076 #define ALP_STATUS_SAL_SCHEMA           (ALP_CLASS_SAL | 0x00130000)
00077 #define ALP_STATUS_SAL_NOTFOUND         (ALP_CLASS_SAL | 0x00140000)
00078 #define ALP_STATUS_SAL_INTERNAL         (ALP_CLASS_SAL | 0x00150000)
00079 #define ALP_STATUS_SAL_PERM             (ALP_CLASS_SAL | 0x00160000)
00080 #define ALP_STATUS_SAL_ABORT            (ALP_CLASS_SAL | 0x00170000)
00081 #define ALP_STATUS_SAL_UNKNOWN          (ALP_CLASS_SAL | 0x00180000)
00082 #define ALP_STATUS_SAL_BADPARAM         (ALP_CLASS_SAL | 0x00190000)
00083 #define ALP_STATUS_SAL_NORECORDS        (ALP_CLASS_SAL | 0x001A0000)
00084 #define ALP_STATUS_SAL_DMLEXISTS        (ALP_CLASS_SAL | 0x001B0000)
00085 
00088 /*Typedefs********************************************************************/
00090 typedef void *AlpSALHandle;
00091 
00096 typedef void *AlpSALStatement;
00097 
00098 /*Prototypes******************************************************************/
00099 
00100 #ifdef __cplusplus
00101 extern "C" {
00102 #endif
00103 
00111 extern alp_status_t     alp_sal_database_open(AlpSALHandle *sal, 
00112                                                   const char *dbName);
00113 extern alp_status_t     alp_sal_database_close(AlpSALHandle sal);
00114 extern alp_status_t     alp_sal_database_create(const char *dbFileName,
00115                                                  const char *schemaFileName);
00116 
00117 extern alp_status_t     alp_sal_transaction_commit(AlpSALHandle sal);
00118 extern alp_status_t     alp_sal_transaction_begin(AlpSALHandle sal, 
00119                                                   char exclusive);
00120 extern alp_status_t             alp_sal_transaction_rollback(AlpSALHandle sal);
00121 
00122 extern alp_status_t     alp_sal_sql_execute(AlpSALHandle sal, const char *sql, ...);
00123 extern alp_status_t     alp_sal_last_insert_rowid(AlpSALHandle sal, 
00124                                                   uint32_t *rowID);
00125 extern alp_status_t     alp_sal_execute_sql_script(AlpSALHandle sal, FILE *fd);
00126 extern alp_status_t     alp_sal_sql_get_value(AlpSALHandle sal, int32_t 
00127                                                   *value, const char *sql, ...);
00128 
00129 extern const char       *alp_sal_get_error_message(AlpSALHandle sal);
00130 
00131 extern alp_status_t     alp_sal_string_build(char **combined, 
00132                                                   const char *sql, ...);
00133 extern void             alp_sal_string_destroy(char *s);
00142 /*alpSALStatement.c***********************************************************/
00143 extern alp_status_t     alp_sal_statement_initialize(AlpSALHandle sal, 
00144                                                   AlpSALStatement **stmt, const char *sql);
00145 extern AlpSALHandle     alp_sal_statement_get_handle(AlpSALStatement *stmt);
00146 
00147 extern alp_status_t     alp_sal_statement_set_text(AlpSALStatement *stmt, 
00148                                                   int16_t pos, const char *s, bool copy);
00149 extern alp_status_t     alp_sal_statement_set_int(AlpSALStatement *stmt, 
00150                                                   int16_t pos, int32_t n);
00151 extern alp_status_t     alp_sal_statement_set_int64(AlpSALStatement *stmt, 
00152                                                   int16_t pos, int64_t n);
00153 extern alp_status_t     alp_sal_statement_set_blob(AlpSALStatement *stmt, 
00154                                                   int16_t pos, void *blob, int32_t size, bool copy);
00155 extern alp_status_t     alp_sal_statement_set_float(AlpSALStatement *stmt, 
00156                                                   int16_t pos, float f);
00157 
00158 extern int32_t                  alp_sal_statement_get_int(AlpSALStatement *stmt, 
00159                                                   int pos);
00160 extern int64_t                  alp_sal_statement_get_int64(AlpSALStatement *stmt, 
00161                                                   int pos);
00162 extern float                    alp_sal_statement_get_float(AlpSALStatement *stmt, 
00163                                                   int pos);
00164 extern char                     *alp_sal_statement_get_text(AlpSALStatement *stmt, 
00165                                                   int pos, bool copy);
00166 extern void             *alp_sal_statement_get_blob(AlpSALStatement *stmt, 
00167                                                   int pos, int32_t *size, bool copy);
00168 extern bool                     alp_sal_statement_is_null(AlpSALStatement *stmt, 
00169                                                   int pos);
00170 
00171 extern alp_status_t     alp_sal_statement_execute(AlpSALStatement *stmt);
00172 extern alp_status_t     alp_sal_statement_destroy(AlpSALStatement *stmt);
00173 extern alp_status_t     alp_sal_statement_next_result(AlpSALStatement *stmt);
00174 extern alp_status_t     alp_sal_statement_reset(AlpSALStatement *stmt);
00183 #ifdef __cplusplus
00184 }
00185 #endif
00186 
00187 #endif /* ALP_SAL_H_ */
00188 

Generated on Sat Dec 16 20:29:47 2006 for hiker-0.9 by  doxygen 1.4.4