Re: [sqlite] Unrecognised token error in insert statement

2005-02-17 Thread lawrence.chitty
> 
> From: "Anirban Sarkar" <[EMAIL PROTECTED]>
> Date: 2005/02/17 Thu AM 10:51:08 GMT
> To: 
> Subject: [sqlite] Unrecognised token error in insert statement

> The variable $system_tm contains the value 16:40
> When I try to insert this value in a varchar field in a sqlite table it gives 
> me ' unrecognised token ":" ' due to which the insertion process fails.
> 
> How do I get rid of this?

ensure that $system_tm is surrounded with ' ' in the sql. If that isn't the 
problem, use 'puts' to output the actual sql statement you have built and are 
passing to 'db eval', and post here.

> Probably should be some addslashes or some other stuff, but I am not quite 
> sure.

The only thing that I think needs escaping are , (commas), which need escaping 
with a second comma.
You can deal with these with a string map, e.g.

set my_var [string map {, ,,} $my_var]

Lawrence

> Kindly help.
> 
> Regards,
> Anirban Sarkar
> 
> 

-
Email sent from www.ntlworld.com
virus-checked by McAfee
visit www.ntlworld.com/security for more information
 



Re: Re: [sqlite] Basic insert statement - syntax problem

2005-02-17 Thread lawrence.chitty

> 
> From: "Anirban Sarkar" <[EMAIL PROTECTED]>
> Date: 2005/02/17 Thu AM 09:45:03 GMT
> To: 
> Subject: Re: [sqlite] Basic insert statement - syntax problem
> 
> #Inserting data into mri_output table
>   set connection_no { }
>   set insert_normal "insert into mri_output (pwd,ac_my,con_no) values 
> ('$pass','$ac_mth$ac_yr','$sel_con')"
>   db1 eval insert_normal {} {
>   
>   }

Unless you mistyped agains, then the las line above should be

db1 eval $insert_normal {} {
.^ missing in original

Lawrence


-
Email sent from www.ntlworld.com
virus-checked by McAfee
visit www.ntlworld.com/security for more information
 



Re: [sqlite] Expr error in TCL

2005-01-28 Thread lawrence.chitty
Hi Anirban

I recently suggested to you 2 very good resources for these sort of questions. 
I really recommend you use them as you will find answers much more forthcomming.

The problem you have is a common problem where numbers with leading 0's are 
interpreted as octal numbers. To solve this, the number can be reformatted to 
remove the 0's . The method recommended on the Tcl'ers Wiki is to use the scan 
command.

e.g.

scan $prv_rd %d prv_rd
set calc [expr $prv_rd+2]

Lawrence

> 
> From: "Anirban Sarkar" <[EMAIL PROTECTED]>
> Date: 2005/01/28 Fri AM 08:25:54 GMT
> To: 
> Subject: [sqlite] Expr error in TCL
> 
> The $prv_rd variable stores backend sqlite data (varchar data type). The data 
> is 874. In order to perform any mathematical operation on this data, I 
> use :
> 
> set calc [expr $prv_rd+2]
> 
> The above expression gives me the following error message :
> 
> Error : expected integer but got "874" ( looks like invalid octal number )
> 
> How do I get rid of this error?
> Any early help will be appreciated.
> 
> Thanks.
> Anirban Sarkar
> 

-
Email provided by http://www.ntlhome.com/




Re: [sqlite] Tcl sqlite connectivity

2005-01-07 Thread lawrence.chitty

> 
> From: "Anirban Sarkar" <[EMAIL PROTECTED]>
> Date: 2005/01/07 Fri AM 08:49:40 GMT
> To: 
> Subject: [sqlite] Tcl sqlite connectivity
> 
> I am using sqlite-2.8.15.
> I want to connect to the sqlite database using TCL and fetch some data. 
> Please note that I have already downloaded tclsqlite-2.8.15 from 
> www.sqlite.org. What do I do next?


See 
http://www.sqlite.org/cvstrac/wiki?p=SqliteTclPackageWrapper
for setting up under Tcl 
and
http://www.sqlite.org/tclsqlite.html
for tcl commands

For all other docs, look at 

http://www.sqlite.org/docs.html

Lawrence

-
Email provided by http://www.ntlhome.com/