Changed file and key-value API according GENIVI naming conventions
[profile/ivi/persistence-client-library.git] / src / persistence_client_library_itzam_errors.c
1 /*
2     Itzam/C (version 6.0) is an embedded database engine written in Standard C.
3
4     Copyright 2011 Scott Robert Ladd. All rights reserved.
5
6     Older versions of Itzam/C are:
7         Copyright 2002, 2004, 2006, 2008 Scott Robert Ladd. All rights reserved.
8
9     Ancestral code, from Java and C++ books by the author, is:
10         Copyright 1992, 1994, 1996, 2001 Scott Robert Ladd.  All rights reserved.
11
12     Itzam/C is user-supported open source software. It's continued development is dependent on
13     financial support from the community. You can provide funding by visiting the Itzam/C
14     website at:
15
16         http://www.coyotegulch.com
17
18     You may license Itzam/C in one of two fashions:
19
20     1) Simplified BSD License (FreeBSD License)
21
22     Redistribution and use in source and binary forms, with or without modification, are
23     permitted provided that the following conditions are met:
24
25     1.  Redistributions of source code must retain the above copyright notice, this list of
26         conditions and the following disclaimer.
27
28     2.  Redistributions in binary form must reproduce the above copyright notice, this list
29         of conditions and the following disclaimer in the documentation and/or other materials
30         provided with the distribution.
31
32     THIS SOFTWARE IS PROVIDED BY SCOTT ROBERT LADD ``AS IS'' AND ANY EXPRESS OR IMPLIED
33     WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
34     FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SCOTT ROBERT LADD OR
35     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36     CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
37     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
38     ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39     NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
40     ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41
42     The views and conclusions contained in the software and documentation are those of the
43     authors and should not be interpreted as representing official policies, either expressed
44     or implied, of Scott Robert Ladd.
45
46     2) Closed-Source Proprietary License
47
48     If your project is a closed-source or proprietary project, the Simplified BSD License may
49     not be appropriate or desirable. In such cases, contact the Itzam copyright holder to
50     arrange your purchase of an appropriate license.
51
52     The author can be contacted at:
53
54           scott.ladd@coyotegulch.com
55           scott.ladd@gmail.com
56           http:www.coyotegulch.com
57 */
58
59 /******************************************************************************
60  * Project         Persistency
61  * (c) copyright   2012
62  * Company         XS Embedded GmbH
63  *****************************************************************************/
64 /******************************************************************************
65 Small changes to use in persistence
66 ******************************************************************************/
67  /**
68  * @file           persistence_client_itzam_errors.c
69  * @ingroup        Persistence client library
70  * @author         Ingo Huerner
71  * @brief          Itzam database error definnitions
72  * @see
73  */
74
75 #include "persistence_client_library_itzam_errors.h"
76
77
78 const char * ERROR_STRINGS [] =
79 {
80     "invalid datafile signature",
81     "invalid version",
82     "can not open 64-bit datafile on 32-bit operating system",
83     "write failed",
84     "open failed",
85     "read failed",
86     "close failed",
87     "seek failed",
88     "tell failed",
89     "duplicate remove",
90     "flush failed",
91     "rewrite record too small",
92     "page not found",
93     "lost key",
94     "key not written",
95     "key seek failed",
96     "unable to remove key record",
97     "record seek failed",
98     "unable to remove data record",
99     "list of deleted records could not be read",
100     "list of deleted records could not be written",
101     "iterator record count differs from database internal count",
102     "rewrite over deleted record",
103     "invalid column index",
104     "invalid row index",
105     "invalid hash value",
106     "memory allocation failed",
107     "attempt reading deleted record",
108     "invalid record signature found",
109     "invalid file locking mode",
110     "unable to lock datafile",
111     "unable to unlock datafile",
112     "size mismatch when reading record",
113     "attempt to start new transaction while one is already active",
114     "no transaction active",
115     "attempt to free a B-tree cursor when cursors were active",
116     "invalid datafile object",
117     "size_t is incompatible with Itzam",
118     "could not create datafile",
119     "global shared memory requires Administrator or user with SeCreateGlobalPrivilege",
120     "cannot create global shared memory",
121     "another process or thread has already created shared objects for this datafile",
122     "invalid operation for read only file"
123 };
124
125 const char * STATE_MESSAGES [] =
126 {
127     "okay",
128     "operation failed",
129     "version mismatch in files",
130     "iterator at end",
131     "iterator at beginning",
132     "key not found",
133     "duplicate key",
134     "exceeded maximum file size on 32-bit system",
135     "unable to write data record for index",
136     "sizeof(size_t) smaller than required for file references; possibly 64-bit DB on 32-bit platform",
137     "invalid operation for read only file"
138 };
139
140
141 void error_handler(const char * function_name, itzam_error error)
142 {
143     fprintf(stderr, "Itzam error in %s: %s\n", function_name, ERROR_STRINGS[error]);
144 }