Re: [sqlite] Error when reading from pre-populated SQLite database in Ionic project

2018-09-09 Thread Simon Slavin
On 10 Sep 2018, at 12:30am, Robert Helmick  wrote:

> Thanks for your response. I'm using the node.js plugin. I've tried creating
> a table then closing the db, and the queries executed successfully, but I
> was not able to find the database file that it created. I searched the
> folder structure and was unable to find any .db file, even though the db
> was opened, a table was created, and the db was closed again.

Once you have found the file, you will understand where the default folder is.

Just as a test, after your program which creates the table and puts a row into 
it is finished, write another to check that the table you created is still 
there.  If it is, then the file definitely exists somewhere.

Simon.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Error when reading from pre-populated SQLite database in Ionic project

2018-09-09 Thread Robert Helmick
Hi Simon,

Thanks for your response. I'm using the node.js plugin. I've tried creating
a table then closing the db, and the queries executed successfully, but I
was not able to find the database file that it created. I searched the
folder structure and was unable to find any .db file, even though the db
was opened, a table was created, and the db was closed again.

Regards,
Robert

On Thu, Sep 6, 2018 at 12:32 PM Simon Slavin  wrote:

> On 6 Sep 2018, at 5:33pm, Robert Helmick 
> wrote:
>
> > by default, then creates an empty database when it doesn't find the
> > pre-populated mydb.db file. This is why it can't find the 'plant' table,
> > because the newly created blank database obviously doesn't contain a
> > 'plant' table. However I can confirm that the database *is* in the /www
> > folder, and that it contains the 'plant' table when I run `sqlite3
> mydb.db`
>
> What OS ?
> Are you using the C API or some other library ?
>
> If you write code to create a new database (open a filename, do at least a
> CREATE TABLE command, close the connection) what directory does it put the
> file in ?
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Error when reading from pre-populated SQLite database in Ionic project

2018-09-06 Thread Simon Slavin
On 6 Sep 2018, at 5:33pm, Robert Helmick  wrote:

> by default, then creates an empty database when it doesn't find the
> pre-populated mydb.db file. This is why it can't find the 'plant' table,
> because the newly created blank database obviously doesn't contain a
> 'plant' table. However I can confirm that the database *is* in the /www
> folder, and that it contains the 'plant' table when I run `sqlite3 mydb.db`

What OS ?
Are you using the C API or some other library ?

If you write code to create a new database (open a filename, do at least a 
CREATE TABLE command, close the connection) what directory does it put the file 
in ?

Simon.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Error when reading from pre-populated SQLite database in Ionic project

2018-09-06 Thread Robert Helmick
I'm receiving an error when I try to read from a pre-populated SQLite
database: `sqlite3_prepare_v2 failure: no such table 'plant'`

From what I understand SQLite looks for the mydb.db file in the /www folder
by default, then creates an empty database when it doesn't find the
pre-populated mydb.db file. This is why it can't find the 'plant' table,
because the newly created blank database obviously doesn't contain a
'plant' table. However I can confirm that the database *is* in the /www
folder, and that it contains the 'plant' table when I run `sqlite3 mydb.db`
then `.tables` in the terminal.

I can't figure out why it's not reading from the pre-populated mydb.db file.

Folder structure (from root):

/src
-/app
--/app.component.ts
/www
-/mydb.db

app.component.ts:

  constructor(public platform: Platform, private sqlite: SQLite ) {
platform.ready().then(() => {
  this.getData();
});
  }

  getData() {
this.sqlite.create({
  name: 'mydb.db',
  location: 'default'
}).then((db: SQLiteObject) => {
  db.executeSql('SELECT * FROM plant ORDER BY id ASC', [])
  .then(res => {
// Do Stuff
  }).catch(e => console.log("FAIL executeSql:", e));
})
  }

I've attempted many fixes that I've found on StackOverflow, like wiping the
app from my device, starting a new ionic project then copying app and
config files over, and setting a direct path in the database location, but
it still keeps trying to read from the empty database that it creates..

Thanks in advance for any help.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Error when reading from pre-populated SQLite database in Ionic project

2018-09-05 Thread Chris Brody
Check the results of cordova plugin ls

A common pitfall is that you have to use cordova-sqlite-ext plugin to get
pre-populated database functionality. Commonly used cordova-sqlite-storage
plugin does not support this feature. Second pitfall is if you have
multiple Cordova sqlite plugins installed.

On Wed, Sep 5, 2018 at 12:25 PM Chris Locke 
wrote:

