Skip to content

Constraint fails when trying to INSERT #11

Description

@mkucherenko

Hi,

i've initialized database with:

@Override
public void onCreate(SQLiteDatabase db) {
String createSql = "CREATE TABLE t_geom  id INTEGER NOT NULL " +
                                "PRIMARY KEY AUTOINCREMENT " +
                                "name TEXT NOT NULL " +
                                "measured_value DOUBLE NOT NULL);";
    db.execSQL(createSql);

    db.rawQuery("SELECT InitSpatialMetaData();");

    db.rawQuery("SELECT AddGeometryColumn('t_geom', 'the_geom', 4326, 'POINT', 'XY', 1);"");

     ...

 }

I'm getting everything instantiated:
image

But when I'm trying to INSERT value in that field
INSERT INTO t_geom(name, measured_value, the_geom) VALUES ('testtttt', 22.3, PointFromText('POINT(101.23 171.82)'));

I'm getting:
android.database.sqlite.SQLiteConstraintException: t_geom.the_geom violates Geometry constraint [geom-type or SRID not allowed] (code 1811) at org.spatialite.database.SQLiteConnection.nativeExecuteForChangedRowCount(Native Method) at org.spatialite.database.SQLiteConnection.executeForChangedRowCount(SQLiteConnection.java:764) at org.spatialite.database.SQLiteSession.executeForChangedRowCount(SQLiteSession.java:766) at org.spatialite.database.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:68) at org.spatialite.database.SQLiteDatabase.executeSql(SQLiteDatabase.java:1677) at org.spatialite.database.SQLiteDatabase.execSQL(SQLiteDatabase.java:1669)

Spatial-gui also displays error message:
image

Any idea?

Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions