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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1

/* Define to 1 if you have the `memset' function. */
#define HAVE_MEMSET 1

/* Define to 1 if you have the `readline' function. */
/* #undef HAVE_READLINE */

/* Define to 1 if you have the `sqrt' function. */
/* #undef HAVE_SQRT */

/* Define to 1 if `stat' has the bug that it succeeds when given the
   zero-length file name argument. */
/* #undef HAVE_STAT_EMPTY_STRING_BUG */







|







98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1

/* Define to 1 if you have the `memset' function. */
#define HAVE_MEMSET 1

/* Define to 1 if you have the `readline' function. */
#define HAVE_READLINE 1

/* Define to 1 if you have the `sqrt' function. */
/* #undef HAVE_SQRT */

/* Define to 1 if `stat' has the bug that it succeeds when given the
   zero-length file name argument. */
/* #undef HAVE_STAT_EMPTY_STRING_BUG */

Changes to exif_loader.c.

1613
1614
1615
1616
1617
1618
1619

1620
1621
	fprintf (stderr, "sqlite3_close() error: %s\n",
		 sqlite3_errmsg (handle));
    spatialite_cleanup_ex (cache);
    if (cnt)
	fprintf (stderr,
		 "\n\n***   %d EXIF photo%s successfully inserted into the DB\n",
		 cnt, (cnt > 1) ? "s where" : " was");

    return 0;
}







>


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

Changes to shell.c.

115
116
117
118
119
120
121




122
123
124
125
126
127
128
...
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
....
2245
2246
2247
2248
2249
2250
2251

2252
2253
2254
2255
2256
2257
2258
....
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
....
4104
4105
4106
4107
4108
4109
4110



4111
4112
4113
4114
4115
4116
4117
....
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
....
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
....
4377
4378
4379
4380
4381
4382
4383

4384
4385
4386
4387
4388
4389
4390
....
4429
4430
4431
4432
4433
4434
4435
4436


4437
4438
4439
 */
#define isatty(x) 1
#endif

/* True if the timer is enabled */
static int enableTimer = 0;





/* ctype macros that work with signed characters */
#define IsSpace(X)  isspace((unsigned char)X)
#define IsDigit(X)  isdigit((unsigned char)X)
#define ToLower(X)  (char)tolower((unsigned char)X)

#if !defined(_WIN32) && !defined(WIN32) && !defined(_WRS_KERNEL)
#include <sys/time.h>
................................................................................
static int bail_on_error = 0;

/*
** sandro 2013-08-30
** If the following flag is set, no welcome message will be
** printed at all.
*/
static int silent = 0;

/*
** Threat stdin as an interactive input if the following variable
** is true.  Otherwise, assume stdin is connected to a file or pipe.
*/
static int stdin_is_interactive = 1;

................................................................................
          shellstaticFunc, 0, 0);
    }
    if( db==0 || SQLITE_OK!=sqlite3_errcode(db) ){
      fprintf(stderr,"Error: unable to open database \"%s\": %s\n", 
          p->zDbFilename, sqlite3_errmsg(db));
      exit(1);
    }

#ifndef SQLITE_OMIT_LOAD_EXTENSION
    sqlite3_enable_load_extension(p->db, 1);
#endif

/* Sandro Furieri 2009-11-08 */
	  sqlite3_exec (p->db, "PRAGMA foreign_keys = 1", NULL, 0, NULL);
/* end Sandro Furieri 2008-11-08 */
................................................................................
	  open_db (p);
      /* creating a DXF parser */
          dxf = gaiaCreateDxfParser (srid, force_dims, prefix, layer_name,
                special_rings);
          if (dxf == NULL)
              goto stop_dxf;
      /* attempting to parse the DXF input file */
          if (gaiaParseDxfFile (dxf, dxf_path))
          {
      /* loading into the DB */
              if (!gaiaLoadFromDxfParser (p->db, dxf, mode, append))
                  fprintf (stderr, "DB error while loading: %s\n", dxf_path);
          }
          else
              fprintf (stderr, "Unable to parse: %s\n", dxf_path);
................................................................................
int main(int argc, char **argv){
  char *zErrMsg = 0;
  struct callback_data data;
  const char *zInitFile = 0;
  char *zFirstCmd = 0;
  int i;
  int rc = 0;




  if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
    fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
            sqlite3_sourceid(), SQLITE_SOURCE_ID);
    exit(1);
  }
  Argv0 = argv[0];
................................................................................
===========================
registering the SpatiaLite extension
2013-08-30: supporting "silent mode"
*/
  for(i=1; i<argc && argv[i][0]=='-'; i++){
    char *z = argv[i];
    if( z[1]=='-' ){ z++; }
    if( strcmp(z,"-silent")==0 ){ silent = 1;}
	}
fprintf(stderr, "silent %d %d\n", silent, (silent == 0) ? 1 : 0);
    spatialite_init ((silent == 0) ? 1 : 0);

  stdin_is_interactive = isatty(0);

  /* Make sure we have a valid signal handler early, before anything
  ** else is done.
  */
#ifdef SIGINT
................................................................................
      data.echoOn = 1;
    }else if( strcmp(z,"-stats")==0 ){
      data.statsOn = 1;
    }else if( strcmp(z,"-bail")==0 ){
      bail_on_error = 1;
    }else if( strcmp(z,"-silent")==0 ){
/* sandro 2013-08-30 */
      silent = 1;
/* end sandro */
    }else if( strcmp(z,"-version")==0 ){
      printf("%s %s\n", sqlite3_libversion(), sqlite3_sourceid());
      return 0;
    }else if( strcmp(z,"-interactive")==0 ){
      stdin_is_interactive = 1;
    }else if( strcmp(z,"-batch")==0 ){
................................................................................
      printf(
        "SQLite version %s %.19s\n" 
        "Enter \".help\" for instructions\n"
        "Enter SQL statements terminated with a \";\"\n",
        sqlite3_libversion(), sqlite3_sourceid()
      );
*/

     if (isatty (1))
          printf ("SQLite version ......: %s\n",
     sqlite3_libversion ());
     auto_fdo_start (data.db);
     if (isatty (1))
         printf ("Enter \".help\" for instructions\n");
/* end Sandro Furieri 2008-11-20 */
................................................................................


/*
Sandro Furieri 30 May 2008
===========================
memory cleanup for SpatiaLite extension
*/
    sqlite3_reset_auto_extension ();



  return rc;
}







>
>
>
>







 







|







 







>







 







|







 







>
>
>







 







|

<
<







 







|







 







>







 







|
>
>



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
...
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
....
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
....
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
....
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
....
4129
4130
4131
4132
4133
4134
4135
4136
4137


4138
4139
4140
4141
4142
4143
4144
....
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
....
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
....
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
 */
#define isatty(x) 1
#endif

/* True if the timer is enabled */
static int enableTimer = 0;

/* sandro 2013-11-07 */
void *splite_cache = NULL;
/* end sandro 2013-11-07 */

/* ctype macros that work with signed characters */
#define IsSpace(X)  isspace((unsigned char)X)
#define IsDigit(X)  isdigit((unsigned char)X)
#define ToLower(X)  (char)tolower((unsigned char)X)

#if !defined(_WIN32) && !defined(WIN32) && !defined(_WRS_KERNEL)
#include <sys/time.h>
................................................................................
static int bail_on_error = 0;

/*
** sandro 2013-08-30
** If the following flag is set, no welcome message will be
** printed at all.
*/
static int splite_silent = 0;

/*
** Threat stdin as an interactive input if the following variable
** is true.  Otherwise, assume stdin is connected to a file or pipe.
*/
static int stdin_is_interactive = 1;

................................................................................
          shellstaticFunc, 0, 0);
    }
    if( db==0 || SQLITE_OK!=sqlite3_errcode(db) ){
      fprintf(stderr,"Error: unable to open database \"%s\": %s\n", 
          p->zDbFilename, sqlite3_errmsg(db));
      exit(1);
    }
    spatialite_init_ex (p->db, splite_cache, (splite_silent == 0) ? 1 : 0);
#ifndef SQLITE_OMIT_LOAD_EXTENSION
    sqlite3_enable_load_extension(p->db, 1);
#endif

/* Sandro Furieri 2009-11-08 */
	  sqlite3_exec (p->db, "PRAGMA foreign_keys = 1", NULL, 0, NULL);
/* end Sandro Furieri 2008-11-08 */
................................................................................
	  open_db (p);
      /* creating a DXF parser */
          dxf = gaiaCreateDxfParser (srid, force_dims, prefix, layer_name,
                special_rings);
          if (dxf == NULL)
              goto stop_dxf;
      /* attempting to parse the DXF input file */
          if (gaiaParseDxfFile_r (splite_cache, dxf, dxf_path))
          {
      /* loading into the DB */
              if (!gaiaLoadFromDxfParser (p->db, dxf, mode, append))
                  fprintf (stderr, "DB error while loading: %s\n", dxf_path);
          }
          else
              fprintf (stderr, "Unable to parse: %s\n", dxf_path);
................................................................................
int main(int argc, char **argv){
  char *zErrMsg = 0;
  struct callback_data data;
  const char *zInitFile = 0;
  char *zFirstCmd = 0;
  int i;
  int rc = 0;
  
/* initializing the SpatiaLite's internal cache */
  splite_cache = spatialite_alloc_connection ();

  if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
    fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
            sqlite3_sourceid(), SQLITE_SOURCE_ID);
    exit(1);
  }
  Argv0 = argv[0];
................................................................................
===========================
registering the SpatiaLite extension
2013-08-30: supporting "silent mode"
*/
  for(i=1; i<argc && argv[i][0]=='-'; i++){
    char *z = argv[i];
    if( z[1]=='-' ){ z++; }
    if( strcmp(z,"-silent")==0 ){ splite_silent = 1;}
	}



  stdin_is_interactive = isatty(0);

  /* Make sure we have a valid signal handler early, before anything
  ** else is done.
  */
#ifdef SIGINT
................................................................................
      data.echoOn = 1;
    }else if( strcmp(z,"-stats")==0 ){
      data.statsOn = 1;
    }else if( strcmp(z,"-bail")==0 ){
      bail_on_error = 1;
    }else if( strcmp(z,"-silent")==0 ){
/* sandro 2013-08-30 */
      splite_silent = 1;
/* end sandro */
    }else if( strcmp(z,"-version")==0 ){
      printf("%s %s\n", sqlite3_libversion(), sqlite3_sourceid());
      return 0;
    }else if( strcmp(z,"-interactive")==0 ){
      stdin_is_interactive = 1;
    }else if( strcmp(z,"-batch")==0 ){
................................................................................
      printf(
        "SQLite version %s %.19s\n" 
        "Enter \".help\" for instructions\n"
        "Enter SQL statements terminated with a \";\"\n",
        sqlite3_libversion(), sqlite3_sourceid()
      );
*/
     open_db(&data);
     if (isatty (1))
          printf ("SQLite version ......: %s\n",
     sqlite3_libversion ());
     auto_fdo_start (data.db);
     if (isatty (1))
         printf ("Enter \".help\" for instructions\n");
/* end Sandro Furieri 2008-11-20 */
................................................................................


/*
Sandro Furieri 30 May 2008
===========================
memory cleanup for SpatiaLite extension
*/
    
  spatialite_cleanup_ex (splite_cache);
  spatialite_shutdown ();

  return rc;
}

Changes to spatialite_convert.c.

7023
7024
7025
7026
7027
7028
7029

7030
7031

/* closing the DB */
  stop:
    fprintf (stderr, "*** ERROR: conversion failed\n");
  end:
    sqlite3_close (handle);
    spatialite_cleanup_ex (cache);

    return 0;
}







>


7023
7024
7025
7026
7027
7028
7029
7030
7031
7032

/* closing the DB */
  stop:
    fprintf (stderr, "*** ERROR: conversion failed\n");
  end:
    sqlite3_close (handle);
    spatialite_cleanup_ex (cache);
    spatialite_shutdown ();
    return 0;
}

Changes to spatialite_dxf.c.

476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
...
537
538
539
540
541
542
543

544
545
    else if (unlinked_rings)
	special_rings = GAIA_DXF_RING_UNLINKED;
    dxf = gaiaCreateDxfParser (srid, force_dims, prefix, selected_layer,
			       special_rings);
    if (dxf == NULL)
	goto stop;
