Check-in [4d07ddcdff]
Not logged in

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

Overview
Comment:fixing a regression in SpatialIndex (Spatial Views) and supporting floating point scientific notations in the text importer
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4d07ddcdffbd22a67e68b4adcf2908b5bbe78fc2
User & Date: sandro 2016-04-06 09:23:07
Context
2016-04-17
15:31
supporting MSVC 2015 check-in: 7031382b2b user: sandro tags: trunk
2016-04-06
09:23
fixing a regression in SpatialIndex (Spatial Views) and supporting floating point scientific notations in the text importer check-in: 4d07ddcdff user: sandro tags: trunk
2016-03-30
18:10
fixing other issues caused by the previous commit check-in: 32c650b797 user: sandro tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/spatialite/virtualspatialindex.c.

169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
		strcpy (rg, v);
		count++;
	    }
      }
    sqlite3_finalize (stmt);
    if (count != 1)
	return 0;
    if (!validateRowid (sqlite, table_name))
      {
	  free (rt);
	  free (rg);
	  return 0;
      }
    *real_table = rt;
    *real_geom = rg;







|







169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
		strcpy (rg, v);
		count++;
	    }
      }
    sqlite3_finalize (stmt);
    if (count != 1)
	return 0;
    if (validateRowid (sqlite, table_name))
      {
	  free (rt);
	  free (rg);
	  return 0;
      }
    *real_table = rt;
    *real_geom = rg;

Changes to src/virtualtext/virtualtext.c.

1164
1165
1166
1167
1168
1169
1170














































1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
....
1214
1215
1216
1217
1218
1219
1220











1221
1222
1223
1224
1225
1226
1227
	  else
	      return 0;		/* sign is not the first/last string char */
      }
    return 1;			/* ok, can be a valid INTEGER value */
}

static int














































vrttxt_is_double (const char *value, char decimal_separator)
{
/* checking if this value can be a DOUBLE */
    int invalids = 0;
    int digits = 0;
    int signs = 0;
    int points = 0;
    char last = '\0';
    const char *p = value;
    while (*p != '\0')
................................................................................
	  if (*value == '+' || *value == '-' || last == '+' || last == '-')
	      ;
	  else
	      return 0;		/* sign is not the first/last string char */
      }
    return 1;			/* ok, can be a valid DOUBLE value */
}












static int
vrttxt_check_type (const char *value, char decimal_separator)
{
/* checking the Field type */
    if (*value == '\0')
	return VRTTXT_NULL;







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

|







 







>
>
>
>
>
>
>
>
>
>
>







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
....
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
	  else
	      return 0;		/* sign is not the first/last string char */
      }
    return 1;			/* ok, can be a valid INTEGER value */
}

static int
vrttxt_is_scientific_double (const char *value, char decimal_separator)
{
/* checking if this value can be a DOUBLE (scientific notation: -1.567E-16) */
    int points = 0;
    int exp = 0;
    int sign = 0;
    int invalid = 0;
    int digit2 = 0;
    int digit3 = 0;
    const char *p = value;
    if (*p == '-' || *p == '+')
	p++;			/* skipping the first sign */
    while (*p != '\0')
      {
	  if (*p == decimal_separator)
	    {
		if (digit2 == 0)
		    points++;
		else
		    invalid++;
	    }
	  else if (*p == 'E' || *p == 'e')
	      exp++;
	  else if (*p == '-' || *p == '+')
	    {
		if (exp && !digit3)
		    sign++;
		else
		    invalid++;
	    }
	  else if (*p >= '0' && *p <= '9')
	    {
		if (exp)
		    digit3++;
		else if (points)
		    digit2++;
	    }
	  p++;
      }
    if (digit2 >= 0 && exp == 1 && (sign == 0 || sign == 1) && digit3
	&& !invalid)
	return 1;
    return 0;
}

static int
vrttxt_is_plain_double (const char *value, char decimal_separator)
{
/* checking if this value can be a DOUBLE (normal case: -123.567 */
    int invalids = 0;
    int digits = 0;
    int signs = 0;
    int points = 0;
    char last = '\0';
    const char *p = value;
    while (*p != '\0')
................................................................................
	  if (*value == '+' || *value == '-' || last == '+' || last == '-')
	      ;
	  else
	      return 0;		/* sign is not the first/last string char */
      }
    return 1;			/* ok, can be a valid DOUBLE value */
}

static int
vrttxt_is_double (const char *value, char decimal_separator)
{
/* checking if this value can be a DOUBLE */
    if (vrttxt_is_plain_double (value, decimal_separator))
	return 1;
    if (vrttxt_is_scientific_double (value, decimal_separator))
	return 1;
    return 0;
}

static int
vrttxt_check_type (const char *value, char decimal_separator)
{
/* checking the Field type */
    if (*value == '\0')
	return VRTTXT_NULL;

Changes to test/gpkg_test.gpkg.

cannot compute difference between binary files