cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "saurabh Trivedi (JIRA)" <>
Subject [jira] [Commented] (CB-3550) Undefined error while open database when comes back from inappBrowser link: android
Date Fri, 31 May 2013 07:12:19 GMT


saurabh Trivedi commented on CB-3550:

Hello Joe bowser thanks for reply , however my question was on some other expects like I am
developing a android based application through Phonegap(Jscript, HTML5) , on my application
i saved dataBase with .db extension in assets folder and on very starting of application copy
the database to app database file, every thing is fine till now , able to do transaction to
database successfully fetching the data from db , but the problem is when i am opening the
external Link (Browser) from my app and comes back to my app and if now i do any type of query
from db its throwing error as "Undefined". my code for fetching the data from database is
Below. so where is the problem while i have database , its should not be lost.

  code for copying the database from my assets folder is:

	public void onCreate(Bundle savedInstanceState) {
		try {

			this.copy("Databases.db", "/data/data/" + pName + "/app_database/");
			this.copy("0000000000000001.db", "/data/data/" + pName
					+ "/app_database/file__0/");
			super.setIntegerProperty("splashscreen", R.drawable.splash);


    void copy(String file, String folder) throws IOException {

		Log.d("GRT", "We are in the copy of db");
		File CheckDirectory;
		CheckDirectory = new File(folder);
		if (!CheckDirectory.exists()) {
			Log.d("GRT", "Creating copy of db db");
		} else {
			Log.d("GRT", "Databse already exists");

		InputStream in = getApplicationContext().getAssets().open(file);
		OutputStream out = new FileOutputStream(folder + file);

		// Transfer bytes from in to out
		byte[] buf = new byte[1024];
		int len;
		while ((len = > 0)
			out.write(buf, 0, len);


    function queryRecommded(){   
    var db = window.openDatabase("Database", "1.0", "GRTDB", 200000);
    db.transaction(queryRecommondedProduct, errorCB2, successCB);
function queryRecommondedProduct(tx){
    //alert("SQL gonna run now");
   var progressHud =window.plugins.waitingDialog;"Loading...Please wait");      
   tx.executeSql("Select aa.ProductID,aa.ProductName,aa.Price,aa.Description,aa.Specification,aa.VideoLink,ab.GalleryID,ab.Location,ab.ImageName,ab.LocalFolder,aa.Buy_Now
from tblProduct aa inner join tblGallery ab on aa.ProductId=ab.ProductId where aa.ProductId=(select
RecomProdId  from tblQuery where AnswerQ1='"+shouseType.toLowerCase()+"' AND  AnswerQ2='"+lawnSize.toLowerCase()+"'
AND AnswerQ3='"+lawnobstacle.toLowerCase()+"' AND AnswerQ4='"+trimmingneeds.toLowerCase()+"'
AND AnswerQ5='"+strimfreq.toLowerCase()+"' AND IsDeleted='0' ORDER BY ProductAnswerId ASC
LIMIT 1  ) and aa.IsDeleted ='0' and ab.IsDeleted ='0' and ab.IsDownLoad ='1'", [],function(tx,result){queryRecommdedSuccess(tx,result,"isReccom")},
> Undefined error while open database when comes back from inappBrowser link: android
> -----------------------------------------------------------------------------------
>                 Key: CB-3550
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 2.7.0
>            Reporter: saurabh Trivedi
>            Assignee: Joe Bowser
> save db file on assets folder , on application launch time copy database to application
database file, successful open database and fetch data from db, navigate to external link
using IN app browser and come back to my application, getting database Undefined while fetching
again data from db ,database connectivity Issues occurring, and error is Undefined. 

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message