/* attempting to parse the DXF input file */
    if (gaiaParseDxfFile (dxf, dxf_path))
      {
	  /* loading into the DB */
	  if (!gaiaLoadFromDxfParser (handle, dxf, mode, append))
	      fprintf (stderr, "DB error while loading: %s\n", dxf_path);
      }
    else
	fprintf (stderr, "Unable to parse: %s\n", dxf_path);
................................................................................
	  /* closing the DB connection */
	  ret = sqlite3_close (handle);
	  if (ret != SQLITE_OK)
	      fprintf (stderr, "sqlite3_close() error: %s\n",
		       sqlite3_errmsg (handle));
      }
    spatialite_cleanup_ex (cache);

    return 0;
}







|







 







>


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

Changes to spatialite_gml.c.

1937
1938
1939
1940
1941
1942
1943

1944
1945
	  sqlite3_close (handle);
	  handle = disk_db_handle;
	  printf ("\tIN_MEMORY database succesfully exported\n");
      }

    sqlite3_close (handle);
    spatialite_cleanup_ex (cache);

    return 0;
}







>


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

    sqlite3_close (handle);
    spatialite_cleanup_ex (cache);
    spatialite_shutdown ();
    return 0;
}

Changes to spatialite_network.c.

2119
2120
2121
2122
2123
2124
2125

2126
2127
      {
	  do_help ();
	  return -1;
      }
    validate (path, table, from_column, to_column, cost_column, geom_column,
	      name_column, oneway_tofrom, oneway_fromto, bidirectional,
	      out_table, force_creation, a_star_supported);

    return 0;
}







>


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

Changes to spatialite_osm_filter.c.

1860
1861
1862
1863
1864
1865
1866

1867
1868

  stop:
    free (mask);
    sqlite3_close (handle);
    spatialite_cleanup_ex (cache);
    if (out != NULL)
	fclose (out);

    return 0;
}







>


1860
1861
1862
1863
1864
1865
1866
1867
1868
1869

  stop:
    free (mask);
    sqlite3_close (handle);
    spatialite_cleanup_ex (cache);
    if (out != NULL)
	fclose (out);
    spatialite_shutdown ();
    return 0;
}

Changes to spatialite_osm_map.c.

2828
2829
2830
2831
2832
2833
2834

2835
2836
	  printf ("\tIN_MEMORY database succesfully exported\n");
      }

/* VACUUMing */
    db_vacuum (handle);
    sqlite3_close (handle);
    spatialite_cleanup_ex (cache);

    return 0;
}







>


2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
	  printf ("\tIN_MEMORY database succesfully exported\n");
      }

/* VACUUMing */
    db_vacuum (handle);
    sqlite3_close (handle);
    spatialite_cleanup_ex (cache);
    spatialite_shutdown ();
    return 0;
}

Changes to spatialite_osm_net.c.

2743
2744
2745
2746
2747
2748
2749

2750
2751
	  printf ("\tIN_MEMORY database succesfully exported\n");
      }
/* VACUUMing */
    db_vacuum (handle);
    sqlite3_close (handle);
    spatialite_cleanup_ex (cache);
    free_params (&params);

    return 0;
}







>


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

Changes to spatialite_osm_raw.c.

1221
1222
1223
1224
1225
1226
1227

1228
1229
	  handle = disk_db_handle;
	  printf ("\tIN_MEMORY database succesfully exported\n");
      }

/* closing the DB connection */
    sqlite3_close (handle);
    spatialite_cleanup_ex (cache);

    return 0;
}







>


1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
	  handle = disk_db_handle;
	  printf ("\tIN_MEMORY database succesfully exported\n");
      }

/* closing the DB connection */
    sqlite3_close (handle);
    spatialite_cleanup_ex (cache);
    spatialite_shutdown ();
    return 0;
}

Changes to spatialite_tool.c.

535
536
537
538
539
540
541

542
543
    if (import && in_dbf)
	do_import_dbf (db_path, dbf_path, table, charset);
    if (import && in_shp)
	do_import_shp (db_path, shp_path, table, charset, srid, column,
		       coerce2d, compressed);
    if (export)
	do_export (db_path, shp_path, table, column, charset, type);

    return 0;
}







>


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