Return-Path: X-Original-To: apmail-metamodel-dev-archive@minotaur.apache.org Delivered-To: apmail-metamodel-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5ECD71049F for ; Wed, 28 May 2014 09:00:16 +0000 (UTC) Received: (qmail 76568 invoked by uid 500); 28 May 2014 09:00:16 -0000 Delivered-To: apmail-metamodel-dev-archive@metamodel.apache.org Received: (qmail 76529 invoked by uid 500); 28 May 2014 09:00:16 -0000 Mailing-List: contact dev-help@metamodel.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@metamodel.incubator.apache.org Delivered-To: mailing list dev@metamodel.incubator.apache.org Received: (qmail 76511 invoked by uid 99); 28 May 2014 09:00:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 May 2014 09:00:16 +0000 X-ASF-Spam-Status: No, hits=3.2 required=5.0 tests=FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of balendrasingh@gmail.com designates 209.85.192.52 as permitted sender) Received: from [209.85.192.52] (HELO mail-qg0-f52.google.com) (209.85.192.52) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 May 2014 09:00:12 +0000 Received: by mail-qg0-f52.google.com with SMTP id a108so16416137qge.25 for ; Wed, 28 May 2014 01:59:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Y9uFLeVfdgPSlVxlmvRKBSpRjtdca+Y6UupQmdBOyGU=; b=ufkNmwpdITFzwz3sxta8nQetHafNZ6lbVuhgsUJ7JIT7tpV/Q2azQuVtD/hqQI1v59 ATh4dWt2gPY7RlTt0TTEAZpNjH5dkfLyCWq9RUr7NGUF/BNc2REe0bzfAOPVpLX5ofSj 4q52uJNVASprnL8oQ/dPbcBo62JtWDxZ6chrEUGwY4zybeDxYjlXYTKa1g5d188DyV3Q YFpVYr/0mVt8/a7GyRlvjGDoqbYcLXrcCYE4khzcq1PpPTYm41IMceVfn8ecOkIDC2To YOgxBhK6vIkVMC4SuKqduHvd+WtuDlRXyIjl5udMcF6olbPtm7VKOBpnwo4HAVK5G4dH BMSA== MIME-Version: 1.0 X-Received: by 10.224.92.75 with SMTP id q11mr28188286qam.15.1401267591211; Wed, 28 May 2014 01:59:51 -0700 (PDT) Received: by 10.224.109.199 with HTTP; Wed, 28 May 2014 01:59:51 -0700 (PDT) In-Reply-To: References: Date: Wed, 28 May 2014 14:29:51 +0530 Message-ID: Subject: Re: Metamodel timestamp issue for MSSQL From: Balendra Singh To: dev@metamodel.incubator.apache.org Content-Type: multipart/alternative; boundary=089e01493f10028b4a04fa72098e X-Virus-Checked: Checked by ClamAV on apache.org --089e01493f10028b4a04fa72098e Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Yes Kasper. Already working on it. I will submit the patch soon. Thanks, Balendra On 28 May 2014 14:23, Kasper S=C3=B8rensen = wrote: > Hi Balendra, > > OK thanks for clearing that up. > > I suggest we register a bug in JIRA [1] about this and fix it on high > priority. > Would you be interested in submitting a patch? > > [1] https://issues.apache.org/jira/browse/METAMODEL > > Best regards, > Kasper > > > 2014-05-28 5:57 GMT+02:00 Balendra Singh : > > > Hi Kasper, > > > > We are using *datetime *datatype to store dates in the table. > > > > > > > > Thanks, > > Balendra > > > > > > On 27 May 2014 19:24, Kasper S=C3=B8rensen > >wrote: > > > > > Hi Balendra, > > > > > > I think you may have catched a bug that we should look into. Looking > > > at SQLServerQueryRewriter I don't see any special handling of date/ti= me > > > literals in MS SQL, but I do see in the docs for MS SQL server [1] > that a > > > number of literals are possible, but none of them complies with the > > > standard format of MetaModel. > > > > > > In addition I looked to one of my favourite SQL dialect comparison > papers > > > [2] and it says that timestamp in MS SQL is deprecated and that > DATETIME > > > type is preferred. I doubt it has any impact on the query literals, b= ut > > > just wondering which type you use? > > > > > > Best regards, > > > Kasper > > > > > > [1] http://msdn.microsoft.com/en-us/library/ms710282(v=3Dvs.85).aspx = and > > > http://msdn.microsoft.com/en-us/library/ms187819.aspx > > > > > > [2] > http://troels.arvin.dk/db/rdbms/#data_types-date_and_time-timestamp > > > > > > > > > 2014-05-27 12:21 GMT+02:00 Balendra Singh : > > > > > > > Hi, > > > > > > > > I am using the following query in my application. This application = is > > > using > > > > DB2, Postgres, Oracle and MSSQL databases. > > > > But the following is not being executed in MSSQL saying* Incorrect > > syntax > > > > near '2014-05-26 16:02:45'.* > > > > > > > > *UPDATE SET =3D? WHERE ( < > > > > TIMESTAMP '2014-05-26 16:02:45')* > > > > > > > > I am creating this query using FilterItem. > > > > After modifying the query with addition of CAST in the query, I am > able > > > to > > > > execute the following query in MSSQL client - > > > > > > > > *UPDATE
SET =3D? WHERE ( > > > column> < CAST('2014-05-26 16:02:45' AS DATETIME))* > > > > > > > > *I debugged the code and found that > > > > in org.eobjects.metamodel.util.FormatHelper.formatSqlTime(ColumnTyp= e, > > > Date, > > > > boolean, String, String), *we are appending this extra TIMESTAMP > > > > as typePrefix in the query. > > > > > > > > Am I missing something or the Metamodel is not generating query > > correctly > > > > compatible for MSSQL. > > > > Please provide your input. > > > > > > > > > > > > > > > > Thanks, > > > > Balendra > > > > > > > > > > --089e01493f10028b4a04fa72098e--