Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constraint fails when trying to INSERT #11

Open
mkucherenko opened this issue Sep 18, 2019 · 0 comments
Open

Constraint fails when trying to INSERT #11

mkucherenko opened this issue Sep 18, 2019 · 0 comments

Comments

@mkucherenko
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant