Skip to content

Commit 736c048

Browse files
committed
time capabilities: fix issue when no extent supplied
1 parent 3049def commit 736c048

File tree

1 file changed

+29
-35
lines changed

1 file changed

+29
-35
lines changed

lib/dimension.c

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@
3535
#include <time.h>
3636
#ifdef USE_SQLITE
3737
#include <sqlite3.h>
38-
#include <apr_reslist.h>
39-
#include <apr_hash.h>
40-
#ifdef APR_HAS_THREADS
41-
#include <apr_thread_mutex.h>
42-
#endif
38+
#include <float.h>
4339
#endif
4440

4541

@@ -526,41 +522,39 @@ static void _bind_sqlite_timedimension_params(mapcache_context *ctx, sqlite3_stm
526522
}
527523
}
528524

529-
if(extent) {
530-
paramidx = sqlite3_bind_parameter_index(stmt, ":minx");
531-
if (paramidx) {
532-
ret = sqlite3_bind_double(stmt, paramidx, extent->minx);
533-
if(ret != SQLITE_OK) {
534-
ctx->set_error(ctx,400, "failed to bind :minx %s", sqlite3_errmsg(handle));
535-
return;
536-
}
525+
paramidx = sqlite3_bind_parameter_index(stmt, ":minx");
526+
if (paramidx) {
527+
ret = sqlite3_bind_double(stmt, paramidx, extent?extent->minx:-DBL_MAX);
528+
if(ret != SQLITE_OK) {
529+
ctx->set_error(ctx,400, "failed to bind :minx %s", sqlite3_errmsg(handle));
530+
return;
537531
}
538-
paramidx = sqlite3_bind_parameter_index(stmt, ":miny");
539-
if (paramidx) {
540-
ret = sqlite3_bind_double(stmt, paramidx, extent->miny);
541-
if(ret != SQLITE_OK) {
542-
ctx->set_error(ctx,400, "failed to bind :miny %s", sqlite3_errmsg(handle));
543-
return;
544-
}
532+
}
533+
paramidx = sqlite3_bind_parameter_index(stmt, ":miny");
534+
if (paramidx) {
535+
ret = sqlite3_bind_double(stmt, paramidx, extent?extent->miny:-DBL_MAX);
536+
if(ret != SQLITE_OK) {
537+
ctx->set_error(ctx,400, "failed to bind :miny %s", sqlite3_errmsg(handle));
538+
return;
545539
}
546-
paramidx = sqlite3_bind_parameter_index(stmt, ":maxx");
547-
if (paramidx) {
548-
ret = sqlite3_bind_double(stmt, paramidx, extent->maxx);
549-
if(ret != SQLITE_OK) {
550-
ctx->set_error(ctx,400, "failed to bind :maxx %s", sqlite3_errmsg(handle));
551-
return;
552-
}
540+
}
541+
paramidx = sqlite3_bind_parameter_index(stmt, ":maxx");
542+
if (paramidx) {
543+
ret = sqlite3_bind_double(stmt, paramidx, extent?extent->maxx:DBL_MAX);
544+
if(ret != SQLITE_OK) {
545+
ctx->set_error(ctx,400, "failed to bind :maxx %s", sqlite3_errmsg(handle));
546+
return;
553547
}
554-
paramidx = sqlite3_bind_parameter_index(stmt, ":maxy");
555-
if (paramidx) {
556-
ret = sqlite3_bind_double(stmt, paramidx, extent->maxy);
557-
if(ret != SQLITE_OK) {
558-
ctx->set_error(ctx,400, "failed to bind :maxy %s", sqlite3_errmsg(handle));
559-
return;
560-
}
548+
}
549+
paramidx = sqlite3_bind_parameter_index(stmt, ":maxy");
550+
if (paramidx) {
551+
ret = sqlite3_bind_double(stmt, paramidx, extent?extent->maxy:DBL_MAX);
552+
if(ret != SQLITE_OK) {
553+
ctx->set_error(ctx,400, "failed to bind :maxy %s", sqlite3_errmsg(handle));
554+
return;
561555
}
562556
}
563-
557+
564558
paramidx = sqlite3_bind_parameter_index(stmt, ":start_timestamp");
565559
if (paramidx) {
566560
ret = sqlite3_bind_int64(stmt, paramidx, start);

0 commit comments

Comments
 (0)