有没有办法确定SQL Server存储过程返回记录集(Is there any way of determining of a SQL Server Stored Procedure returns a recordset)
我们有一个内部应用程序,它生成ASP代码来调用Oracle和SQL存储过程。
该应用程序查询相应的数据字典,并能够确定参数信息,并相应地构建调用。 使用此应用程序的开发人员可以在其项目中包含代码,并使用专用DTO(也由应用程序生成)将数据传递给它。
在Oracle中,我们可以愉快地确定是否返回记录集,因为我们使用了refcursors,并且这些记录显示在Oracle DDL的参数列表中。
对于SQL Server,情况并非如此。 目前,开发人员必须知道SQL Server SP是否返回记录集,并在界面上勾选一个选项。 反过来,这将确定代码生成是否包含
ExecuteQuery
或ExecuteNonQuery
。虽然这没关系,但是选择这个选项会很好。 有没有办法通过检查数据字典或其他方式以编程方式确定?
谢谢,
詹姆士
We have an internal application which generates ASP code to call Oracle and SQL Stored procedures.
This application queries the respective data dictionaries, and is able to determine parameter information, and construct the call accordingly. A developer using this application can include the code in their project, and pass data to it using a dedicated DTO (also generated by the app).
In Oracle, we can happily determine if a recordset is returned, as we use refcursors, and these show up in the parameter list on the Oracle DDL.
This not the case for for SQL Server. Currently the developers themselves have to know whether the SQL Server SP returns a recordset, and tick an option on the interface. This, in turn, determines whether the code generates contains
ExecuteQuery
orExecuteNonQuery
.While this is ok, it would be nice no to have that option. Is there a way that his can be determined programatically by inspecting the data dictionary or by some other means?
Thanks,
James
原文:https://stackoverflow.com/questions/4874265
最满意答案
我建议摆脱
TestFunctions.h
,并将Test::count()
的实现添加到Test.cpp
。 目前,TestFunctions.h
头文件并不包含在任何地方,所以你无法访问main的定义。I would suggest getting rid of
TestFunctions.h
, and adding the implementation ofTest::count()
toTest.cpp
. Currently, theTestFunctions.h
header is not included anywhere, so you have no access to the definition from main.
相关问答
更多-
如果我在Class2.cpp中包含#include "Burrito.cpp" ,那么它可以工作,但他没有包含它。 这很少(我会说永远不会)解决方案。 不要#include在其他源文件中应该是源文件。 解决方案是编译您需要编译的所有文件,并让链接器处理链接问题。 你没有编译Burrito.cpp,所以当然你有链接问题。 解决方案很简单:编译Burrito.cpp并将Burrito.o添加到您提供给链接器的文件集中。 或者,您可以向编译器提供Class2.cpp和Burrito.cpp,从而创建可执行文件而不 ...
-
通过带有静态类型Class的引用调用可能未定义的方法(Call to a possibly undefined method through a reference with static type Class)[2023-12-09]
假设你单身人士是Calculation类,你是否缺少getInstance调用? utils.Calculation.getInstance().setResult(2, 1); 一个好的动作单例模式: package com.stackOverflow { public class MySingleton { public function MySingleton(lock:Class) { if(lock != Singleton ... -
C ++类方法包含对静态变量的未定义引用(C++ Class Method contains Undefined Reference to a Static Variable)[2022-03-10]
在定义 .cpp文件中的字段时,不应使用static关键字,只有在类中声明时才使用。 请注意代码注释中有“声明”和“定义”错误的方式。 另外,在定义成员时,您需要使用类名称对其进行限定。 所以.cpp定义应该是: MyTest::DBGL MyTest::debug_level_d = MyTest::FULL; 通过在定义中使用static关键字,可以将其限制为内部链接。 请参阅: http : //en.cppreference.com/w/cpp/language/static You should ... -
我建议摆脱TestFunctions.h ,并将Test::count()的实现添加到Test.cpp 。 目前, TestFunctions.h头文件并不包含在任何地方,所以你无法访问main的定义。 I would suggest getting rid of TestFunctions.h, and adding the implementation of Test::count() to Test.cpp. Currently, the TestFunctions.h header is not i ...
-
我不认为专业类模板从非专用类模板继承方法实现的概念是正确的。 考虑例如std :: enable_if。 此类的全部内容是通过引用模板的特定版本中不存在的类型来触发替代失败。 如果您描述的行为是正确的,那么这将无效。 或者至少,您需要使用两个特化而不是泛型和一个特化来定义enable_if(事实并非如此)。 我认为这是一个“XY”的情况:你希望能够做一些事情,但我认为你更有可能修改你的设计,所以你不需要做那件事。 我可以想象获得通用模板成员函数会有用的情况,但它应该是相对罕见的,这不会让我觉得这些情况之一。 ...
-
你已经声明了默认的构造函数(CombatAdmin()),从而阻止了编译器自动生成它。 因此,您需要1)从类中移除默认构造函数的声明,或者2)提供一个实现。 You have declared the default constructor (CombatAdmin()) and thus prevented the compiler from automatically generating it. Thus, you either need to 1) remove declaration of the ...
-
首先实例化一个实例,并确保在目标文件中有一个非extern的g_myClass定义。 Instantiate an instance first, and make sure that you have a non-extern definition of g_myClass among your object files.
-
您的cpp文件中不应包含Class。 他们看起来应该更像: BinomialNode.cpp #include "BinomialNode.h" BinomialNode::BinomialNode(int n) : k(0) { data = n; } 当然,更长的BinomialTree.cpp的必然结果。 此外,您应该使用以下内容编译它: g++ BinomialTree.cpp BinomialNode.cpp Asg5.cpp -o asg5 你的代码也会遇到很多其他问题。 例如: ...
-
该错误是由于在B和C析构函数中调用A::decompose引起的。 即使析构函数是虚拟的并且方法本身是虚拟的,也会调用A::decompose 。 当为派生对象B或C运行析构函数时,对象的派生部分已被销毁。 class A { public: virtual void decompose() { std::cout << "A";} virtual ~A() { decompose(); } }; class B:public A { private: int *b_data; p ...
-
#
的未定义方法'+'(Undefined method '+' for # [2022-07-02]) 改变这一行: @magazine.pages.create(image: image, page_number: @pages + index + 1) 至 @magazine.pages.create(image: image, page_number: @pages.page_number || 0 + index + 1) change this line: @magazine.pages.create(image: image, page_number: @pages + index + 1) ...