MS Access取消执行直通查询键盘快捷键 [英] MS Access cancel execution of pass-thru query keyboard shortcut

查看:155
本文介绍了MS Access取消执行直通查询键盘快捷键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MS Access中使用SQL直通查询时,默认超时为60秒,此时将一条指令发送到远程服务器以取消请求.无论如何,有没有类似于Access自己的"Ctrl + Break"操作从键盘发送该命令的方法?

When using SQL pass-thru queries in MS Access, there is a default time-out of 60 seconds, at which point an instruction is sent to the remote server to cancel the request. Is there anyway to send this command from the keyboard similar to Access' own "Ctrl + Break" operation?

推荐答案

首先,了解Control-C如何取消执行.他们可能会捕获该键序列,并执行一些特殊的操作.我强烈怀疑oracle的客户端应用程序(SQL * Plus等)正在幕后调用OCIBreak(),并将句柄传递给他们使用前一个OCI调用执行查询时所获得的服务器.

Firstly, understanding how Control-C cancels execution. They probably trap that key sequence, and do something special. I strongly suspect that oracle's client apps (SQL*Plus et al) are calling OCIBreak() behind the scenes, and passing in the handle to the server that they obtained when they executed the query with a previous OCI call.

我还怀疑Access在60秒后没有做任何积极的事情.那只是执行查询时它所请求的超时.更是如此,我开始怀疑Access是否正在请求该超时.我读过的所有内容都表明ODBC驱动程序不支持查询超时,这使我认为这只是客户端超时,但是我离题了...

I also suspect that Access isn't doing anything actively after 60 seconds; that's just the timeout it requests at time of execution query. Even more so, I'm beginning to wonder if Access is even requesting that timeout; everything I've read says that the ODBC driver does not support a query timeout, which makes me think it's just a client-side timeout, but I digress...

所以-返回此OCIBreak()调用.这是个坏消息:我不认为ODBC实现了这些调用.要确保100%肯定,您必须看一下oracle源的ODBC驱动程序,但是我读到的所有内容都表明该API调用未公开.

So - back to this OCIBreak() call. Here's the bad news: I don't think ODBC implements these calls. To be 100% sure, you'd have to take a look at the ODBC driver for oracle sources, but everything I've read indicates that the API call is not exposed.

作为参考,我一直在与"OBDC"结合使用这些搜索词:

For reference, I've been googling with these search terms in combination with "OBDC":

ORA-01013  (error when a user cancelled an operation, or when an operation times out)
OCIBreak   (OCI function which cancels a pending operation)

---编辑#1 ---

作为一个旁注,我真的相信Access只是放弃了,并且在超过传递超时时不发送任何类型的取消命令.如果您看一下这篇kb文章,则 ODBC驱动程序甚至不支持查询超时:

As a side note, I really believe that Access is just giving up, and not sending any type of cancel command when the Pass-Through timeout is exceeded. If you take a look at this kb article, the ODBC Driver doesn't even support a query timeout:

PRB:Microsoft Oracle ODBC驱动程序和OLE DB提供程序不支持连接超时和查询超时

经过一段时间后,Access可能只是停止监听结果.如果您要向oracle查询仍在执行的查询列表,我强烈怀疑您仍然会看到列出的查询.

After the elapsed time, Access probably just stops listening for results. If you were to ask oracle for a list of queries that are still executing, I strongly suspect you'd still see yours listed.

---编辑#2 ---

就实现自己的取消"(实际上并不是取消)而言,更多的是使UI保持响应状态,而不管查询的状态如何",此处的关键字将是异步的.您将要重写代码以异步执行,这样就不会阻塞UI的消息泵.我将开始使用Google搜索异步查询访问"功能,然后查看弹出的内容.一个SO结果出现了:

As far as implementing your own "cancel" -- which isn't really a cancel, more of a "keep the UI responsive regardless of the state of a query" -- the keyword here is going be asynchronous. You're going to want to rewrite your code to execute asynchronously so that it isn't blocking the message pump for your UI. I'd start googling for "async query access" and see what pops up. One SO result came up:

在MS Access中运行异步查询

以及xtremevbtalk.com上一个不错的起点:

as well as a decent starting point at xtremevbtalk.com:

http://www.xtremevbtalk.com/showthread.php?t=82631

实际上,您将要求访问权限以在后台启动代码,而不是触发直到超时或返回结果集为止的阻止执行的代码.然后,您将设置一个事件,当发生进一步的事情时将触发该事件,例如让用户知道发生了超时(超时失败),使用结果填充网格(成功)等).

In effect, instead of firing off code that blocks execution until either a timeout occurs or a result set is returned, you'll be asking access to kick off the code behind the scenes. You'll then set up an event that fires when something further happens, such as letting the user know that the timeout occurred (timeout failure), populating a grid with results (success), etc...)

这篇关于MS Access取消执行直通查询键盘快捷键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