Check-in [e38bdcfea5]
Not logged in

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

Overview
Comment:implementing GetDbObjectScope() and Pause()
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e38bdcfea5c42932ebe4264b371cf244e8f96e10
User & Date: sandro 2019-05-29 09:12:00
Context
2019-07-05
13:01
using a second DB connection on StoredProc_Execute check-in: 7dcf78e2d0 user: sandro tags: trunk
2019-05-29
09:12
implementing GetDbObjectScope() and Pause() check-in: e38bdcfea5 user: sandro tags: trunk
2019-05-15
07:57
adding missing testcases check-in: 30a0ab420d user: sandro tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to spatialite-sql-latest.html.

2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
....
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
....
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
....
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
....
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
....
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
....
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
....
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
....
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
....
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
....
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
....
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
....
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
....
6492
6493
6494
6495
6496
6497
6498




















6499
6500
6501
6502
6503
6504
6505
....
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
....
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
				<th bgcolor="#d0d0d0">Syntax</th>
				<th bgcolor="#d0d0d0">OGC<br>defined</th>
				<th bgcolor="#d0d0d0">required<br>module</th>
				<th bgcolor="#d0d0d0">Summary</th></tr>
			<tr><td><b>Transform</b></td>
				<td>Transform( geom <i>Geometry</i> , newSRID <i>Integer</i> ) : <i>Geometry</i><hr>
					ST_Transform( geom <i>Geometry</i> , newSRID <i>Integer</i> ) : <i>Geometry</i><hr>
					Transform( geom <i>Geometry</i> , newSRID <i>Integer</i> , area_of_use <i>Geometry</i></i> ) : <i>Geometry</i><hr>
					ST_Transform( geom <i>Geometry</i> , newSRID <i>Integer</i> , area_of_use <i>Geometry</i></i> ) : <i>Geometry</i><hr>
					Transform( geom <i>Geometry</i> , newSRID <i>Integer</i> , area_of_use <i>Geometry</i></i> , proj_string_from <i>Text</i> ) : <i>Geometry</i><hr>
					ST_Transform( geom <i>Geometry</i> , newSRID <i>Integer</i> , area_of_use <i>Geometry</i></i> , proj_string_from <i>Text</i> ) : <i>Geometry</i><hr>
					Transform( geom <i>Geometry</i> , newSRID <i>Integer</i> , area_of_use <i>Geometry</i></i> , proj_string_from <i>Text</i> , proj_string_to <i>Text</i> ) : <i>Geometry</i><hr>
					ST_Transform( geom <i>Geometry</i> , newSRID <i>Integer</i> , area_of_use <i>Geometry</i></i> , proj_string_from <i>Text</i> , proj_string_to <i>Text</i> ) : <i>Geometry</i></td>
				<td></td>
				<td align="center" bgcolor="#d0d0f0">PROJ</td>
				<td>return a geometric object obtained by reprojecting coordinates into the Reference System identified by newSRID<hr>
				    All the following optional arguments are available only when SpatiaLite is built on the top of <b>PROJ.6</b> (or any later version):
				    <ul>
						<li><b>area_of_use</b>: the BBOX of this Geometry (always required to be in <i>SRID=4326</i>) will be possibly used by PROJ.6 in order to optimize the transformation as much as possible.<br>
						    may be eventually <b>NULL</b> (<i>default setting</i>).</li>
						<li><b>proj_string_from</b>: an user defined text string accepted by PROJ.6 identifying the <b><i>origin CRS</i></b> of the transformation.</li>
						<li><b>proj_string_to</b>: an user defined text string accepted by PROJ.6 identifying the <b><i>destination CRS</i></b> of the transformation.
						<li><b><u><i>Interpretation</i></u></b>:</li>
						<ul>
							<li>if both <b><i>proj_string_from</i></b> and <b><i>proj_string_to</i></b> are <b>NULL</b> (<i>default setting</i>) then PROJ.6 will be left free to choose the best possible
							    transformation between the origin and the destination CRSes.</li>
							<li>if both <b><i>proj_string_from</i></b> and <b><i>proj_string_to</i></b> are instead explicitly set then PROJ.6 will be constrained to identify the origin and destination
								CRSes accordingly to the received string values. Valid CRS strings accepted by PROJ.6 can be:
								<ul>
									<li>a <b>proj-string</b> as e.g. <b><i>+proj=longlat +datum=WGS84 +no_defs</i></b></li>
................................................................................
		<tr><td><b>SE_RegisterVectorStyle</b></td>
				<td>SE_RegisterVectorStyle( style <i>BLOB</i> ) : <i>Integer</i></td>
				<td></td>
				<td align="center" bgcolor="#99d099">libxml2</td>
				<td>Inserts a new <b>Vector Style</b> definition.
				<ul>
					<li><b>style</b> is expected to be an XmlBLOB containing a valid SLD/SE Style of the Vector type.<br>
					If <b>CreatedStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.<br>
					The registered Style will be identified either by its unique <b>Style ID</b> or by its <b>Style Name</b> automatically retrieved from SLD/SE XML.</li>
				</ul><hr>
the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be
				returned on invalid arguments.</td></tr>
		<tr><td><b>SE_UnregisterVectorStyle</b></td>
				<td>SE_UnregisterVectorStyle( style_id <i>Integer</i> [ , remove_all <i>Integer</i> ] ) : <i>Integer</i><hr>
					SE_UnregisterVectorStyle( style_name <i>Text</i> [ , remove_all <i>Integer</i> ] ) : <i>Integer</i></td>
................................................................................
				<td>SE_ReloadVectorStyle( style_id <i>Integer</i> , style <i>BLOB</i> ) : <i>Integer</i><hr>
					SE_ReloadVectorStyle( style_name <i>Text</i> , style <i>BLOB</i> ) : <i>Integer</i></td>
				<td></td>
				<td align="center" bgcolor="#99d099">libxml2</td>
				<td>Updates an already existing <b>Vector Style</b> definition.
				<ul>
					<li><b>style</b> is expected to be an XmlBLOB containing a valid SLD/SE Style of the Vector type.<br>
					If <b>CreatedStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.<br>
					The updated Style will continue to be identified by its current unique <b>Style ID</b> but the <b>Style Name</b> will be automatically updated accordingly to SLD/SE XML.</li>
				</ul><hr>
the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be
				returned on invalid arguments.</td></tr>
		<tr><td><b>SE_RegisterVectorStyledLayer</b></td>
				<td>SE_RegisterVectorStyledLayer( coverage_name <i>String</i> , style_id <i>Integer</i> ) : <i>Integer</i><hr>
					SE_RegisterVectorStyledLayer( coverage_name <i>String</i> , style_name <i>Text</i> ) : <i>Integer</i></td>
................................................................................
		<tr><td><b>SE_RegisterRasterStyle</b></td>
				<td>SE_RegisterRasterStyle( style <i>BLOB</i> ) : <i>Integer</i></td>
				<td></td>
				<td align="center" bgcolor="#99d099">libxml2</td>
				<td>Inserts a new <b>Raster Style</b> definition.
				<ul>
					<li><b>style</b> is expected to be an XmlBLOB containing a valid SLD/SE Style of the Raster type.<br>
					If <b>CreatedStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.<br>
					The registered Style will be identified either by its unique <b>Style ID</b> or by its <b>Style Name</b> automatically retrieved from SLD/SE XML.</li>
				</ul><hr>
the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be
				returned on invalid arguments.</td></tr>
		<tr><td><b>SE_UnregisterRasterStyle</b></td>
				<td>SE_UnregisterRasterStyle( style_id <i>Integer</i> [ , remove_all <i>Integer</i> ] ) : <i>Integer</i><hr>
					SE_UnregisterRasterStyle( style_name <i>Text</i> [ , remove_all <i>Integer</i> ] ) : <i>Integer</i></td>
................................................................................
				<td>SE_ReloadRasterStyle( style_id <i>Integer</i> , style <i>BLOB</i> ) : <i>Integer</i><hr>
					SE_ReloadRasterStyle( style_name <i>Text</i> , style <i>BLOB</i> ) : <i>Integer</i></td>
				<td></td>
				<td align="center" bgcolor="#99d099">libxml2</td>
				<td>Updates an already existing <b>Raster Style</b> definition.
				<ul>
					<li><b>style</b> is expected to be an XmlBLOB containing a valid SLD/SE Style of the Raster type.<br>
					If <b>CreatedStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.<br>
					The updated Style will continue to be identified by its current unique <b>Style ID</b> but the <b>Style Name</b> will be automatically updated accordingly to SLD/SE XML.</li>
				</ul><hr>
the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be
				returned on invalid arguments.</td></tr>
		<tr><td><b>SE_RegisterRasterStyledLayer</b></td>
				<td>SE_RegisterRasterStyledLayer( coverage_name <i>String</i> , style_id <i>Integer</i>  ) : <i>Integer</i><hr>
					SE_RegisterRasterStyledLayer( coverage_name <i>String</i> , style_name <i>Text</i>  ) : <i>Integer</i></td>
................................................................................
		<tr><td><b>SE_RegisterGroupStyle</b></td>
				<td>SE_RegisterGroupStyle( style <i>BLOB</i> ) : <i>Integer</i></td>
				<td></td>
				<td align="center" bgcolor="#99d099">libxml2</td>
				<td>Inserts a new <b>Group Style</b> definition.
				<ul>
					<li><b>style</b> is expected to be an XmlBLOB containing a valid SLD complex Style.<br>
					If <b>CreatedStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.<br>
					The registered Style will be identified either by its unique <b>Style ID</b> or by its unique <b>Style Name</b> automatically retrieved from SLD/SE XML.</li>
				</ul><hr>
the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be
				returned on invalid arguments.</td></tr>
		<tr><td><b>SE_UnregisterGroupStyle</b></td>
				<td>SE_UnregisterGroupStyle( style_id <i>Integer</i> [ , remove_all <i>Integer</i> ] ) : <i>Integer</i><hr>
					SE_UnregisterGroupStyle( style_name <i>Text</i> [ , remove_all <i>Integer</i> ] ) : <i>Integer</i></td>
................................................................................
				<td>SE_ReloadGroupStyle( style_id <i>Integer</i> , style <i>BLOB</i> ) : <i>Integer</i><hr>
					SE_ReloadGroupStyle( style_name <i>Text</i> , style <i>BLOB</i> ) : <i>Integer</i></td>
				<td></td>
				<td align="center" bgcolor="#99d099">libxml2</td>
				<td>Updates an already existing <b>Group Style</b> definition.
				<ul>
					<li><b>style</b> is expected to be an XmlBLOB containing a valid SLD complex Style.<br>
					If <b>CreatedStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.<br>
					The updated Style will continue to be identified by its current unique <b>Style ID</b> but the <b>Style Name</b> will be automatically updated accordingly to SLD/SE XML.</li>
				</ul><hr>
the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be
				returned on invalid arguments.</td></tr>
		<tr><td><b>SE_RegisterStyledGroupStyle</b></td>
				<td>SE_RegisterStyledGroupStyle( group_name <i>String</i> , style_id <i>Integer</i> ) : <i>Integer</i><hr>
					SE_RegisterStyledGroupStyle( group_name <i>String</i> , style_name <i>Text</i> ) : <i>Integer</i></td>
................................................................................
				    PROJ_AsWKT( auth_name <i>String</i> , auth_srid <i>Integer</i> , style <i>String</i> , indented <i>Boolean</i> ) : <i>String</i><hr>
				    PROJ_AsWKT( auth_name <i>String</i> , auth_srid <i>Integer</i> , style <i>String</i> , indented <i>Boolean</i> , indentation <i>Integer</i> ) : <i>String</i></td>
				<td colspan="3">Will return the WKT expression corresponding to a given Reference System; the definitions will be taken directly from the private PROJ's own database.
				<ul>
					<li><b>auth_name</b> and <b>auth_srid</b> identify the requested Reference System.<br>
						<b>auth_name</b> can be <b>NULL</b>, and in this case <b>EPSG</b> will be assumed.</li>
					<li>the optional argument <b>style</b> determines which WKT format should be adopted, and must be one between <i><b>GDAL</b></i>, <i><b>ESRI</b></i>,
						<i><b>ISO-2015</b></i> or <b>ISO-2018</b></i> (this latter being the default setting).</li>
					<li>the optional argument <b>indented</b> if set to <b>TRUE</b> will nicely format a multiline WKT expression, 
						otherwise a single monolithic line lacking any white-space or new-line will be printed (the default is <b>TRUE</b>).</li>
					<li>the optional argument <b>indentation</b> determines how many white-spaces are to be used for indenting (only meaningful if <i>indented=TRUE</i>; the default values is <b>4</b>).</li>
				</ul><hr>
				<b>NULL</b> will be returned on failure.<br>
				<u>Note</u>: this SQL function will be available only when SpatiaLite is built on <b>PROJ.6</b> (or any later version).</td></tr>
			<tr><td><b>PROJ_GuessSridFromWKT</b></td>
................................................................................
						and will be automatically created by the function itself.<br>
						<u>Note</u>: both the <i>dustbin-table</i> and the <i>dustbin-view</i> will be always created on the same DB containing the input GeoTable.</li>
				        <li><i>db-prefix</i> can be <b>NULL</b>. In such a case the input GeoTable is expected to be located within the <b>"MAIN"</b> database, otherwise in the given <b>db-prefix</b> database.</li>
						<li><i>column-name</i> too can be <b>NULL</b>. In such a case the name of the column containing Geometries will be automatically retrieved;
						if <b>"db"."table"</b> does not contains any Geometry column, or contains more than one, an exception will be raised.<br>
						Otherwise the given column name in <b>"db-prefix"."column-name"</b> will be used if it exists.</li>
						<li>the input GeoTable must be properly registered and must match both the <b>SRID</b> and <b>dimensions</b> declared in the target Topology.</li>
						<li>A <b>Primary Key</b> for the input GeoTable</i> is mandatory.</li>
						<li><i>dustbin-table</i> is the name of the table intended to store the PK values corresponding to each feature that failed to be imported; this table must not exist,
						since it will be created by this function.</li>
						<li><i>dustbin-view</i> is the name of the Spatial View supporting the above table; this view should not already exist
						and will be automatically created by the function itself.<br>
						<u>Note</u>: both the <i>dustbin-table</i> and the <i>dustbin-view</i> will be created on the same DB containing the input GeoTable.
						Use <b>DropGetoTable()</b> for both <i>dustbin-table</i> and <i>dustbin-view</i> before recalling, or even better use different names for each call.</li>
						<li>this function accepts input Geometries of any class: <b>Point</b>, <b>MultiPoint</b>, <b>Linestring</b>, <b>MultiLinestring</b>,
................................................................................
				transaction <i>Integer</i> , option_1 <i>Text</i> [ , ... , option_10 <i>Text</i> ] ) : <i>Integer</i></td>
				<td colspan="3">Will clone (i.e. create+copy) an origin table into a destination table: 
				the origin could be eventually located into some <i>attached</i> DB, but the destination is always
				assumed to be located in the primary DB.<ul>
				<li>Mandatory arguments:
				<ul>
					<li><b>db-prefix</b> corresponding to the origin; the primary DB always using the <i>main</i> prefix.<br>
					    Can be legitimately set to <b>NULL</b>, and in this case <b>MAIN</b> will be implicitly assumed.</b></b></li>
					<li><b>input_table</b> name of the origin table</li>
					<li><b>output_table</b> name of the destination table inside the primary DB.</li>
					<li><b>transaction</b> a <i>boolean</i> values stating if the whole operation has to be atomically confined
					within a monolithic SQL transaction</li>
				</ul></li>
				<li>Optional arguments: a maximum of 10 further options could be eventually be specified. Valid options are:
				<ul>
................................................................................
				<td colspan="3" bgcolor="#ffd080">Will completely remove a Geometry Table (or Spatial View) this including any eventual SpatialIndex,
				metadata and statistics definitions an alike.<br>
				The <i>optional</i> argument <b>transaction</b> determines if an internal SQL Transaction should be automatically
				started or not (the default setting if not explicitly overridden is <b>TRUE</b>).
				<hr>
				Will return <b>0</b> (i.e. <b>FALSE</b>) on failure, any other value (i.e. <b>TRUE</b>) on success..<br> 
				<b>NULL</b> will be returned on invalid arguments.</td></tr>
			<tr><td><b>DropTable</td>
				<td>DropTable( db-prefix <i>Text</i> , table <i>Text</i> ) : <i>Integer</i><hr>
				DropTable( db-prefix <i>Text</i> , table <i>Text</i> , permissive <i>Boolean</i> ) : <i>Integer</i></td>
				<td colspan="3">Will safely remove a Geometry Table (or Spatial View), including any SpatialIndex,
				triggers, metadata, statistics tables.<br>
				Will also work on ordinary (non-Spatial) Tables and Views, RasterLite2 raster_coverage, GeoPackage (Vector/Raster) and OGR/FDO Geometries.<br>
				<ul>
					<li><i>db-prefix</i> can be <b>NULL</b>, where the Table or View to be dropped is expected to be located within the <b>"MAIN"</b> database.</li>
................................................................................
				</ul>
				<hr>
				Will return <b>1</b> (i.e. <b>TRUE</b>) on success, <b>0</b> (i.e. <b>FALSE</b>) on failure based on the <b>permissive</b> setting.<br> 
				An <b><i>exception</i></b> will be always raised on invalid arguments and on failure, except when <b>permissive</b> has been  explicitly set.<br>
				In this case any generic failure (as e.g. attempting to drop a non existing table) will simply return an error code without raising any exception;
				said in other words, enabling <b><i>permissive</i></b> is more or less equivalent to declare an <b><i>IF EXISTS</i></b> SQL clause and allows
				for a relaxed (non blocking) failure handling.</td></tr>
			<tr><td><b>RenameTable</td>
				<td>RenameTable( db-prefix <i>Text</i> , old_name <i>Text</i> , new_name <i>Text</i> ) : <i>Integer</i><hr>
				    RenameTable( db-prefix <i>Text</i> , old_name <i>Text</i> , new_name <i>Text</i> , permissive <i>Boolean</i> ) : <i>Integer</i></td>
				<td colspan="3">Will safely rename a Geometry Table, including any SpatialIndex,
				triggers, metadata, statistics tables.<br>
				Will also work on ordinary (non-Spatial) Tables, RasterLite2 raster_coverage, GeoPackage (Vector/Raster) and OGR/FDO Geometries.<br>
				<ul>
					<li><i>db-prefix</i> can be <b>NULL</b>, where the Table to be renamed is expected to be located within the <b>"MAIN"</b> database.</li>
................................................................................
				<hr>
				Will return <b>1</b> (i.e. <b>TRUE</b>) on success.<br> 
				An <b><i>exception</i></b> will be raised on invalid arguments or on failure, except when <b>permissive</b> has been  explicitly set.<br>
				In this case any generic failure (as e.g. attempting to rename a non existing table) will simply return an error code without raising any exception;
				said in other words, enabling <b><i>permissive</i></b> is more or less equivalent to declare an <b><i>IF EXISTS</i></b> SQL clause and allows
				for a relaxed (non blocking) failure handling.<hr>
				<table bgcolor="#ffd080"><tr><td>When used with a <b><i>SQLite</i></b> version < than <b><i>3.25</i></b> this function will raise an exception.</td></tr></table></td></tr>
			<tr><td><b>RenameColumn</td>
				<td>RenameColumn( db-prefix <i>Text</i> , table <i>Text</i> , old_colname <i>Text</i> , new_colname <i>Text</i> ) : <i>Integer</i><hr>
				    RenameColumn( db-prefix <i>Text</i> , table <i>Text</i> , old_colname <i>Text</i> , new_colname <i>Text</i> , permissive <i>Boolean</i> ) : <i>Integer</i></td>
				<td colspan="3">Will safely rename a Column belonging to a Geometry Table, including any SpatialIndex,
				triggers, metadata, statistics tables.<br>
				Will also work on Columns of ordinary (non-Spatial) Tables, GeoPackage and OGR/FDO Geometries.<br>
				<ul>
					<li><i>db-prefix</i> can be <b>NULL</b>, where the Table containing the Column to be renamed is expected to be located within the <b>"MAIN"</b> database.</li>
................................................................................
				<td colspan="3">Will return the most <i>recent error message</i> emitted by <b>CreateRouting()</b> or <b>CreateRoutingNodes()</b>.<br>
				<b>NULL</b> will be returned if no such error message currently exists.</td></tr>	
			<tr><td><b>IsLowASCII</b></td>
				<td>IsLowASCII( text_string <i>String</i> ) : <i>Integer</i></td>
				<td colspan="3">Inspects an <b>UTF-8</b> encoded <b>text_string</b> testing if it only contains <b>ASCII 7-bit</b> characters.<br>
                    The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, 
                    and -1 for UNKNOWN when called with invalid arguments.</td></tr>




















			<tr><td colspan="5" align="center" bgcolor="#f0e0c0">
				<h3><a name="sqlproc">SQL Procedures, Stored Procedures and Stored Variables related SQL functions</a></h3></td></tr>
			<tr><th bgcolor="#d0d0d0">Function</th>
				<th bgcolor="#d0d0d0">Syntax</th>
				<th bgcolor="#d0d0d0" colspan="3">Summary</th></tr>
			<tr><td><b>SqlProc_GetLastError</b></td>
				<td>SqlProc_GetLastError( <i>void</i> ) : <i>String</i></td>
................................................................................
			<tr><td><b>SqlProc_ExecuteLoop</b></td>
				<td>SqlProc_ExecuteLoop( object <i>BLOB</i> ) : <i>Integer</i><hr>
					SqlProc_ExecuteLoop( object <i>BLOB</i> , vararg <i>String</i> ) : <i>Integer</i><hr>
					SqlProc_ExecuteLoop( object <i>BLOB</i> , vararg1 <i>String</i> [ , ... ] , varargN <i>String</i> ) : <i>Integer</i></td>
				<td colspan="3">This SQL function is almost exactly the same of <b>SqlProc_Execute()</b>, with just an outstanding differece:
				<ul>
					<li>the <b>cooked SQL Body</b> will be iteratively executed, as if it was declared within a <b>while (true) { ... }</b> never ending loop.</li>
					<li>the execution loop will break only when <b>SqlProc_Return()</b> will set a <b>negative or zero</b> return value of the Integer type.</b></li>
					<li><b><u>Warning</u></b>: a badly implemented call to <b>SqlProc_ExecuteLoop()</b> may easily cause a nastry <a href="https://en.wikipedia.org/wiki/Infinite_loop">endless loop</a></li>
				</ul><hr>
				Returns <b>TRUE</b> on success.<br>
				An exception will be raised on failure or invalid arguments.</td></tr>
			<tr><td><b>StoredProc_CreateTables</b></td>
				<td>StoredProc_CreateTables( <i>void</i> ) : <i>Boolean</i></td>
				<td colspan="3">Returns <b>TRUE</b> if the <b>Stored Procedures and Variables tables</b> have been succesfully created or if they already exist, otherwise <b>FALSE</b>.</td></tr>
................................................................................
			<tr><td><b>StoredProc_ExecuteLoop</b></td>
				<td>StoredProc_ExecuteLoop( name <i>String</i> ) : <i>Integer</i><hr>
					StoredProc_ExecuteLoop( name <i>String</i> , vararg <i>String</i> ) : <i>Integer</i><hr>
					StoredProc_ExecuteLoop( name <i>String</i> , vararg1 <i>String</i> [ , ... ] , varargN <i>String</i> ) : <i>Integer</i></td>
				<td colspan="3">This SQL function is almost exactly the same of <b>StoredProc_Execute()</b>, with just an outstanding differece:
				<ul>
					<li>the <b>cooked SQL Body</b> will be iteratively executed, as if it was declared within a <b>while (true) { ... }</b> never ending loop.</li>
					<li>the execution loop will break only when <b>StoredProc_Return()</b> will set a <b>negative or zero</b> return value of the Integer type.</b></li>
					<li><b><u>Warning</u></b>: a badly implemented call to <b>StoredProc_ExecuteLoop()</b> may easily cause a nastry <a href="https://en.wikipedia.org/wiki/Infinite_loop">endless loop</a></li>
				</ul><hr>
				Returns <b>TRUE</b> on success.<br>
				An exception will be raised on failure or invalid arguments.</td></tr>
			<tr><td><b>StoredVar_Register</b></td>
				<td>StoredVar_Register( name <i>String</i> , title <i>String</i> , value <i>NULL</i> ) : <i>Boolean</i><hr>
				    StoredVar_Register( name <i>String</i> , title <i>String</i> , value <i>Integer</i> ) : <i>Boolean</i><hr>







|
|
|
|
|
|









|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|







 







|







2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
....
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
....
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
....
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
....
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
....
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
....
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
....
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
....
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
....
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
....
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
....
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
....
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
....
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
....
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
....
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
				<th bgcolor="#d0d0d0">Syntax</th>
				<th bgcolor="#d0d0d0">OGC<br>defined</th>
				<th bgcolor="#d0d0d0">required<br>module</th>
				<th bgcolor="#d0d0d0">Summary</th></tr>
			<tr><td><b>Transform</b></td>
				<td>Transform( geom <i>Geometry</i> , newSRID <i>Integer</i> ) : <i>Geometry</i><hr>
					ST_Transform( geom <i>Geometry</i> , newSRID <i>Integer</i> ) : <i>Geometry</i><hr>
					Transform( geom <i>Geometry</i> , newSRID <i>Integer</i> , area_of_use <i>Geometry</i> ) : <i>Geometry</i><hr>
					ST_Transform( geom <i>Geometry</i> , newSRID <i>Integer</i> , area_of_use <i>Geometry</i> ) : <i>Geometry</i><hr>
					Transform( geom <i>Geometry</i> , newSRID <i>Integer</i> , area_of_use <i>Geometry</i> , proj_string_from <i>Text</i> ) : <i>Geometry</i><hr>
					ST_Transform( geom <i>Geometry</i> , newSRID <i>Integer</i> , area_of_use <i>Geometry</i> , proj_string_from <i>Text</i> ) : <i>Geometry</i><hr>
					Transform( geom <i>Geometry</i> , newSRID <i>Integer</i> , area_of_use <i>Geometry</i> , proj_string_from <i>Text</i> , proj_string_to <i>Text</i> ) : <i>Geometry</i><hr>
					ST_Transform( geom <i>Geometry</i> , newSRID <i>Integer</i> , area_of_use <i>Geometry</i> , proj_string_from <i>Text</i> , proj_string_to <i>Text</i> ) : <i>Geometry</i></td>
				<td></td>
				<td align="center" bgcolor="#d0d0f0">PROJ</td>
				<td>return a geometric object obtained by reprojecting coordinates into the Reference System identified by newSRID<hr>
				    All the following optional arguments are available only when SpatiaLite is built on the top of <b>PROJ.6</b> (or any later version):
				    <ul>
						<li><b>area_of_use</b>: the BBOX of this Geometry (always required to be in <i>SRID=4326</i>) will be possibly used by PROJ.6 in order to optimize the transformation as much as possible.<br>
						    may be eventually <b>NULL</b> (<i>default setting</i>).</li>
						<li><b>proj_string_from</b>: an user defined text string accepted by PROJ.6 identifying the <b><i>origin CRS</i></b> of the transformation.</li>
						<li><b>proj_string_to</b>: an user defined text string accepted by PROJ.6 identifying the <b><i>destination CRS</i></b> of the transformation.
						<li><b><u><i>Interpretation</i></u></b>:
						<ul>
							<li>if both <b><i>proj_string_from</i></b> and <b><i>proj_string_to</i></b> are <b>NULL</b> (<i>default setting</i>) then PROJ.6 will be left free to choose the best possible
							    transformation between the origin and the destination CRSes.</li>
							<li>if both <b><i>proj_string_from</i></b> and <b><i>proj_string_to</i></b> are instead explicitly set then PROJ.6 will be constrained to identify the origin and destination
								CRSes accordingly to the received string values. Valid CRS strings accepted by PROJ.6 can be:
								<ul>
									<li>a <b>proj-string</b> as e.g. <b><i>+proj=longlat +datum=WGS84 +no_defs</i></b></li>
................................................................................
		<tr><td><b>SE_RegisterVectorStyle</b></td>
				<td>SE_RegisterVectorStyle( style <i>BLOB</i> ) : <i>Integer</i></td>
				<td></td>
				<td align="center" bgcolor="#99d099">libxml2</td>
				<td>Inserts a new <b>Vector Style</b> definition.
				<ul>
					<li><b>style</b> is expected to be an XmlBLOB containing a valid SLD/SE Style of the Vector type.<br>
					If <b>CreateStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.<br>
					The registered Style will be identified either by its unique <b>Style ID</b> or by its <b>Style Name</b> automatically retrieved from SLD/SE XML.</li>
				</ul><hr>
the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be
				returned on invalid arguments.</td></tr>
		<tr><td><b>SE_UnregisterVectorStyle</b></td>
				<td>SE_UnregisterVectorStyle( style_id <i>Integer</i> [ , remove_all <i>Integer</i> ] ) : <i>Integer</i><hr>
					SE_UnregisterVectorStyle( style_name <i>Text</i> [ , remove_all <i>Integer</i> ] ) : <i>Integer</i></td>
................................................................................
				<td>SE_ReloadVectorStyle( style_id <i>Integer</i> , style <i>BLOB</i> ) : <i>Integer</i><hr>
					SE_ReloadVectorStyle( style_name <i>Text</i> , style <i>BLOB</i> ) : <i>Integer</i></td>
				<td></td>
				<td align="center" bgcolor="#99d099">libxml2</td>
				<td>Updates an already existing <b>Vector Style</b> definition.
				<ul>
					<li><b>style</b> is expected to be an XmlBLOB containing a valid SLD/SE Style of the Vector type.<br>
					If <b>CreateStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.<br>
					The updated Style will continue to be identified by its current unique <b>Style ID</b> but the <b>Style Name</b> will be automatically updated accordingly to SLD/SE XML.</li>
				</ul><hr>
the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be
				returned on invalid arguments.</td></tr>
		<tr><td><b>SE_RegisterVectorStyledLayer</b></td>
				<td>SE_RegisterVectorStyledLayer( coverage_name <i>String</i> , style_id <i>Integer</i> ) : <i>Integer</i><hr>
					SE_RegisterVectorStyledLayer( coverage_name <i>String</i> , style_name <i>Text</i> ) : <i>Integer</i></td>
................................................................................
		<tr><td><b>SE_RegisterRasterStyle</b></td>
				<td>SE_RegisterRasterStyle( style <i>BLOB</i> ) : <i>Integer</i></td>
				<td></td>
				<td align="center" bgcolor="#99d099">libxml2</td>
				<td>Inserts a new <b>Raster Style</b> definition.
				<ul>
					<li><b>style</b> is expected to be an XmlBLOB containing a valid SLD/SE Style of the Raster type.<br>
					If <b>CreateStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.<br>
					The registered Style will be identified either by its unique <b>Style ID</b> or by its <b>Style Name</b> automatically retrieved from SLD/SE XML.</li>
				</ul><hr>
the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be
				returned on invalid arguments.</td></tr>
		<tr><td><b>SE_UnregisterRasterStyle</b></td>
				<td>SE_UnregisterRasterStyle( style_id <i>Integer</i> [ , remove_all <i>Integer</i> ] ) : <i>Integer</i><hr>
					SE_UnregisterRasterStyle( style_name <i>Text</i> [ , remove_all <i>Integer</i> ] ) : <i>Integer</i></td>
................................................................................
				<td>SE_ReloadRasterStyle( style_id <i>Integer</i> , style <i>BLOB</i> ) : <i>Integer</i><hr>
					SE_ReloadRasterStyle( style_name <i>Text</i> , style <i>BLOB</i> ) : <i>Integer</i></td>
				<td></td>
				<td align="center" bgcolor="#99d099">libxml2</td>
				<td>Updates an already existing <b>Raster Style</b> definition.
				<ul>
					<li><b>style</b> is expected to be an XmlBLOB containing a valid SLD/SE Style of the Raster type.<br>
					If <b>CreateStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.<br>
					The updated Style will continue to be identified by its current unique <b>Style ID</b> but the <b>Style Name</b> will be automatically updated accordingly to SLD/SE XML.</li>
				</ul><hr>
the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be
				returned on invalid arguments.</td></tr>
		<tr><td><b>SE_RegisterRasterStyledLayer</b></td>
				<td>SE_RegisterRasterStyledLayer( coverage_name <i>String</i> , style_id <i>Integer</i>  ) : <i>Integer</i><hr>
					SE_RegisterRasterStyledLayer( coverage_name <i>String</i> , style_name <i>Text</i>  ) : <i>Integer</i></td>
................................................................................
		<tr><td><b>SE_RegisterGroupStyle</b></td>
				<td>SE_RegisterGroupStyle( style <i>BLOB</i> ) : <i>Integer</i></td>
				<td></td>
				<td align="center" bgcolor="#99d099">libxml2</td>
				<td>Inserts a new <b>Group Style</b> definition.
				<ul>
					<li><b>style</b> is expected to be an XmlBLOB containing a valid SLD complex Style.<br>
					If <b>CreateStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.<br>
					The registered Style will be identified either by its unique <b>Style ID</b> or by its unique <b>Style Name</b> automatically retrieved from SLD/SE XML.</li>
				</ul><hr>
the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be
				returned on invalid arguments.</td></tr>
		<tr><td><b>SE_UnregisterGroupStyle</b></td>
				<td>SE_UnregisterGroupStyle( style_id <i>Integer</i> [ , remove_all <i>Integer</i> ] ) : <i>Integer</i><hr>
					SE_UnregisterGroupStyle( style_name <i>Text</i> [ , remove_all <i>Integer</i> ] ) : <i>Integer</i></td>
................................................................................
				<td>SE_ReloadGroupStyle( style_id <i>Integer</i> , style <i>BLOB</i> ) : <i>Integer</i><hr>
					SE_ReloadGroupStyle( style_name <i>Text</i> , style <i>BLOB</i> ) : <i>Integer</i></td>
				<td></td>
				<td align="center" bgcolor="#99d099">libxml2</td>
				<td>Updates an already existing <b>Group Style</b> definition.
				<ul>
					<li><b>style</b> is expected to be an XmlBLOB containing a valid SLD complex Style.<br>
					If <b>CreateStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.<br>
					The updated Style will continue to be identified by its current unique <b>Style ID</b> but the <b>Style Name</b> will be automatically updated accordingly to SLD/SE XML.</li>
				</ul><hr>
the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be
				returned on invalid arguments.</td></tr>
		<tr><td><b>SE_RegisterStyledGroupStyle</b></td>
				<td>SE_RegisterStyledGroupStyle( group_name <i>String</i> , style_id <i>Integer</i> ) : <i>Integer</i><hr>
					SE_RegisterStyledGroupStyle( group_name <i>String</i> , style_name <i>Text</i> ) : <i>Integer</i></td>
................................................................................
				    PROJ_AsWKT( auth_name <i>String</i> , auth_srid <i>Integer</i> , style <i>String</i> , indented <i>Boolean</i> ) : <i>String</i><hr>
				    PROJ_AsWKT( auth_name <i>String</i> , auth_srid <i>Integer</i> , style <i>String</i> , indented <i>Boolean</i> , indentation <i>Integer</i> ) : <i>String</i></td>
				<td colspan="3">Will return the WKT expression corresponding to a given Reference System; the definitions will be taken directly from the private PROJ's own database.
				<ul>
					<li><b>auth_name</b> and <b>auth_srid</b> identify the requested Reference System.<br>
						<b>auth_name</b> can be <b>NULL</b>, and in this case <b>EPSG</b> will be assumed.</li>
					<li>the optional argument <b>style</b> determines which WKT format should be adopted, and must be one between <i><b>GDAL</b></i>, <i><b>ESRI</b></i>,
						<i><b>ISO-2015</b></i> or <i><b>ISO-2018</b></i> (this latter being the default setting).</li>
					<li>the optional argument <b>indented</b> if set to <b>TRUE</b> will nicely format a multiline WKT expression, 
						otherwise a single monolithic line lacking any white-space or new-line will be printed (the default is <b>TRUE</b>).</li>
					<li>the optional argument <b>indentation</b> determines how many white-spaces are to be used for indenting (only meaningful if <i>indented=TRUE</i>; the default values is <b>4</b>).</li>
				</ul><hr>
				<b>NULL</b> will be returned on failure.<br>
				<u>Note</u>: this SQL function will be available only when SpatiaLite is built on <b>PROJ.6</b> (or any later version).</td></tr>
			<tr><td><b>PROJ_GuessSridFromWKT</b></td>
................................................................................
						and will be automatically created by the function itself.<br>
						<u>Note</u>: both the <i>dustbin-table</i> and the <i>dustbin-view</i> will be always created on the same DB containing the input GeoTable.</li>
				        <li><i>db-prefix</i> can be <b>NULL</b>. In such a case the input GeoTable is expected to be located within the <b>"MAIN"</b> database, otherwise in the given <b>db-prefix</b> database.</li>
						<li><i>column-name</i> too can be <b>NULL</b>. In such a case the name of the column containing Geometries will be automatically retrieved;
						if <b>"db"."table"</b> does not contains any Geometry column, or contains more than one, an exception will be raised.<br>
						Otherwise the given column name in <b>"db-prefix"."column-name"</b> will be used if it exists.</li>
						<li>the input GeoTable must be properly registered and must match both the <b>SRID</b> and <b>dimensions</b> declared in the target Topology.</li>
						<li>A <b>Primary Key</b> for the input <i>GeoTable</i> is mandatory.</li>
						<li><i>dustbin-table</i> is the name of the table intended to store the PK values corresponding to each feature that failed to be imported; this table must not exist,
						since it will be created by this function.</li>
						<li><i>dustbin-view</i> is the name of the Spatial View supporting the above table; this view should not already exist
						and will be automatically created by the function itself.<br>
						<u>Note</u>: both the <i>dustbin-table</i> and the <i>dustbin-view</i> will be created on the same DB containing the input GeoTable.
						Use <b>DropGetoTable()</b> for both <i>dustbin-table</i> and <i>dustbin-view</i> before recalling, or even better use different names for each call.</li>
						<li>this function accepts input Geometries of any class: <b>Point</b>, <b>MultiPoint</b>, <b>Linestring</b>, <b>MultiLinestring</b>,
................................................................................
				transaction <i>Integer</i> , option_1 <i>Text</i> [ , ... , option_10 <i>Text</i> ] ) : <i>Integer</i></td>
				<td colspan="3">Will clone (i.e. create+copy) an origin table into a destination table: 
				the origin could be eventually located into some <i>attached</i> DB, but the destination is always
				assumed to be located in the primary DB.<ul>
				<li>Mandatory arguments:
				<ul>
					<li><b>db-prefix</b> corresponding to the origin; the primary DB always using the <i>main</i> prefix.<br>
					    Can be legitimately set to <b>NULL</b>, and in this case <b>MAIN</b> will be implicitly assumed.</li>
					<li><b>input_table</b> name of the origin table</li>
					<li><b>output_table</b> name of the destination table inside the primary DB.</li>
					<li><b>transaction</b> a <i>boolean</i> values stating if the whole operation has to be atomically confined
					within a monolithic SQL transaction</li>
				</ul></li>
				<li>Optional arguments: a maximum of 10 further options could be eventually be specified. Valid options are:
				<ul>
................................................................................
				<td colspan="3" bgcolor="#ffd080">Will completely remove a Geometry Table (or Spatial View) this including any eventual SpatialIndex,
				metadata and statistics definitions an alike.<br>
				The <i>optional</i> argument <b>transaction</b> determines if an internal SQL Transaction should be automatically
				started or not (the default setting if not explicitly overridden is <b>TRUE</b>).
				<hr>
				Will return <b>0</b> (i.e. <b>FALSE</b>) on failure, any other value (i.e. <b>TRUE</b>) on success..<br> 
				<b>NULL</b> will be returned on invalid arguments.</td></tr>
			<tr><td><b>DropTable</b></td>
				<td>DropTable( db-prefix <i>Text</i> , table <i>Text</i> ) : <i>Integer</i><hr>
				DropTable( db-prefix <i>Text</i> , table <i>Text</i> , permissive <i>Boolean</i> ) : <i>Integer</i></td>
				<td colspan="3">Will safely remove a Geometry Table (or Spatial View), including any SpatialIndex,
				triggers, metadata, statistics tables.<br>
				Will also work on ordinary (non-Spatial) Tables and Views, RasterLite2 raster_coverage, GeoPackage (Vector/Raster) and OGR/FDO Geometries.<br>
				<ul>
					<li><i>db-prefix</i> can be <b>NULL</b>, where the Table or View to be dropped is expected to be located within the <b>"MAIN"</b> database.</li>
................................................................................
				</ul>
				<hr>
				Will return <b>1</b> (i.e. <b>TRUE</b>) on success, <b>0</b> (i.e. <b>FALSE</b>) on failure based on the <b>permissive</b> setting.<br> 
				An <b><i>exception</i></b> will be always raised on invalid arguments and on failure, except when <b>permissive</b> has been  explicitly set.<br>
				In this case any generic failure (as e.g. attempting to drop a non existing table) will simply return an error code without raising any exception;
				said in other words, enabling <b><i>permissive</i></b> is more or less equivalent to declare an <b><i>IF EXISTS</i></b> SQL clause and allows
				for a relaxed (non blocking) failure handling.</td></tr>
			<tr><td><b>RenameTable</b></td>
				<td>RenameTable( db-prefix <i>Text</i> , old_name <i>Text</i> , new_name <i>Text</i> ) : <i>Integer</i><hr>
				    RenameTable( db-prefix <i>Text</i> , old_name <i>Text</i> , new_name <i>Text</i> , permissive <i>Boolean</i> ) : <i>Integer</i></td>
				<td colspan="3">Will safely rename a Geometry Table, including any SpatialIndex,
				triggers, metadata, statistics tables.<br>
				Will also work on ordinary (non-Spatial) Tables, RasterLite2 raster_coverage, GeoPackage (Vector/Raster) and OGR/FDO Geometries.<br>
				<ul>
					<li><i>db-prefix</i> can be <b>NULL</b>, where the Table to be renamed is expected to be located within the <b>"MAIN"</b> database.</li>
