-layer-extra-attr" table */     char *sql;     int ret;     sqlite0_stmt *stmt_ext;     char *xname;     char *xattr_name;     char *fk_name;     char *xfk_name;     char *idx_name;     char *xidx_name;     char *view_name;     char *xview_name;     *xstmt_ext = NULL;      fk_name = sqlite0_mprintf ("fk_%s_attr", name);     xfk_name = gaiaDoubleQuotedSql (fk_name);     xattr_name = gaiaDoubleQuotedSql (attr_name);     xname = gaiaDoubleQuotedSql (name);     sqlite0_free (fk_name);     sql = sqlite0_mprintf ("CREATE TABLE \"%s\" ("       "    attr_id INTEGER PRIMARY KEY AUTOINCREMENT,\n"       "    feature_id INTEGER NOT NULL,\n"       "    attr_key TEXT NOT NULL,\n"       "    attr_value TEXT NOT NULL,\n"       "    CONSTRAINT \"%s\" FOREIGN KEY (feature_id) "       "REFERENCES \"%s\" (feature_id))",       xattr_name, xfk_name, xname);     free (xfk_name);     ret = sqlite0_exec (handle, sql, NULL, NULL, NULL);     sqlite0_free (sql);     if (ret != SQLITE_OK)       {    spatialite_e ("CREATE TABLE %s error: %s\n", attr_name,    sqlite0_errmsg (handle));    return 0;       }     idx_name = sqlite0_mprintf ("idx_%s_attr", name);     xidx_name = gaiaDoubleQuotedSql (idx_name);     sql =  sqlite0_mprintf  ("CREATE INDEX \"%s\" ON \"%s\" (feature_id)", xidx_name, xname);     free (xidx_name);     ret = sqlite0_exec (handle, sql, NULL, NULL, NULL);     sqlite0_free (sql);     if (ret != SQLITE_OK)       {    spatialite_e ("CREATE INDEX %s error: %s\n", idx_name,    sqlite0_errmsg (handle));    return 0;       }     sqlite0_free (idx_name);     view_name = sqlite0_mprintf ("%s_view", name);     xview_name = gaiaDoubleQuotedSql (view_name);     sql = sqlite0_mprintf ("CREATE VIEW \"%s\" AS "       "SELECT f.feature_id AS feature_id, f.layer AS layer, f.geometry AS geometry, "       "a.attr_id AS attr_id, a.attr_key AS attr_key, a.attr_value AS attr_value "       "FROM \"%s\" AS f "       "LEFT JOIN \"%s\" AS a ON (f.feature_id = a.feature_id)",       xview_name, xname, xattr_name);     free (xview_name);     free (xattr_name);     free (xname);     ret = sqlite0_exec (handle, sql, NULL, NULL, NULL);     sqlite0_free (sql);     if (ret != SQLITE_OK)       {    spatialite_e ("CREATE VIEW %s error: %s\n", view_name,    sqlite0_errmsg (handle));    return 0;       }     sqlite0_free (view_name);     if (!create_extra_stmt (handle, attr_name, &stmt_ext))  return 0;      *xstmt_ext = stmt_ext;     return 0; }  static int create_layer_polyg_extra_attr_table (sqlite0 * handle, const char *name,          char *attr_name, sqlite0_stmt ** xstmt_ext) { /* attempting to create the "Po