named-parameters

Spring NamedParameterJdbcTemplate not returning result for simple query

£可爱£侵袭症+ 提交于 2019-12-13 07:57:43
问题 Please bare with my limited info on code since having limited access to copy paste complete code. @Repository("BaseDao") public class BaseDaoImpl implements BaseDao{ public NamedParameterJdbcTemplate namedJdbcTemplate; @Autowired public void setDataSource(DataSource dataSource){ this.namedJdbcTemplate = new NamedParameterJdbcTemplate(dataSource); } } @Repository("WelcomeDao") public class WelcomeDaoImpl extends BaseDaoImpl implements WelcomeDao { public List<String> getFunctionTypes() {

Named parameters in database functions with SQLAlchemy

强颜欢笑 提交于 2019-12-13 02:09:18
问题 I have a function in my database (Postgres) that looks like this: create function test_f(a text default '*', b text default '+') returns text as $$ select a || ' ' || b; $$ language sql; Postgres allows calling it with named parameters: mytest=> select test_f('a', 'b'); test_f -------- a b (1 row) mytest=> select test_f('a'); test_f -------- a + (1 row) mytest=> select test_f(b:='a'); test_f -------- * a (1 row) I want to do the same from Python, using SQLAlchemy's func construct, but it

Shouldn't C# 4.0's new “named parameters” feature be called “named arguments”?

跟風遠走 提交于 2019-12-12 13:57:06
问题 I suppose there could be historical reasons for this naming and that other languages have similar feature, but it also seems to me that parameters always had a name in C#. Arguments are the unnamed ones. Or is there a particular reason why this terminology was chosen? 回答1: Yes, you're absolutely right (to my mind, anyway). Ironically, although I'm usually picky about these terms, I still use "parameter passing" when I should probably talk about "argument passing". I suppose one could argue

Positional before Named argument list parsing

不羁岁月 提交于 2019-12-12 03:44:09
问题 How would you do that in the parser combinators def namedAfterPos[P, N](pos: Parser[P], nmd: Parser[N], sep: Parser[_] = ",") = ??? List("a", "a,a,a", "a,a,a=b,a=b", "a=b, a=b") map (_ parseWith namedAfterPos("a", "a=b")) map {case Success(res, _) => res} val Failure("positional is not expected after named", pos) = "a,a=b,a" parseWith namedAfterPos("a", "a=b") 回答1: Ok, here is mind approach scala> def namedAfterPos[P, N](pos: Parser[P], nmd: Parser[N], sep: Parser[_] = ",") = { // NB! http:/

How can a Bash function detect whether it is being used with positional or named arguments?

孤者浪人 提交于 2019-12-11 18:57:38
问题 I'm writing a Bash function that is to be capable of attempting to use either positional or named arguments, whereby positional arguments are accessed in the usual "${1}" , "${2}" way and named arguments are accessed using getopts . I have some example code and example usage shown below in order to illustrate what I'm trying to do. The problem is that the check I'm doing on the variable ${*} is just a grep for the character - , which limits greatly the character content of further arguments.

Java named parameter's name (for Oracle JDBC function result)

岁酱吖の 提交于 2019-12-10 17:12:25
问题 I'm going to call a function, and set some parameters by name, example: Connection c = null; ResultSet rs = null; String query; PreparedStatement ps; CallableStatement cs = null; try { c = DbUtils.getConnection(); cs = c.prepareCall("{? = call get_proc_name(?, ?) }"); cs.registerOutParameter(1, OracleTypes.VARCHAR); cs.setInt("in_proc_type", ProcTypes.SELECT); cs.setLong("in_table_id", tableId); // here I should use something like cs.registerOutParameter("result", OracleTypes.VARCHAR); cs

named parameters with default values in groovy

a 夏天 提交于 2019-12-09 14:04:11
问题 Is it possible to have named parameters with default values in groovy? My plan is to make a sort of object factory, which can be called with no arguments at all in order to get an object with default values. Also, I'd need the functionality to explicitly set any of the params for the object. I believe this is possible with Python keyword arguments, for example. The code I'm attempting with right now is something like below // Factory method def createFoo( name='John Doe', age=51, address=

How can I pass named arguments to a Rake task?

寵の児 提交于 2019-12-09 07:41:12
问题 Is there a way to pass named arguments to a Rake task without using environment variables? I am aware that Rake tasks can accept arguments in two formats: Environment Variables $ rake my_task foo=bar This creates an environment variable with the name foo and the value bar that can be accessed in the Rake task my_task by ENV['foo'] . Rake Task Arguments $ rake my_task['foo','bar'] This passes the values foo and bar to the first two task arguments (if they are defined). If my_task were defined

Is it possible to use named parameters when command type is adCmdText?

放肆的年华 提交于 2019-12-08 07:41:12
问题 I'm trying to use named parameters with following query through Adodb.Command but no luck. Select * From mytable Where col1 = Lower(@param1) And col2 = Upper(@param2) And col3 = @param1 The code I used something like that. Dim cmd Set cmd = Server.CreateObject("Adodb.Command") cmd.NamedParameters = True cmd.CommandType = adCmdText cmd.CommandText = "Select * From mytable Where col1 = Lower(@param1) And col2 = Upper(@param2) And col3 = @param1" cmd.Parameters.Append cmd.CreateParameter("

Groovy named parameters cause parameter assignments to switch--any way around this?

廉价感情. 提交于 2019-12-07 06:41:33
问题 Groovy will collect all the named parameters into a map and pass it into a method as the first parameter. This seems neat, but after trying to make it work it seems really unusable. So the issue is a method like this: def method(paramMap, specificVar1 = 7, specificVar2 = 14) when you call this method with something like this: method(12, extraValue: "hello") you get pretty much what you expect: assert 12 == specificVar1 assert 14 == specificVar2 assert [extraValue:"hello"] == paramMap not bad,