1

Developing an Android app, but this is a SQLite question.... My SQL is much ropier than my Java.

This is the SQL (copied from a log file, in code it's constructed from various constants):

CREATE VIEW albums (_id, name , type ) AS SELECT rowno, name, subtype   FROM metadata WHERE subtype = 'album'

but it throws:

android.database.sqlite.SQLiteException: near "(": syntax error (code 1): , while compiling:

Specifying column names in the view seems to me to be clearly permitted, if I understand the flow chart in the sqlite documentation here, and at this time of night I really can't see what's wrong. I have tried changing the name of the _id column in case it was something to do with the initial underscore, but to no avail and in any case I will need the _id column later for the CursorAdapter that will end up using this View.

CL.
  • 173,858
  • 17
  • 217
  • 259
ejoftheweb
  • 301
  • 1
  • 2
  • 10

1 Answers1

2

At the bottom of the documentation page you linked it states:

Note that the column-name list syntax is only supported in SQLite versions 3.9.0 and later.

Version 3.9.0 is not supported by Android. Lollipop has 3.7.11. Marshmallow has 3.8.10.2.

Community
  • 1
  • 1
Bob Snyder
  • 37,759
  • 6
  • 111
  • 158