SQLite

Check-in [236588d573]
Login

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

Overview
Comment:Fix the geopoly_json() SQL function so that it works.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | geojson
Files: files | file ages | folders
SHA3-256: 236588d573a007c9c9eb8e337387d3b6318d19c8b8f260fa7324ed8c4e17060b
User & Date: drh 2018-05-09 15:20:47.783
Context
2018-05-09
15:27
The translation in and out of GeoJSON automatically adds or removes the redundant last vertex, as necessary. (check-in: 2653bedd9f user: drh tags: geojson)
15:20
Fix the geopoly_json() SQL function so that it works. (check-in: 236588d573 user: drh tags: geojson)
15:19
Merge from trunk the ability to use sqlite3_sql interfaces in extensions. (check-in: 5bb9e6a9f1 user: drh tags: geojson)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/misc/geopoly.c.
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
static void geopolyJsonFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  GeoPoly *p = geopolyFuncParam(context, argv[0]);
  if( p ){
    sqlite3 *db = sqlite3_context_db_pointer(context);
    sqlite3_str *x = sqlite3_str_new(db);
    int i;
    sqlite3_str_append(x, "[", 1);
    for(i=0; i<p->nVertex; i++){
      sqlite3_str_appendf(x, "[%g,%g]", p->a[i*2], p->a[i*2+1]);
      sqlite3_str_append(x, i==p->nVertex-1 ? "]" : ",", 1);
    }







|







315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
static void geopolyJsonFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  GeoPoly *p = geopolyFuncParam(context, argv[0]);
  if( p ){
    sqlite3 *db = sqlite3_context_db_handle(context);
    sqlite3_str *x = sqlite3_str_new(db);
    int i;
    sqlite3_str_append(x, "[", 1);
    for(i=0; i<p->nVertex; i++){
      sqlite3_str_appendf(x, "[%g,%g]", p->a[i*2], p->a[i*2+1]);
      sqlite3_str_append(x, i==p->nVertex-1 ? "]" : ",", 1);
    }