Check-in Differences
Not logged in

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

Difference From a8f81849a4393fba To bb5e27dd2e2f5f96

2013-11-17
22:22
supporting .dropgeo with DB prefix check-in: f2e4e26566 user: sandro tags: trunk
2013-11-07
11:10
supporting spatialite_shutdown() check-in: bb5e27dd2e user: sandro tags: trunk
2013-08-30
11:21
implementing -silent (suppressing the welcome message) check-in: a8f81849a4 user: sandro tags: trunk
2013-08-24
08:08
upgrading to automake 1.13.4 check-in: ba4af74587 user: sandro tags: trunk

Changes to config.h.

    98     98   /* Define to 1 if you have the <memory.h> header file. */
    99     99   #define HAVE_MEMORY_H 1
   100    100   
   101    101   /* Define to 1 if you have the `memset' function. */
   102    102   #define HAVE_MEMSET 1
   103    103   
   104    104   /* Define to 1 if you have the `readline' function. */
   105         -/* #undef HAVE_READLINE */
          105  +#define HAVE_READLINE 1
   106    106   
   107    107   /* Define to 1 if you have the `sqrt' function. */
   108    108   /* #undef HAVE_SQRT */
   109    109   
   110    110   /* Define to 1 if `stat' has the bug that it succeeds when given the
   111    111      zero-length file name argument. */
   112    112   /* #undef HAVE_STAT_EMPTY_STRING_BUG */

Changes to exif_loader.c.

  1613   1613   	fprintf (stderr, "sqlite3_close() error: %s\n",
  1614   1614   		 sqlite3_errmsg (handle));
  1615   1615       spatialite_cleanup_ex (cache);
  1616   1616       if (cnt)
  1617   1617   	fprintf (stderr,
  1618   1618   		 "\n\n***   %d EXIF photo%s successfully inserted into the DB\n",
  1619   1619   		 cnt, (cnt > 1) ? "s where" : " was");
         1620  +spatialite_shutdown();
  1620   1621       return 0;
  1621   1622   }

Changes to shell.c.

   115    115    */
   116    116   #define isatty(x) 1
   117    117   #endif
   118    118   
   119    119   /* True if the timer is enabled */
   120    120   static int enableTimer = 0;
   121    121   
          122  +/* sandro 2013-11-07 */
          123  +void *splite_cache = NULL;
          124  +/* end sandro 2013-11-07 */
          125  +
   122    126   /* ctype macros that work with signed characters */
   123    127   #define IsSpace(X)  isspace((unsigned char)X)
   124    128   #define IsDigit(X)  isdigit((unsigned char)X)
   125    129   #define ToLower(X)  (char)tolower((unsigned char)X)
   126    130   
   127    131   #if !defined(_WIN32) && !defined(WIN32) && !defined(_WRS_KERNEL)
   128    132   #include <sys/time.h>
................................................................................
   259    263   static int bail_on_error = 0;
   260    264   
   261    265   /*
   262    266   ** sandro 2013-08-30
   263    267   ** If the following flag is set, no welcome message will be
   264    268   ** printed at all.
   265    269   */
   266         -static int silent = 0;
          270  +static int splite_silent = 0;
   267    271   
   268    272   /*
   269    273   ** Threat stdin as an interactive input if the following variable
   270    274   ** is true.  Otherwise, assume stdin is connected to a file or pipe.
   271    275   */
   272    276   static int stdin_is_interactive = 1;
   273    277   
................................................................................
  2245   2249             shellstaticFunc, 0, 0);
  2246   2250       }
  2247   2251       if( db==0 || SQLITE_OK!=sqlite3_errcode(db) ){
  2248   2252         fprintf(stderr,"Error: unable to open database \"%s\": %s\n", 
  2249   2253             p->zDbFilename, sqlite3_errmsg(db));
  2250   2254         exit(1);
  2251   2255       }
         2256  +    spatialite_init_ex (p->db, splite_cache, (splite_silent == 0) ? 1 : 0);
  2252   2257   #ifndef SQLITE_OMIT_LOAD_EXTENSION
  2253   2258       sqlite3_enable_load_extension(p->db, 1);
  2254   2259   #endif
  2255   2260   
  2256   2261   /* Sandro Furieri 2009-11-08 */
  2257   2262   	  sqlite3_exec (p->db, "PRAGMA foreign_keys = 1", NULL, 0, NULL);
  2258   2263   /* end Sandro Furieri 2008-11-08 */
................................................................................
  2665   2670   	  open_db (p);
  2666   2671         /* creating a DXF parser */
  2667   2672             dxf = gaiaCreateDxfParser (srid, force_dims, prefix, layer_name,
  2668   2673                   special_rings);
  2669   2674             if (dxf == NULL)
  2670   2675                 goto stop_dxf;
  2671   2676         /* attempting to parse the DXF input file */
  2672         -          if (gaiaParseDxfFile (dxf, dxf_path))
         2677  +          if (gaiaParseDxfFile_r (splite_cache, dxf, dxf_path))
  2673   2678             {
  2674   2679         /* loading into the DB */
  2675   2680                 if (!gaiaLoadFromDxfParser (p->db, dxf, mode, append))
  2676   2681                     fprintf (stderr, "DB error while loading: %s\n", dxf_path);
  2677   2682             }
  2678   2683             else
  2679   2684                 fprintf (stderr, "Unable to parse: %s\n", dxf_path);
................................................................................
  4104   4109   int main(int argc, char **argv){
  4105   4110     char *zErrMsg = 0;
  4106   4111     struct callback_data data;
  4107   4112     const char *zInitFile = 0;
  4108   4113     char *zFirstCmd = 0;
  4109   4114     int i;
  4110   4115     int rc = 0;
         4116  +  
         4117  +/* initializing the SpatiaLite's internal cache */
         4118  +  splite_cache = spatialite_alloc_connection ();
  4111   4119   
  4112   4120     if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
  4113   4121       fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
  4114   4122               sqlite3_sourceid(), SQLITE_SOURCE_ID);
  4115   4123       exit(1);
  4116   4124     }
  4117   4125     Argv0 = argv[0];
................................................................................
  4121   4129   ===========================
  4122   4130   registering the SpatiaLite extension
  4123   4131   2013-08-30: supporting "silent mode"
  4124   4132   */
  4125   4133     for(i=1; i<argc && argv[i][0]=='-'; i++){
  4126   4134       char *z = argv[i];
  4127   4135       if( z[1]=='-' ){ z++; }
  4128         -    if( strcmp(z,"-silent")==0 ){ silent = 1;}
         4136  +    if( strcmp(z,"-silent")==0 ){ splite_silent = 1;}
  4129   4137   	}
  4130         -fprintf(stderr, "silent %d %d\n", silent, (silent == 0) ? 1 : 0);
  4131         -    spatialite_init ((silent == 0) ? 1 : 0);
  4132   4138   
  4133   4139     stdin_is_interactive = isatty(0);
  4134   4140   
  4135   4141     /* Make sure we have a valid signal handler early, before anything
  4136   4142     ** else is done.
  4137   4143     */
  4138   4144   #ifdef SIGINT
................................................................................
  4298   4304         data.echoOn = 1;
  4299   4305       }else if( strcmp(z,"-stats")==0 ){
  4300   4306         data.statsOn = 1;
  4301   4307       }else if( strcmp(z,"-bail")==0 ){
  4302   4308         bail_on_error = 1;
  4303   4309       }else if( strcmp(z,"-silent")==0 ){
  4304   4310   /* sandro 2013-08-30 */
  4305         -      silent = 1;
         4311  +      splite_silent = 1;
  4306   4312   /* end sandro */
  4307   4313       }else if( strcmp(z,"-version")==0 ){
  4308   4314         printf("%s %s\n", sqlite3_libversion(), sqlite3_sourceid());
  4309   4315         return 0;
  4310   4316       }else if( strcmp(z,"-interactive")==0 ){
  4311   4317         stdin_is_interactive = 1;
  4312   4318       }else if( strcmp(z,"-batch")==0 ){
................................................................................
  4377   4383         printf(
  4378   4384           "SQLite version %s %.19s\n" 
  4379   4385           "Enter \".help\" for instructions\n"
  4380   4386           "Enter SQL statements terminated with a \";\"\n",
  4381   4387           sqlite3_libversion(), sqlite3_sourceid()
  4382   4388         );
  4383   4389   */
         4390  +     open_db(&data);
  4384   4391        if (isatty (1))
  4385   4392             printf ("SQLite version ......: %s\n",
  4386   4393        sqlite3_libversion ());
  4387   4394        auto_fdo_start (data.db);
  4388   4395        if (isatty (1))
  4389   4396            printf ("Enter \".help\" for instructions\n");
  4390   4397   /* end Sandro Furieri 2008-11-20 */
................................................................................
  4429   4436   
  4430   4437   
  4431   4438   /*
  4432   4439   Sandro Furieri 30 May 2008
  4433   4440   ===========================
  4434   4441   memory cleanup for SpatiaLite extension
  4435   4442   */
  4436         -    sqlite3_reset_auto_extension ();
         4443  +    
         4444  +  spatialite_cleanup_ex (splite_cache);
         4445  +  spatialite_shutdown ();
  4437   4446   
  4438   4447     return rc;
  4439   4448   }

Changes to spatialite_convert.c.

  7023   7023   
  7024   7024   /* closing the DB */
  7025   7025     stop:
  7026   7026       fprintf (stderr, "*** ERROR: conversion failed\n");
  7027   7027     end:
  7028   7028       sqlite3_close (handle);
  7029   7029       spatialite_cleanup_ex (cache);
         7030  +    spatialite_shutdown ();
  7030   7031       return 0;
  7031   7032   }

Changes to spatialite_dxf.c.

   476    476       else if (unlinked_rings)
   477    477   	special_rings = GAIA_DXF_RING_UNLINKED;
   478    478       dxf = gaiaCreateDxfParser (srid, force_dims, prefix, selected_layer,
   479    479   			       special_rings);
   480    480       if (dxf == NULL)
   481    481   	goto stop;
   482    482   /* attempting to parse the DXF input file */
   483         -    if (gaiaParseDxfFile (dxf, dxf_path))
          483  +    if (gaiaParseDxfFile_r (cache, dxf, dxf_path))
   484    484         {
   485    485   	  /* loading into the DB */
   486    486   	  if (!gaiaLoadFromDxfParser (handle, dxf, mode, append))
   487    487   	      fprintf (stderr, "DB error while loading: %s\n", dxf_path);
   488    488         }
   489    489       else
   490    490   	fprintf (stderr, "Unable to parse: %s\n", dxf_path);
................................................................................
   537    537   	  /* closing the DB connection */
   538    538   	  ret = sqlite3_close (handle);
   539    539   	  if (ret != SQLITE_OK)
   540    540   	      fprintf (stderr, "sqlite3_close() error: %s\n",
   541    541   		       sqlite3_errmsg (handle));
   542    542         }
   543    543       spatialite_cleanup_ex (cache);
          544  +    spatialite_shutdown ();
   544    545       return 0;
   545    546   }

Changes to spatialite_gml.c.

  1937   1937   	  sqlite3_close (handle);
  1938   1938   	  handle = disk_db_handle;
  1939   1939   	  printf ("\tIN_MEMORY database succesfully exported\n");
  1940   1940         }
  1941   1941   
  1942   1942       sqlite3_close (handle);
  1943   1943       spatialite_cleanup_ex (cache);
         1944  +    spatialite_shutdown ();
  1944   1945       return 0;
  1945   1946   }

Changes to spatialite_network.c.

  2119   2119         {
  2120   2120   	  do_help ();
  2121   2121   	  return -1;
  2122   2122         }
  2123   2123       validate (path, table, from_column, to_column, cost_column, geom_column,
  2124   2124   	      name_column, oneway_tofrom, oneway_fromto, bidirectional,
  2125   2125   	      out_table, force_creation, a_star_supported);
         2126  +    spatialite_shutdown ();
  2126   2127       return 0;
  2127   2128   }

Changes to spatialite_osm_filter.c.

  1860   1860   
  1861   1861     stop:
  1862   1862       free (mask);
  1863   1863       sqlite3_close (handle);
  1864   1864       spatialite_cleanup_ex (cache);
  1865   1865       if (out != NULL)
  1866   1866   	fclose (out);
         1867  +    spatialite_shutdown ();
  1867   1868       return 0;
  1868   1869   }

Changes to spatialite_osm_map.c.

  2828   2828   	  printf ("\tIN_MEMORY database succesfully exported\n");
  2829   2829         }
  2830   2830   
  2831   2831   /* VACUUMing */
  2832   2832       db_vacuum (handle);
  2833   2833       sqlite3_close (handle);
  2834   2834       spatialite_cleanup_ex (cache);
         2835  +    spatialite_shutdown ();
  2835   2836       return 0;
  2836   2837   }

Changes to spatialite_osm_net.c.

  2743   2743   	  printf ("\tIN_MEMORY database succesfully exported\n");
  2744   2744         }
  2745   2745   /* VACUUMing */
  2746   2746       db_vacuum (handle);
  2747   2747       sqlite3_close (handle);
  2748   2748       spatialite_cleanup_ex (cache);
  2749   2749       free_params (&params);
         2750  +    spatialite_shutdown ();
  2750   2751       return 0;
  2751   2752   }

Changes to spatialite_osm_raw.c.

  1221   1221   	  handle = disk_db_handle;
  1222   1222   	  printf ("\tIN_MEMORY database succesfully exported\n");
  1223   1223         }
  1224   1224   
  1225   1225   /* closing the DB connection */
  1226   1226       sqlite3_close (handle);
  1227   1227       spatialite_cleanup_ex (cache);
         1228  +    spatialite_shutdown ();
  1228   1229       return 0;
  1229   1230   }

Changes to spatialite_tool.c.

   535    535       if (import && in_dbf)
   536    536   	do_import_dbf (db_path, dbf_path, table, charset);
   537    537       if (import && in_shp)
   538    538   	do_import_shp (db_path, shp_path, table, charset, srid, column,
   539    539   		       coerce2d, compressed);
   540    540       if (export)
   541    541   	do_export (db_path, shp_path, table, column, charset, type);
          542  +    spatialite_shutdown ();
   542    543       return 0;
   543    544   }