android - How to generate database with table of variable number of columns? -


in android app, need temporarily store data in form of table such follows:

id | column 1 | column 2 | ... | column n

the data downloaded server whenever users press button. however, data table doesn't have fix number of column (as row) every time user downloads server. example, server may send data 3 columns first time. might send data 5 columns second time, etc...

given scenario, think database right data structure use. plan create database, add , delete tables necessary. have been reading various tutorials on android database (one example 1 http://www.codeproject.com/articles/119293/using-sqlite-database-with-android#). seems me cannot create new table variable number of columns using sqlite database. correct? in oncreate(sqlitedatabase db) method, "create table" command must specified known number of columns , data types. provide several "create table" commands, each different number of columns seems crude. there way create database tables variable number of columns on fly?

another alternative using several hash tables, each storing 1 column of data table. i'm considering approach if database approach not possible. better suggestion welcomed.

there no such thing variable number of columns in sqlite data base. also, adding , deleting tables dynamically seems horrible hack.

it sounds want store array of values associated id. suggest think in terms of rows, not columns. use table structure (id, index, value); each array of values returned server results in many rows necessary store values.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -