Skip to content

Loading…

DBAL-955: No exception thrown for query error #2200

Open
doctrinebot opened this Issue · 6 comments

5 participants

@doctrinebot

Jira issue originally created by user flip101:

Consider the following code:

IF OBJECT_ID('tempdb..#TestTable') IS NOT NULL DROP TABLE #TestTable

CREATE TABLE #TestTable
( 
id INT  NOT NULL IDENTITY(1,1) PRIMARY KEY, 
aDate DATETIME2(6) NULL
)

INSERT INTO #TestTable
(
aDate
) VALUES
(
'2014-07-30 08:54:23.000000'
)

SELECT *
FROM #TestTable
WHERE aDate > 2000

Error:

Msg 206, Level 16, State 2, Line 21
Operand type clash: datetime2 is incompatible with smallint

Problem: for this error no DBALexception is thrown

By the way, this does work (but does not affect problem description):

SELECT *
FROM #TestTable
WHERE aDate > '2000'
@doctrinebot

Comment created by @ocramius:

[~flip101] your code example includes no DBAL code: could you also add the PHP wrapping around those SQL statements?

@doctrinebot

Comment created by @deeky666:

[~flip101] ping.

@doctrinebot doctrinebot added the Bug label
@beberlei beberlei was assigned by doctrinebot
@beberlei beberlei was unassigned by deeky666
@deeky666
Doctrine member

@flip111 can you please provide more information on what's actually broken in DBAL? Maybe also provide steps for reproduction. Thanks!

@flip111

Sorry i can not remember what i did exactly 1.5 years ago. I figure i just used a native query, since i didn't find it important enough to include php code it must just have been a one-liner. Also if it was not a native query i would have reported it on ORM, not DBAL. Did you try checking out 1.5 year old code and run the query? So i suggest doing the first queries (making tables) on the database directly. Then using this code http://doctrine-orm.readthedocs.org/projects/doctrine-dbal/en/latest/reference/data-retrieval-and-manipulation.html#data-retrieval to execute that last SELECT query. I think that should be enough to reproduce and to find out what is broken. So i know SQL Server gives an error but Doctrine does not throw an exception ... i forgot what doctrine does instead ... perhaps just return an empty result set.

@deeky666 deeky666 self-assigned this
@deeky666
Doctrine member

@flip111 thanks for your feedback. I know this is old so no problem :) I will try to find out what's wrong.

@deeky666 deeky666 removed their assignment
@deeky666
Doctrine member

@zeroedin-bill assigning this to you for now as I currently don't have a running SQL Server setup. Though this one has no priority... Just in case you are bored ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.