Re: [sqlite] Accessing sqlite3 through javascript.

2009-05-16 Thread Saurabh Pawar

I would like to thank you all first for replying to my query..

You have cleared my doubt to a great extent.However I still have somethings
to be cleared.I will ask them later after studying sqlite a bit more.

Its better to ask precise questions rather than vauge queries.

Thank you.
--- On Sat, 16/5/09, P Kishor punk.k...@gmail.com wrote:

 From: P Kishor punk.k...@gmail.com
 Subject: Re: [sqlite] Accessing sqlite3 through javascript.
 To: General Discussion of SQLite Database sqlite-users@sqlite.org
 Date: Saturday, 16 May, 2009, 4:22 AM
 On Sat, May 16, 2009 at 6:19 AM, Igor
 Tandetnik itandet...@mvps.org
 wrote:
  Saurabh Pawar saurabh.pa...@ymail.com
  wrote in message news:240022.95142...@web95016.mail.in2.yahoo.com
  So I would like to have some
  information if available on how to connect to
 sqlite database through
  javascript and access the same.
 
  http://gears.google.com/
 
 gears allows creating and interacting with db on the
 client's machine,
 just like HTML5 databases, but not with db on the server
 machine. One
 would have to use some kind of server-side js and then
 interact with
 that via the client-side js.
 
 
 
  Igor Tandetnik
 
 
 
  ___
  sqlite-users mailing list
  sqlite-users@sqlite.org
  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
 
 
 
 
 -- 
 Puneet Kishor http://www.punkish.org/
 Carbon Model http://carbonmodel.org/
 Charter Member, Open Source Geospatial Foundation http://www.osgeo.org/
 Science Commons Fellow, Geospatial Data http://sciencecommons.org
 Nelson Institute, UW-Madison http://www.nelson.wisc.edu/
 ---
 collaborate, communicate, compete
 ===
 Sent from Karlstad, Sweden
 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
 


  Bring your gang together. Do your thing. Find your favourite Yahoo! group 
at http://in.promos.yahoo.com/groups/

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


[sqlite] append table

2009-05-16 Thread James Gregurich
howdy!

Questions:


suppose tables t1  t2 exits in two separate db files, d1  d2  
respectively. t1  t2 have identical schemas, but different data.

I want to append t2 to t1.


I suppose the way to do that is to open a connect to d1, use the  
attach command to reference d2.t2 and issue a  INSERT INTO t1 SELECT  
* FROM d2.t2; query.


Is that correct?  Is there a better way?

Is this operation inefficient or pitfalls any pitfalls to watch out for?


-James





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


Re: [sqlite] append table

2009-05-16 Thread P Kishor
On Sat, May 16, 2009 at 5:22 PM, James Gregurich bayouben...@mac.com wrote:
 howdy!

 Questions:


 suppose tables t1  t2 exits in two separate db files, d1  d2
 respectively. t1  t2 have identical schemas, but different data.

 I want to append t2 to t1.


 I suppose the way to do that is to open a connect to d1, use the
 attach command to reference d2.t2 and issue a  INSERT INTO t1 SELECT
 * FROM d2.t2; query.


 Is that correct?

yes

 Is there a better way?

no, maybe, but why should you care... well, because...


 Is this operation inefficient or pitfalls any pitfalls to watch out for?

primary keys. You want to ensure that the combined table has unique keys.




 -James







-- 
Puneet Kishor http://www.punkish.org/
Carbon Model http://carbonmodel.org/
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org/
Science Commons Fellow, Geospatial Data http://sciencecommons.org
Nelson Institute, UW-Madison http://www.nelson.wisc.edu/
---
collaborate, communicate, compete
===
Sent from Karlstad, Sweden
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Updating two tables rows in one sql statement

2009-05-16 Thread velkropie

Hello,

I'm trying to update two tables with one statement but, i'm not getting
something right. can someone here help me , or guide me to the right place
to get help?

Thanks

UPDATE funrecipes, ingredients SET funrecipes.recipetitle,
funrecipes.copyright, funrecipes.directions, ingredients.ingredient_name 
WHERE ingredients.pk = funrecipes.pk

this is returning a database error, any ideas?
-- 
View this message in context: 
http://www.nabble.com/Updating-two-tables-rows-in-one-sql-statement-tp23574927p23574927.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] Updating two tables rows in one sql statement

2009-05-16 Thread P Kishor
On Sat, May 16, 2009 at 5:35 PM, velkropie velkro...@gmail.com wrote:

 Hello,

 I'm trying to update two tables with one statement but, i'm not getting
 something right. can someone here help me , or guide me to the right place
 to get help?

 Thanks

 UPDATE funrecipes, ingredients SET funrecipes.recipetitle,
 funrecipes.copyright, funrecipes.directions, ingredients.ingredient_name
 WHERE ingredients.pk = funrecipes.pk

 this is returning a database error, any ideas?

yea... it is wrong. You can update one or more columns in one table in
one statement, not more than one tables in one statement.