................................................................................
				<hr>
				Will return <b>1</b> (i.e. <b>TRUE</b>) on success.<br> 
				An <b><i>exception</i></b> will be raised on invalid arguments or on failure, except when <b>permissive</b> has been  explicitly set.<br>
				In this case any generic failure (as e.g. attempting to rename a non existing table) will simply return an error code without raising any exception;
				said in other words, enabling <b><i>permissive</i></b> is more or less equivalent to declare an <b><i>IF EXISTS</i></b> SQL clause and allows
				for a relaxed (non blocking) failure handling.<hr>
				<table bgcolor="#ffd080"><tr><td>When used with a <b><i>SQLite</i></b> version < than <b><i>3.25</i></b> this function will raise an exception.</td></tr></table></td></tr>
			<tr><td><b>RenameColumn</b></td>
				<td>RenameColumn( db-prefix <i>Text</i> , table <i>Text</i> , old_colname <i>Text</i> , new_colname <i>Text</i> ) : <i>Integer</i><hr>
				    RenameColumn( db-prefix <i>Text</i> , table <i>Text</i> , old_colname <i>Text</i> , new_colname <i>Text</i> , permissive <i>Boolean</i> ) : <i>Integer</i></td>
				<td colspan="3">Will safely rename a Column belonging to a Geometry Table, including any SpatialIndex,
				triggers, metadata, statistics tables.<br>
				Will also work on Columns of ordinary (non-Spatial) Tables, GeoPackage and OGR/FDO Geometries.<br>
				<ul>
					<li><i>db-prefix</i> can be <b>NULL</b>, where the Table containing the Column to be renamed is expected to be located within the <b>"MAIN"</b> database.</li>
................................................................................
				<td colspan="3">Will return the most <i>recent error message</i> emitted by <b>CreateRouting()</b> or <b>CreateRoutingNodes()</b>.<br>
				<b>NULL</b> will be returned if no such error message currently exists.</td></tr>	
			<tr><td><b>IsLowASCII</b></td>
				<td>IsLowASCII( text_string <i>String</i> ) : <i>Integer</i></td>
				<td colspan="3">Inspects an <b>UTF-8</b> encoded <b>text_string</b> testing if it only contains <b>ASCII 7-bit</b> characters.<br>
                    The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, 
                    and -1 for UNKNOWN when called with invalid arguments.</td></tr>
			<tr><td><b>GetDbObjectScope</b></td>
				<td>GetDbObjectScope( db_prefix <i>String</i> , db_object_name <i>String</i> ) : <i>String</i></td>
				<td colspan="3">Will return a text string explaining the intended scope of any DB object (<i><b>Table</b></i>, <i><b>View</b></i>, <i><b>Index</b></i> or <i><b>Trigger</b></i>), 
					distinguishing between <b>system</b> (<i>internal/private objects required by SQLite or SpatiaLite</i>) and <b>userland</b> objects.<br>
                    <b>NULL</b> will be returned on invalid arguments or a non existing DB object.<hr>
                    The <b>db_prefix</b> argument may be eventually <b>NULL</b>, and in this case the <b>MAIN</b> DB will be assumed.</td></tr>
			<tr><td><b>Pause</b></td>
				<td>Pause( <i>void</i> ) : <i>NULL</i></td>
				<td colspan="3">Will suspend the execution of the current process. (mainly intended for debugging purposes).<hr>
					<b><i><u>Note</u></i></b>: <b>Pause()</b> will effectively work only if <b>EnablePause()</b> has been explicitly called before.</td></tr>
			<tr><td><b>IsPauseEnabled</b></td>
				<td>IsPauseEnabled( <i>void</i> ) : <i>Boolean</i></td>
				<td colspan="3">Will test if <b>Pause()</b> is currently enabled (<b>TRUE</b>) or not (<b>FALSE</b>).</td></tr>
			<tr><td><b>EnablePause</b></td>
				<td>EnablePause( <i>void</i> ) : <i>NULL</i></td>
				<td colspan="3">Will enable all subsequent calls to <b>Pause()</b> to be effective.<hr>
					<b><u>Note</u></b>: by default <b>Pause()</b> is always kept disabled for each connection, so you necessarily have to call <b>EnablePause()</b> in order to effectively enable it.</td></tr>
			<tr><td><b>DisablePause</b></td>
				<td>DisablePause( <i>void</i> ) : <i>NULL</i></td>
				<td colspan="3">Will make all subsequent calls to <b>Pause()</b> to be effectless <b>no-ops</b>.</td></tr>
			<tr><td colspan="5" align="center" bgcolor="#f0e0c0">
				<h3><a name="sqlproc">SQL Procedures, Stored Procedures and Stored Variables related SQL functions</a></h3></td></tr>
			<tr><th bgcolor="#d0d0d0">Function</th>
				<th bgcolor="#d0d0d0">Syntax</th>
				<th bgcolor="#d0d0d0" colspan="3">Summary</th></tr>
			<tr><td><b>SqlProc_GetLastError</b></td>
				<td>SqlProc_GetLastError( <i>void</i> ) : <i>String</i></td>
................................................................................
			<tr><td><b>SqlProc_ExecuteLoop</b></td>
				<td>SqlProc_ExecuteLoop( object <i>BLOB</i> ) : <i>Integer</i><hr>
					SqlProc_ExecuteLoop( object <i>BLOB</i> , vararg <i>String</i> ) : <i>Integer</i><hr>
					SqlProc_ExecuteLoop( object <i>BLOB</i> , vararg1 <i>String</i> [ , ... ] , varargN <i>String</i> ) : <i>Integer</i></td>
				<td colspan="3">This SQL function is almost exactly the same of <b>SqlProc_Execute()</b>, with just an outstanding differece:
				<ul>
					<li>the <b>cooked SQL Body</b> will be iteratively executed, as if it was declared within a <b>while (true) { ... }</b> never ending loop.</li>
					<li>the execution loop will break only when <b>SqlProc_Return()</b> will set a <b>negative or zero</b> return value of the Integer type.</li>
					<li><b><u>Warning</u></b>: a badly implemented call to <b>SqlProc_ExecuteLoop()</b> may easily cause a nastry <a href="https://en.wikipedia.org/wiki/Infinite_loop">endless loop</a></li>
				</ul><hr>
				Returns <b>TRUE</b> on success.<br>
				An exception will be raised on failure or invalid arguments.</td></tr>
			<tr><td><b>StoredProc_CreateTables</b></td>
				<td>StoredProc_CreateTables( <i>void</i> ) : <i>Boolean</i></td>
				<td colspan="3">Returns <b>TRUE</b> if the <b>Stored Procedures and Variables tables</b> have been succesfully created or if they already exist, otherwise <b>FALSE</b>.</td></tr>
................................................................................
			<tr><td><b>StoredProc_ExecuteLoop</b></td>
				<td>StoredProc_ExecuteLoop( name <i>String</i> ) : <i>Integer</i><hr>
					StoredProc_ExecuteLoop( name <i>String</i> , vararg <i>String</i> ) : <i>Integer</i><hr>
					StoredProc_ExecuteLoop( name <i>String</i> , vararg1 <i>String</i> [ , ... ] , varargN <i>String</i> ) : <i>Integer</i></td>
				<td colspan="3">This SQL function is almost exactly the same of <b>StoredProc_Execute()</b>, with just an outstanding differece:
				<ul>
					<li>the <b>cooked SQL Body</b> will be iteratively executed, as if it was declared within a <b>while (true) { ... }</b> never ending loop.</li>
					<li>the execution loop will break only when <b>StoredProc_Return()</b> will set a <b>negative or zero</b> return value of the Integer type.</li>
					<li><b><u>Warning</u></b>: a badly implemented call to <b>StoredProc_ExecuteLoop()</b> may easily cause a nastry <a href="https://en.wikipedia.org/wiki/Infinite_loop">endless loop</a></li>
				</ul><hr>
				Returns <b>TRUE</b> on success.<br>
				An exception will be raised on failure or invalid arguments.</td></tr>
			<tr><td><b>StoredVar_Register</b></td>
				<td>StoredVar_Register( name <i>String</i> , title <i>String</i> , value <i>NULL</i> ) : <i>Boolean</i><hr>
				    StoredVar_Register( name <i>String</i> , title <i>String</i> , value <i>Integer</i> ) : <i>Boolean</i><hr>

Changes to src/connection_cache/alloc_cache.c.

378
379
380
381
382
383
384






385
386
387
388
389
390
391
...
857
858
859
860
861
862
863
864
865









866






867

868
869
870
871
872
873
874
....
1510
1511
1512
1513
1514
1515
1516










































































































































1517
    cache->magic1 = SPATIALITE_CACHE_MAGIC1;
    cache->magic2 = SPATIALITE_CACHE_MAGIC2;
    cache->gpkg_mode = 0;
    cache->gpkg_amphibious_mode = 0;
    cache->decimal_precision = -1;
    cache->GEOS_handle = NULL;
    cache->PROJ_handle = NULL;






    cache->RTTOPO_handle = NULL;
    cache->cutterMessage = NULL;
    cache->storedProcError = NULL;
    cache->createRoutingError = NULL;
    cache->SqlProcLogfile = NULL;
    cache->SqlProcLog = NULL;
    cache->SqlProcContinue = 1;
................................................................................
	finishGEOS_r (handle);
#endif
    cache->GEOS_handle = NULL;
    gaiaResetGeosMsg_r (cache);
#endif

#ifndef OMIT_PROJ
    if (cache->PROJ_handle != NULL)
#ifdef PROJ_NEW			/* supporting new PROJ.6 */









	proj_context_destroy (cache->PROJ_handle);






#else /* supporting old PROJ.4 */

	pj_ctx_free (cache->PROJ_handle);
    cache->PROJ_handle = NULL;
#endif
#endif

/* freeing PROJ error buffer */
    if (cache->gaia_proj_error_msg)
................................................................................
      {
	  if (cache->magic1 == SPATIALITE_CACHE_MAGIC1
	      && cache->magic2 == SPATIALITE_CACHE_MAGIC2)
	      return cache->PROJ_handle;
      }
    return NULL;
}










































































































































#endif







>
>
>
>
>
>







 







<

>
>
>
>
>
>
>
>
>

>
>
>
>
>
>

>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
...
863
864
865
866
867
868
869

870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
....
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
    cache->magic1 = SPATIALITE_CACHE_MAGIC1;
    cache->magic2 = SPATIALITE_CACHE_MAGIC2;
    cache->gpkg_mode = 0;
    cache->gpkg_amphibious_mode = 0;
    cache->decimal_precision = -1;
    cache->GEOS_handle = NULL;
    cache->PROJ_handle = NULL;
    cache->proj6_cached = 0;
    cache->proj6_cached_pj = NULL;
    cache->proj6_cached_string_1 = NULL;
    cache->proj6_cached_string_2 = NULL;
    cache->proj6_cached_area = NULL;
    cache->is_pause_enabled = 0;
    cache->RTTOPO_handle = NULL;
    cache->cutterMessage = NULL;
    cache->storedProcError = NULL;
    cache->createRoutingError = NULL;
    cache->SqlProcLogfile = NULL;
    cache->SqlProcLog = NULL;
    cache->SqlProcContinue = 1;
................................................................................
	finishGEOS_r (handle);
#endif
    cache->GEOS_handle = NULL;
    gaiaResetGeosMsg_r (cache);
#endif

#ifndef OMIT_PROJ

#ifdef PROJ_NEW			/* supporting new PROJ.6 */
    if (cache->proj6_cached_string_1 != NULL)
	free (cache->proj6_cached_string_1);
    if (cache->proj6_cached_string_2 != NULL)
	free (cache->proj6_cached_string_2);
    if (cache->proj6_cached_area != NULL)
	free (cache->proj6_cached_area);
    if (cache->proj6_cached_pj != NULL)
	proj_destroy (cache->proj6_cached_pj);
    if (cache->PROJ_handle != NULL)
	proj_context_destroy (cache->PROJ_handle);
    cache->PROJ_handle = NULL;
    cache->proj6_cached = 0;
    cache->proj6_cached_pj = NULL;
    cache->proj6_cached_string_1 = NULL;
    cache->proj6_cached_string_2 = NULL;
    cache->proj6_cached_area = NULL;
#else /* supporting old PROJ.4 */
    if (cache->PROJ_handle != NULL)
	pj_ctx_free (cache->PROJ_handle);
    cache->PROJ_handle = NULL;
#endif
#endif

/* freeing PROJ error buffer */
    if (cache->gaia_proj_error_msg)
................................................................................
      {
	  if (cache->magic1 == SPATIALITE_CACHE_MAGIC1
	      && cache->magic2 == SPATIALITE_CACHE_MAGIC2)
	      return cache->PROJ_handle;
      }
    return NULL;
}

SPATIALITE_DECLARE int
gaiaSetCurrentCachedProj (const void
			  *p_cache, void *pj,
			  const char *proj_string_1,
			  const char *proj_string_2, void *area)
{
/* updates the PROJ6 internal cache */
    int ok = 0;
    int len;
    gaiaProjAreaPtr bbox_in = (gaiaProjAreaPtr) area;
    struct splite_internal_cache *cache =
	(struct splite_internal_cache *) p_cache;
    if (cache != NULL)
      {
	  if (cache->magic1 == SPATIALITE_CACHE_MAGIC1
	      && cache->magic2 == SPATIALITE_CACHE_MAGIC2)
	      ok = 1;
      }
    if (!ok)
	return 0;		/* invalid cache */
    if (proj_string_1 == NULL || pj == NULL)
	return 0;

/* resetting the PROJ6 internal cache */
    if (cache->proj6_cached_string_1 != NULL)
	free (cache->proj6_cached_string_1);
    if (cache->proj6_cached_string_2 != NULL)
	free (cache->proj6_cached_string_2);
    if (cache->proj6_cached_area != NULL)
	free (cache->proj6_cached_area);
    if (cache->proj6_cached_pj != NULL)
	proj_destroy (cache->proj6_cached_pj);

/* updating the PROJ6 internal cache */
    cache->proj6_cached = 1;
    cache->proj6_cached_pj = pj;
    len = strlen (proj_string_1);
    cache->proj6_cached_string_1 = malloc (len + 1);
    strcpy (cache->proj6_cached_string_1, proj_string_1);
    if (proj_string_2 == NULL)
	cache->proj6_cached_string_2 = NULL;
    else
      {
	  len = strlen (proj_string_2);
	  cache->proj6_cached_string_2 = malloc (len + 1);
	  strcpy (cache->proj6_cached_string_2, proj_string_2);
      }
    if (bbox_in == NULL)
	cache->proj6_cached_area = NULL;
    else
      {
	  gaiaProjAreaPtr bbox_out =
	      (gaiaProjAreaPtr) (cache->proj6_cached_area);
	  bbox_out = malloc (sizeof (gaiaProjArea));
	  bbox_out->WestLongitude = bbox_in->WestLongitude;
	  bbox_out->SouthLatitude = bbox_in->SouthLatitude;
	  bbox_out->EastLongitude = bbox_in->EastLongitude;
	  bbox_out->NorthLatitude = bbox_in->NorthLatitude;
      }
    return 1;
}

SPATIALITE_DECLARE void *
gaiaGetCurrentCachedProj (const void *p_cache)
{
/* returning the currently cached PROJ6 object */
    struct splite_internal_cache *cache =
	(struct splite_internal_cache *) p_cache;
    if (cache != NULL)
      {
	  if (cache->magic1 == SPATIALITE_CACHE_MAGIC1
	      && cache->magic2 == SPATIALITE_CACHE_MAGIC2)
	    {
		if (cache->proj6_cached)
		    return cache->proj6_cached_pj;
		else
		    return NULL;
	    }
      }
    return NULL;		/* invalid cache */
}

SPATIALITE_DECLARE int
gaiaCurrentCachedProjMatches (const void *p_cache,
			      const char
			      *proj_string_1,
			      const char *proj_string_2, void *area)
{
/* checking if the currently cached PROJ6 object matches */
    int ok = 0;
    gaiaProjAreaPtr bbox_1 = (gaiaProjAreaPtr) area;
    struct splite_internal_cache *cache =
	(struct splite_internal_cache *) p_cache;
    if (cache != NULL)
      {
	  if (cache->magic1 == SPATIALITE_CACHE_MAGIC1
	      && cache->magic2 == SPATIALITE_CACHE_MAGIC2)
	      ok = 1;
      }
    if (!ok)
	return 0;		/* invalid cache */
    if (proj_string_1 == NULL)
	return 0;		/* invalid request */
    if (cache->proj6_cached == 0)
	return 0;		/* there is no PROJ6 object currently cached */

/* checking all definitions */
    if (strcmp (proj_string_1, cache->proj6_cached_string_1) != 0)
	return 0;		/* mismatching string #1 */
    if (proj_string_2 == NULL && cache->proj6_cached_string_2 == NULL)
	;
    else if (proj_string_2 != NULL && cache->proj6_cached_string_2 != NULL)
      {
	  if (strcmp (proj_string_2, cache->proj6_cached_string_2) != 0)
	      return 0;		/* mismatching string #2 */
      }
    else
	return 0;		/* mismatching string #2 */
    if (bbox_1 == NULL && cache->proj6_cached_area == NULL)
	;
    else if (bbox_1 != NULL && cache->proj6_cached_area != NULL)
      {
	  gaiaProjAreaPtr bbox_2 = (gaiaProjAreaPtr) (cache->proj6_cached_area);
	  if (bbox_1->WestLongitude != bbox_2->WestLongitude)
	      return 0;
	  if (bbox_1->SouthLatitude != bbox_2->SouthLatitude)
	      return 0;
	  if (bbox_1->EastLongitude != bbox_2->EastLongitude)
	      return 0;
	  if (bbox_1->NorthLatitude != bbox_2->NorthLatitude)
	      return 0;
      }
    else
	return 0;		/* mismatching area */

    return 1;			/* anything nicely matches */
}
#endif

Changes to src/gaiageo/gg_transform.c.

65
66
67
68
69
70
71

72
73
74
75
76
77
78
....
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423

2424
2425
2426
2427
2428
2429
2430
....
2438
2439
2440
2441
2442
2443
2444










2445
2446
2447
2448
2449
2450
2451
....
2460
2461
2462
2463
2464
2465
2466



2467
2468
2469
2470
2471
2472



2473

2474
2475
2476
2477
2478
2479
2480
....
2516
2517
2518
2519
2520
2521
2522

2523
2524
2525
2526
2527
2528
2529
2530
#else /* supporting old PROJ.4 */
#include <proj_api.h>
#endif

#include <spatialite/sqlite.h>
#include <spatialite/debug.h>
#include <spatialite_private.h>


#include <spatialite/gaiageo.h>

GAIAGEO_DECLARE gaiaGeomCollPtr
gaiaMakeCircle (double cx, double cy, double radius, double step)
{
/* return a Linestring approximating a Circle */
................................................................................
      }
  stop:
#endif
    return error;
}

static gaiaGeomCollPtr
gaiaTransformCommon (void *x_handle, void *p_cache, gaiaGeomCollPtr org,
		     const char *proj_string_1,
		     const char *proj_string_2, gaiaProjAreaPtr proj_bbox,
		     int ignore_z, int ignore_m)
{
/* creates a new GEOMETRY reprojecting coordinates from the original one */
    int error = 0;
#ifdef PROJ_NEW			/* supporting new PROJ.6 */
    PJ_CONTEXT *handle = (PJ_CONTEXT *) x_handle;
    PJ *from_to_pre;
    PJ *from_to_cs;

#else /* supporting old PROJ.4 */
    if (p_cache == NULL)
	p_cache = NULL;		/* silencing stupid compiler warnings about unused args */
    projCtx handle = (projCtx) x_handle;
    projPJ from_cs;
    projPJ to_cs;
#endif
................................................................................
#endif
    if (proj_bbox == NULL)
	proj_bbox = NULL;	/* silencing stupid compiler warnings about unused args */
    if (proj_string_1 == NULL)
	return NULL;

#ifdef PROJ_NEW			/* supporting new PROJ.6 */










    if (proj_string_2 != NULL)
      {
	  PJ_AREA *area = NULL;
	  if (proj_bbox != NULL)
	    {
		area = proj_area_create ();
		proj_area_set_bbox (area, proj_bbox->WestLongitude,
................................................................................
	      return NULL;
	  from_to_cs = proj_normalize_for_visualization (handle, from_to_pre);
	  proj_destroy (from_to_pre);
	  if (area != NULL)
	      proj_area_destroy (area);
	  if (!from_to_cs)
	      return NULL;



      }
    else			/* PROJ_STRING - PIPELINE */
      {
	  from_to_cs = proj_create (handle, proj_string_1);
	  if (!from_to_cs)
	      return NULL;



      }

#else /* supporting old PROJ.4 */
    if (proj_string_2 == NULL)
	return NULL;
    if (handle != NULL)
      {
	  from_cs = pj_init_plus_ctx (handle, proj_string_1);
	  to_cs = pj_init_plus_ctx (handle, proj_string_2);
................................................................................
    error =
	do_transfom_proj (org, dst, ignore_z, ignore_m, from_radians,
			  to_radians, from_cs, to_cs, NULL);
#endif

/* destroying the PROJ4 params */
#ifdef PROJ_NEW			/* supporting new PROJ.6 */

    proj_destroy (from_to_cs);
#else /* supporting old PROJ.4 */
    pj_free (from_cs);
    pj_free (to_cs);
#endif
    if (error)
      {
	  /* some error occurred */







>







 







|










>







 







>
>
>
>
>
>
>
>
>
>







 







>
>
>






>
>
>

>







 







>
|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
....
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
....
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
....
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
....
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
#else /* supporting old PROJ.4 */
#include <proj_api.h>
#endif

#include <spatialite/sqlite.h>
#include <spatialite/debug.h>
#include <spatialite_private.h>
#include <spatialite.h>

#include <spatialite/gaiageo.h>

GAIAGEO_DECLARE gaiaGeomCollPtr
gaiaMakeCircle (double cx, double cy, double radius, double step)
{
/* return a Linestring approximating a Circle */
................................................................................
      }
  stop:
#endif
    return error;
}

static gaiaGeomCollPtr
gaiaTransformCommon (void *x_handle, const void *p_cache, gaiaGeomCollPtr org,
		     const char *proj_string_1,
		     const char *proj_string_2, gaiaProjAreaPtr proj_bbox,
		     int ignore_z, int ignore_m)
{
/* creates a new GEOMETRY reprojecting coordinates from the original one */
    int error = 0;
#ifdef PROJ_NEW			/* supporting new PROJ.6 */
    PJ_CONTEXT *handle = (PJ_CONTEXT *) x_handle;
    PJ *from_to_pre;
    PJ *from_to_cs;
    int proj_is_cached = 0;
#else /* supporting old PROJ.4 */
    if (p_cache == NULL)
	p_cache = NULL;		/* silencing stupid compiler warnings about unused args */
    projCtx handle = (projCtx) x_handle;
    projPJ from_cs;
    projPJ to_cs;
#endif
................................................................................
#endif
    if (proj_bbox == NULL)
	proj_bbox = NULL;	/* silencing stupid compiler warnings about unused args */
    if (proj_string_1 == NULL)
	return NULL;

#ifdef PROJ_NEW			/* supporting new PROJ.6 */
    if (gaiaCurrentCachedProjMatches
	(p_cache, proj_string_1, proj_string_2, proj_bbox))
      {
	  from_to_cs = gaiaGetCurrentCachedProj (p_cache);
	  if (from_to_cs != NULL)
	    {
		proj_is_cached = 1;
		goto skip_cached;
	    }
      }
    if (proj_string_2 != NULL)
      {
	  PJ_AREA *area = NULL;
	  if (proj_bbox != NULL)
	    {
		area = proj_area_create ();
		proj_area_set_bbox (area, proj_bbox->WestLongitude,
................................................................................
	      return NULL;
	  from_to_cs = proj_normalize_for_visualization (handle, from_to_pre);
	  proj_destroy (from_to_pre);
	  if (area != NULL)
	      proj_area_destroy (area);
	  if (!from_to_cs)
	      return NULL;
	  proj_is_cached =
	      gaiaSetCurrentCachedProj (p_cache, from_to_cs, proj_string_1,
					proj_string_2, proj_bbox);
      }
    else			/* PROJ_STRING - PIPELINE */
      {
	  from_to_cs = proj_create (handle, proj_string_1);
	  if (!from_to_cs)
	      return NULL;
	  proj_is_cached =
	      gaiaSetCurrentCachedProj (p_cache, from_to_cs, proj_string_1,
					NULL, NULL);
      }
  skip_cached:
#else /* supporting old PROJ.4 */
    if (proj_string_2 == NULL)
	return NULL;
    if (handle != NULL)
      {
	  from_cs = pj_init_plus_ctx (handle, proj_string_1);
	  to_cs = pj_init_plus_ctx (handle, proj_string_2);
................................................................................
    error =
	do_transfom_proj (org, dst, ignore_z, ignore_m, from_radians,
			  to_radians, from_cs, to_cs, NULL);
#endif

/* destroying the PROJ4 params */
#ifdef PROJ_NEW			/* supporting new PROJ.6 */
    if (!proj_is_cached)
	proj_destroy (from_to_cs);
#else /* supporting old PROJ.4 */
    pj_free (from_cs);
    pj_free (to_cs);
#endif
    if (error)
      {
	  /* some error occurred */

Changes to src/headers/spatialite.h.

2012
2013
2014
2015
2016
2017
2018

2019
2020
2021
2022
2023
2024




















2025
2026
2027
2028
2029
2030
								       void
								       *cache);

    SPATIALITE_DECLARE int gaiaGPKG2Spatialite (sqlite3 * handle_in,
						const char *gpkg_in_path,
						sqlite3 * handle_out,
						const char *splite_out_path);

    SPATIALITE_DECLARE int gaiaSpatialite2GPKG (sqlite3 * handle_in,
						const char *splite_in_path,
						sqlite3 * handle_out,
						const char *gpkg_out_path);

    SPATIALITE_DECLARE const void *gaiaGetCurrentProjContext (const void *cache);





















#ifdef __cplusplus
}
#endif

#endif				/* _SPATIALITE_H */







>





|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
								       void
								       *cache);

    SPATIALITE_DECLARE int gaiaGPKG2Spatialite (sqlite3 * handle_in,
						const char *gpkg_in_path,
						sqlite3 * handle_out,
						const char *splite_out_path);

    SPATIALITE_DECLARE int gaiaSpatialite2GPKG (sqlite3 * handle_in,
						const char *splite_in_path,
						sqlite3 * handle_out,
						const char *gpkg_out_path);

    SPATIALITE_DECLARE const void *gaiaGetCurrentProjContext (const void
							      *cache);

    SPATIALITE_DECLARE int gaiaSetCurrentCachedProj (const void
						     *cache, void *pj,
						     const char *proj_string_1,
						     const char *proj_string_2,
						     void *area);

    SPATIALITE_DECLARE void *gaiaGetCurrentCachedProj (const void *cache);

    SPATIALITE_DECLARE int gaiaCurrentCachedProjMatches (const void *cache,
							 const char
							 *proj_string_1,
							 const char
							 *proj_string_2,
							 void *area);

    SPATIALITE_DECLARE char *gaiaGetDbObjectScope (sqlite3 * handle,
						   const char *db_prefix,
						   const char *obj_name);

#ifdef __cplusplus
}
#endif

#endif				/* _SPATIALITE_H */

Changes to src/headers/spatialite_private.h.

211
212
213
214
215
216
217






218
219
220
221
222
223
224
....
1490
1491
1492
1493
1494
1495
1496






1497
1498
1499
1500
1501
1502
	int tinyPointEnabled;
	unsigned char magic2;
	char *lastPostgreSqlError;
	int buffer_end_cap_style;
	int buffer_join_style;
	double buffer_mitre_limit;
	int buffer_quadrant_segments;






    };

    struct epsg_defs
    {
	int srid;
	char *auth_name;
	int auth_srid;
................................................................................
						  *variant, const char *value,
						  int size);

    SPATIALITE_PRIVATE int gaia_set_variant_blob (struct gaia_variant_value
						  *variant,
						  const unsigned char *value,
						  int size);







#ifdef __cplusplus
}
#endif

#endif				/* _SPATIALITE_PRIVATE_H */







>
>
>
>
>
>







 







>
>
>
>
>
>






211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
....
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
	int tinyPointEnabled;
	unsigned char magic2;
	char *lastPostgreSqlError;
	int buffer_end_cap_style;
	int buffer_join_style;
	double buffer_mitre_limit;
	int buffer_quadrant_segments;
	int proj6_cached;
	void *proj6_cached_pj;
	char *proj6_cached_string_1;
	char *proj6_cached_string_2;
	void *proj6_cached_area;
	int is_pause_enabled;
    };

    struct epsg_defs
    {
	int srid;
	char *auth_name;
	int auth_srid;
................................................................................
						  *variant, const char *value,
						  int size);

    SPATIALITE_PRIVATE int gaia_set_variant_blob (struct gaia_variant_value
						  *variant,
						  const unsigned char *value,
						  int size);

#ifdef _WIN32
    SPATIALITE_PRIVATE void splite_pause_windows (void);
#else
    SPATIALITE_PRIVATE void splite_pause_signal (void);
#endif

#ifdef __cplusplus
}
#endif

#endif				/* _SPATIALITE_PRIVATE_H */

Changes to src/spatialite/Makefile.am.

3
4
5
6
7
8
9

10
11
12
13
14
15

16
17
18
19
20
21
22
AM_CPPFLAGS += @CFLAGS@ @CPPFLAGS@ @GEOS_CFLAGS@ @LIBXML2_CFLAGS@

noinst_LTLIBRARIES = libsplite.la splite.la

SPATIALITE_COMMON_SOURCES = mbrcache.c \
	spatialite.c \
	spatialite_init.c \

	metatables.c \
	statistics.c \
	extra_tables.c \
	se_helpers.c \
	srid_aux.c \
	table_cloner.c \

	virtualdbf.c \
	virtualXL.c \
	virtualfdo.c \
	virtualgpkg.c \
	virtualbbox.c \
	virtualspatialindex.c \
	virtualnetwork.c \







>






>







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
AM_CPPFLAGS += @CFLAGS@ @CPPFLAGS@ @GEOS_CFLAGS@ @LIBXML2_CFLAGS@

noinst_LTLIBRARIES = libsplite.la splite.la

SPATIALITE_COMMON_SOURCES = mbrcache.c \
	spatialite.c \
	spatialite_init.c \
	pause.c \
	metatables.c \
	statistics.c \
	extra_tables.c \
	se_helpers.c \
	srid_aux.c \
	table_cloner.c \
	dbobj_scopes.c \
	virtualdbf.c \
	virtualXL.c \
	virtualfdo.c \
	virtualgpkg.c \
	virtualbbox.c \
	virtualspatialindex.c \
	virtualnetwork.c \

Changes to src/spatialite/Makefile.in.

100
101
102
103
104
105
106
107

108
109
110
111
112
113
114
115
116
117
...
122
123
124
125
126
127
128
129

130
131
132
133
134
135
136
137
138
139
...
335
336
337
338
339
340
341

342
343
344
345
346
347

348
349
350
351
352
353
354
...
423
424
425
426
427
428
429

430
431
432

433
434
435
436
437
438
439
...
446
447
448
449
450
451
452

453
454
455

456
457
458
459
460
461
462
...
511
512
513
514
515
516
517







518
519
520
521
522
523
524
...
553
554
555
556
557
558
559







560
561
562
563
564
565
566
...
672
673
674
675
676
677
678







679
680
681
682
683
684
685
...
714
715
716
717
718
719
720







721
722
723
724
725
726
727
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libsplite_la_LIBADD =
am__objects_1 = libsplite_la-mbrcache.lo libsplite_la-spatialite.lo \
	libsplite_la-spatialite_init.lo libsplite_la-metatables.lo \

	libsplite_la-statistics.lo libsplite_la-extra_tables.lo \
	libsplite_la-se_helpers.lo libsplite_la-srid_aux.lo \
	libsplite_la-table_cloner.lo libsplite_la-virtualdbf.lo \
	libsplite_la-virtualXL.lo libsplite_la-virtualfdo.lo \
	libsplite_la-virtualgpkg.lo libsplite_la-virtualbbox.lo \
	libsplite_la-virtualspatialindex.lo \
	libsplite_la-virtualnetwork.lo libsplite_la-virtualrouting.lo \
	libsplite_la-virtualshape.lo libsplite_la-virtualxpath.lo \
	libsplite_la-virtualelementary.lo libsplite_la-virtualknn.lo \
	libsplite_la-create_routing.lo libsplite_la-virtualgeojson.lo
................................................................................
am__v_lt_0 = --silent
am__v_lt_1 = 
libsplite_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libsplite_la_CFLAGS) \
	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
splite_la_LIBADD =
am__objects_2 = splite_la-mbrcache.lo splite_la-spatialite.lo \
	splite_la-spatialite_init.lo splite_la-metatables.lo \

	splite_la-statistics.lo splite_la-extra_tables.lo \
	splite_la-se_helpers.lo splite_la-srid_aux.lo \
	splite_la-table_cloner.lo splite_la-virtualdbf.lo \
	splite_la-virtualXL.lo splite_la-virtualfdo.lo \
	splite_la-virtualgpkg.lo splite_la-virtualbbox.lo \
	splite_la-virtualspatialindex.lo splite_la-virtualnetwork.lo \
	splite_la-virtualrouting.lo splite_la-virtualshape.lo \
	splite_la-virtualxpath.lo splite_la-virtualelementary.lo \
	splite_la-virtualknn.lo splite_la-create_routing.lo \
	splite_la-virtualgeojson.lo
................................................................................
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)/src/headers @CFLAGS@ @CPPFLAGS@ \
	@GEOS_CFLAGS@ @LIBXML2_CFLAGS@ $(am__empty)
noinst_LTLIBRARIES = libsplite.la splite.la
SPATIALITE_COMMON_SOURCES = mbrcache.c \
	spatialite.c \
	spatialite_init.c \

	metatables.c \
	statistics.c \
	extra_tables.c \
	se_helpers.c \
	srid_aux.c \
	table_cloner.c \

	virtualdbf.c \
	virtualXL.c \
	virtualfdo.c \
	virtualgpkg.c \
	virtualbbox.c \
	virtualspatialindex.c \
	virtualnetwork.c \
................................................................................
mostlyclean-compile:
	-rm -f *.$(OBJEXT)

distclean-compile:
	-rm -f *.tab.c

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-create_routing.Plo@am__quote@

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-extra_tables.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-mbrcache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-metatables.Plo@am__quote@

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-se_helpers.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-spatialite.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-spatialite_init.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-srid_aux.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-statistics.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-table_cloner.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualXL.Plo@am__quote@
................................................................................
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualknn.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualnetwork.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualrouting.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualshape.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualspatialindex.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualxpath.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-create_routing.Plo@am__quote@

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-extra_tables.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-mbrcache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-metatables.Plo@am__quote@

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-se_helpers.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-spatialite.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-spatialite_init.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-srid_aux.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-statistics.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-table_cloner.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-virtualXL.Plo@am__quote@
................................................................................
libsplite_la-spatialite_init.lo: spatialite_init.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -MT libsplite_la-spatialite_init.lo -MD -MP -MF $(DEPDIR)/libsplite_la-spatialite_init.Tpo -c -o libsplite_la-spatialite_init.lo `test -f 'spatialite_init.c' || echo '$(srcdir)/'`spatialite_init.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libsplite_la-spatialite_init.Tpo $(DEPDIR)/libsplite_la-spatialite_init.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='spatialite_init.c' object='libsplite_la-spatialite_init.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -c -o libsplite_la-spatialite_init.lo `test -f 'spatialite_init.c' || echo '$(srcdir)/'`spatialite_init.c








libsplite_la-metatables.lo: metatables.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -MT libsplite_la-metatables.lo -MD -MP -MF $(DEPDIR)/libsplite_la-metatables.Tpo -c -o libsplite_la-metatables.lo `test -f 'metatables.c' || echo '$(srcdir)/'`metatables.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libsplite_la-metatables.Tpo $(DEPDIR)/libsplite_la-metatables.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='metatables.c' object='libsplite_la-metatables.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -c -o libsplite_la-metatables.lo `test -f 'metatables.c' || echo '$(srcdir)/'`metatables.c

................................................................................
libsplite_la-table_cloner.lo: table_cloner.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -MT libsplite_la-table_cloner.lo -MD -MP -MF $(DEPDIR)/libsplite_la-table_cloner.Tpo -c -o libsplite_la-table_cloner.lo `test -f 'table_cloner.c' || echo '$(srcdir)/'`table_cloner.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libsplite_la-table_cloner.Tpo $(DEPDIR)/libsplite_la-table_cloner.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='table_cloner.c' object='libsplite_la-table_cloner.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -c -o libsplite_la-table_cloner.lo `test -f 'table_cloner.c' || echo '$(srcdir)/'`table_cloner.c








libsplite_la-virtualdbf.lo: virtualdbf.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -MT libsplite_la-virtualdbf.lo -MD -MP -MF $(DEPDIR)/libsplite_la-virtualdbf.Tpo -c -o libsplite_la-virtualdbf.lo `test -f 'virtualdbf.c' || echo '$(srcdir)/'`virtualdbf.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libsplite_la-virtualdbf.Tpo $(DEPDIR)/libsplite_la-virtualdbf.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='virtualdbf.c' object='libsplite_la-virtualdbf.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -c -o libsplite_la-virtualdbf.lo `test -f 'virtualdbf.c' || echo '$(srcdir)/'`virtualdbf.c

................................................................................
splite_la-spatialite_init.lo: spatialite_init.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splite_la-spatialite_init.lo -MD -MP -MF $(DEPDIR)/splite_la-spatialite_init.Tpo -c -o splite_la-spatialite_init.lo `test -f 'spatialite_init.c' || echo '$(srcdir)/'`spatialite_init.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/splite_la-spatialite_init.Tpo $(DEPDIR)/splite_la-spatialite_init.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='spatialite_init.c' object='splite_la-spatialite_init.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splite_la-spatialite_init.lo `test -f 'spatialite_init.c' || echo '$(srcdir)/'`spatialite_init.c








splite_la-metatables.lo: metatables.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splite_la-metatables.lo -MD -MP -MF $(DEPDIR)/splite_la-metatables.Tpo -c -o splite_la-metatables.lo `test -f 'metatables.c' || echo '$(srcdir)/'`metatables.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/splite_la-metatables.Tpo $(DEPDIR)/splite_la-metatables.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='metatables.c' object='splite_la-metatables.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splite_la-metatables.lo `test -f 'metatables.c' || echo '$(srcdir)/'`metatables.c

................................................................................
splite_la-table_cloner.lo: table_cloner.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splite_la-table_cloner.lo -MD -MP -MF $(DEPDIR)/splite_la-table_cloner.Tpo -c -o splite_la-table_cloner.lo `test -f 'table_cloner.c' || echo '$(srcdir)/'`table_cloner.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/splite_la-table_cloner.Tpo $(DEPDIR)/splite_la-table_cloner.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='table_cloner.c' object='splite_la-table_cloner.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splite_la-table_cloner.lo `test -f 'table_cloner.c' || echo '$(srcdir)/'`table_cloner.c








splite_la-virtualdbf.lo: virtualdbf.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splite_la-virtualdbf.lo -MD -MP -MF $(DEPDIR)/splite_la-virtualdbf.Tpo -c -o splite_la-virtualdbf.lo `test -f 'virtualdbf.c' || echo '$(srcdir)/'`virtualdbf.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/splite_la-virtualdbf.Tpo $(DEPDIR)/splite_la-virtualdbf.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='virtualdbf.c' object='splite_la-virtualdbf.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splite_la-virtualdbf.lo `test -f 'virtualdbf.c' || echo '$(srcdir)/'`virtualdbf.c








|
>
|
|
|







 







|
>
|
|
|







 







>






>







 







>



>







 







>



>







 







>
>
>
>
>
>
>







 







>
>
>
>
>
>
>







 







>
>
>
>
>
>
>







 







>
>
>
>
>
>
>







100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
...
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
...
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
...
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
...
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
...
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
...
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
...
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
...
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libsplite_la_LIBADD =
am__objects_1 = libsplite_la-mbrcache.lo libsplite_la-spatialite.lo \
	libsplite_la-spatialite_init.lo libsplite_la-pause.lo \
	libsplite_la-metatables.lo libsplite_la-statistics.lo \
	libsplite_la-extra_tables.lo libsplite_la-se_helpers.lo \
	libsplite_la-srid_aux.lo libsplite_la-table_cloner.lo \
	libsplite_la-dbobj_scopes.lo libsplite_la-virtualdbf.lo \
	libsplite_la-virtualXL.lo libsplite_la-virtualfdo.lo \
	libsplite_la-virtualgpkg.lo libsplite_la-virtualbbox.lo \
	libsplite_la-virtualspatialindex.lo \
	libsplite_la-virtualnetwork.lo libsplite_la-virtualrouting.lo \
	libsplite_la-virtualshape.lo libsplite_la-virtualxpath.lo \
	libsplite_la-virtualelementary.lo libsplite_la-virtualknn.lo \
	libsplite_la-create_routing.lo libsplite_la-virtualgeojson.lo
................................................................................
am__v_lt_0 = --silent
am__v_lt_1 = 
libsplite_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libsplite_la_CFLAGS) \
	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
splite_la_LIBADD =
am__objects_2 = splite_la-mbrcache.lo splite_la-spatialite.lo \
	splite_la-spatialite_init.lo splite_la-pause.lo \
	splite_la-metatables.lo splite_la-statistics.lo \
	splite_la-extra_tables.lo splite_la-se_helpers.lo \
	splite_la-srid_aux.lo splite_la-table_cloner.lo \
	splite_la-dbobj_scopes.lo splite_la-virtualdbf.lo \
	splite_la-virtualXL.lo splite_la-virtualfdo.lo \
	splite_la-virtualgpkg.lo splite_la-virtualbbox.lo \
	splite_la-virtualspatialindex.lo splite_la-virtualnetwork.lo \
	splite_la-virtualrouting.lo splite_la-virtualshape.lo \
	splite_la-virtualxpath.lo splite_la-virtualelementary.lo \
	splite_la-virtualknn.lo splite_la-create_routing.lo \
	splite_la-virtualgeojson.lo
