[Lift] Re: how to use BySql query

2009-08-14 Thread Jeppe Nejsum Madsen

pravin pravinka...@gmail.com writes:

 Hi,
 I am new to lift .
 I am using mapper framework.
 i have table emp with name ,salary, location columns


  now i want to put query to find employee whose salary is less than
 1  and greater that 1000 and location is California.

 For this i am using BySql query...as foolows -

 val emp_List = emp_details.findAll(BySql(salary between ? and ?,
 1000,1,IHaveValidatedThisSQL(pravin,2009-08-03)));

 but when i compileing this i get following error -

I don't think this is problem with your sql (though I think you need to
provide the params as a list as the last parameter:-) but with the
encoding of your source file. Please verify that it is UTF8 encoded if
it contains non-ascii characters or specify the correct encoding when
compiling

/Jeppe

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: how to use BySql query

2009-08-14 Thread David Pollak
On Thu, Aug 13, 2009 at 10:26 PM, pravin pravinka...@gmail.com wrote:


 Hi,
 I am new to lift .
 I am using mapper framework.
 i have table emp with name ,salary, location columns


  now i want to put query to find employee whose salary is less than
 1  and greater that 1000 and location is California.

 For this i am using BySql query...as foolows -

 val emp_List = emp_details.findAll(BySql(salary between ? and ?,
 1000,1,IHaveValidatedThisSQL(pravin,2009-08-03)));


The first issue is the misplaced quotes.  This is a Scala compiler issue...
the compiler should report a syntax error:

val emp_List = emp_details.findAll(BySql(salary between ? and ?,
1000,1,IHaveValidatedThisSQL(pravin,2009-08-03)));

Should be:
val emp_List = emp_details.findAll(BySql(salary between ? and ?,
1000,1,IHaveValidatedThisSQL(pravin,2009-08-03)));

But once it compiles, it's still going to result in a run-time error.  salary
between ? and ?, 1000,1 is not valid SQL.  You probably want something
like:

val emp_List = emp_details.findAll(BySql(salary between ? and
?,IHaveValidatedThisSQL(pravin,2009-08-03), 1000, 1));

Note that 1000 and 1 are not part of the query string, but are
parameters bound to the two '?'.




 but when i compileing this i get following error -

 java.io.IOException: MALFORMED[1]
at scala.tools.nsc.io.SourceReader$.decode(SourceReader.scala:
 134)
at scala.tools.nsc.io.SourceReader.read(SourceReader.scala:95)
at scala.tools.nsc.io.SourceReader.read(SourceReader.scala:46)
at scala.tools.nsc.io.SourceReader.read(SourceReader.scala:65)
at scala.tools.nsc.Global.getSourceFile(Global.scala:211)
at scala.tools.nsc.Global.getSourceFile(Global.scala:217)
at scala.tools.nsc.Global$Run$$anonfun$compile$1.apply
 (Global.scala:667)
at scala.tools.nsc.Global$Run$$anonfun$compile$1.apply
 (Global.scala:667)
at scala.List.map(List.scala:805)
at scala.tools.nsc.Global$Run.compile(Global.scala:667)
at scala.tools.nsc.Main$.process(Main.scala:73)
at scala.tools.nsc.Main$.main(Main.scala:87)
at scala.tools.nsc.Main.main(Main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
 (NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
 (DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.scala_tools.maven.executions.MainHelper.runMain
 (MainHelper.java:105)
at org.scala_tools.maven.executions.MainWithArgsInFile.main
 (MainWithArgsInFile.java:26)
 error: IO error while decoding C:\Documents and Settings\pravin_karne
 \Scala_workspace\mobworx\src\main\scala\com\mobworx\snip
 pet\DisplayResults.scala with UTF-8
 Please try specifying another one using the -encoding option
 one error found



 So what is cause of this error and is there other way to find it out


 Thanks in advance
 -Pravin

 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---