Coder Social home page Coder Social logo

Comments (23)

an-rahulpandey avatar an-rahulpandey commented on May 29, 2024

How did you add the plugin and what platform are you using. What is the exact error message, does it showing window.plugins.sqlDB undefined?

from cordova-plugin-dbcopy.

sangariv avatar sangariv commented on May 29, 2024

hi,
i have copied the databasehelper.java and sqldb.java under src folder of my project.
Then added the sqldb.js inside www folder.
Then added my demo.sqlite file under assets directory.
and called in javscript as you said .
function dbcopy()
{
window.plugins.sqlDB.copy("demo",copysuccess,copyerror);
}

from cordova-plugin-dbcopy.

an-rahulpandey avatar an-rahulpandey commented on May 29, 2024

Do not add the plugin manually, please add the plugin using the Cordova CLI -

cordova plugin add https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git

from cordova-plugin-dbcopy.

sangariv avatar sangariv commented on May 29, 2024

ok let me add using this.Thankyou

from cordova-plugin-dbcopy.

sangariv avatar sangariv commented on May 29, 2024

Hi,
i my sample database name is test.sqlite have defined like this
var db = window.plugins.sqlDB.copy("test",copysuccess,copyerror);
alert(db);
but i get it as "undefined"
please guide me where i am wrong.

from cordova-plugin-dbcopy.

an-rahulpandey avatar an-rahulpandey commented on May 29, 2024

Use the demo code as shown in the read me, call the dbcopy function and put the console.log or alert in the copysuccess method. If you are using any IDE, you can check for error in their log section.

from cordova-plugin-dbcopy.

sangariv avatar sangariv commented on May 29, 2024

HI,
I am having my "test.sqlite" inside assets directory and trying to call like below.still i get alert as
copy error.
document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
 alert("onDeviceReady");
  var db =   window.plugins.sqlDB.copy("test",copysuccess,copyerror);
  alert(db);

}

function copysuccess()
{
alert("copysuccess");

}

function copyerror()
{
alert("copyerror");

}

from cordova-plugin-dbcopy.

an-rahulpandey avatar an-rahulpandey commented on May 29, 2024

First delete your existing app from the device, then compile and run the new app with this change

var db = window.plugins.sqlDB.copy("test.sqlite",copysuccess,copyerror);

Also if you are using eclipse, check the Logcat. I have not removed the logging from the current code, it will also give you the exact error message.

One more thing, it goes to copy error method -

  1. When there is a problem while copying the database.
  2. When the database already exists in the current location.

You can use following method to know the exact issue -

function copyerror(e)
{
alert(JSON.stringify(e));
}

from cordova-plugin-dbcopy.

sangariv avatar sangariv commented on May 29, 2024

Hi,
Just now i got into copy success function
i just changed the line
var db = window.plugins.sqlDB.copy("test.sqlite",copysuccess,copyerror);
into
var db = window.plugins.sqlDB.copy("test.db",copysuccess,copyerror);

Thanks

from cordova-plugin-dbcopy.

sangariv avatar sangariv commented on May 29, 2024

HI,
select query inside copy success always returns "no table found".below is my code
document.addEventListener("deviceready", onDeviceReady, false);

var db
function onDeviceReady() {
alert("onDeviceReady");
window.plugins.sqlDB.copy("Databases.db",copysuccess,copyerror);

}

function copysuccess()
{
alert("copysuccess");
db = window.openDatabase("Databases", "1.0", "Test DB", 1000000);

db.transaction(queryDB, errorCB);

}

function copyerror()
{
alert("copyerror");
//db.transaction(queryDB, errorCB);

}

function queryDB(tx) {

alert("started");

tx.executeSql("select id from halal_product",[],renderEntries,errorCB);

}
function renderEntries(tx,results){
 alert("res.rows.length: " + results.rows.length);
}
function errorCB(err) {
  alert("Error processing SQL : "+err.message);
}

from cordova-plugin-dbcopy.

an-rahulpandey avatar an-rahulpandey commented on May 29, 2024

You have to use SQLite Plugin -
https://github.com/brodysoft/Cordova-SQLitePlugin

from cordova-plugin-dbcopy.

sangariv avatar sangariv commented on May 29, 2024

yes i have used it alerady but it says no table found

from cordova-plugin-dbcopy.

an-rahulpandey avatar an-rahulpandey commented on May 29, 2024

Run the code in simulator and then copy the db from the data directory. Open the downloaded db in Sqlitebrowser and check if everything is proper or not.

from cordova-plugin-dbcopy.

sangariv avatar sangariv commented on May 29, 2024

HI,
if i give the path like this
db = window.sqlitePlugin.openDatabase('/data/data/com.qr.app/databases/qrapp.db',"1.0", "qr", 1000000);
it opens correctly.

from cordova-plugin-dbcopy.

an-rahulpandey avatar an-rahulpandey commented on May 29, 2024

var db = window.sqlitePlugin.openDatabase("Databases.db", "1.0", "Test DB", -1);

In your previous code there was no .db extension.

from cordova-plugin-dbcopy.

blattmann avatar blattmann commented on May 29, 2024

I have also the problem that I am not able to talk to my sqlite db on an iphone.
In xcode I have this warning:

warning: no rule to process file '/Library/WebServer/Documents/rcs/dev/platforms/ios/Myapp/Plugins/me.rahul.plugins.sqlDB/sqlDB.h' of type sourcecode.c.h for architecture arm64

In the debug console I receive this:

  • [debug] OPEN database: rcsappmobile.db
  • [debug] Initializing SQLitePlugin
  • [debug] Detected docs path: /var/mobile/Containers/Data/Application//Documents
  • [debug] Detected Library path: /var/mobile/Containers/Data/Application//Library
  • [debug] no cloud sync at path: /var/mobile/Containers/Data/Application//Library/LocalDatabase
  • [debug] open full db path: /var/mobile/Containers/Data/Application//Library/LocalDatabase/rcsappmobile.db
  • [debug] Good news: SQLite is thread safe!
  • [debug] DB opened: rcsappmobile.db

I have no problems on Android!

I created also an issue on Stackoverflow with more info regarding my code: http://stackoverflow.com/q/36705044/2425177

Any ideas?

from cordova-plugin-dbcopy.

an-rahulpandey avatar an-rahulpandey commented on May 29, 2024

See #25

from cordova-plugin-dbcopy.

IoTFusion avatar IoTFusion commented on May 29, 2024

Can you help me? I added the sqlDB plugin using cordova, but still having call to unknown plugin: sqlDB error.

from cordova-plugin-dbcopy.

an-rahulpandey avatar an-rahulpandey commented on May 29, 2024

@IoTFusion Try building your project with Cordova CLI.

from cordova-plugin-dbcopy.

milanifour avatar milanifour commented on May 29, 2024

when db copy it crash app.

from cordova-plugin-dbcopy.

an-rahulpandey avatar an-rahulpandey commented on May 29, 2024

from cordova-plugin-dbcopy.

milanifour avatar milanifour commented on May 29, 2024

my db present in www folder of cordova-plugin-dbcopy
basically my database copied but not whole database.
my database size is 25 MB and when copy just start and reach to just 12 KB my app crashed.
it's says like "unfortunatley , your app closed".

i am using Telerik app builder and my code as below
my code:

window.plugins.sqlDB.copy("mydb",null, function (error) {
alert(JSON.stringify(error));
console.log(JSON.stringify(error));

    });

also i tried

window.plugins.sqlDB.copy("mydb",0,null, function (error) {
alert(JSON.stringify(error));
console.log(JSON.stringify(error));

    });

from cordova-plugin-dbcopy.

an-rahulpandey avatar an-rahulpandey commented on May 29, 2024

from cordova-plugin-dbcopy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.