Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mssql stored procedure implicit return value support #352

Merged
merged 1 commit into from
Apr 8, 2015

Conversation

javornikolov
Copy link
Contributor

Add support for capturing procedure implicit return value (integer)

This is intended to resolve #351

Add support for capturing procedure implicit return value (integer)
@javornikolov javornikolov force-pushed the mssql-stored-proc-implicit-return-int-support branch from afbbe82 to 05309f3 Compare April 8, 2015 20:43
@benilovj
Copy link
Member

benilovj commented Apr 8, 2015

LGTM

benilovj added a commit that referenced this pull request Apr 8, 2015
…int-support

mssql stored procedure implicit return value support
@benilovj benilovj merged commit a05401e into master Apr 8, 2015
@benilovj benilovj deleted the mssql-stored-proc-implicit-return-int-support branch April 8, 2015 21:25
@OB4
Copy link

OB4 commented Apr 9, 2015

Hello @benilovj, I got an runtime-error:

!|Execute Procedure|dbo.CalcLength_P|
|name|strlength?|?|

com.microsoft.sqlserver.jdbc.SQLServerException: Falsche Syntax in der Nähe des where-Schlüsselworts.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1522)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1716)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:285)
at dbfit.environment.SqlServerEnvironment.readIntoParams(SqlServerEnvironment.java:92)
at dbfit.environment.SqlServerEnvironment.getAllProcedureParameters(SqlServerEnvironment.java:216)
at dbfit.api.DbStoredProcedure.getAllParams(DbStoredProcedure.java:57)
at dbfit.api.DbStoredProcedure.findAccessorForParamWithName(DbStoredProcedure.java:49)
at dbfit.api.DbStoredProcedure.getDbParameterAccessor(DbStoredProcedure.java:32)
at dbfit.fixture.DbObjectExecutionFixture.getAccessors(DbObjectExecutionFixture.java:121)
at dbfit.fixture.DbObjectExecutionFixture.getAccessors(DbObjectExecutionFixture.java:108)
at dbfit.fixture.DbObjectExecutionFixture.doRows(DbObjectExecutionFixture.java:71)
at fit.Fixture.doTable(Fixture.java:155)
at fitlibrary.traverse.AlienTraverseHandler.doTable(AlienTraverseHandler.java:18)
at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:99)
at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:87)
at fitlibrary.DoFixture.interpretWholeTable(DoFixture.java:69)
at fitlibrary.suite.InFlowPageRunner.run(InFlowPageRunner.java:34)
at fitlibrary.DoFixture.interpretTables(DoFixture.java:42)
at dbfit.DatabaseTest.interpretTables(DatabaseTest.java:26)
at fit.Fixture.doTables(Fixture.java:80)
at fit.FitServer.process(FitServer.java:81)
at fit.FitServer.run(FitServer.java:56)
at fit.FitServer.main(FitServer.java:41)

mika 4 0

@javornikolov
Copy link
Contributor Author

Hi @OB4 - can you try the following query (sorry for the raw format - you need to strip + and "). The mistake should be somewhere in it:

                "select [name], [Type], max_length, is_output, is_cursor_ref from "
                    + "("
                    + "   select "
                    + "       p.[name], TYPE_NAME(p.system_type_id) as [Type], "
                    + "       p.max_length, p.is_output, p.is_cursor_ref, "
                    + "       p.parameter_id, 0 as set_id, p.object_id "
                    + "   from sys.parameters p "
                    + "   union all select "
                    + "        '' as [name], 'int' as [Type], "
                    + "        4 as max_length, 1 as [is_output], 0 as is_cursor_ref, "
                    + "        null as parameter_id, 1 as set_id, o.object_id "
                    + "   from sys.objects where type in (N'P', N'PC') "
                    + ") where object_id = OBJECT_ID(?) order by set_id, parameter_id");

@OB4
Copy link

OB4 commented Apr 9, 2015

Hallo @javornikolov, here his a screenshot from the query and the result:

query

@javornikolov
Copy link
Contributor Author

Hi @OB4 - as far as I can see, you have added an AS u alias before where object_id = OBJECT_ID(?).
Does it fail without it? (If yes - maybe this was causing the error).

@OB4
Copy link

OB4 commented Apr 9, 2015

Hallo @javornikolov, yes indeed, without the alias the query fails.

@OB4
Copy link

OB4 commented Apr 9, 2015

Hallo @javornikolov, I have forgotten: in the union I droped the 'o' of 'o.object_id'

@javornikolov
Copy link
Contributor Author

Hello @OB4, could you try this build and let us know if it works OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stored Proc implicit return value SQL Server 2014
3 participants