Return-Path: X-Original-To: apmail-db-torque-user-archive@www.apache.org Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 53B1910610 for ; Wed, 12 Jun 2013 07:00:05 +0000 (UTC) Received: (qmail 39163 invoked by uid 500); 12 Jun 2013 07:00:04 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 38924 invoked by uid 500); 12 Jun 2013 06:59:56 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 38916 invoked by uid 99); 12 Jun 2013 06:59:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Jun 2013 06:59:54 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [217.24.207.26] (HELO mail.seitenbau.net) (217.24.207.26) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Jun 2013 06:59:47 +0000 Received: from www.seitenbau.net ([192.168.15.18]:62785) by mail.seitenbau.net with esmtp (Exim 4.76) (envelope-from ) id 1Umf1h-0001Uq-1g for torque-user@db.apache.org; Wed, 12 Jun 2013 08:59:25 +0200 X-CTCH-RefID: str=0001.0A0C0208.51B81C4D.0123,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 In-Reply-To: <53D7A1AD-3700-4399-9684-A7729EFAFB81@gmail.com> References: <53D7A1AD-3700-4399-9684-A7729EFAFB81@gmail.com> Subject: RE: SummaryHelper not setting replacements X-KeepSent: 1FEFE5BE:D4454834-C1257B88:0025A542; type=4; name=$KeepSent To: "Apache Torque Users List" X-Mailer: Lotus Notes Release 8.5.3 September 15, 2011 Message-ID: From: Thomas Fox Date: Wed, 12 Jun 2013 08:59:24 +0200 X-MIMETrack: Serialize by Router on www/seitenbau(Release 8.5HF467 | May 15, 2009) at 06/12/2013 08:59:24 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Virus-Checked: Checked by ClamAV on apache.org |----------------------------------------------------------------------------------------------------------------------------------------------------> |Jay Bourland wrote: | |----------------------------------------------------------------------------------------------------------------------------------------------------> >---------------------------| | An: | >---------------------------| > I'm trying to convert an old Torque site to version 4. I'm running > into a problem with using a count() function. The code looks like this: > > Criteria crit = getCriteriaDogsWithAllTitles( titles, year ); > > SummaryHelper summary = new SummaryHelper(); > > summary.addAggregate( "count", new Count( DogPeer.DOG_ID ) ); > List results = summary.summarize( crit ); > > When summarize() is executed, I get a > "jdbc4.MySQLSyntaxErrorException: You have an error in your SQL > syntax" exception. The Criteria is good and works fine with a > doSelect(). It appears that the summarize converts the Criteria to a > string without adding in the replacements for the parameters in the > prepared statement. Can you please provide an example how you construct a crit which fails ? > Also, if I take the string from the > queryStatement and replace the '?' with values, the statement runs > fine from an interactive MySQL session. When I compare the code in > SummaryHelper.summarize() to BasePeerImpl.doSelect() the code to set > the replacements is present in doSelect but not in summarize. > > What's the best way to report this? Please file a jira issue at https://issues.apache.org/jira/browse/TORQUE/ As a workaround, you can try crit.addSelectColumn(new org.apache.torque.util.functions.Count ("*")); int count = SomePeer.doSelectSingleRecord(crit, new org.apache.torque.om.mapper.IntegerMapper()); instead of summary.addAggregate( "count", new Count( DogPeer.DOG_ID ) ); List results = summary.summarize( crit ); Thomas --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org