> When SQLite creates an empty .db file, which directory is it in?  With all
> your tweaking, etc, is the new database always in the same directory?
>
> Thanks,
> Chris
>
> On Wed, Sep 5, 2018 at 3:23 PM Robert Helmick  >
> wrote:
>
> > I'm receiving an error when I try to read from a pre-populated SQLite
> > database: `sqlite3_prepare_v2 failure: no such table 'plant'`
> >
> > From what I understand SQLite looks for the mydb.db file in the /www
> folder
> > by default, then creates an empty database when it doesn't find the
> > pre-populated mydb.db file. This is why it can't find the 'plant' table,
> > because the newly created blank database obviously doesn't contain a
> > 'plant' table. However I can confirm that the database *is* in the /www
> > folder, and that it contains the 'plant' table when I run `sqlite3
> mydb.db`
> > then `.tables` in the terminal.
> >
> > I can't figure out why it's not reading from the pre-populated mydb.db
> > file.
> >
> > Folder structure (from root):
> >
> > /src
> > -/app
> > --/app.component.ts
> > /www
> > -/mydb.db
> >
> > app.component.ts:
> >
> >   constructor(public platform: Platform, private sqlite: SQLite ) {
> > platform.ready().then(() => {
> >   this.getData();
> > });
> >   }
> >
> >   getData() {
> > this.sqlite.create({
> >   name: 'mydb.db',
> >   location: 'default'
> > }).then((db: SQLiteObject) => {
> >   db.executeSql('SELECT * FROM plant ORDER BY id ASC', [])
> >   .then(res => {
> > // Do Stuff
> >   }).catch(e => console.log("FAIL executeSql:", e));
> > })
> >   }
> >
> > I've attempted many fixes that I've found on StackOverflow, like wiping
> the
> > app from my device, starting a new ionic project then copying app and
> > config files over, and setting a direct path in the database location,
> but
> > it still keeps trying to read from the empty database that it creates..
> >
> > Thanks in advance for any help.
> >
> > Robert
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Error when reading from pre-populated SQLite database in Ionic project

2018-09-05 Thread Chris Locke
When SQLite creates an empty .db file, which directory is it in?  With all
your tweaking, etc, is the new database always in the same directory?

Thanks,
Chris

On Wed, Sep 5, 2018 at 3:23 PM Robert Helmick 
wrote:

> I'm receiving an error when I try to read from a pre-populated SQLite
> database: `sqlite3_prepare_v2 failure: no such table 'plant'`
>
> From what I understand SQLite looks for the mydb.db file in the /www folder
> by default, then creates an empty database when it doesn't find the
> pre-populated mydb.db file. This is why it can't find the 'plant' table,
> because the newly created blank database obviously doesn't contain a
> 'plant' table. However I can confirm that the database *is* in the /www
> folder, and that it contains the 'plant' table when I run `sqlite3 mydb.db`
> then `.tables` in the terminal.
>
> I can't figure out why it's not reading from the pre-populated mydb.db
> file.
>
> Folder structure (from root):
>
> /src
> -/app
> --/app.component.ts
> /www
> -/mydb.db
>
> app.component.ts:
>
>   constructor(public platform: Platform, private sqlite: SQLite ) {
> platform.ready().then(() => {
>   this.getData();
> });
>   }
>
>   getData() {
> this.sqlite.create({
>   name: 'mydb.db',
>   location: 'default'
> }).then((db: SQLiteObject) => {
>   db.executeSql('SELECT * FROM plant ORDER BY id ASC', [])
>   .then(res => {
> // Do Stuff
>   }).catch(e => console.log("FAIL executeSql:", e));
> })
>   }
>
> I've attempted many fixes that I've found on StackOverflow, like wiping the
> app from my device, starting a new ionic project then copying app and
> config files over, and setting a direct path in the database location, but
> it still keeps trying to read from the empty database that it creates..
>
> Thanks in advance for any help.
>
> Robert
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Error when reading from pre-populated SQLite database in Ionic project

2018-09-05 Thread Robert Helmick
I'm receiving an error when I try to read from a pre-populated SQLite
database: `sqlite3_prepare_v2 failure: no such table 'plant'`

From what I understand SQLite looks for the mydb.db file in the /www folder
by default, then creates an empty database when it doesn't find the
pre-populated mydb.db file. This is why it can't find the 'plant' table,
because the newly created blank database obviously doesn't contain a
'plant' table. However I can confirm that the database *is* in the /www
folder, and that it contains the 'plant' table when I run `sqlite3 mydb.db`
then `.tables` in the terminal.

I can't figure out why it's not reading from the pre-populated mydb.db file.

Folder structure (from root):

/src
-/app
--/app.component.ts
/www
-/mydb.db

app.component.ts:

  constructor(public platform: Platform, private sqlite: SQLite ) {
platform.ready().then(() => {
  this.getData();
});
  }

  getData() {
this.sqlite.create({
  name: 'mydb.db',
  location: 'default'
}).then((db: SQLiteObject) => {
  db.executeSql('SELECT * FROM plant ORDER BY id ASC', [])
  .then(res => {
// Do Stuff
  }).catch(e => console.log("FAIL executeSql:", e));
})
  }

I've attempted many fixes that I've found on StackOverflow, like wiping the
app from my device, starting a new ionic project then copying app and
config files over, and setting a direct path in the database location, but
it still keeps trying to read from the empty database that it creates..

Thanks in advance for any help.

Robert
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users