................................................................................
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)/src/headers @CFLAGS@ @CPPFLAGS@ \
	@GEOS_CFLAGS@ @LIBXML2_CFLAGS@ $(am__empty)
noinst_LTLIBRARIES = libsplite.la splite.la
SPATIALITE_COMMON_SOURCES = mbrcache.c \
	spatialite.c \
	spatialite_init.c \
	pause.c \
	metatables.c \
	statistics.c \
	extra_tables.c \
	se_helpers.c \
	srid_aux.c \
	table_cloner.c \
	dbobj_scopes.c \
	virtualdbf.c \
	virtualXL.c \
	virtualfdo.c \
	virtualgpkg.c \
	virtualbbox.c \
	virtualspatialindex.c \
	virtualnetwork.c \
................................................................................
mostlyclean-compile:
	-rm -f *.$(OBJEXT)

distclean-compile:
	-rm -f *.tab.c

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-create_routing.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-dbobj_scopes.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-extra_tables.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-mbrcache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-metatables.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-pause.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-se_helpers.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-spatialite.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-spatialite_init.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-srid_aux.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-statistics.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-table_cloner.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualXL.Plo@am__quote@
................................................................................
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualknn.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualnetwork.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualrouting.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualshape.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualspatialindex.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualxpath.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-create_routing.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-dbobj_scopes.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-extra_tables.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-mbrcache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-metatables.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-pause.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-se_helpers.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-spatialite.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-spatialite_init.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-srid_aux.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-statistics.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-table_cloner.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-virtualXL.Plo@am__quote@
................................................................................
libsplite_la-spatialite_init.lo: spatialite_init.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -MT libsplite_la-spatialite_init.lo -MD -MP -MF $(DEPDIR)/libsplite_la-spatialite_init.Tpo -c -o libsplite_la-spatialite_init.lo `test -f 'spatialite_init.c' || echo '$(srcdir)/'`spatialite_init.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libsplite_la-spatialite_init.Tpo $(DEPDIR)/libsplite_la-spatialite_init.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='spatialite_init.c' object='libsplite_la-spatialite_init.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -c -o libsplite_la-spatialite_init.lo `test -f 'spatialite_init.c' || echo '$(srcdir)/'`spatialite_init.c

libsplite_la-pause.lo: pause.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -MT libsplite_la-pause.lo -MD -MP -MF $(DEPDIR)/libsplite_la-pause.Tpo -c -o libsplite_la-pause.lo `test -f 'pause.c' || echo '$(srcdir)/'`pause.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libsplite_la-pause.Tpo $(DEPDIR)/libsplite_la-pause.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='pause.c' object='libsplite_la-pause.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -c -o libsplite_la-pause.lo `test -f 'pause.c' || echo '$(srcdir)/'`pause.c

libsplite_la-metatables.lo: metatables.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -MT libsplite_la-metatables.lo -MD -MP -MF $(DEPDIR)/libsplite_la-metatables.Tpo -c -o libsplite_la-metatables.lo `test -f 'metatables.c' || echo '$(srcdir)/'`metatables.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libsplite_la-metatables.Tpo $(DEPDIR)/libsplite_la-metatables.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='metatables.c' object='libsplite_la-metatables.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -c -o libsplite_la-metatables.lo `test -f 'metatables.c' || echo '$(srcdir)/'`metatables.c

................................................................................
libsplite_la-table_cloner.lo: table_cloner.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -MT libsplite_la-table_cloner.lo -MD -MP -MF $(DEPDIR)/libsplite_la-table_cloner.Tpo -c -o libsplite_la-table_cloner.lo `test -f 'table_cloner.c' || echo '$(srcdir)/'`table_cloner.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libsplite_la-table_cloner.Tpo $(DEPDIR)/libsplite_la-table_cloner.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='table_cloner.c' object='libsplite_la-table_cloner.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -c -o libsplite_la-table_cloner.lo `test -f 'table_cloner.c' || echo '$(srcdir)/'`table_cloner.c

libsplite_la-dbobj_scopes.lo: dbobj_scopes.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -MT libsplite_la-dbobj_scopes.lo -MD -MP -MF $(DEPDIR)/libsplite_la-dbobj_scopes.Tpo -c -o libsplite_la-dbobj_scopes.lo `test -f 'dbobj_scopes.c' || echo '$(srcdir)/'`dbobj_scopes.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libsplite_la-dbobj_scopes.Tpo $(DEPDIR)/libsplite_la-dbobj_scopes.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='dbobj_scopes.c' object='libsplite_la-dbobj_scopes.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -c -o libsplite_la-dbobj_scopes.lo `test -f 'dbobj_scopes.c' || echo '$(srcdir)/'`dbobj_scopes.c

libsplite_la-virtualdbf.lo: virtualdbf.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -MT libsplite_la-virtualdbf.lo -MD -MP -MF $(DEPDIR)/libsplite_la-virtualdbf.Tpo -c -o libsplite_la-virtualdbf.lo `test -f 'virtualdbf.c' || echo '$(srcdir)/'`virtualdbf.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libsplite_la-virtualdbf.Tpo $(DEPDIR)/libsplite_la-virtualdbf.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='virtualdbf.c' object='libsplite_la-virtualdbf.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -c -o libsplite_la-virtualdbf.lo `test -f 'virtualdbf.c' || echo '$(srcdir)/'`virtualdbf.c

................................................................................
splite_la-spatialite_init.lo: spatialite_init.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splite_la-spatialite_init.lo -MD -MP -MF $(DEPDIR)/splite_la-spatialite_init.Tpo -c -o splite_la-spatialite_init.lo `test -f 'spatialite_init.c' || echo '$(srcdir)/'`spatialite_init.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/splite_la-spatialite_init.Tpo $(DEPDIR)/splite_la-spatialite_init.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='spatialite_init.c' object='splite_la-spatialite_init.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splite_la-spatialite_init.lo `test -f 'spatialite_init.c' || echo '$(srcdir)/'`spatialite_init.c

splite_la-pause.lo: pause.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splite_la-pause.lo -MD -MP -MF $(DEPDIR)/splite_la-pause.Tpo -c -o splite_la-pause.lo `test -f 'pause.c' || echo '$(srcdir)/'`pause.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/splite_la-pause.Tpo $(DEPDIR)/splite_la-pause.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='pause.c' object='splite_la-pause.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splite_la-pause.lo `test -f 'pause.c' || echo '$(srcdir)/'`pause.c

splite_la-metatables.lo: metatables.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splite_la-metatables.lo -MD -MP -MF $(DEPDIR)/splite_la-metatables.Tpo -c -o splite_la-metatables.lo `test -f 'metatables.c' || echo '$(srcdir)/'`metatables.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/splite_la-metatables.Tpo $(DEPDIR)/splite_la-metatables.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='metatables.c' object='splite_la-metatables.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splite_la-metatables.lo `test -f 'metatables.c' || echo '$(srcdir)/'`metatables.c

................................................................................
splite_la-table_cloner.lo: table_cloner.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splite_la-table_cloner.lo -MD -MP -MF $(DEPDIR)/splite_la-table_cloner.Tpo -c -o splite_la-table_cloner.lo `test -f 'table_cloner.c' || echo '$(srcdir)/'`table_cloner.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/splite_la-table_cloner.Tpo $(DEPDIR)/splite_la-table_cloner.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='table_cloner.c' object='splite_la-table_cloner.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splite_la-table_cloner.lo `test -f 'table_cloner.c' || echo '$(srcdir)/'`table_cloner.c

splite_la-dbobj_scopes.lo: dbobj_scopes.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splite_la-dbobj_scopes.lo -MD -MP -MF $(DEPDIR)/splite_la-dbobj_scopes.Tpo -c -o splite_la-dbobj_scopes.lo `test -f 'dbobj_scopes.c' || echo '$(srcdir)/'`dbobj_scopes.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/splite_la-dbobj_scopes.Tpo $(DEPDIR)/splite_la-dbobj_scopes.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='dbobj_scopes.c' object='splite_la-dbobj_scopes.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splite_la-dbobj_scopes.lo `test -f 'dbobj_scopes.c' || echo '$(srcdir)/'`dbobj_scopes.c

splite_la-virtualdbf.lo: virtualdbf.c
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splite_la-virtualdbf.lo -MD -MP -MF $(DEPDIR)/splite_la-virtualdbf.Tpo -c -o splite_la-virtualdbf.lo `test -f 'virtualdbf.c' || echo '$(srcdir)/'`virtualdbf.c
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/splite_la-virtualdbf.Tpo $(DEPDIR)/splite_la-virtualdbf.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='virtualdbf.c' object='splite_la-virtualdbf.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splite_la-virtualdbf.lo `test -f 'virtualdbf.c' || echo '$(srcdir)/'`virtualdbf.c

Added src/spatialite/dbobj_scopes.c.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
/*

 dbobj_scopes.c -- DB objects scopes

 version 5.0, 2018 May 25

 Author: Sandro Furieri a.furieri@lqt.it

 ------------------------------------------------------------------------------
 
 Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
 The contents of this file are subject to the Mozilla Public License Version
 1.1 (the "License"); you may not use this file except in compliance with
 the License. You may obtain a copy of the License at
 http://www.mozilla.org/MPL/
 
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.

The Original Code is the SpatiaLite library

The Initial Developer of the Original Code is Alessandro Furieri
 
Portions created by the Initial Developer are Copyright (C) 2008-2018
the Initial Developer. All Rights Reserved.

Contributor(s):

Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
 
*/

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#if defined(_WIN32) && !defined(__MINGW32__)
#include "config-msvc.h"
#else
#include "config.h"
#endif

#include <spatialite/sqlite.h>
#include <spatialite/debug.h>

#include <spatialite.h>
#include <spatialite_private.h>
#include <spatialite/gaiaaux.h>

#ifdef _WIN32
#define strcasecmp	_stricmp
#define strncasecmp	_strnicmp
#endif /* not WIN32 */

static int
scope_is_spatial_table (sqlite3 * sqlite, const char *db_prefix,
			const char *tbl_name)
{
/* testing for a possible Spatial Table */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;

    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql = sqlite3_mprintf ("SELECT Count(*) FROM \"%s\".geometry_columns "
			   "WHERE Lower(f_table_name) = Lower(%Q)", xprefix,
			   tbl_name);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		if (atoi (results[(i * columns) + 0]) > 0)
		    ok = 1;
	    }
      }
    sqlite3_free_table (results);
    return ok;
}

static int
scope_is_topology (sqlite3 * sqlite, const char *db_prefix,
		   const char *tbl_name)
{
/* testing for a possible Topology */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;
    const char *cvg;
    char *name;
    int cmp;

    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql =
	sqlite3_mprintf ("SELECT topology_name FROM \"%s\".topologies",
			 xprefix);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		cvg = results[(i * columns) + 0];
		name = sqlite3_mprintf ("%s_face", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_node", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_edge", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_seeds", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_topolayers", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_topofeatures", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
	    }
      }
  done:
    sqlite3_free_table (results);
    return ok;
}

static int
scope_is_topology_view (sqlite3 * sqlite, const char *db_prefix,
			const char *tbl_name)
{
/* testing for a possible Topology View */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;
    const char *cvg;
    char *name;
    int cmp;

    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql =
	sqlite3_mprintf ("SELECT topology_name FROM \"%s\".topologies",
			 xprefix);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		cvg = results[(i * columns) + 0];
		name = sqlite3_mprintf ("%s_edge_seeds", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_face_seeds", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_face_geoms", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
	    }
      }
  done:
    sqlite3_free_table (results);
    return ok;
}

static int
scope_is_network (sqlite3 * sqlite, const char *db_prefix, const char *tbl_name)
{
/* testing for a possible Network */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;
    const char *cvg;
    char *name;
    int cmp;

    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql = sqlite3_mprintf ("SELECT network_name FROM \"%s\".networks", xprefix);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		cvg = results[(i * columns) + 0];
		name = sqlite3_mprintf ("%s_face", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_node", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_link", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_seeds", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
	    }
      }
  done:
    sqlite3_free_table (results);
    return ok;
}

static int
scope_is_iso_metadata (const char *tbl_name)
{
/* testing for a possible ISO Metadata */
    if (strcasecmp (tbl_name, "ISO_metadata") == 0
	|| strcasecmp (tbl_name, "ISO_metadata_reference") == 0)
	return 1;
    return 0;
}

static int
scope_is_raster_coverage (sqlite3 * sqlite, const char *db_prefix,
			  const char *tbl_name)
{
/* testing for a possible Raster Coverage */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;
    const char *cvg;
    char *name;
    int cmp;

    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql =
	sqlite3_mprintf ("SELECT coverage_name FROM \"%s\".raster_coverages",
			 xprefix);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		cvg = results[(i * columns) + 0];
		name = sqlite3_mprintf ("%s_levels", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_sections", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_tile_data", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_tiles", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
	    }
      }
  done:
    sqlite3_free_table (results);
    return ok;
}

static int
scope_is_raster_coverage_spatial_index (sqlite3 * sqlite, const char *db_prefix,
					const char *tbl_name, int *sys)
{
/* testing for a possible Raster Coverage Spatial Index */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;
    const char *cvg;
    char *name;
    int cmp;

    *sys = 0;
    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql =
	sqlite3_mprintf ("SELECT coverage_name FROM \"%s\".raster_coverages ",
			 xprefix);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		cvg = results[(i * columns) + 0];
		name = sqlite3_mprintf ("idx_%s_sections_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		cvg = results[(i * columns) + 0];
		name = sqlite3_mprintf ("idx_%s_sections_geometry_rowid", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = -1;
		      goto done;
		  }
		cvg = results[(i * columns) + 0];
		name = sqlite3_mprintf ("idx_%s_sections_geometry_node", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = -1;
		      goto done;
		  }
		cvg = results[(i * columns) + 0];
		name = sqlite3_mprintf ("idx_%s_sections_geometry_parent", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = -1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_tiles_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_tiles_geometry_rowid", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = -1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_tiles_geometry_node", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = -1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_tiles_geometry_parent", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = -1;
		      goto done;
		  }
	    }
      }
  done:
    sqlite3_free_table (results);
    if (ok < 0)
	*sys = 1;
    return ok;
}

static int
scope_is_topology_index (sqlite3 * sqlite, const char *db_prefix,
			 const char *tbl_name)
{
/* testing for a possible Topology Index */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;
    const char *cvg;
    char *name;
    int cmp;

    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql =
	sqlite3_mprintf ("SELECT topology_name FROM \"%s\".topologies",
			 xprefix);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		cvg = results[(i * columns) + 0];
		name = sqlite3_mprintf ("idx_%s_node_contface", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_start_node", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_end_node", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_edge_leftface", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_edge_rightface", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_timestamp", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_sdedge", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_sdface", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_seeds_timestamp", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_ftnode", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_ftedge", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_ftface", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_fttopolayers", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
	    }
      }
  done:
    sqlite3_free_table (results);
    return ok;
}