-- 
Puneet Kishor http://www.punkish.org/
Carbon Model http://carbonmodel.org/
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org/
Science Commons Fellow, Geospatial Data http://sciencecommons.org
Nelson Institute, UW-Madison http://www.nelson.wisc.edu/
---
collaborate, communicate, compete
===
Sent from Karlstad, Sweden
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Updating two tables rows in one sql statement

2009-05-16 Thread John Machin
On 17/05/2009 1:35 AM, velkropie wrote:
 Hello,
 
 I'm trying to update two tables with one statement but, i'm not getting
 something right. can someone here help me , or guide me to the right place
 to get help?
 
 Thanks
 
 UPDATE funrecipes, ingredients SET funrecipes.recipetitle,
 funrecipes.copyright, funrecipes.directions, ingredients.ingredient_name 
 WHERE ingredients.pk = funrecipes.pk
 
 this is returning a database error, any ideas?

A database error? Nothing to do with a database, it's just not valid 
SQL. Read this: http://www.sqlite.org/lang_update.html

There are _*TWO*_ syntax problems with your UPDATE statement:
(1) it is not possible to update more than one table in the same UPDATE 
statement
(2) you don't say *what* each column must be set to ... the syntax is
 SET column_name1 = expression1, column_name2 = expression2, ...

And possibly one logic problem ... your WHERE clause would look a bit 
suss even in a SELECT statement, especially if pk means primary key.

HTH,
John
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Updating two tables rows in one sql statement

2009-05-16 Thread velkropie



John Machin wrote:
 
 On 17/05/2009 1:35 AM, velkropie wrote:
 Hello,
 
 I'm trying to update two tables with one statement but, i'm not getting
 something right. can someone here help me , or guide me to the right
 place
 to get help?
 
 Thanks
 
 UPDATE funrecipes, ingredients SET funrecipes.recipetitle,
 funrecipes.copyright, funrecipes.directions, ingredients.ingredient_name 
 WHERE ingredients.pk = funrecipes.pk
 
 this is returning a database error, any ideas?
 
 A database error? Nothing to do with a database, it's just not valid 
 SQL. Read this: http://www.sqlite.org/lang_update.html
 
 There are _*TWO*_ syntax problems with your UPDATE statement:
 (1) it is not possible to update more than one table in the same UPDATE 
 statement
 (2) you don't say *what* each column must be set to ... the syntax is
  SET column_name1 = expression1, column_name2 = expression2, ...
 
 And possibly one logic problem ... your WHERE clause would look a bit 
 suss even in a SELECT statement, especially if pk means primary key.
 
 HTH,
 John
 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
 
 

i'm sorry for not placing more information, and thanks for your help.
the application has two tables.
recipes tables has the following fields:
pk which is the primary field and autoincrements
directions
copyright
another table call ingredients
ingredient_name
ingredient_id(pk)
pk (which i was hoping to tie to recipes, since pk is the (pk) for recipes)

since i plan to have many ingredients display at once i decided to set it in
another table.

the fields will be updated by user imput

-- 
View this message in context: 
http://www.nabble.com/Updating-two-tables-rows-in-one-sql-statement-tp23574927p23579117.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] Updating two tables rows in one sql statement

2009-05-16 Thread John Machin
On 17/05/2009 10:34 AM, velkropie wrote:
 
 
 John Machin wrote:
 On 17/05/2009 1:35 AM, velkropie wrote:
 Hello,

 I'm trying to update two tables with one statement but, i'm not getting
 something right. can someone here help me , or guide me to the right
 place
 to get help?

 Thanks

 UPDATE funrecipes, ingredients SET funrecipes.recipetitle,
 funrecipes.copyright, funrecipes.directions, ingredients.ingredient_name 
 WHERE ingredients.pk = funrecipes.pk

 this is returning a database error, any ideas?
 A database error? Nothing to do with a database, it's just not valid 
 SQL. Read this: http://www.sqlite.org/lang_update.html

 There are _*TWO*_ syntax problems with your UPDATE statement:
 (1) it is not possible to update more than one table in the same UPDATE 
 statement
 (2) you don't say *what* each column must be set to ... the syntax is
  SET column_name1 = expression1, column_name2 = expression2, ...

 And possibly one logic problem ... your WHERE clause would look a bit 
 suss even in a SELECT statement, especially if pk means primary key.

 HTH,
 John
 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


 
 i'm sorry for not placing more information, and thanks for your help.
 the application has two tables.
 recipes tables has the following fields:
 pk which is the primary field and autoincrements
 directions
 copyright
 another table call ingredients
 ingredient_name
 ingredient_id(pk)
 pk (which i was hoping to tie to recipes, since pk is the (pk) for recipes)

Hope has little place in database design.

 since i plan to have many ingredients display at once i decided to set it in
 another table.

The relationship between ingredients and recipes is many-to-many; 
consider having a THIRD table which tells what quantity of ingredient I 
(if any) is used in recipe R.
Consider reading up on database design.
Consider borrowing a schema from one of the zillion ** 2 recipe 
packages out there.

 the fields will be updated by user imput

Consider validating the imput :-)

HTH,
John
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users