Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 688 lines (568 sloc) 21.646 kb
cadfcf5 licenses
kristina authored
1 /**
fba1a20 @derickr Using MongoDB, Inc. And 2014.
derickr authored
2 * Copyright 2009-2014 MongoDB, Inc.
572857c @kchodorow whitespace
kchodorow authored
3 *
cadfcf5 licenses
kristina authored
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
572857c @kchodorow whitespace
kchodorow authored
7 *
cadfcf5 licenses
kristina authored
8 * http://www.apache.org/licenses/LICENSE-2.0
572857c @kchodorow whitespace
kchodorow authored
9 *
cadfcf5 licenses
kristina authored
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
b79c77c start
kristina authored
16 #ifndef PHP_MONGO_H
17 #define PHP_MONGO_H 1
18
41552e1 @derickr Move to 1.7 in master
derickr authored
19 #define PHP_MONGO_VERSION "1.7.0dev"
b79c77c start
kristina authored
20 #define PHP_MONGO_EXTNAME "mongo"
21
2e5ca9a @derickr Sort out the includes a bit better and add support for a config.w32.h to...
derickr authored
22 #ifdef HAVE_CONFIG_H
23 # include "config.h"
24 #endif
25
e279866 @derickr Move strtoll() definition so that it can be used everywhere.
derickr authored
26 #if defined(_MSC_VER)
27 # define strtoll(s, f, b) _atoi64(s)
28 #elif !defined(HAVE_STRTOLL)
29 # if defined(HAVE_ATOLL)
30 # define strtoll(s, f, b) atoll(s)
31 # else
32 # define strtoll(s, f, b) strtol(s, f, b)
33 # endif
34 #endif
35
36
2a12f6e @derickr Changed mongo_link struct.
derickr authored
37 #include "mcon/types.h"
e2c5779 @derickr Added .h file and fixed typo.
derickr authored
38 #include "mcon/read_preference.h"
2a12f6e @derickr Changed mongo_link struct.
derickr authored
39
78f675b @derickr Windows build fixes.
derickr authored
40 #ifndef zend_parse_parameters_none
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
41 # define zend_parse_parameters_none() \
42 zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "")
78f675b @derickr Windows build fixes.
derickr authored
43 #endif
44
45 #ifndef Z_UNSET_ISREF_P
46 # define Z_UNSET_ISREF_P(pz) pz->is_ref = 0
47 #endif
48
b15925b windows compile MINOR
kristina authored
49 #ifdef WIN32
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
50 # ifndef int64_t
51 typedef __int64 int64_t;
52 # endif
b15925b windows compile MINOR
kristina authored
53 #endif
54
ac190eb @derickr Make this compile with PHP < 5.3.
derickr authored
55 #ifndef Z_ADDREF_P
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
56 # define Z_ADDREF_P(pz) (pz)->refcount++
ac190eb @derickr Make this compile with PHP < 5.3.
derickr authored
57 #endif
58
78f675b @derickr Windows build fixes.
derickr authored
59 #ifndef Z_ADDREF_PP
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
60 # define Z_ADDREF_PP(ppz) Z_ADDREF_P(*(ppz))
78f675b @derickr Windows build fixes.
derickr authored
61 #endif
62
ac190eb @derickr Make this compile with PHP < 5.3.
derickr authored
63 #ifndef Z_DELREF_P
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
64 # define Z_DELREF_P(pz) (pz)->refcount--
ac190eb @derickr Make this compile with PHP < 5.3.
derickr authored
65 #endif
66
48fd9aa @derickr Fixed PHP-521: Build fixes for PHP 5.2 and PHP 5.4.
derickr authored
67 #ifndef Z_SET_REFCOUNT_P
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
68 # define Z_SET_REFCOUNT_P(pz, rc) (pz)->refcount = (rc)
48fd9aa @derickr Fixed PHP-521: Build fixes for PHP 5.2 and PHP 5.4.
derickr authored
69 #endif
ac190eb @derickr Make this compile with PHP < 5.3.
derickr authored
70
5496b6f @kchodorow single-server connect
kchodorow authored
71 #define INT_32 4
72 #define INT_64 8
73 #define DOUBLE_64 8
74 #define BYTE_8 1
75
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
76 /* db ops */
2f0dda1 fix -Wall errors and cursor contains buffer type
kristina authored
77 #define OP_REPLY 1
b82404f connect & insert
kristina authored
78 #define OP_MSG 1000
79 #define OP_UPDATE 2001
80 #define OP_INSERT 2002
81 #define OP_GET_BY_OID 2003
82 #define OP_QUERY 2004
572857c @kchodorow whitespace
kchodorow authored
83 #define OP_GET_MORE 2005
b82404f connect & insert
kristina authored
84 #define OP_DELETE 2006
572857c @kchodorow whitespace
kchodorow authored
85 #define OP_KILL_CURSORS 2007
b82404f connect & insert
kristina authored
86
1366709 @bjori Remove unused stuff
bjori authored
87 #define REPLY_HEADER_SIZE 36
76ad912 cursor id fixes
kristina authored
88
bc909d1 fixed buf resize
kristina authored
89 #define INITIAL_BUF_SIZE 4096
da78561 @jmikola PHP-1030: Default GridFS chunk size default to 255K (from 256K)
jmikola authored
90 #define DEFAULT_CHUNK_SIZE (255*1024)
91 #define DEFAULT_CHUNK_SIZE_S "261120"
4ca3b05 gridfs funcs to mongo.c
kristina authored
92
ca7b57f @bjori Fixed PHP-684: add support for socketTimeoutMS
bjori authored
93 #define PHP_MONGO_DEFAULT_WTIMEOUT 10000
ce20cdc @bjori Fixed PHP-1099: socketTimeoutMS=-1 doesn't work in the connection uri
bjori authored
94 #define PHP_MONGO_STATIC_CURSOR_TIMEOUT_NOT_SET_INITIALIZER -2
072aff0 w & wtimeout PHP-99
Kristina Chodorow authored
95
952fecf @derickr PHP-1226: Review comments: add a constant and use "return;".
derickr authored
96 #define PHP_MONGO_COLLECTION_DOES_NOT_EXIST 26
97
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
98 /* if _id field should be added */
75ba71e _id on insert
kristina authored
99 #define PREP 1
100 #define NO_PREP 0
47833b5 query, cursor
kristina authored
101
e158001 basic Mongo
kristina authored
102 #define NOISY 0
b01c78a @kchodorow Check for err, too PHP-204
kchodorow authored
103 #define QUIET 1
e158001 basic Mongo
kristina authored
104
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
105 /* duplicate strings */
539b5bb improved serialization
kristina authored
106 #define DUP 1
107 #define NO_DUP 0
108
7840b70 @derickr Remove pre-PHP 5.3 related macros.
derickr authored
109 #define PUSH_PARAM(arg) zend_vm_stack_push(arg TSRMLS_CC)
110 #define POP_PARAM() (void)zend_vm_stack_pop(TSRMLS_C)
111 #define PUSH_EO_PARAM()
112 #define POP_EO_PARAM()
e40006b @derickr Fixed arginfo staticness for PHP 5.1 and 5.2.
derickr authored
113
b2414df @bjori Really fix build on 5.3.3. Fixes PHP-948
bjori authored
114 #if PHP_VERSION_ID < 50307
115 # define PHP_FE_END { NULL, NULL, NULL, 0, 0 }
116 #endif
502733b @bjori Fixed PHP-435 (1.2.11 doesn't build on PHP5.2)
bjori authored
117
361a363 @bjori Fixed bug #473 (Sort by field "0" (zero char, ASCII 0x30) does not work)
bjori authored
118 #define MUST_BE_ARRAY_OR_OBJECT(num, arg) do { \
119 if (arg && !(Z_TYPE_P(arg) == IS_ARRAY || Z_TYPE_P(arg) == IS_OBJECT)) { \
120 php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects parameter %d to be an array or object, %s given", num, zend_get_type_by_const(Z_TYPE_P(arg))); \
121 RETURN_NULL(); \
122 } \
123 } while(0);
124
cc4d845 @derickr Fixed PHP-437: Removed old API checks and some unused code.
derickr authored
125 #define MONGO_METHOD_BASE(classname, name) zim_##classname##_##name
aa5d098 5.1 compatible
kristina authored
126
0af8880 varargs macro only works on linux
Kristina Chodorow authored
127 #define MONGO_METHOD_HELPER(classname, name, retval, thisptr, num, param) \
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
128 PUSH_PARAM(param); PUSH_PARAM((void*)num); \
129 PUSH_EO_PARAM(); \
130 MONGO_METHOD_BASE(classname, name)(num, retval, NULL, thisptr, 0 TSRMLS_CC); \
131 POP_EO_PARAM(); \
132 POP_PARAM(); POP_PARAM();
0af8880 varargs macro only works on linux
Kristina Chodorow authored
133
134 /* push parameters, call function, pop parameters */
135 #define MONGO_METHOD(classname, name, retval, thisptr) \
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
136 MONGO_METHOD_BASE(classname, name)(0, retval, NULL, thisptr, 0 TSRMLS_CC);
0af8880 varargs macro only works on linux
Kristina Chodorow authored
137
138 #define MONGO_METHOD1(classname, name, retval, thisptr, param1) \
042559d @bjori Fixed PHP-722: Random segfault
bjori authored
139 ZEND_VM_STACK_GROW_IF_NEEDED(2); \
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
140 MONGO_METHOD_HELPER(classname, name, retval, thisptr, 1, param1);
0af8880 varargs macro only works on linux
Kristina Chodorow authored
141
142 #define MONGO_METHOD2(classname, name, retval, thisptr, param1, param2) \
042559d @bjori Fixed PHP-722: Random segfault
bjori authored
143 ZEND_VM_STACK_GROW_IF_NEEDED(3); \
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
144 PUSH_PARAM(param1); \
145 MONGO_METHOD_HELPER(classname, name, retval, thisptr, 2, param2); \
146 POP_PARAM();
0af8880 varargs macro only works on linux
Kristina Chodorow authored
147
148 #define MONGO_METHOD3(classname, name, retval, thisptr, param1, param2, param3) \
042559d @bjori Fixed PHP-722: Random segfault
bjori authored
149 ZEND_VM_STACK_GROW_IF_NEEDED(4); \
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
150 PUSH_PARAM(param1); PUSH_PARAM(param2); \
151 MONGO_METHOD_HELPER(classname, name, retval, thisptr, 3, param3); \
152 POP_PARAM(); POP_PARAM();
0af8880 varargs macro only works on linux
Kristina Chodorow authored
153
154 #define MONGO_METHOD4(classname, name, retval, thisptr, param1, param2, param3, param4) \
042559d @bjori Fixed PHP-722: Random segfault
bjori authored
155 ZEND_VM_STACK_GROW_IF_NEEDED(5); \
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
156 PUSH_PARAM(param1); PUSH_PARAM(param2); PUSH_PARAM(param3); \
157 MONGO_METHOD_HELPER(classname, name, retval, thisptr, 4, param4); \
158 POP_PARAM(); POP_PARAM(); POP_PARAM();
0af8880 varargs macro only works on linux
Kristina Chodorow authored
159
160 #define MONGO_METHOD5(classname, name, retval, thisptr, param1, param2, param3, param4, param5) \
042559d @bjori Fixed PHP-722: Random segfault
bjori authored
161 ZEND_VM_STACK_GROW_IF_NEEDED(6); \
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
162 PUSH_PARAM(param1); PUSH_PARAM(param2); PUSH_PARAM(param3); PUSH_PARAM(param4); \
163 MONGO_METHOD_HELPER(classname, name, retval, thisptr, 5, param5); \
164 POP_PARAM(); POP_PARAM(); POP_PARAM(); POP_PARAM();
0af8880 varargs macro only works on linux
Kristina Chodorow authored
165
abbb606 allows saving/retrieving using objs
kristina authored
166 #define HASH_P(a) (Z_TYPE_P(a) == IS_ARRAY ? Z_ARRVAL_P(a) : Z_OBJPROP_P(a))
167 #define HASH_PP(a) (Z_TYPE_PP(a) == IS_ARRAY ? Z_ARRVAL_PP(a) : Z_OBJPROP_PP(a))
168
95317f8 @derickr Fixed PHP-813: IS_SCALAR_*() doesn't account for resources.
derickr authored
169 #define IS_SCALAR_P(a) (Z_TYPE_P(a) == IS_NULL || Z_TYPE_P(a) == IS_LONG || Z_TYPE_P(a) == IS_DOUBLE || Z_TYPE_P(a) == IS_BOOL || Z_TYPE_P(a) == IS_STRING)
170 #define IS_SCALAR_PP(a) IS_SCALAR_P(*a)
171 #define IS_ARRAY_OR_OBJECT_P(a) (Z_TYPE_P(a) == IS_ARRAY || Z_TYPE_P(a) == IS_OBJECT)
abbb606 allows saving/retrieving using objs
kristina authored
172
cc4d845 @derickr Fixed PHP-437: Removed old API checks and some unused code.
derickr authored
173 #if PHP_VERSION_ID >= 50400
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
174 # define init_properties(intern) object_properties_init(&intern->std, class_type)
b31517c @kchodorow 5.4 compile PHP-246
kchodorow authored
175 #else
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
176 # define init_properties(intern) { \
a1f11b5 @derickr Fixed compiling on PHP 5.2 and PHP 5.3 which has a different init_proper...
derickr authored
177 zval *tmp; \
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
178 zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); \
a1f11b5 @derickr Fixed compiling on PHP 5.2 and PHP 5.3 which has a different init_proper...
derickr authored
179 }
b31517c @kchodorow 5.4 compile PHP-246
kchodorow authored
180 #endif
c290847 @kchodorow slave reading support methods PHP-143
kchodorow authored
181
d9ca569 @derickr Fixed PHP-479: Compiler warnings
derickr authored
182 #define PHP_MONGO_OBJ_NEW(mongo_obj) \
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
183 zend_object_value retval; \
184 mongo_obj *intern; \
185 \
186 intern = (mongo_obj*)emalloc(sizeof(mongo_obj)); \
187 memset(intern, 0, sizeof(mongo_obj)); \
188 \
189 zend_object_std_init(&intern->std, class_type TSRMLS_CC); \
190 init_properties(intern); \
191 \
192 retval.handle = zend_objects_store_put(intern,(zend_objects_store_dtor_t) zend_objects_destroy_object, php_##mongo_obj##_free, NULL TSRMLS_CC); \
193 retval.handlers = &mongo_default_handlers; \
194 \
195 return retval;
f1af449 remove connection resource
Kristina Chodorow authored
196
f11bfad @bjori Fixed PHP-796: Modifying MongoDate internal properties evilness
bjori authored
197 zend_object_value php_mongo_type_object_new(zend_class_entry *class_type TSRMLS_DC);
198 void php_mongo_type_object_free(void *object TSRMLS_DC);
199
ba4e212 @derickr Merge branch 'v1.4'
derickr authored
200 #if PHP_VERSION_ID >= 50400
201 void mongo_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC);
202 #else
203 void mongo_write_property(zval *object, zval *member, zval *value TSRMLS_DC);
204 #endif
205
206 #if PHP_VERSION_ID >= 50400
207 zval *mongo_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC);
208 #else
209 zval *mongo_read_property(zval *object, zval *member, int type TSRMLS_DC);
210 #endif
211
212
f11bfad @bjori Fixed PHP-796: Modifying MongoDate internal properties evilness
bjori authored
213 /* Used in our _write_property() handler to mark properties are userland Read Only */
214 #define MONGO_ACC_READ_ONLY 0x10000000
215
216 typedef struct {
217 zend_object std;
218 } mongo_type_object;
219
1d591c3 more flexible, neater connection
Kristina Chodorow authored
220 typedef struct {
2a12f6e @derickr Changed mongo_link struct.
derickr authored
221 zend_object std;
e012320 better connection
kristina authored
222
2a12f6e @derickr Changed mongo_link struct.
derickr authored
223 mongo_con_manager *manager; /* Contains a link to the manager */
224 mongo_servers *servers;
298e42b @bjori Rename the Mongo class to MongoClient
bjori authored
225 } mongoclient;
b82404f connect & insert
kristina authored
226
f6843d8 doesn't blow up
kristina authored
227 typedef struct {
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
228 int length;
229 int request_id;
230 int response_to;
231 int op;
b82404f connect & insert
kristina authored
232 } mongo_msg_header;
b79c77c start
kristina authored
233
47833b5 query, cursor
kristina authored
234 typedef struct {
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
235 char *start;
236 char *pos;
237 char *end;
829fcd4 @derickr Rename "buffer" to "mongo_buffer".
derickr authored
238 } mongo_buffer;
676cf3c added buffer type
kristina authored
239
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
240 #define CREATE_MSG_HEADER(rid, rto, opcode) \
241 header.length = 0; \
242 header.request_id = rid; \
243 header.response_to = rto; \
244 header.op = opcode;
d9aed01 added slaveOkay(), tailable(), and logReplay() to MongoCursor
kristina authored
245
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
246 #define CREATE_RESPONSE_HEADER(buf, ns, rto, opcode) \
247 CREATE_MSG_HEADER(MonGlo(request_id)++, rto, opcode); \
248 APPEND_HEADER_NS(buf, ns, 0);
c9a4d02 more windows stuff
U-ACER-6E40E97492\Kristina Chodorow authored
249
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
250 #define CREATE_HEADER_WITH_OPTS(buf, ns, opcode, opts) \
251 CREATE_MSG_HEADER(MonGlo(request_id)++, 0, opcode); \
252 APPEND_HEADER_NS(buf, ns, opts);
c9a4d02 more windows stuff
U-ACER-6E40E97492\Kristina Chodorow authored
253
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
254 #define CREATE_HEADER(buf, ns, opcode) \
255 CREATE_RESPONSE_HEADER(buf, ns, 0, opcode);
c9a4d02 more windows stuff
U-ACER-6E40E97492\Kristina Chodorow authored
256
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
257 #define APPEND_HEADER(buf, opts) buf->pos += INT_32; \
258 php_mongo_serialize_int(buf, header.request_id); \
259 php_mongo_serialize_int(buf, header.response_to); \
260 php_mongo_serialize_int(buf, header.op); \
261 php_mongo_serialize_int(buf, opts);
c9a4d02 more windows stuff
U-ACER-6E40E97492\Kristina Chodorow authored
262
263
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
264 #define APPEND_HEADER_NS(buf, ns, opts) \
265 APPEND_HEADER(buf, opts); \
266 php_mongo_serialize_ns(buf, ns TSRMLS_CC);
eaf06fc fixed memory leak
kristina authored
267
6b06a15 check object initialization
kristina authored
268
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
269 #define MONGO_CHECK_INITIALIZED(member, class_name) \
270 if (!(member)) { \
271 zend_throw_exception(mongo_ce_Exception, "The " #class_name " object has not been correctly initialized by its constructor", 0 TSRMLS_CC); \
272 RETURN_FALSE; \
273 }
6b06a15 check object initialization
kristina authored
274
b439c74 @derickr PHP-1063: Refactor out MongoCursor:__construct() and used it with find()...
derickr authored
275 #define MONGO_CHECK_INITIALIZED_C(member, class_name) \
276 if (!(member)) { \
277 zend_throw_exception(mongo_ce_Exception, "The " #class_name " object has not been correctly initialized by its constructor", 0 TSRMLS_CC); \
278 return FAILURE; \
279 }
280
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
281 #define MONGO_CHECK_INITIALIZED_STRING(member, class_name) \
282 if (!(member)) { \
283 zend_throw_exception(mongo_ce_Exception, "The " #class_name " object has not been correctly initialized by its constructor", 0 TSRMLS_CC); \
284 RETURN_STRING("", 1); \
285 }
6b06a15 check object initialization
kristina authored
286
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
287 #define PHP_MONGO_GET_LINK(obj) \
288 link = (mongoclient*)zend_object_store_get_object((obj) TSRMLS_CC); \
289 MONGO_CHECK_INITIALIZED(link->servers, Mongo);
84400a4 extract buffer functions
Kristina Chodorow authored
290
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
291 #define PHP_MONGO_GET_DB(obj) \
292 db = (mongo_db*)zend_object_store_get_object((obj) TSRMLS_CC); \
293 MONGO_CHECK_INITIALIZED(db->name, MongoDB);
84400a4 extract buffer functions
Kristina Chodorow authored
294
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
295 #define PHP_MONGO_GET_COLLECTION(obj) \
296 c = (mongo_collection*)zend_object_store_get_object((obj) TSRMLS_CC); \
297 MONGO_CHECK_INITIALIZED(c->ns, MongoCollection);
84400a4 extract buffer functions
Kristina Chodorow authored
298
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
299 #define PHP_MONGO_GET_CURSOR(obj) \
300 cursor = (mongo_cursor*)zend_object_store_get_object((obj) TSRMLS_CC); \
b2d6ac3 @derickr Rename "resource" to "zmongoclient".
derickr authored
301 MONGO_CHECK_INITIALIZED(cursor->zmongoclient, MongoCursor);
ad9aba3 propagate CursorException
Kristina Chodorow authored
302
0796c4c @derickr Fixed PHP-714: Convenience macro for getting mongoclient*.
derickr authored
303 #define PHP_MONGO_GET_MONGOCLIENT_FROM_CURSOR(cursor) \
304 client = (mongoclient*)zend_object_store_get_object((cursor)->zmongoclient TSRMLS_CC);
305
73a58e9 fix remove options PHP-107
Kristina Chodorow authored
306 #define PHP_MONGO_CHECK_EXCEPTION() if (EG(exception)) { return; }
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
307
308 #define PHP_MONGO_CHECK_EXCEPTION1(arg1) \
309 if (EG(exception)) { \
88eb84f @derickr Check for NULL values here.
derickr authored
310 if (*arg1) { zval_ptr_dtor(arg1); } \
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
311 return; \
312 }
313
314 #define PHP_MONGO_CHECK_EXCEPTION2(arg1, arg2) \
315 if (EG(exception)) { \
88eb84f @derickr Check for NULL values here.
derickr authored
316 if (*arg1) { zval_ptr_dtor(arg1); } \
317 if (*arg2) { zval_ptr_dtor(arg2); } \
b8e36ec @jmikola Fix macro indentation
jmikola authored
318 return; \
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
319 }
320
321 #define PHP_MONGO_CHECK_EXCEPTION3(arg1, arg2, arg3) \
322 if (EG(exception)) { \
88eb84f @derickr Check for NULL values here.
derickr authored
323 if (*arg1) { zval_ptr_dtor(arg1); } \
324 if (*arg2) { zval_ptr_dtor(arg2); } \
325 if (*arg3) { zval_ptr_dtor(arg3); } \
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
326 return; \
327 }
328
329 #define PHP_MONGO_CHECK_EXCEPTION4(arg1, arg2, arg3, arg4) \
330 if (EG(exception)) { \
88eb84f @derickr Check for NULL values here.
derickr authored
331 if (*arg1) { zval_ptr_dtor(arg1); } \
332 if (*arg2) { zval_ptr_dtor(arg2); } \
333 if (*arg3) { zval_ptr_dtor(arg3); } \
334 if (*arg4) { zval_ptr_dtor(arg4); } \
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
335 return; \
336 }
337
338 #define PHP_MONGO_SERIALIZE_KEY(type) \
339 php_mongo_set_type(buf, type); \
340 php_mongo_serialize_key(buf, name, name_len, prep TSRMLS_CC); \
341 if (EG(exception)) { \
342 return ZEND_HASH_APPLY_STOP; \
343 }
73a58e9 fix remove options PHP-107
Kristina Chodorow authored
344
84400a4 extract buffer functions
Kristina Chodorow authored
345
0bbee7e cursor timeout PHP-62
Kristina Chodorow authored
346 #define REPLY_HEADER_LEN 36
6b06a15 check object initialization
kristina authored
347
676cf3c added buffer type
kristina authored
348 typedef struct {
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
349 zend_object std;
eaf06fc fixed memory leak
kristina authored
350
da9b033 @derickr Rework running commands to use the new connection/database API.
derickr authored
351 /* Connection */
352 mongo_connection *connection;
b2d6ac3 @derickr Rename "resource" to "zmongoclient".
derickr authored
353 zval *zmongoclient;
d9aed01 added slaveOkay(), tailable(), and logReplay() to MongoCursor
kristina authored
354
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
355 /* collection namespace */
356 char *ns;
357
358 /* fields to send */
359 zval *query;
360 zval *fields;
361 int limit;
362 int batch_size;
363 int skip;
364 int opts;
365
366 char special;
367 int timeout;
368
369 mongo_msg_header send;
370 mongo_msg_header recv;
371
372 /* response fields */
373 int flag;
374 int start;
375 /* number of results used */
376 int at;
377 /* number results returned */
378 int num;
379 /* results */
829fcd4 @derickr Rename "buffer" to "mongo_buffer".
derickr authored
380 mongo_buffer buf;
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
381
382 /* cursor_id indicates if there are more results to fetch. If cursor_id
383 * is 0, the cursor is "dead." If cursor_id != 0, server is set to the
384 * server that was queried, so a get_more doesn't try to fetch results
385 * from the wrong server. server just points to a member of link, so it
386 * should never need to be freed. */
387 int64_t cursor_id;
388
389 zend_bool started_iterating;
ea85257 @derickr Add MongoCommandCursor::createFromDocument
derickr authored
390 zend_bool pre_created; /* Used for command cursors through createFromDocument */
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
391 zend_bool persist;
392
393 zval *current;
394 int retry;
d9aed01 added slaveOkay(), tailable(), and logReplay() to MongoCursor
kristina authored
395
da737da @derickr Fixed PHP-511: Setting slaveOkay on MongoDB doesn't get passed properly ...
derickr authored
396 mongo_read_preference read_pref;
397
1505672 @derickr Re-implement mongo_util_cursor_failed().
derickr authored
398 int dead;
39bc904 @derickr Allow for special cursor and bson_to_zval options, to force Long -> obje...
derickr authored
399
400 /* Options that deal with changes to what the cursor documents return. For
401 * example forcing longs to be returned as objects */
402 int cursor_options;
16deccf @derickr Implement parsing the cursor_id and "first batch".
derickr authored
403
404 /* Fields that are only used for command cursors */
405 zval *first_batch; /* The first batch of results */
406 int first_batch_at; /* The current cursor position in the first batch */
407 int first_batch_num; /* The number of entries in the first batch */
47833b5 query, cursor
kristina authored
408 } mongo_cursor;
409
7af9441 @derickr New command_cursor file with some boiler plate.
derickr authored
410 typedef mongo_cursor mongo_command_cursor;
411
1b5122b better MongoId
kristina authored
412 typedef struct {
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
413 zend_object std;
414 char *id;
1b5122b better MongoId
kristina authored
415 } mongo_id;
416
b986bcd faster, started command
kristina authored
417
418 typedef struct {
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
419 zend_object std;
420 zval *link;
421 zval *name;
572857c @kchodorow whitespace
kchodorow authored
422
3054346 @derickr Added tagset storage and helpers and copy handlers.
derickr authored
423 mongo_read_preference read_pref;
b986bcd faster, started command
kristina authored
424 } mongo_db;
425
426 typedef struct {
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
427 zend_object std;
b986bcd faster, started command
kristina authored
428
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
429 /* parent database */
430 zval *parent;
431 zval *link;
b986bcd faster, started command
kristina authored
432
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
433 /* names */
434 zval *name;
435 zval *ns;
459a15e @kchodorow add slaveOkay to conn, db, and coll
kchodorow authored
436
3054346 @derickr Added tagset storage and helpers and copy handlers.
derickr authored
437 mongo_read_preference read_pref;
b986bcd faster, started command
kristina authored
438 } mongo_collection;
439
ffbb80c @bjori PHP-990: Add a MongoWriteBatch for the Batch Write API
bjori authored
440 #include "api/write.h"
441
442 typedef struct {
f8d998d @bjori PHP-987: Split Batch Writes into multiple batches automatically
bjori authored
443 zend_object std;
596f7f0 @bjori WS/CS/quirks as per PR review
bjori authored
444 php_mongo_write_types batch_type;
f8d998d @bjori PHP-987: Split Batch Writes into multiple batches automatically
bjori authored
445 zval *zcollection_object;
c5c59e7 @bjori git grep -l php_mongodb_ | xargs perl -p -i -e 's/php_mongodb_/php_mongo...
bjori authored
446 php_mongo_batch *batch;
447 php_mongo_write_options write_options;
f8d998d @bjori PHP-987: Split Batch Writes into multiple batches automatically
bjori authored
448 int total_items;
ffbb80c @bjori PHP-990: Add a MongoWriteBatch for the Batch Write API
bjori authored
449 } mongo_write_batch_object;
450
b986bcd faster, started command
kristina authored
451
676cf3c added buffer type
kristina authored
452 #define BUF_REMAINING (buf->end-buf->pos)
453
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
454 #define CREATE_BUF(buf, size) \
455 buf.start = (char*)emalloc(size); \
456 buf.pos = buf.start; \
457 buf.end = buf.start + size;
676cf3c added buffer type
kristina authored
458
b79c77c start
kristina authored
459 PHP_MINIT_FUNCTION(mongo);
1c88a1f added config vars for max num connections and persistent connections
kristina authored
460 PHP_MSHUTDOWN_FUNCTION(mongo);
461 PHP_RINIT_FUNCTION(mongo);
0a0fc13 phpinfo section
kristina authored
462 PHP_MINFO_FUNCTION(mongo);
b79c77c start
kristina authored
463
9a6d247 @derickr Collapse, spell check and remove some // comments.
derickr authored
464 /* Serialization functions */
d262804 bson_encode and bson_decode
kristina authored
465 PHP_FUNCTION(bson_encode);
466 PHP_FUNCTION(bson_decode);
1b032c4 query, has_next, and next
kristina authored
467
c27beb5 locking macros
Kristina Chodorow authored
468
05f70b4 mongo tests
kristina authored
469 void mongo_init_MongoDB(TSRMLS_D);
470 void mongo_init_MongoCollection(TSRMLS_D);
0f2f9af most of gridfs
kristina authored
471
fc6d4a5 gridfs skeleton
kristina authored
472 void mongo_init_MongoGridFS(TSRMLS_D);
473 void mongo_init_MongoGridFSFile(TSRMLS_D);
474 void mongo_init_MongoGridFSCursor(TSRMLS_D);
0f2f9af most of gridfs
kristina authored
475
ccb2bfa @bjori Fix zts build
bjori authored
476 void mongo_init_MongoWriteBatch(TSRMLS_D);
477 void mongo_init_MongoInsertBatch(TSRMLS_D);
478 void mongo_init_MongoUpdateBatch(TSRMLS_D);
479 void mongo_init_MongoDeleteBatch(TSRMLS_D);
ffbb80c @bjori PHP-990: Add a MongoWriteBatch for the Batch Write API
bjori authored
480
e8e4997 Merge branch 'master' into oop
kristina authored
481 void mongo_init_MongoId(TSRMLS_D);
dacae2f mostly db and collections stuff
kristina authored
482 void mongo_init_MongoCode(TSRMLS_D);
b157bdd collection stuff
kristina authored
483 void mongo_init_MongoRegex(TSRMLS_D);
5fa0dd2 cleanup
kristina authored
484 void mongo_init_MongoDate(TSRMLS_D);
485 void mongo_init_MongoBinData(TSRMLS_D);
97be73a collection & cursor count
kristina authored
486 void mongo_init_MongoDBRef(TSRMLS_D);
edd0d1e MongoTimestamp type
kristina authored
487 void mongo_init_MongoTimestamp(TSRMLS_D);
e3003cc @derickr - Added the mongo.native_int setting, that tries to use the platform's i...
derickr authored
488 void mongo_init_MongoInt32(TSRMLS_D);
489 void mongo_init_MongoInt64(TSRMLS_D);
05f70b4 mongo tests
kristina authored
490
0ffc287 @derickr Implement Mongo/MongoDB/MongoCollection::getReadPreference().
derickr authored
491 /* Shared helper functions */
10a1801 @jmikola [PHP-638] Make getReadPreference() tags consistent with those set
jmikola authored
492 zval *php_mongo_make_tagsets(mongo_read_preference *rp);
0ffc287 @derickr Implement Mongo/MongoDB/MongoCollection::getReadPreference().
derickr authored
493 void php_mongo_add_tagsets(zval *return_value, mongo_read_preference *rp);
c096aa5 @derickr Refactor setReadPreference so that we don't have to reimplement this 4 t...
derickr authored
494 int php_mongo_set_readpreference(mongo_read_preference *rp, char *read_preference, HashTable *tags TSRMLS_DC);
0fd03e9 @jmikola Move trigger_error functions from collection.c to php_mongo.c
jmikola authored
495 int php_mongo_trigger_error_on_command_failure(mongo_connection *connection, zval *document TSRMLS_DC);
496 int php_mongo_trigger_error_on_gle(mongo_connection *connection, zval *document TSRMLS_DC);
0ffc287 @derickr Implement Mongo/MongoDB/MongoCollection::getReadPreference().
derickr authored
497
1c88a1f added config vars for max num connections and persistent connections
kristina authored
498 ZEND_BEGIN_MODULE_GLOBALS(mongo)
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
499 /* php.ini options */
500 char *default_host;
db026ce @derickr Fixed data types for INI entries.
derickr authored
501 long default_port;
502 long request_id;
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
503 int chunk_size;
504
505 /* $ alternative */
506 char *cmd_char;
db026ce @derickr Fixed data types for INI entries.
derickr authored
507 long native_long;
508 long long_as_object;
509 long allow_empty_keys;
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
510
511 /* _id generation helpers */
512 int inc, pid, machine;
513
514 /* timestamp generation helper */
f373ea6 @derickr Fixed another wrong type.
derickr authored
515 long ts_inc;
4b3cf98 @derickr Whitespace and CS fixing, phase 1.
derickr authored
516 char *errmsg;
3023bac @derickr Make MongoLog settings thread safe.
derickr authored
517
518 long log_level;
519 long log_module;
caba6de @bjori Fixed PHP-280 (Allow MongoLog to log to Pear Log module)
bjori authored
520 zend_fcall_info log_callback_info;
521 zend_fcall_info_cache log_callback_info_cache;
d289895 @derickr Fix for PHP-329: Added two ini settings to control ping and is_master in...
derickr authored
522
523 long ping_interval;
05cc15e @derickr Rename is_master to ismaster.
derickr authored
524 long ismaster_interval;
c5bdd41 @derickr Fixed manager initialisation to be thread safe.
derickr authored
525
526 mongo_con_manager *manager;
572857c @kchodorow whitespace
kchodorow authored
527 ZEND_END_MODULE_GLOBALS(mongo)
1c88a1f added config vars for max num connections and persistent connections
kristina authored
528
529 #ifdef ZTS
b82404f connect & insert
kristina authored
530 #include <TSRM.h>
1c88a1f added config vars for max num connections and persistent connections
kristina authored
531 # define MonGlo(v) TSRMG(mongo_globals_id, zend_mongo_globals *, v)
532 #else
533 # define MonGlo(v) (mongo_globals.v)
572857c @kchodorow whitespace
kchodorow authored
534 #endif
1c88a1f added config vars for max num connections and persistent connections
kristina authored
535
ea38b84 @derickr Fixed PHP-1120: The mongo driver fails to build as static extension.
derickr authored
536 #define phpext_mongo_ptr &mongo_module_entry
537
b79c77c start
kristina authored
538 extern zend_module_entry mongo_module_entry;
539
540 #endif
4ed3b10 @kchodorow track error codes
kchodorow authored
541
542 /*
543 * Error codes
544 *
9bfc0bc @derickr Added a todo to recheck all the constants being used for exceptions.
derickr authored
545 * TODO: Check and update those all
546 *
abfa87e @kchodorow add MongoException codes
kchodorow authored
547 * MongoException:
548 * 0: The <class> object has not been correctly initialized by its constructor
549 * 1: zero-length keys are not allowed, did you use $ with double quotes?
9e46da1 @derickr Fixed PHP-872: Driver should prevent \0 characters in keys, collection a...
derickr authored
550 * 2: characters not allowed in key: <key>
abfa87e @kchodorow add MongoException codes
kchodorow authored
551 * 3: insert too large: <size>, max: 16000000
552 * 5: size of BSON doc is <size> bytes, max 4MB
553 * 6: no documents given
554 * 7: MongoCollection::group takes an array, object, or MongoCode key
555 * 8: field names must be strings
556 * 9: invalid regex
557 * 10: MongoDBRef::get: $ref field must be a string
558 * 11: MongoDBRef::get: $db field must be a string
559 * 12: non-utf8 string: <str>
560 * 13: mutex error: <err>
561 * 14: index name too long: <len>, max <max> characters
c290847 @kchodorow slave reading support methods PHP-143
kchodorow authored
562 * 15: Reading from slaves won't work without using the replicaSet option on connect
563 * 16: No server found for reads
e62c3c6 @kchodorow added bson max size detection
kchodorow authored
564 * 17: The MongoCollection object has not been correctly initialized by its constructor
14f4d5e @bjori Fixed PHP-554: MongoId should not get constructed when passing in an inv...
bjori authored
565 * 18: ID must be valid hex characters
566 * 19: Invalid object ID
0b57273 @bjori Fixed PHP-781: MongoCollection::count() should not leak, and throw excep...
bjori authored
567 * 20: Cannot run command count(): (error message from MongoDB)
9e69653 @derickr Fixed PHP-816: MongoCursor doesn't validate the namespace
derickr authored
568 * 21: Namespace field is invalid.
d940baf @derickr Added checks for invalid index specifications
derickr authored
569 * 22: invalid index specification
50d5186 @jmikola PHP-1269: Exception if MongoBinData::UUID_RFC4122 has invalid size
jmikola authored
570 * 25: invalid RFC4122 UUID size
4e27128 @jmikola PHP-1259: Use exception codes in legacy collection enumeration method
jmikola authored
571 * 26: Invalid type of "filter" option for collection enumeration method
572 * 27: Invalid type of "filter" option "name" criteria for collection enumeration method on MongoDB <2.8
abfa87e @kchodorow add MongoException codes
kchodorow authored
573 *
4ed3b10 @kchodorow track error codes
kchodorow authored
574 * MongoConnectionException:
575 * 0: connection to <host> failed: <errmsg>
576 * 1: no server name given
577 * 2: can't use slaveOkay without replicaSet
578 * 3: could not store persistent link
a02fb5a @kchodorow throw an exception if persist string not given
kchodorow authored
579 * 4: pass in an identifying string to get a persistent connection
c290847 @kchodorow slave reading support methods PHP-143
kchodorow authored
580 * 5: failed to get primary or secondary
4ed3b10 @kchodorow track error codes
kchodorow authored
581 * 10: failed to get host from <substr> of <str>
582 * 11: failed to get port from <substr> of <str>
03f3c8f @kchodorow more aggressive reconnection
kchodorow authored
583 * 12: lost db connection
e979ecb @derickr Fixed PHP-617: Use real error codes for MongoConnectionException on ctor...
derickr authored
584 * 2X: Parsing errors (ununsed)
585 * 21: Empty option name or value
586 * 22: Unknown connection string option
587 * 23: Logical error (conflicting options)
588 * 24: (unused)
589 * 25: Option with no string key
0e3ddfc @bjori Add timeout support to the streams, and parse the 'ssl' option to
bjori authored
590 * 26: SSL support is only available when compiled against PHP Streams
1a77e00 @bjori Changed the 3rd argument to be an array of driver options
bjori authored
591 * 27: Driver options are only available when compiled against PHP Streams
cdf72de @bjori Fixed PHP-831 and PHP-832: Add support for SASL authentication (Kerberos...
bjori authored
592 * 28: GSSAPI authentication mechanism is only available when compiled against PHP Streams
593 * 29: Plain authentication mechanism is only available when compiled against PHP Streams
6179340 @derickr Refactor exception codes.
derickr authored
594 * 31: Unknown failure doing io_stream_read.
595 * 32: When the remote server closes the connection in io_stream_read.
8fa4582 @bjori Fixed CID-11031: Dereference after null check
bjori authored
596 * 72: Could not retrieve connection
4ed3b10 @kchodorow track error codes
kchodorow authored
597 *
0933900 @derickr Split out MongoCursorTimeoutException into its own files.
derickr authored
598 * MongoCursorTimeoutException:
9bfc0bc @derickr Added a todo to recheck all the constants being used for exceptions.
derickr authored
599 * 80: timeout exception
600 *
4ed3b10 @kchodorow track error codes
kchodorow authored
601 * MongoCursorException:
602 * 0: cannot modify cursor after beginning iteration
603 * 1: get more: send error (C error string)
604 * 2: get more: cursor not found
605 * 3: cursor->buf.pos is null
606 * 4: couldn't get response header
607 * 5: no db response
608 * 6: bad response length: <len>, max: <len>, did the db assert?
609 * 7: incomplete header
610 * 8: incomplete response
611 * 9: couldn't find a response
612 * 10: error getting socket
613 * 11: couldn't find reply, please try again
614 * 12: [WSA ]error getting database response: <err>
615 * 13: Timeout error (C error)
616 * 14: couldn't send query: <err>
720d9d7 @kchodorow move socket choice out of send function PHP-143
kchodorow authored
617 * 15: couldn't get sock for safe op
618 * 16: couldn't send safe op
fd31b03 @kchodorow randomly distribute slave choice PHP-143
kchodorow authored
619 * 17: exceptional condition on socket
ad643fe @kchodorow link server to cursor
kchodorow authored
620 * 18: Trying to get more, but cannot find server
7abe14a @kchodorow add query retry PHP-243
kchodorow authored
621 * 19: max number of retries exhausted, couldn't send query
1505672 @derickr Re-implement mongo_util_cursor_failed().
derickr authored
622 * 20: something exceptional has happened, and the cursor is now dead
b4b27d2 @derickr Fixed PHP-800: Do not overload error codes.
derickr authored
623 * 21: invalid string length for key "%s"
624 * 22: invalid binary length for key "%s"
d2c4356 @derickr Fixed error code, and add a check for it to the test.
derickr authored
625 * 23: Can not natively represent the long %llu on this platform
b4b27d2 @derickr Fixed PHP-800: Do not overload error codes.
derickr authored
626 * 24: invalid code length for key "%s"
50d5186 @jmikola PHP-1269: Exception if MongoBinData::UUID_RFC4122 has invalid size
jmikola authored
627 * 25: invalid RFC4122 UUID size
6179340 @derickr Refactor exception codes.
derickr authored
628 * 28: recv_header() (abs()) recv_data() stream handlers error (timeout)
ec053e2 @derickr Make a mask for error flags and provide a check end error code for a def...
derickr authored
629 * 29: Unknown query/get_more failure
ea85257 @derickr Add MongoCommandCursor::createFromDocument
derickr authored
630 * 30: Cursor command response does not have the expected structure
d2170e7 @derickr Fixed PHP-1010: commandCursor should not require batchSize option to be ...
derickr authored
631 * 32: Cursor command structure is invalid
ea85257 @derickr Add MongoCommandCursor::createFromDocument
derickr authored
632 * 33: cannot iterate twice with command cursors created through createFromDocument
bb1463b @derickr PHP-972: Implement MongoCollection::parallelCollectionScan().
derickr authored
633 * 34: Cursor structure is invalid
af988d2 @bjori Fix error codes
bjori authored
634 * 35: Message size (%d) overflows valid message size (%d) php_mongo_api_get_reply()
635 * 36: request/response mismatch: %d vs %d php_mongo_api_get_reply()
636 * 37: Couldn't finish reading from network
afd2937 @derickr Fixed CS, picked and documented the exception code and rephrased the exc...
derickr authored
637 *
638 * MongoGridFSException:
639 * 0:
640 * 1: There is more data in the stored file than the meta data shows
8cdc6b7 @bjori Fixed PHP-658: Add error codes for GridFSExceptions
bjori authored
641 * 2: Invalid collection prefix (throws Exception, not MongoGridFSException)
642 * 3: Could not open file for reading
643 * 4: Filesize larger then we can handle
644 * 5: Invalid filehandle for a resource
645 * 6: Resource doesn't contain filehandle
646 * 7: Error setting up file for reading
647 * 8: Argument not a file stream or a filename string (throws Exception, not MongoGridFSException)
648 * 9: Error reading file data
649 * 10: Error reading from resource
650 * 11: Can't find uploaded file
651 * 12: tmp_name not found, upload probably failed
652 * 13: tmp_name was not a valid filename
653 * 14: Unable to determin file size
654 * 15: Missing filename
655 * 16: Could not open filename for writing
656 * 17: Could not read chunk
657 * 18: Failed creating file stream
658 * 19: Could not find array key
659 * 20: Chunk larger then chunksize
660 * 21: Unexpected chunk format
6b1deb7 @derickr Moved the error checking to a non-static function.
derickr authored
661 *
662 * MongoResultException:
663 * 1: Unknown error executing command (empty document returned)
664 * 2: Command could not be executed for some reason (exception message tells why)
665 * 1000+: MongoDB server codes
b7158f0 @bjori Don't use 0 for error codes
bjori authored
666 *
667 * MongoWriteConcernException:
668 * 100: <server error message> (server returned no error code, only message)
669 * 101: Unknown error occurred, did not get an error message or code
670 * 102: Got write errors, but don't know how to parse them
671 * 103: Missing 'ok' field in response, don't know what to do
672 * 104: Got write errors, but don't know how to parse them
673 * 105: Got write errors, but don't know how to parse them
674 * (all other error codes are from mongod)
91076ef @bjori Disable Batch API for pre-2.6 & force calling the ctor
bjori authored
675 *
676 * MongoProtocolException:
677 * 1: Current primary does not have a Write API support
4ed3b10 @kchodorow track error codes
kchodorow authored
678 */
28291a9 @bjori Fixed PHP-748: Add modelines
bjori authored
679
680 /*
681 * Local variables:
682 * tab-width: 4
683 * c-basic-offset: 4
684 * End:
685 * vim600: fdm=marker
686 * vim: noet sw=4 ts=4
687 */
Something went wrong with that request. Please try again.