static int
scope_is_topology_trigger (sqlite3 * sqlite, const char *db_prefix,
			   const char *tbl_name)
{
/* testing for a possible Topology Trigger */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;
    const char *cvg;
    char *name;
    int cmp;

    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql =
	sqlite3_mprintf ("SELECT topology_name FROM \"%s\".topologies",
			 xprefix);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		cvg = results[(i * columns) + 0];
		name = sqlite3_mprintf ("tmd_%s_edge_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmd_%s_face_mbr", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmd_%s_node_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmd_%s_seeds_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmi_%s_edge_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmi_%s_face_mbr", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmi_%s_node_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmi_%s_seeds_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmu_%s_edge_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmu_%s_face_mbr", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmu_%s_node_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmu_%s_seeds_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("ggi_%s_edge_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("ggi_%s_face_mbr", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("gii_%s_node_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("gii_%s_seeds_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("ggu_%s_edge_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("ggu_%s_face_mbr", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("ggu_%s_node_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("ggu_%s_seeds_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("ggi_%s_edge_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("ggi_%s_face_mbr", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("ggi_%s_node_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("ggi_%s_seeds_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("gii_%s_edge_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("gii_%s_face_mbr", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("gii_%s_node_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("gii_%s_seeds_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("gid_%s_edge_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("gid_%s_face_mbr", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("gid_%s_node_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("gid_%s_seeds_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("giu_%s_edge_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("giu_%s_face_mbr", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("giu_%s_node_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("giu_%s_seeds_geom", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_edge_next_ins", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_edge_update", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_edge_next_upd", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_seeds_ins", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_seeds_update", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_topolayer_name_insert", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_topolayer_name_update", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
	    }
      }
  done:
    sqlite3_free_table (results);
    return ok;
}

static int
scope_is_network_index (sqlite3 * sqlite, const char *db_prefix,
			const char *tbl_name)
{
/* testing for a possible Network Index */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;
    const char *cvg;
    char *name;
    int cmp;

    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql = sqlite3_mprintf ("SELECT network_name FROM \"%s\".networks", xprefix);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		cvg = results[(i * columns) + 0];
		name = sqlite3_mprintf ("idx_%s_start_node", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_end_node", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_timestamp", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_link", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_seeds_timestamp", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
	    }
      }
  done:
    sqlite3_free_table (results);
    return ok;
}

static int
scope_is_network_trigger (sqlite3 * sqlite, const char *db_prefix,
			  const char *tbl_name)
{
/* testing for a possible Network Trigger */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;
    const char *cvg;
    char *name;
    int cmp;

    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql = sqlite3_mprintf ("SELECT network_name FROM \"%s\".networks", xprefix);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		cvg = results[(i * columns) + 0];
		name = sqlite3_mprintf ("tmd_%s_link_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmd_%s_node_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmd_%s_seeds_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmi_%s_link_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmi_%s_node_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmi_%s_seeds_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmu_%s_link_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmu_%s_node_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("tmu_%s_seeds_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("ggi_%s_link_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("ggi_%s_node_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("ggi_%s_seeds_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("ggu_%s_link_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("ggu_%s_node_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("ggu_%s_seeds_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("gii_%s_link_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("gii_%s_node_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("gii_%s_seeds_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("giu_%s_link_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("giu_%s_node_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("giu_%s_seeds_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("gid_%s_link_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("gid_%s_node_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("gid_%s_seeds_geometry", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_node_next_ins", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_node_next_upd", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_link_next_ins", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_link_update", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_link_next_upd", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_seeds_ins", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_seeds_update", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
	    }
      }
  done:
    sqlite3_free_table (results);
    return ok;
}

static int
scope_is_raster_coverage_index (sqlite3 * sqlite, const char *db_prefix,
				const char *tbl_name)
{
/* testing for a possible Raster Coverage Index */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;
    const char *cvg;
    char *name;
    int cmp;

    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql =
	sqlite3_mprintf ("SELECT coverage_name FROM \"%s\".raster_coverages",
			 xprefix);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		cvg = results[(i * columns) + 0];
		name = sqlite3_mprintf ("idx_%s_sect_name", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_sect_md5", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_tiles_sect", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("idx_%s_tiles_lev", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
	    }
      }
  done:
    sqlite3_free_table (results);
    return ok;
}

static int
scope_is_topology_spatial_index (sqlite3 * sqlite, const char *db_prefix,
				 const char *tbl_name, int *sys)
{
/* testing for a possible Topology Spatial Index */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;
    const char *table;
    int cmp;
    char *idx_name;

    *sys = 0;
    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql =
	sqlite3_mprintf
	("SELECT topology_name FROM \"%s\".topologies", xprefix, tbl_name);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		table = results[(i * columns) + 0];
		idx_name = sqlite3_mprintf ("idx_%s_node_geom", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = 1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_node_geom_node", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_node_geom_rowid", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_node_geom_parent", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_edge_geom", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = 1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_edge_geom_node", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_edge_geom_rowid", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_edge_geom_parent", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_seeds_geom", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = 1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_seeds_geom_node", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_seeds_geom_rowid", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_seeds_geom_parent", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_face_mbr", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = 1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_face_mbr_node", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_face_mbr_rowid", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_face_mbr_parent", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
	    }
      }
    sqlite3_free_table (results);
    if (ok < 0)
	*sys = 1;
    return ok;
}

static int
scope_is_network_spatial_index (sqlite3 * sqlite, const char *db_prefix,
				const char *tbl_name, int *sys)
{
/* testing for a possible Network Spatial Index */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;
    const char *table;
    int cmp;
    char *idx_name;

    *sys = 0;
    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql =
	sqlite3_mprintf
	("SELECT network_name FROM \"%s\".networks", xprefix, tbl_name);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		table = results[(i * columns) + 0];
		idx_name = sqlite3_mprintf ("idx_%s_node_geometry", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = 1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_node_geometry_node", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name =
		    sqlite3_mprintf ("idx_%s_node_geometry_rowid", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name =
		    sqlite3_mprintf ("idx_%s_node_geometry_parent", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_link_geometry", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = 1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_link_geometry_node", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name =
		    sqlite3_mprintf ("idx_%s_link_geometry_rowid", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name =
		    sqlite3_mprintf ("idx_%s_link_geometry_parent", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_seeds_geometry", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = 1;
		      break;
		  }
		idx_name =
		    sqlite3_mprintf ("idx_%s_seeds_geometry_node", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name =
		    sqlite3_mprintf ("idx_%s_seeds_geometry_rowid", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name =
		    sqlite3_mprintf ("idx_%s_seeds_geometry_parent", table);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
	    }
      }
    sqlite3_free_table (results);
    if (ok < 0)
	*sys = 1;
    return ok;
}

static int
scope_is_spatial_index (sqlite3 * sqlite, const char *db_prefix,
			const char *tbl_name, int *sys)
{
/* testing for a possible Spatial Index */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;
    const char *table;
    const char *geom;
    int cmp;
    char *idx_name;

    *sys = 0;
    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql =
	sqlite3_mprintf
	("SELECT f_table_name, f_geometry_column FROM \"%s\".geometry_columns "
	 "WHERE spatial_index_enabled = 1", xprefix, tbl_name);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		table = results[(i * columns) + 0];
		geom = results[(i * columns) + 1];
		idx_name = sqlite3_mprintf ("idx_%s_%s", table, geom);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = 1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_%s_rowid", table, geom);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_%s_node", table, geom);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
		idx_name = sqlite3_mprintf ("idx_%s_%s_parent", table, geom);
		cmp = strcasecmp (idx_name, tbl_name);
		sqlite3_free (idx_name);
		if (cmp == 0)
		  {
		      ok = -1;
		      break;
		  }
	    }
      }
    sqlite3_free_table (results);
    if (ok < 0)
	*sys = 1;
    return ok;
}

static int
scope_is_raster_coverage_trigger (sqlite3 * sqlite, const char *db_prefix,
				  const char *tbl_name)
{
/* testing for a possible Raster Coverage trigger */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;
    const char *cvg;
    char *name;
    int cmp;

    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql =
	sqlite3_mprintf ("SELECT coverage_name FROM \"%s\".raster_coverages ",
			 xprefix);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		cvg = results[(i * columns) + 0];
		name = sqlite3_mprintf ("%s_tile_data_insert", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_tile_data_update", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_sections_statistics_insert", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
		name = sqlite3_mprintf ("%s_sections_statistics_update", cvg);
		cmp = strcasecmp (name, tbl_name);
		sqlite3_free (name);
		if (cmp == 0)
		  {
		      ok = 1;
		      goto done;
		  }
	    }
      }
  done:
    sqlite3_free_table (results);
    return ok;
}

static int
scope_is_geometry_trigger (sqlite3 * sqlite, const char *db_prefix,
			   const char *tbl_name)
{
/* testing for a possible Geometry Trigger */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;
    const char *table;
    const char *geom;
    int cmp;
    char *trg_name;

    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql =
	sqlite3_mprintf
	("SELECT f_table_name, f_geometry_column FROM \"%s\".geometry_columns",
	 xprefix, tbl_name);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		table = results[(i * columns) + 0];
		geom = results[(i * columns) + 1];
		trg_name = sqlite3_mprintf ("tmu_%s_%s", table, geom);
		cmp = strcasecmp (trg_name, tbl_name);
		sqlite3_free (trg_name);
		if (cmp == 0)
		  {
		      ok = 1;
		      break;
		  }
		trg_name = sqlite3_mprintf ("tmi_%s_%s", table, geom);
		cmp = strcasecmp (trg_name, tbl_name);
		sqlite3_free (trg_name);
		if (cmp == 0)
		  {
		      ok = 1;
		      break;
		  }
		trg_name = sqlite3_mprintf ("tmd_%s_%s", table, geom);
		cmp = strcasecmp (trg_name, tbl_name);
		sqlite3_free (trg_name);
		if (cmp == 0)
		  {
		      ok = 1;
		      break;
		  }
		trg_name = sqlite3_mprintf ("ggi_%s_%s", table, geom);
		cmp = strcasecmp (trg_name, tbl_name);
		sqlite3_free (trg_name);
		if (cmp == 0)
		  {
		      ok = 1;
		      break;
		  }
		trg_name = sqlite3_mprintf ("ggu_%s_%s", table, geom);
		cmp = strcasecmp (trg_name, tbl_name);
		sqlite3_free (trg_name);
		if (cmp == 0)
		  {
		      ok = 1;
		      break;
		  }
		trg_name = sqlite3_mprintf ("gii_%s_%s", table, geom);
		cmp = strcasecmp (trg_name, tbl_name);
		sqlite3_free (trg_name);
		if (cmp == 0)
		  {
		      ok = 1;
		      break;
		  }
		trg_name = sqlite3_mprintf ("giu_%s_%s", table, geom);
		cmp = strcasecmp (trg_name, tbl_name);
		sqlite3_free (trg_name);
		if (cmp == 0)
		  {
		      ok = 1;
		      break;
		  }
		trg_name = sqlite3_mprintf ("gid_%s_%s", table, geom);
		cmp = strcasecmp (trg_name, tbl_name);
		sqlite3_free (trg_name);
		if (cmp == 0)
		  {
		      ok = 1;
		      break;
		  }
	    }
      }
    sqlite3_free_table (results);
    return ok;
}

static int
scope_is_spatial_view (sqlite3 * sqlite, const char *db_prefix,
		       const char *tbl_name)
{
/* testing for a possible Spatial View */
    int ok = 0;
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;

    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql = sqlite3_mprintf ("SELECT Count(*) FROM \"%s\".views_geometry_columns "
			   "WHERE Lower(view_name) = Lower(%Q)", xprefix,
			   tbl_name);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	return 0;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		if (atoi (results[(i * columns) + 0]) > 0)
		    ok = 1;
	    }
      }
    sqlite3_free_table (results);
    return ok;
}

static int
scope_is_internal_table (const char *tbl_name, char **sys_scope)
{
/* testing for a possible internal table */
    if (strcasecmp (tbl_name, "sqlite_sequence") == 0
	|| strcasecmp (tbl_name, "sqlite_stat1") == 0
	|| strcasecmp (tbl_name, "sqlite_stat3") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("SQLite's own");
	  return 1;
      }
    if (strcasecmp (tbl_name, "geometry_columns") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Spatial Tables Catalog");
	  return 1;
      }
    if (strcasecmp (tbl_name, "views_geometry_columns") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Spatial Views Catalog");
	  return 1;
      }
    if (strcasecmp (tbl_name, "virts_geometry_columns") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Spatial Virtual Tables Catalog");
	  return 1;
      }
    if (strcasecmp (tbl_name, "spatial_ref_sys") == 0
	|| strcasecmp (tbl_name, "spatial_ref_sys_aux") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("CRS Catalog");
	  return 1;
      }
    if (strcasecmp (tbl_name, "spatialite_history") == 0
	|| strcasecmp (tbl_name, "sql_statements_log") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("SQL log");
	  return 1;
      }
    if (strcasecmp (tbl_name, "geometry_columns_statistics") == 0
	|| strcasecmp (tbl_name, "views_geometry_columns_statistics") == 0
	|| strcasecmp (tbl_name, "virts_geometry_columns_statistics") == 0
	|| strcasecmp (tbl_name, "geometry_columns_field_infos") == 0
	|| strcasecmp (tbl_name, "views_geometry_columns_field_infos") == 0
	|| strcasecmp (tbl_name, "virts_geometry_columns_field_infos") == 0
	|| strcasecmp (tbl_name, "geometry_columns_time") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Statistics");
	  return 1;
      }
    if (strcasecmp (tbl_name, "geometry_columns_auth") == 0
	|| strcasecmp (tbl_name, "views_geometry_columns_auth") == 0
	|| strcasecmp (tbl_name, "virts_geometry_columns_auth") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Reserved for future use");
	  return 1;
      }
    if (strcasecmp (tbl_name, "raster_coverages") == 0
	|| strcasecmp (tbl_name, "raster_coverages_srid") == 0
	|| strcasecmp (tbl_name, "raster_coverages_keyword") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Raster Coverages Catalog");
	  return 1;
      }
    if (strcasecmp (tbl_name, "vector_coverages") == 0
	|| strcasecmp (tbl_name, "vector_coverages_srid") == 0
	|| strcasecmp (tbl_name, "vector_coverages_keyword") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Vector Coverages Catalog");
	  return 1;
      }
    if (strcasecmp (tbl_name, "wms_getcapabilities") == 0
	|| strcasecmp (tbl_name, "wms_getmap") == 0
	|| strcasecmp (tbl_name, "wms_settings") == 0
	|| strcasecmp (tbl_name, "wms_ref_sys") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("WMS Coverages Catalog");
	  return 1;
      }
    if (strcasecmp (tbl_name, "data_licenses") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Raster/Vector Coverages Auxiliary");
	  return 1;
      }
    if (strcasecmp (tbl_name, "SE_external_graphics") == 0
	|| strcasecmp (tbl_name, "SE_fonts") == 0
	|| strcasecmp (tbl_name, "SE_vector_styles") == 0
	|| strcasecmp (tbl_name, "SE_raster_styles") == 0
	|| strcasecmp (tbl_name, "SE_group_styles") == 0
	|| strcasecmp (tbl_name, "SE_vector_styled_layers") == 0
	|| strcasecmp (tbl_name, "SE_vector_styled_layers") == 0
	|| strcasecmp (tbl_name, "SE_raster_styled_layers") == 0
	|| strcasecmp (tbl_name, "SE_styled_groups") == 0
	|| strcasecmp (tbl_name, "SE_styled_group_refs") == 0
	|| strcasecmp (tbl_name, "SE_styled_group_styles") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("SLD/SE Styling");
	  return 1;
      }
    if (strcasecmp (tbl_name, "topologies") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Topologies Catalog");
	  return 1;
      }
    if (strcasecmp (tbl_name, "networks") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Networks Catalog");
	  return 1;
      }
    if (strcasecmp (tbl_name, "stored_procedures") == 0
	|| strcasecmp (tbl_name, "stored_variables") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Stored Procs Catalog");
	  return 1;
      }
    if (strcasecmp (tbl_name, "SpatialIndex") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Spatial Index Interface");
	  return 1;
      }
    if (strcasecmp (tbl_name, "KNN") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("KNN Interface");
	  return 1;
      }
    if (strcasecmp (tbl_name, "ElementaryGeometries") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Elementary Geometries Interface");
	  return 1;
      }
    return 0;
}

static int
scope_is_internal_view (const char *tbl_name, char **sys_scope)
{
/* testing for a possible internal view */
    if (strcasecmp (tbl_name, "geom_cols_ref_sys") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("CRS Catalog");
	  return 1;
      }
    if (strcasecmp (tbl_name, "spatial_ref_sys_all") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Spatial Tables Catalog");
	  return 1;
      }
    if (strcasecmp (tbl_name, "raster_coverages_ref_sys") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Raster Coverages Catalog");
	  return 1;
      }
    if (strcasecmp (tbl_name, "vector_coverages_ref_sys") == 0
	|| strcasecmp (tbl_name, "vector_layers") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Vector Coverages Catalog");
	  return 1;
      }
    if (strcasecmp (tbl_name, "vector_layers_statistics") == 0 ||
	strcasecmp (tbl_name, "vector_layers_field_infos") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Statistics");
	  return 1;
      }
    if (strcasecmp (tbl_name, "vector_layers_auth") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("Reserved for future use");
	  return 1;
      }
    if (strcasecmp (tbl_name, "SE_external_graphics_view") == 0
	|| strcasecmp (tbl_name, "SE_fonts_view") == 0
	|| strcasecmp (tbl_name, "SE_vector_styles_view") == 0
	|| strcasecmp (tbl_name, "SE_raster_styles_view") == 0
	|| strcasecmp (tbl_name, "SE_vector_styled_layers_view") == 0
	|| strcasecmp (tbl_name, "SE_raster_styled_layers_view") == 0
	|| strcasecmp (tbl_name, "SE_styled_groups_view") == 0
	|| strcasecmp (tbl_name, "SE_group_styles_view") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("SLD/SE Styling");
	  return 1;
      }
    if (strcasecmp (tbl_name, "ISO_metadata_view") == 0)
      {
	  *sys_scope = sqlite3_mprintf ("ISO Metadata Component");
	  return 1;
      }
    return 0;
}

static int
scope_is_internal_index (const char *tbl_name)
{
/* testing for a possible internal index */
    if (strcasecmp (tbl_name, "idx_spatial_ref_sys") == 0
	|| strcasecmp (tbl_name, "idx_srid_geocols") == 0
	|| strcasecmp (tbl_name, "idx_viewsjoin") == 0
	|| strcasecmp (tbl_name, "idx_virtssrid") == 0)
	return 1;
    if (strcasecmp (tbl_name, "idx_vector_styles") == 0
	|| strcasecmp (tbl_name, "idx_raster_styles") == 0
	|| strcasecmp (tbl_name, "idx_sevstl_style") == 0
	|| strcasecmp (tbl_name, "idx_serstl_style") == 0)
	return 1;
    if (strcasecmp (tbl_name, "idx_ISO_metadata_ids") == 0
	|| strcasecmp (tbl_name, "idx_ISO_metadata_parents") == 0
	|| strcasecmp (tbl_name, "idx_ISO_metadata_reference_ids") == 0
	|| strcasecmp (tbl_name, "idx_ISO_metadata_reference_parents") == 0)
	return 1;
    if (strcasecmp (tbl_name, "idx_SE_styled_vgroups") == 0
	|| strcasecmp (tbl_name, "idx_SE_styled_rgroups") == 0
	|| strcasecmp (tbl_name, "idx_SE_styled_groups_paint") == 0)
	return 1;
    if (strcasecmp (tbl_name, "idx_vector_coverages") == 0
	|| strcasecmp (tbl_name, "idx_wms_getcapabilities") == 0
	|| strcasecmp (tbl_name, "idx_wms_getmap") == 0
	|| strcasecmp (tbl_name, "idx_wms_settings") == 0
	|| strcasecmp (tbl_name, "idx_wms_ref_sys") == 0)
	return 1;
    return 0;
}

static int
scope_is_internal_trigger (const char *tbl_name)
{
/* testing for a possible internal trigger */
    if (strcasecmp (tbl_name, "geometry_columns_f_table_name_insert") == 0
	|| strcasecmp (tbl_name, "geometry_columns_f_table_name_update") == 0
	|| strcasecmp (tbl_name,
		       "geometry_columns_f_geometry_column_insert") == 0
	|| strcasecmp (tbl_name,
		       "geometry_columns_f_geometry_column_update") == 0
	|| strcasecmp (tbl_name, "geometry_columns_geometry_type_insert") == 0
	|| strcasecmp (tbl_name, "geometry_columns_geometry_type_update") == 0
	|| strcasecmp (tbl_name, "geometry_columns_coord_dimension_insert") == 0
	|| strcasecmp (tbl_name,
		       "geometry_columns_coord_dimension_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "vwgc_view_name_insert") == 0
	|| strcasecmp (tbl_name, "vwgc_view_name_update") == 0
	|| strcasecmp (tbl_name, "vwgc_view_geometry_insert") == 0
	|| strcasecmp (tbl_name, "vwgc_view_geometry_update") == 0
	|| strcasecmp (tbl_name, "vwgc_view_rowid_update") == 0
	|| strcasecmp (tbl_name, "vwgc_view_rowid_insert") == 0
	|| strcasecmp (tbl_name, "vwgc_f_table_name_insert") == 0
	|| strcasecmp (tbl_name, "vwgc_f_table_name_update") == 0
	|| strcasecmp (tbl_name, "vwgc_f_geometry_column_insert") == 0
	|| strcasecmp (tbl_name, "vwgc_f_geometry_column_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "vtgc_virt_name_insert") == 0
	|| strcasecmp (tbl_name, "vtgc_virt_name_update") == 0
	|| strcasecmp (tbl_name, "vtgc_geometry_type_update") == 0
	|| strcasecmp (tbl_name, "vtgc_virt_geometry_insert") == 0
	|| strcasecmp (tbl_name, "vtgc_virt_geometry_update") == 0
	|| strcasecmp (tbl_name, "vtgc_geometry_type_insert") == 0
	|| strcasecmp (tbl_name, "vtgc_coord_dimension_insert") == 0
	|| strcasecmp (tbl_name, "vtgc_coord_dimension_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "gcs_f_table_name_insert") == 0
	|| strcasecmp (tbl_name, "gcs_f_table_name_update") == 0
	|| strcasecmp (tbl_name, "gcs_f_geometry_column_insert") == 0
	|| strcasecmp (tbl_name, "gcs_f_geometry_column_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "vwgcs_view_name_insert") == 0
	|| strcasecmp (tbl_name, "vwgcs_view_name_update") == 0
	|| strcasecmp (tbl_name, "vwgcs_view_geometry_insert") == 0
	|| strcasecmp (tbl_name, "vwgcs_view_geometry_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "vtgcs_virt_name_insert") == 0
	|| strcasecmp (tbl_name, "vtgcs_virt_name_update") == 0
	|| strcasecmp (tbl_name, "vtgcs_virt_geometry_insert") == 0
	|| strcasecmp (tbl_name, "vtgcs_virt_geometry_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "gcfi_f_table_name_insert") == 0
	|| strcasecmp (tbl_name, "gcfi_f_table_name_update") == 0
	|| strcasecmp (tbl_name, "gcfi_f_geometry_column_insert") == 0
	|| strcasecmp (tbl_name, "gcfi_f_geometry_column_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "vwgcfi_view_name_insert") == 0
	|| strcasecmp (tbl_name, "vwgcfi_view_name_update") == 0
	|| strcasecmp (tbl_name, "vwgcfi_view_geometry_insert") == 0
	|| strcasecmp (tbl_name, "vwgcfi_view_geometry_update") == 0
	|| strcasecmp (tbl_name, "vtgcfi_virt_name_insert") == 0
	|| strcasecmp (tbl_name, "vtgcfi_virt_name_update") == 0
	|| strcasecmp (tbl_name, "vtgcfi_virt_geometry_insert") == 0
	|| strcasecmp (tbl_name, "vtgcfi_virt_geometry_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "gctm_f_table_name_insert") == 0
	|| strcasecmp (tbl_name, "gctm_f_table_name_update") == 0
	|| strcasecmp (tbl_name, "gctm_f_geometry_column_insert") == 0
	|| strcasecmp (tbl_name, "gctm_f_geometry_column_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "gcau_f_table_name_insert") == 0
	|| strcasecmp (tbl_name, "gcau_f_table_name_update") == 0
	|| strcasecmp (tbl_name, "gcau_f_geometry_column_insert") == 0
	|| strcasecmp (tbl_name, "gcau_f_geometry_column_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "vwgcau_view_name_insert") == 0
	|| strcasecmp (tbl_name, "vwgcau_view_name_update") == 0
	|| strcasecmp (tbl_name, "vwgcau_view_geometry_insert") == 0
	|| strcasecmp (tbl_name, "vwgcau_view_geometry_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "vtgcau_virt_name_insert") == 0
	|| strcasecmp (tbl_name, "vtgcau_virt_name_update") == 0
	|| strcasecmp (tbl_name, "vtgcau_virt_geometry_insert") == 0
	|| strcasecmp (tbl_name, "vtgcau_virt_geometry_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "raster_coverages_name_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_name_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_sample_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_sample_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_pixel_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_pixel_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_bands_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_bands_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_compression_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_compression_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_quality_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_tilew_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_tilew_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_tileh_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_tileh_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "raster_coverages_horzres_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_horzres_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_vertres_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_vertres_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_nodata_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_nodata_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_palette_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_palette_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_statistics_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_statistics_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_monosample_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_monosample_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_monocompr_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_monocompr_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "raster_coverages_monobands_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_monobands_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_pltsample_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_pltsample_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_pltcompr_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_pltcompr_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_pltbands_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_pltbands_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_graysample_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_graysample_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_graybands_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_graybands_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_graycompr_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_graycompr_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "raster_coverages_rgbsample_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_rgbsample_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_rgbcompr_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_rgbcompr_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_rgbbands_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_rgbbands_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_multisample_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_multisample_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_multicompr_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_multicompr_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_multibands_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_multibands_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_graycompr_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_graycompr_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "raster_coverages_gridsample_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_gridsample_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_gridcompr_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_gridcompr_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_gridbands_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_gridbands_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_georef_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_georef_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_delete") == 0
	|| strcasecmp (tbl_name, "raster_coverages_srid_name_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_srid_name_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_keyword_name_insert") == 0
	|| strcasecmp (tbl_name, "raster_coverages_keyword_name_update") == 0
	|| strcasecmp (tbl_name, "raster_coverages_quality_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "topology_name_insert") == 0
	|| strcasecmp (tbl_name, "topology_name_update") == 0
	|| strcasecmp (tbl_name, "network_name_insert") == 0
	|| strcasecmp (tbl_name, "network_name_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "vector_coverages_name_insert") == 0
	|| strcasecmp (tbl_name, "vector_coverages_name_update") == 0
	|| strcasecmp (tbl_name, "vector_coverages_srid_name_insert") == 0
	|| strcasecmp (tbl_name, "vector_coverages_srid_name_update") == 0
	|| strcasecmp (tbl_name, "vector_coverages_keyword_name_insert") == 0
	|| strcasecmp (tbl_name, "vector_coverages_keyword_name_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "sextgr_mime_type_insert") == 0
	|| strcasecmp (tbl_name, "sextgr_mime_type_update") == 0
	|| strcasecmp (tbl_name, "se_font_insert1") == 0
	|| strcasecmp (tbl_name, "se_font_insert2") == 0
	|| strcasecmp (tbl_name, "se_font_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "sevector_style_insert") == 0
	|| strcasecmp (tbl_name, "sevector_style_update") == 0
	|| strcasecmp (tbl_name, "sevector_style_name_ins") == 0
	|| strcasecmp (tbl_name, "sevector_style_name_upd") == 0
	|| strcasecmp (tbl_name, "seraster_style_insert") == 0
	|| strcasecmp (tbl_name, "seraster_style_update") == 0
	|| strcasecmp (tbl_name, "seraster_style_name_ins") == 0
	|| strcasecmp (tbl_name, "seraster_style_name_upd") == 0)
	return 1;
    if (strcasecmp (tbl_name, "segroup_style_insert") == 0
	|| strcasecmp (tbl_name, "segroup_style_update") == 0
	|| strcasecmp (tbl_name, "segroup_style_name_ins") == 0
	|| strcasecmp (tbl_name, "segroup_style_name_upd") == 0)
	return 1;
    if (strcasecmp (tbl_name, "sevstl_coverage_name_insert") == 0
	|| strcasecmp (tbl_name, "sevstl_coverage_name_update") == 0
	|| strcasecmp (tbl_name, "serstl_coverage_name_insert") == 0
	|| strcasecmp (tbl_name, "serstl_coverage_name_update") == 0
	|| strcasecmp (tbl_name, "segrp_group_name_insert") == 0
	|| strcasecmp (tbl_name, "segrp_group_name_update") == 0)
	return 1;
    if (strcasecmp (tbl_name, "segrrefs_group_name_insert") == 0
	|| strcasecmp (tbl_name, "segrrefs_group_name_update") == 0
	|| strcasecmp (tbl_name, "segrrefs_vector_coverage_name_insert") == 0
	|| strcasecmp (tbl_name, "segrrefs_vector_coverage_name_update") == 0
	|| strcasecmp (tbl_name, "segrrefs_raster_coverage_name_insert") == 0
	|| strcasecmp (tbl_name, "segrrefs_raster_coverage_name_update") == 0
	|| strcasecmp (tbl_name, "segrrefs_insert_1") == 0
	|| strcasecmp (tbl_name, "segrrefs_update_1") == 0
	|| strcasecmp (tbl_name, "segrrefs_insert_2") == 0
	|| strcasecmp (tbl_name, "segrrefs_update_2") == 0)
	return 1;
    if (strcasecmp (tbl_name, "segrpstl_group_name_insert") == 0
	|| strcasecmp (tbl_name, "segrpstl_group_name_update") == 0
	|| strcasecmp (tbl_name, "storproc_ins") == 0
	|| strcasecmp (tbl_name, "storproc_upd") == 0)
	return 1;
    if (strcasecmp (tbl_name, "ISO_metadata_md_scope_insert") == 0
	|| strcasecmp (tbl_name, "ISO_metadata_md_scope_update") == 0
	|| strcasecmp (tbl_name, "ISO_metadata_fileIdentifier_insert") == 0
	|| strcasecmp (tbl_name, "ISO_metadata_fileIdentifier_update") == 0
	|| strcasecmp (tbl_name, "ISO_metadata_insert") == 0
	|| strcasecmp (tbl_name, "ISO_metadata_update") == 0
	|| strcasecmp (tbl_name, "ISO_metadata_reference_scope_insert") == 0
	|| strcasecmp (tbl_name, "ISO_metadata_reference_scope_insert") == 0
	|| strcasecmp (tbl_name, "ISO_metadata_reference_scope_update") == 0
	|| strcasecmp (tbl_name,
		       "ISO_metadata_reference_table_name_insert") == 0
	|| strcasecmp (tbl_name,
		       "ISO_metadata_reference_table_name_update") == 0
	|| strcasecmp (tbl_name,
		       "ISO_metadata_reference_row_id_value_insert") == 0
	|| strcasecmp (tbl_name,
		       "ISO_metadata_reference_row_id_value_update") == 0
	|| strcasecmp (tbl_name, "ISO_metadata_reference_timestamp_insert") == 0
	|| strcasecmp (tbl_name,
		       "ISO_metadata_reference_timestamp_update") == 0)
	return 1;
    return 0;
}

SPATIALITE_DECLARE char *
gaiaGetDbObjectScope (sqlite3 * sqlite, const char *db_prefix,
		      const char *obj_name)
{
/* attempting to determine the intended scope for a given DB object */
    char *sql;
    int ret;
    int i;
    char **results;
    int rows;
    int columns;
    char *xprefix;
    const char *type;
    const char *name;
    const char *xsql;
    char *scope = NULL;
    char *sys_scope;
    int sys;

    if (db_prefix == NULL)
	db_prefix = "MAIN";
    xprefix = gaiaDoubleQuotedSql (db_prefix);
    sql = sqlite3_mprintf ("SELECT type, name, sql FROM \"%s\".sqlite_master "
			   "WHERE Lower(name) = Lower(%Q)", xprefix, obj_name);
    free (xprefix);
    ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
	goto error;
    if (rows < 1)
	;
    else
      {
	  for (i = 1; i <= rows; i++)
	    {
		type = results[(i * columns) + 0];
		name = results[(i * columns) + 1];
		xsql = results[(i * columns) + 2];
		if (strcasecmp (type, "table") == 0)
		  {
		      /* testing tables */
		      if (scope_is_internal_table (name, &sys_scope))
			{
			    scope = sqlite3_mprintf ("system: %s", sys_scope);
			    sqlite3_free (sys_scope);
			    goto done;
			}
		      if (scope_is_topology (sqlite, db_prefix, name))
			{
			    scope =
				sqlite3_mprintf ("system: Topology Component");
			    goto done;
			}
		      if (scope_is_network (sqlite, db_prefix, name))
			{
			    scope =
				sqlite3_mprintf ("system: Network Component");
			    goto done;
			}
		      if (scope_is_iso_metadata (name))
			{
			    scope =
				sqlite3_mprintf
				("system: ISO Metadata Component");
			    goto done;
			}
		      if (scope_is_raster_coverage (sqlite, db_prefix, name))
			{
			    scope =
				sqlite3_mprintf
				("system: Raster Coverage Component");
			    goto done;
			}
		      if (scope_is_spatial_table (sqlite, db_prefix, name))
			{
			    scope = sqlite3_mprintf ("userland: Spatial Table");
			    goto done;
			}
		      if (scope_is_raster_coverage_spatial_index
			  (sqlite, db_prefix, name, &sys))
			{
			    if (sys)
				scope =
				    sqlite3_mprintf
				    ("system: Raster Coverage Component (Spatial Index Component)");
			    else
				scope =
				    sqlite3_mprintf
				    ("system: Raster Coverage Component (Spatial Index)");
			    goto done;
			}
		      if (scope_is_topology_spatial_index
			  (sqlite, db_prefix, name, &sys))
			{
			    if (sys)
				scope =
				    sqlite3_mprintf
				    ("system: Topology Component (Spatial Index Component)");
			    else
				scope =
				    sqlite3_mprintf
				    ("system: Topology Component (Spatial Index)");
			    goto done;
			}
		      if (scope_is_network_spatial_index
			  (sqlite, db_prefix, name, &sys))
			{
			    if (sys)
				scope =
				    sqlite3_mprintf
				    ("system: Network Component (Spatial Index Component)");
			    else
				scope =
				    sqlite3_mprintf
				    ("system: Network Component (Spatial Index)");
			    goto done;
			}
		      if (scope_is_spatial_index
			  (sqlite, db_prefix, name, &sys))
			{
			    if (sys)
				scope =
				    sqlite3_mprintf
				    ("system: Spatial Index Component");
			    else
				scope =
				    sqlite3_mprintf ("system: Spatial Index");
			    goto done;
			}
		      /* it should be an unqualified user Table */
		      scope = sqlite3_mprintf ("userland: Table");
		      goto done;
		  }
		if (strcasecmp (type, "view") == 0)
		  {
		      /* testing views */
		      if (scope_is_internal_view (name, &sys_scope))
			{
			    scope = sqlite3_mprintf ("system: %s", sys_scope);
			    sqlite3_free (sys_scope);
			    goto done;
			}
		      if (scope_is_topology_view (sqlite, db_prefix, name))
			{
			    scope =
				sqlite3_mprintf ("system: Topology Component");
			    goto done;
			}
		      if (scope_is_spatial_view (sqlite, db_prefix, name))
			{
			    scope = sqlite3_mprintf ("userland: Spatial View");
			    goto done;
			}
		      /* it should be an unqualified user View */
		      scope = sqlite3_mprintf ("userland: View");
		      goto done;
		  }
		if (strcasecmp (type, "index") == 0)
		  {
		      /* testing indices */
		      if (xsql == NULL)
			{
			    scope = sqlite3_mprintf ("system: AutoIndex");
			    goto done;
			}
		      if (scope_is_internal_index (name))
			{
			    scope = sqlite3_mprintf ("system: Internal Index");
			    goto done;
			}
		      if (scope_is_raster_coverage_index
			  (sqlite, db_prefix, name))
			{
			    scope =
				sqlite3_mprintf
				("system: Raster Coverage Component (index)");
			    goto done;
			}
		      if (scope_is_topology_index (sqlite, db_prefix, name))
			{
			    scope =
				sqlite3_mprintf
				("system: Topology Component (index)");
			    goto done;
			}
		      if (scope_is_network_index (sqlite, db_prefix, name))
			{
			    scope =
				sqlite3_mprintf
				("system: Network Component (index)");
			    goto done;
			}
		      /* it should be an unqualified user Index */
		      scope = sqlite3_mprintf ("userland: Index");
		      goto done;
		  }
		if (strcasecmp (type, "trigger") == 0)
		  {
		      /* testing triggers */
		      if (scope_is_internal_trigger (name))
			{
			    scope =
				sqlite3_mprintf
				("system: Internal Constraints Check (trigger)");
			    goto done;
			}
		      if (scope_is_topology_trigger (sqlite, db_prefix, name))
			{
			    scope =
				sqlite3_mprintf
				("system: Topology Constraints Check (trigger)");
			    goto done;
			}
		      if (scope_is_network_trigger (sqlite, db_prefix, name))
			{
			    scope =
				sqlite3_mprintf
				("system: Network Constraints Check (trigger)");
			    goto done;
			}
		      if (scope_is_raster_coverage_trigger
			  (sqlite, db_prefix, name))
			{
			    scope =
				sqlite3_mprintf
				("system: Raster Coverage Constraints Check (trigger)");
			    goto done;
			}
		      if (scope_is_geometry_trigger (sqlite, db_prefix, name))
			{
			    scope =
				sqlite3_mprintf
				("system: Geometry Constraints Check (trigger)");
			    goto done;
			}
		      /* it should be an unqualified user Trigger */
		      scope = sqlite3_mprintf ("userland: Trigger");
		      goto done;
		  }
		/* unknown object */
		scope = sqlite3_mprintf ("unknown scope");
		goto done;
	    }
      }
  done:
    sqlite3_free_table (results);
    return scope;

  error:
    return NULL;
}

Added src/spatialite/pause.c.

















































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*

 pause.c -- implementing PAUSE() for both Unix/Linux and Windows

 version 5.0, 2018 May 28

 Author: Sandro Furieri a.furieri@lqt.it

 ------------------------------------------------------------------------------
 
 Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
 The contents of this file are subject to the Mozilla Public License Version
 1.1 (the "License"); you may not use this file except in compliance with
 the License. You may obtain a copy of the License at
 http://www.mozilla.org/MPL/
 
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.

The Original Code is the SpatiaLite library

The Initial Developer of the Original Code is Alessandro Furieri
 
Portions created by the Initial Developer are Copyright (C) 2008-2018
the Initial Developer. All Rights Reserved.

Contributor(s):

Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
 
*/

#include <stdlib.h>
#include <stdio.h>

#ifdef _WIN32
#include <windows.h>
#else
#include <signal.h>
#include <unistd.h>
#endif

#include <spatialite_private.h>

#ifdef _WIN32

/* Windows implementation */

SPATIALITE_PRIVATE void
splite_pause_windows (void)
{
    HANDLE hStdin;
    DWORD fdwSaveOldMode;
    DWORD fdwMode;
    DWORD cNumRead;
    DWORD i;
    INPUT_RECORD irInBuf[128];
    int go = 1;

/* Get the standard input handle */
    hStdin = GetStdHandle (STD_INPUT_HANDLE);
    if (hStdin == INVALID_HANDLE_VALUE)
	return;

/* Save the current input mode, to be restored on exit */
    if (!GetConsoleMode (hStdin, &fdwSaveOldMode))
	return;

/* Enable window input events */
    fdwMode = ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT;
    if (!SetConsoleMode (hStdin, fdwMode))
	return;
/* flush to remove existing events */
    FlushConsoleInputBuffer (hStdin);

/* Wait for console events. */
    fprintf (stderr,
	     "***************  PAUSE  ***************  Hit any key to continue\n");
    while (go)
      {
	  if (!ReadConsoleInput (hStdin,	// input buffer handle 
				 irInBuf,	// buffer to read into 
				 128,	// size of read buffer 
				 &cNumRead))	// number of records read 
	      goto reset;

	  for (i = 0; i < cNumRead; i++)
	    {
		/* testing events */
		switch (irInBuf[i].EventType)
		  {
		  case KEY_EVENT:	/* keyboard input */
		      go = 0;
		      break;
		  }
	    }
      }
  reset:
    fprintf (stderr, "*************** resuming execution after PAUSE\n");

/* Restore input mode on exit. */
    SetConsoleMode (hStdin, fdwSaveOldMode);
}

/* end Windows implementation */

#else

/* Unix/Linux implementation */

void
sig_handler (int signum)
{
    if (signum == SIGCONT)
      {
	  fprintf (stderr,
		   "*************** SIGCONT: resuming execution after PAUSE\n");
	  fflush (stderr);
      }
}

SPATIALITE_PRIVATE void
splite_pause_signal (void)
{
/* installing the signal handlers */
    signal (SIGSTOP, sig_handler);
    signal (SIGCONT, sig_handler);

/* raising a SIGSTOP signal to the current process */
    fprintf (stderr, "***************  PAUSE  ***************\n");
    fprintf (stderr, "command for resuming execution is:\nkill -SIGCONT %d\n",
	     getpid ());
    fflush (stderr);
    raise (SIGSTOP);
}

/* end Unix/Linux implementation */

#endif

Changes to src/spatialite/spatialite.c.

2218
2219
2220
2221
2222
2223
2224


2225
2226
2227
2228
2229
2230


2231
2232
2233
2234
2235
2236
2237
....
2451
2452
2453
2454
2455
2456
2457

2458
2459

2460


2461
2462
2463
2464
2465
2466
2467
....
2518
2519
2520
2521
2522
2523
2524


















2525
2526
2527
2528
2529
2530
2531
....
2533
2534
2535
2536
2537
2538
2539










2540
2541
2542
2543
2544
2545








2546
2547
2548
2549
2550
2551
2552
....
6735
6736
6737
6738
6739
6740
6741








































6742
6743
6744
6745
6746
6747
6748
.....
44600
44601
44602
44603
44604
44605
44606










































































44607
44608
44609
44610
44611
44612
44613
.....
46077
46078
46079
46080
46081
46082
46083



46084
46085
46086
46087
46088
46089
46090
.....
48790
48791
48792
48793
48794
48795
48796













48797
48798
48799
48800
48801
48802
48803
		sqlite3_result_int (context, -1);
		return;
	    }
	  db_prefix = (const char *) sqlite3_value_text (argv[0]);
      }
    sqlite = sqlite3_context_db_handle (context);
    ret = checkSpatialMetaData_ex (sqlite, db_prefix);


    if (ret == 3)
      {
	  /* trying to create the advanced metadata tables >= v.4.0.0 */
	  if (db_prefix == NULL || strcasecmp (db_prefix, "main") == 0)
	      createAdvancedMetaData (sqlite);
      }


    sqlite3_result_int (context, ret);
    return;
}

static void
fnct_InitSpatialMetaData (sqlite3_context * context, int argc,
			  sqlite3_value ** argv)
................................................................................
/     or
/ InitSpatialMetaDataFull(integer transaction)
/     or
/ InitSpatialMetaDataFull(integer transaction, text mode)
/
/ conveniency "super" function internally calling in a single shot:
/     - InitSpatialMetaData()

/     - CreateRasterCoveragesTable()
/     - CreateVectorCoveragesTables()

/     - CreateStylingTables()


/ returns 1 on success
/ 0 on failure
*/
    char *errMsg = NULL;
    int ret;
    int transaction = 0;
    const char *xmode = NULL;
................................................................................
	sql = sqlite3_mprintf ("SELECT InitSpatialMetaData(0, %Q)", xmode);
    else
	sql = sqlite3_mprintf ("SELECT InitSpatialMetaData(0)");
    retval = do_execute_sql_with_retval (sqlite, sql, &errMsg);
    sqlite3_free (sql);
    if (retval != 1)
	goto error;



















/* executing CreateRasterCoveragesTable() */
    sql = sqlite3_mprintf ("SELECT CreateRasterCoveragesTable()");
    retval = do_execute_sql_with_retval (sqlite, sql, &errMsg);
    sqlite3_free (sql);
    if (retval != 1)
	goto error;
................................................................................
/* executing CreateVectorCoveragesTables() */
    sql = sqlite3_mprintf ("SELECT CreateVectorCoveragesTables()");
    retval = do_execute_sql_with_retval (sqlite, sql, &errMsg);
    sqlite3_free (sql);
    if (retval != 1)
	goto error;











/* executing CreateStylingTables() */
    sql = sqlite3_mprintf ("SELECT CreateStylingTables()");
    retval = do_execute_sql_with_retval (sqlite, sql, &errMsg);
    sqlite3_free (sql);
    if (retval != 1)
	goto error;









/* executing StoredProc_CreateTables() */
    sql = sqlite3_mprintf ("SELECT StoredProc_CreateTables()");
    retval = do_execute_sql_with_retval (sqlite, sql, &errMsg);
    sqlite3_free (sql);
    if (retval != 1)
	goto error;
................................................................................
    return;
  error:
    spatialite_e ("DiscardFDOGeometryColumn() error: \"%s\"\n", errMsg);
    sqlite3_free (errMsg);
    sqlite3_result_int (context, 0);
    return;
}









































static int
eval_rtree_entry (int ok_geom, double geom_value, int ok_rtree,
		  double rtree_value)
{
/* evaluating geom-coord and rtree-coord */
    if (!ok_geom && !ok_rtree)
................................................................................
	  sqlite3_result_int (context, 0);
	  return;
      }
    sqlite3_result_int (context, cache->gpkg_amphibious_mode);
}

#endif /* end GPKG conditional */











































































static void
fnct_setDecimalPrecision (sqlite3_context * context, int argc,
			  sqlite3_value ** argv)
{
/* SQL function:
/ SetDecimalPrecision ( int precision )
................................................................................
				fnct_AddFDOGeometryColumn, 0, 0, 0);
    sqlite3_create_function_v2 (db, "RecoverFDOGeometryColumn", 6,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0,
				fnct_RecoverFDOGeometryColumn, 0, 0, 0);
    sqlite3_create_function_v2 (db, "DiscardFDOGeometryColumn", 2,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0,
				fnct_DiscardFDOGeometryColumn, 0, 0, 0);




    sqlite3_create_function_v2 (db, "InitSpatialMetaData", 0,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0,
				fnct_InitSpatialMetaData, 0, 0, 0);
    sqlite3_create_function_v2 (db, "InitSpatialMetaData", 1,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0,
				fnct_InitSpatialMetaData, 0, 0, 0);
................................................................................
    sqlite3_create_function_v2 (db, "DisableGpkgAmphibiousMode", 0,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache,
				fnct_disableGpkgAmphibiousMode, 0, 0, 0);
    sqlite3_create_function_v2 (db, "GetGpkgAmphibiousMode", 0,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache,
				fnct_getGpkgAmphibiousMode, 0, 0, 0);
#endif /* end GPKG conditional */














    sqlite3_create_function_v2 (db, "SetDecimalPrecision", 1,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache,
				fnct_setDecimalPrecision, 0, 0, 0);
    sqlite3_create_function_v2 (db, "GetDecimalPrecision", 0,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache,
				fnct_getDecimalPrecision, 0, 0, 0);







>
>
|
|
|
|
|
|
>
>







 







>


>

>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>






>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>







2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
....
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
....
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
....
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
....
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
.....
44684
44685
44686
44687
44688
44689
44690
44691
44692
44693
44694
44695
44696
44697
44698
44699
44700
44701
44702
44703
44704
44705
44706
44707
44708
44709
44710
44711
44712
44713
44714
44715
44716
44717
44718
44719
44720
44721
44722
44723
44724
44725
44726
44727
44728
44729
44730
44731
44732
44733
44734
44735
44736
44737
44738
44739
44740
44741
44742
44743
44744
44745
44746
44747
44748
44749
44750
44751
44752
44753
44754
44755
44756
44757
44758
44759
44760
44761
44762
44763
44764
44765
44766
44767
44768
44769
44770
44771
.....
46235
46236
46237
46238
46239
46240
46241
46242
46243
46244
46245
46246
46247
46248
46249
46250
46251
.....
48951
48952
48953
48954
48955
48956
48957
48958
48959
48960
48961
48962
48963
48964
48965
48966
48967
48968
48969
48970
48971
48972
48973
48974
48975
48976
48977
		sqlite3_result_int (context, -1);
		return;
	    }
	  db_prefix = (const char *) sqlite3_value_text (argv[0]);
      }
    sqlite = sqlite3_context_db_handle (context);
    ret = checkSpatialMetaData_ex (sqlite, db_prefix);

    /*
       if (ret == 3)
       {
       ** trying to create the advanced metadata tables >= v.4.0.0 **
       if (db_prefix == NULL || strcasecmp (db_prefix, "main") == 0)
       createAdvancedMetaData (sqlite);
       }
     */

    sqlite3_result_int (context, ret);
    return;
}

static void
fnct_InitSpatialMetaData (sqlite3_context * context, int argc,
			  sqlite3_value ** argv)
................................................................................
/     or
/ InitSpatialMetaDataFull(integer transaction)
/     or
/ InitSpatialMetaDataFull(integer transaction, text mode)
/
/ conveniency "super" function internally calling in a single shot:
/     - InitSpatialMetaData()
/     - CreateIsoMetadataTables()
/     - CreateRasterCoveragesTable()
/     - CreateVectorCoveragesTables()
/     - CreateTopoTables()
/     - CreateStylingTables()
/     - WMS_CreateTables()
/     - StoredProc_CreateTables()
/ returns 1 on success
/ 0 on failure
*/
    char *errMsg = NULL;
    int ret;
    int transaction = 0;
    const char *xmode = NULL;
................................................................................
	sql = sqlite3_mprintf ("SELECT InitSpatialMetaData(0, %Q)", xmode);
    else
	sql = sqlite3_mprintf ("SELECT InitSpatialMetaData(0)");
    retval = do_execute_sql_with_retval (sqlite, sql, &errMsg);
    sqlite3_free (sql);
    if (retval != 1)
	goto error;

#ifdef ENABLE_LIBXML2		/* only if LibXML2 support is available */
    if (xmode != NULL)
      {
	  if (strcasecmp (xmode, "NONE") == 0
	      || strcasecmp (xmode, "EMPTY") == 0)
	      ;
	  else
	    {
		/* executing CreateIsoMetadataTables() */
		sql = sqlite3_mprintf ("SELECT CreateIsoMetadataTables()");
		retval = do_execute_sql_with_retval (sqlite, sql, &errMsg);
		sqlite3_free (sql);
		if (retval != 1)
		    goto error;
	    }
      }
#endif

/* executing CreateRasterCoveragesTable() */
    sql = sqlite3_mprintf ("SELECT CreateRasterCoveragesTable()");
    retval = do_execute_sql_with_retval (sqlite, sql, &errMsg);
    sqlite3_free (sql);
    if (retval != 1)
	goto error;
................................................................................
/* executing CreateVectorCoveragesTables() */
    sql = sqlite3_mprintf ("SELECT CreateVectorCoveragesTables()");
    retval = do_execute_sql_with_retval (sqlite, sql, &errMsg);
    sqlite3_free (sql);
    if (retval != 1)
	goto error;

#ifdef ENABLE_RTTOPO		/* only if RtTopo support is available */
/* executing CreateTopoTables() */
    sql = sqlite3_mprintf ("SELECT CreateTopoTables()");
    retval = do_execute_sql_with_retval (sqlite, sql, &errMsg);
    sqlite3_free (sql);
    if (retval != 1)
	goto error;
#endif

#ifdef ENABLE_LIBXML2		/* only if LibXML2 support is available */
/* executing CreateStylingTables() */
    sql = sqlite3_mprintf ("SELECT CreateStylingTables()");
    retval = do_execute_sql_with_retval (sqlite, sql, &errMsg);
    sqlite3_free (sql);
    if (retval != 1)
	goto error;
#endif

/* executing WMS_CreateTables() */
    sql = sqlite3_mprintf ("SELECT WMS_CreateTables()");
    retval = do_execute_sql_with_retval (sqlite, sql, &errMsg);
    sqlite3_free (sql);
    if (retval != 1)
	goto error;

/* executing StoredProc_CreateTables() */
    sql = sqlite3_mprintf ("SELECT StoredProc_CreateTables()");
    retval = do_execute_sql_with_retval (sqlite, sql, &errMsg);
    sqlite3_free (sql);
    if (retval != 1)
	goto error;
................................................................................
    return;
  error:
    spatialite_e ("DiscardFDOGeometryColumn() error: \"%s\"\n", errMsg);
    sqlite3_free (errMsg);
    sqlite3_result_int (context, 0);
    return;
}

static void
fnct_GetDbObjectScope (sqlite3_context * context, int argc,
		       sqlite3_value ** argv)
{
/* SQL function:
/ GetDbObjectScope(da-prefix, name)
/
/ returns the intended scope of some DB Object
/ returns a text string
/ NULL on invalid arguments
*/
    const char *db_prefix = NULL;
    const char *name;
    char *scope;
    sqlite3 *sqlite = sqlite3_context_db_handle (context);
    GAIA_UNUSED ();		/* LCOV_EXCL_LINE */
    if (sqlite3_value_type (argv[0]) == SQLITE_NULL)
	;
    else if (sqlite3_value_type (argv[0]) != SQLITE_TEXT)
      {
	  sqlite3_result_null (context);
	  return;
      }
    else
	name = (const char *) sqlite3_value_text (argv[0]);
    if (sqlite3_value_type (argv[1]) != SQLITE_TEXT)
      {
	  sqlite3_result_null (context);
	  return;
      }
    name = (const char *) sqlite3_value_text (argv[1]);
    scope = gaiaGetDbObjectScope (sqlite, db_prefix, name);
    if (scope == NULL)
      {
	  sqlite3_result_null (context);
	  return;
      }
    sqlite3_result_text (context, scope, strlen (scope), sqlite3_free);
}

static int
eval_rtree_entry (int ok_geom, double geom_value, int ok_rtree,
		  double rtree_value)
{
/* evaluating geom-coord and rtree-coord */
    if (!ok_geom && !ok_rtree)
................................................................................
	  sqlite3_result_int (context, 0);
	  return;
      }
    sqlite3_result_int (context, cache->gpkg_amphibious_mode);
}

#endif /* end GPKG conditional */

static void
fnct_EnablePause (sqlite3_context * context, int argc, sqlite3_value ** argv)
{
/* SQL function:
/ EnablePause ( void )
/
/ returns: nothing
*/
    struct splite_internal_cache *cache = sqlite3_user_data (context);
    GAIA_UNUSED ();		/* LCOV_EXCL_LINE */
    if (cache == NULL)
	return;
    cache->is_pause_enabled = 1;
}

static void
fnct_DisablePause (sqlite3_context * context, int argc, sqlite3_value ** argv)
{
/* SQL function:
/ DisablePause ( void )
/
/ returns: nothing
*/
    struct splite_internal_cache *cache = sqlite3_user_data (context);
    GAIA_UNUSED ();		/* LCOV_EXCL_LINE */
    if (cache == NULL)
	return;
    cache->is_pause_enabled = 0;
}

static void
fnct_IsPauseEnabled (sqlite3_context * context, int argc, sqlite3_value ** argv)
{
/* SQL function:
/ IsPauseEnabled ( void )
/
/ returns: TRUE or FALSE
*/
    struct splite_internal_cache *cache = sqlite3_user_data (context);
    GAIA_UNUSED ();		/* LCOV_EXCL_LINE */
    if (cache == NULL)
      {
	  sqlite3_result_int (context, 0);
	  return;
      }
    if (cache->is_pause_enabled)
	sqlite3_result_int (context, 1);
    else
	sqlite3_result_int (context, 0);
}

static void
fnct_Pause (sqlite3_context * context, int argc, sqlite3_value ** argv)
{
/* SQL function:
/ Pause ( void )
/
/ returns: nothing
*/
    struct splite_internal_cache *cache = sqlite3_user_data (context);
    GAIA_UNUSED ();		/* LCOV_EXCL_LINE */
    if (cache == NULL)
	return;
    if (cache->is_pause_enabled == 0)
	return;

/* only if PAUSE is explicitly enabled */
#ifdef _WIN32
    splite_pause_windows ();
#else
    splite_pause_signal ();
#endif
}

static void
fnct_setDecimalPrecision (sqlite3_context * context, int argc,
			  sqlite3_value ** argv)
{
/* SQL function:
/ SetDecimalPrecision ( int precision )
................................................................................
				fnct_AddFDOGeometryColumn, 0, 0, 0);
    sqlite3_create_function_v2 (db, "RecoverFDOGeometryColumn", 6,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0,
				fnct_RecoverFDOGeometryColumn, 0, 0, 0);
    sqlite3_create_function_v2 (db, "DiscardFDOGeometryColumn", 2,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0,
				fnct_DiscardFDOGeometryColumn, 0, 0, 0);
    sqlite3_create_function_v2 (db, "GetDbObjectScope", 2,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0,
				fnct_GetDbObjectScope, 0, 0, 0);

    sqlite3_create_function_v2 (db, "InitSpatialMetaData", 0,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0,
				fnct_InitSpatialMetaData, 0, 0, 0);
    sqlite3_create_function_v2 (db, "InitSpatialMetaData", 1,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0,
				fnct_InitSpatialMetaData, 0, 0, 0);
................................................................................
    sqlite3_create_function_v2 (db, "DisableGpkgAmphibiousMode", 0,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache,
				fnct_disableGpkgAmphibiousMode, 0, 0, 0);
    sqlite3_create_function_v2 (db, "GetGpkgAmphibiousMode", 0,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache,
				fnct_getGpkgAmphibiousMode, 0, 0, 0);
#endif /* end GPKG conditional */

    sqlite3_create_function_v2 (db, "EnablePause", 0,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache,
				fnct_EnablePause, 0, 0, 0);
    sqlite3_create_function_v2 (db, "DisablePause", 0,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache,
				fnct_DisablePause, 0, 0, 0);
    sqlite3_create_function_v2 (db, "IsPauseEnabled", 0,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache,
				fnct_IsPauseEnabled, 0, 0, 0);
    sqlite3_create_function_v2 (db, "Pause", 0,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache,
				fnct_Pause, 0, 0, 0);

    sqlite3_create_function_v2 (db, "SetDecimalPrecision", 1,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache,
				fnct_setDecimalPrecision, 0, 0, 0);
    sqlite3_create_function_v2 (db, "GetDecimalPrecision", 0,
				SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache,
				fnct_getDecimalPrecision, 0, 0, 0);

Changes to src/spatialite/table_cloner.c.

202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
...
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
....
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
....
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
	      sql = sqlite3_mprintf ("ALTER TABLE main.\"%s\" "
				     "ADD COLUMN \"%s\" %s", xtable, xcolumn,
				     column->type);
      }
    free (xtable);
    free (xcolumn);
    ret = sqlite3_exec (sqlite, sql, NULL, NULL, &err_msg);
    sqlite3_free(sql);
    if (ret != SQLITE_OK)
      {
	  spatialite_e ("ALTER TABLE ADD COLUMN error: %s\n", err_msg);
	  sqlite3_free (err_msg);
	  return 0;
      }
    return 1;
................................................................................
    while (index != NULL)
      {
	  /* creating an Index */
	  const char *list;
	  constraint =
	      sqlite3_mprintf ("idx_%s_%d", cloner->out_table, fk_no++);
	  xconstraint = gaiaDoubleQuotedSql (constraint);
	  sqlite3_free(constraint);
	  xtable = gaiaDoubleQuotedSql (cloner->out_table);
	  if (index->unique)
	      sql =
		  sqlite3_mprintf ("CREATE UNIQUE INDEX main.\"%s\" ON \"%s\"",
				   xconstraint, xtable);
	  else
	      sql =
................................................................................
	  if (column->ignore)
	    {
		/* skipping columns to be IGNORED */
		column = column->next;
		continue;
	    }
	  xcolumn = gaiaDoubleQuotedSql (column->name);
    prev_sql = sql;
	  if (first)
	    {
		sql = sqlite3_mprintf ("%s\"%s\"", prev_sql, xcolumn);
		first = 0;
	    }
	  else
	      sql = sqlite3_mprintf ("%s, \"%s\"", prev_sql, xcolumn);
................................................................................
	  column = column->next;
      }
    xdb_prefix = gaiaDoubleQuotedSql (cloner->db_prefix);
    xtable = gaiaDoubleQuotedSql (cloner->in_table);
    prev_sql = sql;
    sql =
	sqlite3_mprintf ("%s FROM \"%s\".\"%s\"", prev_sql, xdb_prefix, xtable);
	sqlite3_free(prev_sql);
    free (xdb_prefix);
    free (xtable);
/* compiling the SELECT FROM statement */
    ret =
	sqlite3_prepare_v2 (cloner->sqlite, sql, strlen (sql), &stmt_in, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)







|







 







|







 







|







 







|







202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
...
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
....
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
....
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
	      sql = sqlite3_mprintf ("ALTER TABLE main.\"%s\" "
				     "ADD COLUMN \"%s\" %s", xtable, xcolumn,
				     column->type);
      }
    free (xtable);
    free (xcolumn);
    ret = sqlite3_exec (sqlite, sql, NULL, NULL, &err_msg);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)
      {
	  spatialite_e ("ALTER TABLE ADD COLUMN error: %s\n", err_msg);
	  sqlite3_free (err_msg);
	  return 0;
      }
    return 1;
................................................................................
    while (index != NULL)
      {
	  /* creating an Index */
	  const char *list;
	  constraint =
	      sqlite3_mprintf ("idx_%s_%d", cloner->out_table, fk_no++);
	  xconstraint = gaiaDoubleQuotedSql (constraint);
	  sqlite3_free (constraint);
	  xtable = gaiaDoubleQuotedSql (cloner->out_table);
	  if (index->unique)
	      sql =
		  sqlite3_mprintf ("CREATE UNIQUE INDEX main.\"%s\" ON \"%s\"",
				   xconstraint, xtable);
	  else
	      sql =
................................................................................
	  if (column->ignore)
	    {
		/* skipping columns to be IGNORED */
		column = column->next;
		continue;
	    }
	  xcolumn = gaiaDoubleQuotedSql (column->name);
	  prev_sql = sql;
	  if (first)
	    {
		sql = sqlite3_mprintf ("%s\"%s\"", prev_sql, xcolumn);
		first = 0;
	    }
	  else
	      sql = sqlite3_mprintf ("%s, \"%s\"", prev_sql, xcolumn);
................................................................................
	  column = column->next;
      }
    xdb_prefix = gaiaDoubleQuotedSql (cloner->db_prefix);
    xtable = gaiaDoubleQuotedSql (cloner->in_table);
    prev_sql = sql;
    sql =
	sqlite3_mprintf ("%s FROM \"%s\".\"%s\"", prev_sql, xdb_prefix, xtable);
    sqlite3_free (prev_sql);
    free (xdb_prefix);
    free (xtable);
/* compiling the SELECT FROM statement */
    ret =
	sqlite3_prepare_v2 (cloner->sqlite, sql, strlen (sql), &stmt_in, NULL);
    sqlite3_free (sql);
    if (ret != SQLITE_OK)

Changes to src/spatialite/virtualrouting.c.

6185
6186
6187
6188
6189
6190
6191


6192
6193
6194
6195
6196
6197
6198
6199
6200

6201
6202
6203
6204
6205
6206
6207
6208


6209
6210

6211
6212

6213
6214
6215
6216
6217
6218

6219
6220
6221
6222
6223
6224
6225
{
/* attempting to identify the optimal Point2Point solution */
    Point2PointCandidatePtr p_from = p2p->firstFromCandidate;
    while (p_from != NULL)
      {
	  /* searching FROM candidates */
	  int ok = 0;


	  if (nodeCode)
	    {
		if (strcmp (solution->From->Code, p_from->codNodeTo) == 0)
		    ok = 1;
	    }
	  else
	    {
		if (solution->From->Id == p_from->idNodeTo)
		    ok = 1;

	    }
	  if (ok)
	    {
		Point2PointCandidatePtr p_to = p2p->firstToCandidate;
		while (p_to != NULL)
		  {
		      /* searching TO candidates */
		      int ok2 = 0;


		      if (nodeCode)
			{

			    if (strcmp (solution->To->Code, p_to->codNodeFrom)
				== 0)

				ok2 = 1;
			}
		      else
			{
			    if (solution->To->Id == p_to->idNodeFrom)
				ok2 = 1;

			}
		      if (ok2)
			{
			    double tot =
				solution->TotalCost + p_from->pathLen +
				p_from->extraLen + p_to->pathLen +
				p_to->extraLen;







>
>
|
|
|
|
|
|
|
|
|
>








>
>
|
|
>
|
<
>
|
|
|
|
|
|
>







6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217

6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
{
/* attempting to identify the optimal Point2Point solution */
    Point2PointCandidatePtr p_from = p2p->firstFromCandidate;
    while (p_from != NULL)
      {
	  /* searching FROM candidates */
	  int ok = 0;
	  if (solution->From != NULL)
	    {
		if (nodeCode)
		  {
		      if (strcmp (solution->From->Code, p_from->codNodeTo) == 0)
			  ok = 1;
		  }
		else
		  {
		      if (solution->From->Id == p_from->idNodeTo)
			  ok = 1;
		  }
	    }
	  if (ok)
	    {
		Point2PointCandidatePtr p_to = p2p->firstToCandidate;
		while (p_to != NULL)
		  {
		      /* searching TO candidates */
		      int ok2 = 0;
		      if (solution->To != NULL)
			{
			    if (nodeCode)
			      {
				  if (strcmp
				      (solution->To->Code,

				       p_to->codNodeFrom) == 0)
				      ok2 = 1;
			      }
			    else
			      {
				  if (solution->To->Id == p_to->idNodeFrom)
				      ok2 = 1;
			      }
			}
		      if (ok2)
			{
			    double tot =
				solution->TotalCost + p_from->pathLen +
				p_from->extraLen + p_to->pathLen +
				p_to->extraLen;

Changes to src/srsinit/srs_init.c.

498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
...
833
834
835
836
837
838
839


840
841
842
843
844
845
846
847
848
849
	  sqlite3_bind_text (stmt, 4, p->ref_sys_name, strlen (p->ref_sys_name),
			     SQLITE_STATIC);
	  sqlite3_bind_text (stmt, 5, p->proj4text, strlen (p->proj4text),
			     SQLITE_STATIC);
	  if (metadata >= 2)
	    {
		/*  SpatiaLite-Legacy 2.4.0 - 3.0.1 and SpatiaLite 4.0.0 - present */
		if  (strlen (p->srs_wkt) == 0)
		    sqlite3_bind_text (stmt, 6, "Undefined", 9, SQLITE_STATIC);
		else
		    sqlite3_bind_text (stmt, 6, p->srs_wkt, strlen (p->srs_wkt),
				       SQLITE_STATIC);
		ret = sqlite3_step (stmt);
		if (ret == SQLITE_DONE || ret == SQLITE_ROW)
		    ;
................................................................................
	  return 0;
      }
    if (mode == GAIA_EPSG_ANY || mode == GAIA_EPSG_NONE
	|| mode == GAIA_EPSG_WGS84_ONLY)
	;
    else
	mode = GAIA_EPSG_ANY;


    if (populate_spatial_ref_sys (handle, mode, metadata))	/* Mark Johnson 2019-01-27 */
      {
	  if (verbose && mode != GAIA_EPSG_NONE)
	      spatialite_e
		  ("OK: the SPATIAL_REF_SYS table was successfully populated\n");
	  return 1;
      }
    return 0;
}








|







 







>
>


|







498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
...
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
	  sqlite3_bind_text (stmt, 4, p->ref_sys_name, strlen (p->ref_sys_name),
			     SQLITE_STATIC);
	  sqlite3_bind_text (stmt, 5, p->proj4text, strlen (p->proj4text),
			     SQLITE_STATIC);
	  if (metadata >= 2)
	    {
		/*  SpatiaLite-Legacy 2.4.0 - 3.0.1 and SpatiaLite 4.0.0 - present */
		if (strlen (p->srs_wkt) == 0)
		    sqlite3_bind_text (stmt, 6, "Undefined", 9, SQLITE_STATIC);
		else
		    sqlite3_bind_text (stmt, 6, p->srs_wkt, strlen (p->srs_wkt),
				       SQLITE_STATIC);
		ret = sqlite3_step (stmt);
		if (ret == SQLITE_DONE || ret == SQLITE_ROW)
		    ;
................................................................................
	  return 0;
      }
    if (mode == GAIA_EPSG_ANY || mode == GAIA_EPSG_NONE
	|| mode == GAIA_EPSG_WGS84_ONLY)
	;
    else
	mode = GAIA_EPSG_ANY;
    if (mode == GAIA_EPSG_NONE)
	return 1;
    if (populate_spatial_ref_sys (handle, mode, metadata))	/* Mark Johnson 2019-01-27 */
      {
	  if (verbose)
	      spatialite_e
		  ("OK: the SPATIAL_REF_SYS table was successfully populated\n");
	  return 1;
      }
    return 0;
}