私は現在、休止状態のクエリを実行する必要があるgrailsプロジェクトに取り組んでいます。データベース上の既存のデータを使用してコードを実行するたびに、すべてが正常に機能します。しかし、データベースを空にして実行すると、エラーがスローされます。
これは私のコードです:
def actActivation = AuditLog.executeQuery("select ll.username from AuditLog ll where ll.event = ? ",[AuditLogEvent.ACCOUNT_ACTIVATION])
def actDeleted = AuditLog.executeQuery("select ll.username from AuditLog ll where ll.event = ? ",[AuditLogEvent.ACCOUNT_DELETION])
def actPurged = AuditLog.executeQuery("select ll.username from AuditLog ll where ll.event = ? ",[AuditLogEvent.ACCOUNT_PURGING])
def list = AuditLog.executeQuery("""select sum(case when l.details like '%Gender: Male.%' and l.event = :actActivationEvent then 1 else 0 end),
sum(case when l.details like '%Gender: Female.%' and l.event = :actActivationEvent then 1 else 0 end),
sum(case when l.event = :actActivationEvent then 1 else 0 end),
sum(case when l.details like '%Gender: Male.%' and l.event = :actFinishRegEvent and ((l.username not in(:actActivation)) or (l.username in(:actDeleted) or l.username in(:actPurged))) then 1 else 0 end),
sum(case when l.details like '%Gender: Female.%' and l.event = :actFinishRegEvent and ((l.username not in(:actActivation)) or (l.username in(:actDeleted) or l.username in(:actPurged))) then 1 else 0 end),
sum(case when l.event = :actFinishRegEvent and ((l.username not in(:actActivation)) or (l.username in(:actDeleted) or l.username in(:actPurged))) then 1 else 0 end),
sum(case when l.details like '%Gender: Male.%' and l.event = :actDeletionEvent then 1 else 0 end),
sum(case when l.details like '%Gender: Female.%' and l.event = :actDeletionEvent then 1 else 0 end),
sum(case when l.event = :actDeletionEvent then 1 else 0 end),
sum(case when l.details like '%Gender: Male.%' and l.event = :actPurgedEvent then 1 else 0 end),
sum(case when l.details like '%Gender: Female.%' and l.event = :actPurgedEvent then 1 else 0 end),
sum(case when l.event = :actPurgedEvent then 1 else 0 end)
from AuditLog l
where l.dateCreated >= :startDate and l.dateCreated < :endDate""",
[
actActivationEvent:AuditLogEvent.ACCOUNT_ACTIVATION,
actDeletionEvent:AuditLogEvent.ACCOUNT_DELETION,
actPurgedEvent:AuditLogEvent.ACCOUNT_PURGING,
actFinishRegEvent:AuditLogEvent.FINISH_REGISTRATION,
actActivation:actActivation,
actDeleted:actDeleted,
actPurged:actPurged,
startDate: startDate,
endDate:endDate
])
これは、データベースを空にしてコードを実行したときのエラーメッセージです。
クラス:org.hibernate.hql.ast.QuerySyntaxException
メッセージ:
サブツリーの予期しない終了[selectsum(case when l.details like'%Gender:Male。%' and l.event =:actActivationEvent then 1 else 0 end)、sum(case when l.details like'%Gender:Female。 %'およびl.event=:actActivationEvent then 1 else 0 end)、sum(case when l.event =:actActivationEvent then 1 else 0 end)、sum(case when l.details like'%Gender:Male。%'and l.event =:actFinishRegEvent and((l.username not in())or(l.username in()or l.username in()))then 1 else 0 end)、sum(case when l.details like ' %Gender:Female。%'and l.event =:actFinishRegEvent and((l.username not in())or(l.username in()or l.username in()))then 1 else 0 end)、sum (l.event =:actFinishRegEvent and((l.username not in())or(l.username in()or l.username in()))then 1 else 0 end)、sum(casewhenl。 '%Gender:Male。%'などの詳細およびl.event=:actDeletionEvent then 1 else 0 end)、sum(case when l.details like'%Gender:Female。%' and l.event =:actDeletionEvent then 1 else 0 end)、sum(casewhenl。 event =:actDeletionEvent then 1 else 0 end)、sum(case when l.details like'%Gender:Male。%' and l.event =:actPurgedEvent then 1 else 0 end)、sum(case when l.details like' %Gender:Female。%'and l.event =:actPurgedEvent then 1 else 0 end)、sum(case when l.event =:actPurgedEvent then 1 else 0 end)from ph.gov.csc.comex.log.AuditLog lここで、l.dateCreated> =:startDateおよびl.dateCreated <:endDate]%Gender:Male。%'and l.event =:actPurgedEvent then 1 else 0 end)、sum(l.details like'%Gender:Female。%'and l.event =:actPurgedEvent then 1 else 0 end) 、sum(case when l.event =:actPurgedEvent then 1 else 0 end)from ph.gov.csc.comex.log.AuditLog l where l.dateCreated> =:startDate and l.dateCreated <:endDate]%Gender:Male。%'and l.event =:actPurgedEvent then 1 else 0 end)、sum(l.details like'%Gender:Female。%'and l.event =:actPurgedEvent then 1 else 0 end) 、sum(case when l.event =:actPurgedEvent then 1 else 0 end)from ph.gov.csc.comex.log.AuditLog l where l.dateCreated> =:startDate and l.dateCreated <:endDate]
これをどのように解決しますか?助けてください!ありがとう!