Check-in [90180e065d]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1:90180e065dfdd8fa624f9e2c8f5ebf8302dd64e5
Date: 2019-02-10 19:03:55
User: sandro
Comment:fixing a bug hanging VirtualKNN tests
Tags And Properties
Context
2019-02-14
09:59
[55f7c3ed61] implementing ReCreateStylingTriggers(), ReCreateRasterCoveragesTriggers(), ReCreateVectorCoveragesTriggers() and ReCreateTopoTriggers() (user: sandro, tags: trunk)
2019-02-10
19:03
[90180e065d] fixing a bug hanging VirtualKNN tests (user: sandro, tags: trunk)
2019-02-08
18:27
[f9ca692b4d] modifying the signature of LongLatToDMS() so to accept a third argument for controlling how many decimal digit must be used for representing Seconds (user: sandro, tags: trunk)
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/spatialite/virtualknn.c.

   236    236       ctx->maxx = -DBL_MAX;
   237    237       ctx->maxy = -DBL_MAX;
   238    238       ctx->min_dist = DBL_MAX;
   239    239       ctx->rtree_minx = -DBL_MAX;
   240    240       ctx->rtree_miny = -DBL_MAX;
   241    241       ctx->rtree_maxx = DBL_MAX;
   242    242       ctx->rtree_maxy = DBL_MAX;
          243  +    ctx->level = 0;
   243    244       ctx->current_level = 0;
   244    245       ctx->max_items = 0;
   245    246       ctx->knn_array = NULL;
   246    247       ctx->curr_items = 0;
   247    248       ctx->rtree_count = 0;
   248    249       ctx->max_dist = -DBL_MAX;
   249    250   }

Changes to test/check_virtualknn.c.

   438    438       sqlite3 *db_handle = NULL;
   439    439       int ret;
   440    440       char *err_msg = NULL;
   441    441       void *cache = spatialite_alloc_connection ();
   442    442   
   443    443       if (argc > 1 || argv[0] == NULL)
   444    444   	argc = 1;		/* silencing stupid compiler warnings */
   445         -/* cazzembaum */
   446         -return 0;
   447    445   
   448    446       ret =
   449    447   	sqlite3_open_v2 (":memory:", &db_handle,
   450    448   			 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
   451    449       if (ret != SQLITE_OK)
   452    450         {
   453    451   	  fprintf (stderr, "cannot open in-memory db: %s\n",
................................................................................
   468    466       if (ret != SQLITE_OK)
   469    467         {
   470    468   	  fprintf (stderr, "InitSpatialMetadata() error: %s\n", err_msg);
   471    469   	  sqlite3_free (err_msg);
   472    470   	  sqlite3_close (db_handle);
   473    471   	  return -2;
   474    472         }
   475         -fprintf(stderr, "********** populate\n");
   476    473   
   477    474   /* Creating and populating the test table */
   478    475       ret = create_table (db_handle);
   479    476       if (!ret)
   480    477         {
   481    478   	  sqlite3_close (db_handle);
   482    479   	  return -3;
................................................................................
   483    480         }
   484    481       ret = populate_table (db_handle);
   485    482       if (!ret)
   486    483         {
   487    484   	  sqlite3_close (db_handle);
   488    485   	  return -4;
   489    486         }
   490         -fprintf(stderr, "** create1\n");
          487  +/* adding a second geometry column */
          488  +    ret = add_second_geom (db_handle);
          489  +    if (!ret)
          490  +      {
          491  +	  fprintf (stderr, "Add Second Geometry: unexpected failure !!!\n");
          492  +	  sqlite3_close (db_handle);
          493  +	  return -5;
          494  +      }
   491    495   
   492    496   /* Creating the VirtualKNN table */
   493    497       ret = create_knn (db_handle);
   494    498       if (ret)
   495    499         {
   496    500   	  fprintf (stderr, "CREATE VIRTUAL TABLE knn: expected failure !!!\n");
   497    501   	  sqlite3_close (db_handle);
   498         -	  return -5;
          502  +	  return -6;
   499    503         }
   500         -fprintf(stderr, "** knn-1\n");
   501    504   
   502    505   /* Testing KNN - #1 */
   503    506       ret = test_knn (db_handle, 0);
   504    507       if (!ret)
   505    508         {
   506    509   	  fprintf (stderr, "Check KNN #1: unexpected failure\n");
   507    510   	  sqlite3_close (db_handle);
   508         -	  return -6;
          511  +	  return -7;
   509    512         }
   510         -fprintf(stderr, "** knn-2\n");
   511    513   
   512    514   /* Testing KNN - #2 */
   513    515       ret = test_knn (db_handle, 1);
   514    516       if (!ret)
   515    517         {
   516    518   	  fprintf (stderr, "Check KNN #2: unexpected failure\n");
   517    519   	  sqlite3_close (db_handle);
   518         -	  return -7;
          520  +	  return -8;
   519    521         }
   520         -fprintf(stderr, "** knn-3\n");
   521    522   
   522    523   /* Testing KNN - #3 */
   523    524       ret = test_knn (db_handle, 2);
   524    525       if (ret)
   525    526         {
   526    527   	  fprintf (stderr, "Check KNN #3: unexpected success\n");
   527    528   	  sqlite3_close (db_handle);
   528         -	  return -8;
          529  +	  return -9;
   529    530         }
   530         -fprintf(stderr, "** View\n");
   531    531   
   532    532   /* creating a first SpatialView */
   533    533       ret = create_spatial_view_1 (db_handle);
   534    534       if (!ret)
   535    535         {
   536    536   	  fprintf (stderr, "Create Spatial View #1: unexpected failure !!!\n");
   537    537   	  sqlite3_close (db_handle);
   538         -	  return -9;
          538  +	  return -10;
   539    539         }
   540         -fprintf(stderr, "** knn-4\n");
   541    540   
   542    541   /* Testing KNN - #4 */
   543    542       ret = test_knn (db_handle, 5);
   544    543       if (!ret)
   545    544         {
   546    545   	  fprintf (stderr, "Check KNN #4: unexpected failure\n");
   547    546   	  sqlite3_close (db_handle);
   548         -	  return -10;
          547  +	  return -11;
   549    548         }
   550         -fprintf(stderr, "** knn-5\n");
   551    549   
   552    550   /* Testing KNN - #5 */
   553    551       ret = test_knn (db_handle, 7);
   554    552       if (!ret)
   555    553         {
   556    554   	  fprintf (stderr, "Check KNN #5: unexpected failure\n");
   557    555   	  sqlite3_close (db_handle);
   558         -	  return -11;
   559         -      }
   560         -fprintf(stderr, "** second\n");
   561         -
   562         -/* adding a second geometry column */
   563         -    ret = add_second_geom (db_handle);
   564         -    if (!ret)
   565         -      {
   566         -	  fprintf (stderr, "Add Second Geometry: unexpected failure !!!\n");
   567         -	  sqlite3_close (db_handle);
   568    556   	  return -12;
   569    557         }
   570         -fprintf(stderr, "** knn-6\n");
   571    558   
   572    559   /* Testing KNN - #6 */
   573    560       ret = test_knn (db_handle, 3);
   574    561       if (ret)
   575    562         {
   576    563   	  fprintf (stderr, "Check KNN #6: unexpected success\n");
   577    564   	  sqlite3_close (db_handle);
   578    565   	  return -13;
   579    566         }
   580         -fprintf(stderr, "** knn-7\n");
   581    567   
   582    568   /* Testing KNN - #7 */
   583    569       ret = test_knn (db_handle, 1);
   584    570       if (!ret)
   585    571         {
   586    572   	  fprintf (stderr, "Check KNN #7: unexpected failure\n");
   587    573   	  sqlite3_close (db_handle);
   588    574   	  return -14;
   589    575         }
   590         -fprintf(stderr, "** knn-8\n");
   591    576   
   592    577   /* Testing KNN - #8 */
   593    578       ret = test_knn (db_handle, 4);
   594    579       if (ret)
   595    580         {
   596    581   	  fprintf (stderr, "Check KNN #8: unexpected success\n");
   597    582   	  sqlite3_close (db_handle);
   598    583   	  return -15;
   599    584         }
   600         -fprintf(stderr, "** spindex\n");
   601    585   
   602    586   /* creating a second SpatialIndex */
   603    587       ret = add_second_rtree (db_handle);
   604    588       if (!ret)
   605    589         {
   606    590   	  fprintf (stderr,
   607    591   		   "Add Second Spatial Index: unexpected failure !!!\n");
   608    592   	  sqlite3_close (db_handle);
   609    593   	  return -16;
   610    594         }
   611         -fprintf(stderr, "** knn-9\n");
   612    595   
   613    596   /* Testing KNN - #9 */
   614    597       ret = test_knn (db_handle, 4);
   615    598       if (!ret)
   616    599         {
   617    600   	  fprintf (stderr, "Check KNN #9: unexpected failure\n");
   618    601   	  sqlite3_close (db_handle);
   619    602   	  return -17;
   620    603         }
   621         -fprintf(stderr, "** secondView\n");
   622    604   
   623    605   /* creating a second SpatialView */
   624    606       ret = create_spatial_view_2 (db_handle);
   625    607       if (!ret)
   626    608         {
   627    609   	  fprintf (stderr, "Create Spatial View #2: unexpected failure !!!\n");
   628    610   	  sqlite3_close (db_handle);
   629    611   	  return -18;
   630    612         }
   631         -fprintf(stderr, "** knn-10\n");
   632    613   
   633    614   /* Testing KNN - #10 */
   634    615       ret = test_knn (db_handle, 6);
   635    616       if (!ret)
   636    617         {
   637    618   	  fprintf (stderr, "Check KNN #10: unexpected failure\n");
   638    619   	  sqlite3_close (db_handle);
   639    620   	  return -19;
   640    621         }
   641         -fprintf(stderr, "** end\n");
   642    622   
   643    623   #endif /* end KNN conditional */
   644    624   #endif /* end GEOS conditional */
   645    625   
   646    626       sqlite3_close (db_handle);
   647    627       spatialite_cleanup_ex (cache);
   648    628       spatialite_shutdown ();
   649    629   
   650    630       return 0;
   651    631   }