These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: How does NH generate parameters for SQL query being executed
PostPosted: Mon Jan 22, 2007 3:45 am 
Regular
Regular

Joined: Fri Feb 18, 2005 3:34 am
Posts: 88
Location: Poland/Wrocław
Hi,

I am working on a dialect for SharpHsql database and have a following problem.

Why does it insert '?' as parameters? And how I can control it from the level of dialect?

Code:
2187 [TestRunnerThread] DEBUG NHibernate.SQL (null) - INSERT INTO "ITEM" (Name, Date) VALUES (?, ?); p0 = '', p1 = '1/22/2007 8:42:48'
NHibernate: INSERT INTO "ITEM" (Name, Date) VALUES (?, ?); p0 = '', p1 = '1/22/2007 8:42:48'
2203 [TestRunnerThread] DEBUG NHibernate.Impl.BatcherImpl (null) - Closed IDbCommand, open IDbCommands: 0
2203 [TestRunnerThread] DEBUG NHibernate.Util.ADOExceptionReporter (null) - could not insert: [NHibernate.SharpHSQLDriver.Test.Domain.Item] [INSERT INTO "ITEM" (Name, Date) VALUES (?, ?)]
System.Data.Hsql.SharpHsqlException: 37000 Unexpected token: ? in statement [INSERT INTO "ITEM" (Name, Date) VALUES (?, ?)]
   at System.Data.Hsql.SharpHsqlConnection.CheckForError(Result _result) in d:\01-Private\SharpHsql\SharpHSQL\Provider\SharpHsqlConnection.cs:line 459
   at System.Data.Hsql.SharpHsqlConnection.Execute(String sqlBatch) in d:\01-Private\SharpHsql\SharpHSQL\Provider\SharpHsqlConnection.cs:line 447
   at System.Data.Hsql.SharpHsqlCommand.ExecuteNonQuery() in d:\01-Private\SharpHsql\SharpHSQL\Provider\SharpHsqlCommand.cs:line 276
   at NHibernate.Impl.BatcherImpl.ExecuteNonQuery(IDbCommand cmd)
   at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object[] fields, Boolean[] notNull, SqlCommandInfo sql, Object obj, ISessionImplementor session)
2281 [TestRunnerThread] WARN NHibernate.Util.ADOExceptionReporter (null) - System.Data.Hsql.SharpHsqlException: 37000 Unexpected token: ? in statement [INSERT INTO "ITEM" (Name, Date) VALUES (?, ?)]
   at System.Data.Hsql.SharpHsqlConnection.CheckForError(Result _result) in d:\01-Private\SharpHsql\SharpHSQL\Provider\SharpHsqlConnection.cs:line 459
   at System.Data.Hsql.SharpHsqlConnection.Execute(String sqlBatch) in d:\01-Private\SharpHsql\SharpHSQL\Provider\SharpHsqlConnection.cs:line 447
   at System.Data.Hsql.SharpHsqlCommand.ExecuteNonQuery() in d:\01-Private\SharpHsql\SharpHSQL\Provider\SharpHsqlCommand.cs:line 276
   at NHibernate.Impl.BatcherImpl.ExecuteNonQuery(IDbCommand cmd)
   at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object[] fields, Boolean[] notNull, SqlCommandInfo sql, Object obj, ISessionImplementor session)
2281 [TestRunnerThread] ERROR NHibernate.Util.ADOExceptionReporter (null) - 37000 Unexpected token: ? in statement [INSERT INTO "ITEM" (Name, Date) VALUES (?, ?)]
2281 [TestRunnerThread] DEBUG NHibernate.Transaction.AdoTransaction (null) - rollback

_________________
Please rate this post if you've found it helpfull
Roland


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 22, 2007 4:47 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
It is controlled by the driver, see IDriver.GenerateCommand and its implementation in DriverBase. You can override certain properties to customize the behavior of the DriverBase's implementation.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 22, 2007 6:57 am 
Regular
Regular

Joined: Fri Feb 18, 2005 3:34 am
Posts: 88
Location: Poland/Wrocław
sergey wrote:
It is controlled by the driver, see IDriver.GenerateCommand and its implementation in DriverBase. You can override certain properties to customize the behavior of the DriverBase's implementation.


Thanx. One step further :)

_________________
Please rate this post if you've found it helpfull
Roland


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.