Browse code

- mysql versions < 5.0 do not support MYSQL_DATA_TRUNCATED patch provided by Alfred E. Heggestad closes SER-377

Jan Janak authored on 22/05/2008 13:55:24
Showing 1 changed files
... ...
@@ -1237,6 +1237,8 @@ int my_cmd_next(db_res_t* res)
1237 1237
 		mcmd->next_flag =  mcmd->next_flag<0?-2:2;
1238 1238
 		return 1;
1239 1239
 	}
1240
+	/* MYSQL_DATA_TRUNCATED is only defined in mysql >= 5.0 */
1241
+#if defined MYSQL_DATA_TRUNCATED
1240 1242
 	if (ret == MYSQL_DATA_TRUNCATED) {
1241 1243
 		int i;
1242 1244
 		ERR("mysql: mysql_stmt_fetch, data truncated, fields: %d\n", res->cmd->result_count);
... ...
@@ -1246,11 +1248,13 @@ int my_cmd_next(db_res_t* res)
1246 1248
 					i, *(mcmd->st->bind[i].length), mcmd->st->bind[i].buffer_length);
1247 1249
 			}
1248 1250
 		}
1251
+		ret = 0;
1249 1252
 	}
1253
+#endif
1250 1254
 	if (mcmd->next_flag <= 0) {
1251 1255
 		mcmd->next_flag++;
1252 1256
 	}
1253
-	if (ret != 0 && ret != MYSQL_DATA_TRUNCATED) {
1257
+	if (ret != 0) {
1254 1258
 		ERR("mysql: Error in mysql_stmt_fetch (ret=%d): %s\n", ret, mysql_stmt_error(mcmd->st));
1255 1259
 		return -1;
1256 1260
 	}