- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
下一个 SP 假设运行该集合并保留对下一批文档的查询(每批 10 个文档)。但每次都会返回相同的 10 个文档。
function sample(prefix) {
var continuations = [],
ids = [],
context = getContext(),
collection = context.getCollection(),
response = context.getResponse();
var queryOptions = { pageSize: 10, continuation: null };
for (i = 0; i < 10; i++) {
// get all user wish list actions
var query = "select * from w",
accept = collection.queryDocuments(collection.getSelfLink(), query, queryOptions, processMultiUsers);
if (!accept) throw "Unable to read user's sessions";
}
getContext().getResponse().setBody(ids);
function processMultiUsers(err, docs, options) {
if (err) throw new Error("Error: " + err.message);
if (docs == undefined || docs.length == 0) throw new Error("Warning: Users not exists");
for (j = 0; j < docs.length; j++) {
ids.push(docs[j].UserId);
}
queryOptions.continuation = options.continuation;
continuations.push(options.continuation);
}}
最佳答案
在您编写的脚本中,查询的执行是同步完成的,并且它们使用相同的初始延续标记(为 null)排队。相反,我们需要从第一个查询中获取 token ,然后对下一个查询进行排队并继续。
下面的示例应该有助于实现您正在寻找的内容
function sample(continuationToken) {
var collection = getContext().getCollection();
var maxResult = 10;
var documentsProcessed = 0;
var ids = [];
var filterQuery = "select * from w";
tryQuery(continuationToken);
function tryQuery(nextContinuationToken) {
var responseOptions = { continuation: nextContinuationToken, pageSize: maxResult };
if (documentsProcessed >= maxResult || !query(responseOptions)) {
setBody(nextContinuationToken);
}
}
function query(responseOptions) {
return (filterQuery && filterQuery.length) ?
collection.queryDocuments(collection.getSelfLink(), filterQuery, responseOptions, onReadDocuments) :
collection.readDocuments(collection.getSelfLink(), responseOptions, onReadDocuments);
}
function onReadDocuments(err, docFeed, responseOptions) {
if (err) {
throw 'Error while reading document: ' + err;
}
documentsProcessed += docFeed.length;
for (var i = 0; i < documentsProcessed; i++) {
ids.push(docFeed[i].UserId);
}
if (responseOptions.continuation) {
tryQuery(responseOptions.continuation);
} else {
setBody(null);
}
}
function setBody(continuationToken) {
var body = { continuationToken: continuationToken, documentsProcessed: documentsProcessed, ids: ids };
getContext().getResponse().setBody(body);
}
}
关于azure - DocumentDB,如何在 SP 中使用 continuationToken,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38640968/
我正在尝试使用 JSOM 更新 SP.Listitem,以保留另一个用户的 spUser。请参阅下面的代码片段 // Query the picker for user information. $.
虽然我环顾四周但还没有运气 我正在使用 SQL Server。这是整个场景。 我有一个旧的遗留 sp(由于很多依赖关系和其他问题我无法更改)它不返回任何值也不接受任何输出参数,它只是选择一个值作为 C
虽然我环顾四周但还没有运气 我正在使用 SQL Server。这是整个场景。 我有一个旧的遗留 sp(由于很多依赖关系和其他问题我无法更改)它不返回任何值也不接受任何输出参数,它只是选择一个值作为 C
我正在研究使用过程的MIPS代码,但无法理解堆栈(sp)和帧指针(fp)的目的。 例如,我研究的代码如下。它会在您输入的号码之前打印所有号码,例如3. 3,2,1,0,并显示它使用了多少堆栈大小。在此
我已成功创建以下 MySQL SP.. CREATE DEFINER=`root`@`%` PROCEDURE `Common_Proc_Create_NewId` ( TableName VARC
我尝试使用链接的数据库代码中的另一个 SP 执行存储过程(SP),工作顺利,没有错误,但它不会在我的表中插入数据。 这是存储过程的代码 USE [MYDB] GO SET ANSI_NULLS ON
我有一个包含许多存储过程的生产 SQL-Server 数据库(报告)。SP以不同的方式向外界公开 - 一些用户可以直接访问 SP, - 一些通过 WebService 公开 - 而其他的则通过 DCO
我是 SQL DBA 角色的新手。我有一个可能每天运行多次的存储过程 (SP1)。它在 table1 上运行昂贵的 SELECT,可能需要 15 分钟才能完成。我有另一个存储过程 (SP2),它在 t
自从更新了 sp 软件包后,我收到了以前没有收到的警告: 1: In showSRID(uprojargs, format = "PROJ", multiline = "NO") : Disca
问题 我们试图理解为什么通过调用存储过程执行相同的代码与在查询窗口中执行存储过程内容显示出截然不同的执行时间,但返回完全相同的 183 行结果集。 测试1 从 SSMS 执行以下 SP 需要 5 分钟
为什么在0(SP)处传递的值只能在4(SP)处访问?例如,我需要通过 0(SP) 而不是 4(SP) 将数字传递给 printn (因为它在例程中使用)否则它不会起作用。我错过了什么? MOVE #1
在 MySql 存储过程中,我想捕获并记录可能发生的任何错误,然后停止/终止/退出调用存储过程的进程。该进程是另一个存储过程,其上一级或可能上两级,由计划事件执行。 目前我有第一部分,但没有第二部分:
这个问题在这里已经有了答案: scipy.special import issue (1 个回答) 关闭 7 年前。 我想使用 scipy.signal.lti 和 scipy.signal.imp
在制作 LINQ to SQL 和实体的 POC 时,我遇到了一个卡在死胡同里的问题。问题是,我正在使用 LINQ to SP,一切都运行良好,我制作了很酷的编辑、添加和删除方法。然后在我的矿井中点击
我最近开始使用 TST (tst.codeplex.com) 测试存储过程,并发现它非常有用 - 但一个缺点是我们无法隔离依赖项并“模拟”其他 SP/函数调用(就像我们对 C# 所做的那样)对象依赖关
您好,我已经创建了一个每天触发 sp 的 mysql 事件,但它触发 sp 的时间间隔为一天。我创建的事件是: CREATE DEFINER=`root`@`localhost` EVENT `Job
我想知道是否可以在 Sql Server Profiler 中查看其他存储过程正在执行的存储过程,是否可以,如果可以,如何实现? 最佳答案 如果您使用 SP::Starting 事件进行分析,您可以看
我的场景 我正在开发一个数据库,该数据库将包含整个服务器上不同数据库中各种存储过程的许多详细信息。我现在试图收集的信息是“SP 输出什么?” 在搜索中我发现答案就在 OPENROWSET 中。我的初步
在 python 中,我们有包含 sp.linalg.norm、sp.cross 的库 scipy。 C++ boost 库中有没有类似的函数? 最佳答案 好像没有。 但是,OpenCV 有您需要的!
将 scipy 导入 Python 时出现错误。当我写: import scipy as sp x2 = lambda x: x**2 print sp.integrate.quad(x2, 0, 4
我是一名优秀的程序员,十分优秀!