I pulled from the master a couple of hours ago in order to grab your
fix to HAVING for Jonathan. I'm having a couple of problems:
- Squeryl unit test suite appears to be broken:
[info] x return the correct results if a left outer join is used
[info] 'Some(org.squeryl.dsl.GroupWithMeasures@62ea423e)' is not
equal to 'Some(14)' (AggregateFuncInOuterJoin.scala:99)
[info] == org.squeryl.tests.LeftJoinTest ==
[info]
[info] == test-finish ==
[error] Failed: : Total 8, Failed 1, Errors 0, Passed 6, Skipped 1
[info] == test-finish ==
[info]
[info] == test-cleanup ==
[info] == test-cleanup ==
[error] Error running org.squeryl.tests.LeftJoinTest: Test FAILED
- I'm getting a SQL exception in my own unit test suite. It appears
that something has gone wrong with "IN" functionality. My query looks
like this:
from(ZamboniSchema.steps)(s =>
where(s.workflowId === workflowId and
s._status.in(desiredStatuses.map(_.toString)))
select(s))
And the SQL looks like the following. Note that there are only 2 ?s
in the query, but the array of JDBC parameters is longer.
Select
Step1.fan_Out as Step1_fan_Out,
Step1.name as Step1_name,
Step1.child_Workflow_Id as Step1_child_Workflow_Id,
Step1.step_Runner as Step1_step_Runner,
Step1.id as Step1_id,
Step1.max_Tries as Step1_max_Tries,
Step1.created_At as Step1_created_At,
Step1.terminal_Step_Ordinal as Step1_terminal_Step_Ordinal,
Step1.workflow_Id as Step1_workflow_Id,
Step1.status as Step1_status
From
Step Step1
Where
((Step1.workflow_Id = ?) and (Step1.status in (?)))
jdbcParams:[1,RUNNING]
2011-03-01 12:17:16 [INFO] [wf: NestedWorkflow 3-1]: Select
Step1.fan_Out as Step1_fan_Out,
Step1.name as Step1_name,
Step1.child_Workflow_Id as Step1_child_Workflow_Id,
Step1.step_Runner as Step1_step_Runner,
Step1.id as Step1_id,
Step1.max_Tries as Step1_max_Tries,
Step1.created_At as Step1_created_At,
Step1.terminal_Step_Ordinal as Step1_terminal_Step_Ordinal,
Step1.workflow_Id as Step1_workflow_Id,
Step1.status as Step1_status
From
Step Step1
Where
((Step1.workflow_Id = ?) and (Step1.status in (?)))
jdbcParams:[1,STOPPED,STEP_RUNNER_FAILED,INTERNAL_ERROR,FAILED,UNKNOWN]
Exception while executing statement : Invalid value "3" for parameter
"parameterIndex" [90008-127]
errorCode: 90008, sqlState: 90008
Thanks, Alec
2011/3/1 Maxime Lévesque <maxime....@gmail.com>:
It does work if I add the .toSeq:
from(ZamboniSchema.steps)(s =>
where(s.workflowId === workflowId and
s._status.in(desiredStatuses.map(_.toString).toSeq))
select(s))
results in the right number of question marks in the query:
Select
Step1.fan_Out as Step1_fan_Out,
Step1.name as Step1_name,
Step1.child_Workflow_Id as Step1_child_Workflow_Id,
Step1.step_Runner as Step1_step_Runner,
Step1.id as Step1_id,
Step1.max_Tries as Step1_max_Tries,
Step1.created_At as Step1_created_At,
Step1.terminal_Step_Ordinal as Step1_terminal_Step_Ordinal,
Step1.workflow_Id as Step1_workflow_Id,
Step1.status as Step1_status
From
Step Step1
Where
((Step1.workflow_Id = ?) and (Step1.status in (?,?,?,?,?)))
jdbcParams:[1,STOPPED,STEP_RUNNER_FAILED,INTERNAL_ERROR,FAILED,UNKNOWN]
I then undid my change and made the following change to
DslFactory.scala, and this also worked:
diff --git a/src/main/scala/org/squeryl/dsl/DslFactory.scala
b/src/main/scala/org/squeryl/dsl/DslFactory.scala
index a0f7699..b9ee26d 100644
--- a/src/main/scala/org/squeryl/dsl/DslFactory.scala
+++ b/src/main/scala/org/squeryl/dsl/DslFactory.scala
@@ -108,17 +108,17 @@ trait DslFactory
// column/field types, so they don't need to be overridable factory methods :
implicit def traversableOfNumercalExpressionList[A <%
NumericalExpression[_]](l: Traversable[A]) =
- new RightHandSideOfIn[NumericalExpression[A]](new
ConstantExpressionNodeList[Any](l))
+ new RightHandSideOfIn[NumericalExpression[A]](new
ConstantExpressionNodeList[Any](l.toSeq))
// TODO : find out why this generalized conv for NonNumericals won't
work (looks like a scalac bug...):
// implicit def traversableOfNonNumercalExpressionList[A <%
NonNumericalExpression[_]](l: Traversable[A]) =
// new RightHandSideOfIn[NonNumericalExpression[A]](new
ConstantExpressionNodeList[Any](l))
implicit def traversableOfString2ListString(l: Traversable[StringType]) =
- new RightHandSideOfIn[StringType](new
ConstantExpressionNodeList[StringType](l))
+ new RightHandSideOfIn[StringType](new
ConstantExpressionNodeList[StringType](l.toSeq))
implicit def traversableOfDate2ListDate(l: Traversable[DateType]) =
- new RightHandSideOfIn[DateType](new
ConstantExpressionNodeList[DateType](l))
+ new RightHandSideOfIn[DateType](new
ConstantExpressionNodeList[DateType](l.toSeq))
implicit def typedExpression2OrderByArg[E <%
TypedExpressionNode[_]](e: E) = new OrderByArg(e)
Let me know if you want me to push this change onto a branch. I don't
really understand the DSL very well, so it is quite possible that this
change is incorrect or incomplete.
I neglected to say that desiredStatuses in the example below is a Set,
not a Seq.
-Alec
2011/3/1 Maxime Lévesque <maxime....@gmail.com>: