database update

by Dan » Fri, 26 Feb 2010 00:40:30 GMT


Sponsored Links
 I've got a question about updating an app after release.  If I have a
database that contains 10 columns and I add a feature that requires an
11th column after the app has been released, where would I put the sql
code to add the new column so that when they install the app it keeps
their current data, but adds that 11th column?  Is that even possible
or would I need to create another table that references the first with
a foreign key?

--



database update

by Mark Murphy » Fri, 26 Feb 2010 00:45:06 GMT


 


In onUpgrade() of your SQLiteOpenHelper subclass.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Warescription: Three Android Books, Plus Updates, One Low Price!

--


Sponsored Links


database update

by Kevin Anthony » Fri, 26 Feb 2010 01:53:55 GMT


 Alter
 http://www.techonthenet.com/sql/tables/alter_table.php 

Kevin




I've got a question about updating an app after release.  If I have a
database that contains 10 columns and I add a feature that requires an
11th column after the app has been released, where would I put the sql
code to add the new column so that when they install the app it keeps
their current data, but adds that 11th column?  Is that even possible
or would I need to create another table that references the first with
a foreign key?

--



database update

by Dan » Fri, 26 Feb 2010 04:35:36 GMT


 thanks, so the onCreate gets called when the database has not been
created and the onupgrade gets called when the database has been
created, but the app is being upgraded?  Do these methods get called
due to some global variable that gets reset upon a fresh or upgraded
install of the app?






--



database update

by Mark Murphy » Fri, 26 Feb 2010 05:24:47 GMT


 


Yes on the first. More accurately for the second, onUpgrade() will be
called when the schema revision (parameter in the SQLiteOpenHelper
constructor) changes.


No, they get called when you ask your SQLiteOpenHelper subclass to
getWriteableDatabase(), for example. The determination of whether an
upgrade is needed is based on some metadata tucked away in some corner
of the database.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Warescription: Three Android Books, Plus Updates, One Low Price!

--



Other Threads

1. ALSA - ASoC Debug crash With Music applications. Is sample rate an issue

Hi all,

I have an issue with the audio in Android.  I suspect the sample rates being
the cause.
Synopsis as follows

Android 1.0 release with WindRiver's ALSA patch for audio
and Hardware consists of OMAP3430 + TWL4030(Audio codec)
TWL4030 audio CODEC driver is ASoC instead of ALSA

With the music applications (music, volume, audible touch tones selection)
The android's Dalvik logcat shows some debug crash.
(You can find the crash as an attachment also.)

The crash seems to be like the media servers getting killed and restarted
automatically.
other than this issue audio is working fine.

May be this is silly work around. But, with this following TWL4030_RATES

#define TWL4030_RATES    (SNDRV_PCM_RATE_8000 |  SNDRV_PCM_RATE_48000)
#define TWL4030_FORMATS  (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FORMAT_S24_LE)

struct snd_soc_dai twl4030_dai = {
        .name = "twl4030",
        .playback = {
                .stream_name = "Playback",
                .channels_min = 2,
                .channels_max = 2,
                .rate_min = SNDRV_PCM_RATE_8000,
                .rate_max = SNDRV_PCM_RATE_48000,
                .rates = TWL4030_RATES,
                .formats = TWL4030_FORMATS,},
        .capture = {
                .stream_name = "Capture",
                .channels_min = 2,
                .channels_max = 2,
                .rate_min = SNDRV_PCM_RATE_8000,
                .rate_max = SNDRV_PCM_RATE_48000,
                .rates = TWL4030_RATES,
                .formats = TWL4030_FORMATS,},
        .ops = {
                .hw_params = twl4030_hw_params,
        },
        .dai_ops = {
                .set_sysclk = twl4030_set_dai_sysclk,
                .set_fmt = twl4030_set_dai_fmt,
        }
};
EXPORT_SYMBOL_GPL(twl4030_dai);

In the sound/soc/omap/twl4030.c
I dint came across the crash till now for about 2 weeks i have been testing.


If i try making any change to the TWL4030_RATES macro
to populate the .rates field of (twl4030_dai)
like
#define TWL4030_RATES    (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |  \
                          SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_32000 | \
                          SNDRV_PCM_RATE_44100 |SNDRV_PCM_RATE_48000)

The crash is consistent

I gone through the sources of android/hardware/alsa_sound/*
The sample rate for playback and capture path being hard coded here.

and in the alsa CODEC driver of TWL4030 there is no mentioning abt the
rates.
only rate_min=8000,
and rate_max=48000, are being used.

Is my interception right or am i missing something,
any code change is needed in the kernel side or in the Android side.

If this is not the appropriate place for this issue. Kindly redirect me
there.


-- 
Cheers
(: Naveen Krishna Ch :)

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. basic doubts on andriod

Hi,

I am new to andriod. I have some basic doubts, please clarify it.

a) I have a RGB565 frame buffer. I need to display it on a screen. I am not 
finding a suitable API to pass a frame buffer [unsigned char*] to display on a 
screen.How can i display my own frame buffer on a screen ?

I have my own library file say [sample.so file] and it will be in library layer 
and its in C/C++ . I need to load this library in a application say Browser 
app. 

b) How browser app can load my library ? Is it dl_open function call (or) 
through BINDER IPC ?

c) My library exposed a function say CreatePlayer(). If browser wants to call 
CreatePlayer() then does browser should use dl_sym() function ? Can a 
application directly talks to a library through dl_sym function call which is 
in library layer ? My librray also exposed a JNI API.

d)My libraryneeds media framework utitlity in andriod. So From C/C++ code, 
cani call JNI API of media framework function say mPlayer = new MediaPlayer() 
.. so on,

Thanks & Regards,
P.Sriniamul


      Add more friends to your messenger and enjoy! Go to 
http://messenger.yahoo.com/invite/
--~--~---------~--~----~------------~-------~--~----~

3. N810 running Android is seen as external drive, but it's not accessible

4. Is this what the next firmware should be like?

5. Android Instrumentation for unit testing

6. Why isn't there a Sort By Ratings tab in market?

7. EDGE/3G Connection issues