Browse code

- test for db_first and db_next functions only if the driver exports db_get

Jan Janak authored on 27/05/2008 11:55:36
Showing 1 changed files
... ...
@@ -140,23 +140,23 @@ db_cmd_t* db_cmd(enum db_cmd_type type, db_ctx_t* ctx, char* table,
140 140
 			}
141 141
 		}
142 142
 
143
-		r = db_drv_func((void*)(&newp->first[i]), &con->uri->scheme, "db_first");
144
-		if (r < 0) goto err;
145
-		if (r > 0) {
146
-			ERR("DB driver %.*s does not implement mandatory db_first function\n",
147
-				con->uri->scheme.len, ZSW(con->uri->scheme.s));
148
-			goto err;
149
-		}
150
-
151
-		r = db_drv_func((void*)(&newp->next[i]), &con->uri->scheme, "db_next");
152
-		if (r < 0) goto err;
153
-		if (r > 0) {
154
-			ERR("DB driver %.*s does not implement mandatory db_next function\n",
155
-				con->uri->scheme.len, ZSW(con->uri->scheme.s));
156
-			goto err;
143
+		if (type == DB_GET) {
144
+			r = db_drv_func((void*)(&newp->first[i]), &con->uri->scheme, "db_first");
145
+			if (r < 0) goto err;
146
+			if (r > 0) {
147
+				ERR("DB driver %.*s does not implement mandatory db_first function\n",
148
+					con->uri->scheme.len, ZSW(con->uri->scheme.s));
149
+				goto err;
150
+			}
151
+			
152
+			r = db_drv_func((void*)(&newp->next[i]), &con->uri->scheme, "db_next");
153
+			if (r < 0) goto err;
154
+			if (r > 0) {
155
+				ERR("DB driver %.*s does not implement mandatory db_next function\n",
156
+					con->uri->scheme.len, ZSW(con->uri->scheme.s));
157
+				goto err;
158
+			}
157 159
 		}
158
-
159
-
160 160
 	}
161 161
     return newp;
162 162