小编tho*_*mas的帖子

MySql SELECT联合用于不同的列?

我有一个选择查询,选择附加了缩略图文件的文件,我还需要获取没有附加缩略图的文件.

我当前的SQL查询是

SELECT   node.title, node.nid, files.fid, files.filepath, 
         content_type_mobile_event.field_date_value, 
         content_type_mobile_event.field_movie_shorts_value, 
         content_type_mobile_event.field_director_value, 
         content_type_mobile_event.field_length_value, 
         content_type_mobile_event.field_movie_type_value, 
         content_type_mobile_event.field_year_value, 
         content_type_mobile_event.field_event_type_value, 
         content_type_mobile_event.field_movie_location_value, 
         content_type_mobile_event.field_movie_desc_value, 
         content_type_mobile_event.field_movie_id_value, 
         content_type_mobile_event.field_movie_thumb_fid, 
         content_type_mobile_event.field_movie_trailer_url 
FROM     node, content_type_mobile_event, files 
WHERE    node.nid=content_type_mobile_event.nid AND 
         content_type_mobile_event.field_movie_thumb_fid=files.fid 
ORDER BY content_type_mobile_event.field_date_value ASC
Run Code Online (Sandbox Code Playgroud)

我也需要

SELECT   node.title, node.nid, content_type_mobile_event.field_date_value, 
         content_type_mobile_event.field_movie_shorts_value, 
         content_type_mobile_event.field_director_value, 
         content_type_mobile_event.field_length_value, 
         content_type_mobile_event.field_movie_type_value, 
         content_type_mobile_event.field_year_value, 
         content_type_mobile_event.field_event_type_value, 
         content_type_mobile_event.field_movie_location_value, 
         content_type_mobile_event.field_movie_desc_value, 
         content_type_mobile_event.field_movie_id_value, 
         content_type_mobile_event.field_movie_thumb_fid, 
         content_type_mobile_event.field_movie_trailer_url 
FROM     node, content_type_mobile_event 
WHERE    node.nid=content_type_mobile_event.nid AND
         content_type_mobile_event.field_movie_thumb_fid!=1 
ORDER BY content_type_mobile_event.field_date_value ASC
Run Code Online (Sandbox Code Playgroud)

我通常会做一个

(
SELECT   node.title, node.nid, files.fid, files.filepath, 
         content_type_mobile_event.field_date_value, 
         content_type_mobile_event.field_movie_shorts_value, 
         content_type_mobile_event.field_director_value, 
         content_type_mobile_event.field_length_value, 
         content_type_mobile_event.field_movie_type_value, 
         content_type_mobile_event.field_year_value, 
         content_type_mobile_event.field_event_type_value, 
         content_type_mobile_event.field_movie_location_value, 
         content_type_mobile_event.field_movie_desc_value, 
         content_type_mobile_event.field_movie_id_value, 
         content_type_mobile_event.field_movie_thumb_fid, 
         content_type_mobile_event.field_movie_trailer_url 
FROM     node, content_type_mobile_event, …
Run Code Online (Sandbox Code Playgroud)

mysql

26
推荐指数
3
解决办法
7万
查看次数

Firebase Cloud Function 已完成,状态为:“响应错误”

我有一个云函数,它返回大量数据(50'000 个文档)作为对象。当我运行它时,我收到错误finished with status: 'response error'

仅当我导出所有数据时才会发生这种情况,当应用限制(最多 20'000)时,它可以正常工作。这让我认为响应可能太大,但日志中根本没有关于此的信息。另外添加 try/catch 也不起作用。在控制台中,我只收到上述消息,没有任何进一步的指示。

我知道函数通常会在超时或超出内存时记录日志,所以我想知道还有什么可能是错误来源。

exports.run = functions.runWith({ timeoutSeconds: 540, memory: '8GB' }).https.onRequest(async (req, res) => {
  try {
    const querySnap = await db.collection("myData").get();
    const data = querySnap.docs.map(doc => doc.data());
    return res.status(200).json({
      data: data
    }).end();

  } catch (err) {
    console.log(err);
    return res.status(400).end();
  }
});
Run Code Online (Sandbox Code Playgroud)

编辑:确实是响应的大小导致了此错误。如果您只是返回给定大小的数据(使用Buffer.alloc(bytes)),您可以重现此情况。

javascript firebase google-cloud-functions google-cloud-firestore

10
推荐指数
1
解决办法
4375
查看次数

Java 中的多个 SQL 语句(使用 ?allowMultiQueries=true)

我有个问题。我使用了很多 SQL 查询,并尝试找出最好和最快的解决方案来处理大量查询(大约 10'000 个 SQL 查询)。我已经想出了 2 种方法来做到这一点,并想听听您对此的看法。VERSION1:循环准备好的语句,VERSION2:允许多个查询以分号分隔(通过在连接到数据库时添加“?allowMultiQueries=true”)。

Version2 运行得更快(3 秒),而 Version1 很慢(超过 1 分钟)。所以我的问题是,允许多个准备好的语句有什么缺点(或者可能是安全问题)?

这是一个简短的代码示例。感谢所有帮助!

// i want to execute the following 3 SQL queries:
String[] SQL = new String[3];
SQL[0] = "UPDATE tbl1 SET age=22 WHERE id=1;";
SQL[1] = "UPDATE tbl1 SET age=80 WHERE id=2;";
SQL[2] = "UPDATE tbl1 SET age=31 WHERE id=3;";

// VERSION1: loop over prepared statements
int[] age = {22,80,31};
int[] id  = { 1, 2, 3};
Connection conn1 = …
Run Code Online (Sandbox Code Playgroud)

java mysql sql

5
推荐指数
1
解决办法
3836
查看次数

滑块在使用后从GUI消失

我尝试以编程方式创建一个MATLAB GUI,并面对我的滑块在使用后消失的问题.我隔离了问题以保持代码简短.在这个GUI中,我想在plotmatrix每次使用滑块时刷新(忽略滑块的值与我的程序完全无关的事实,如前所述,我真的想保持代码清洁,这就是为什么我也删除了这个功能) .这是代码(您必须将其作为函数运行):

function StackOverflowQuestion_GUI()
    % clear memory
    close all; clc;

    % initialize figure
    f = figure;

    % create main axes
    AX_main = axes('Parent',f,...
        'Units','normalized','Position',[.1 .2 .8 .7]);

    % create slider
    uicontrol('Parent',f,...
        'Style','slider','Callback',{@sliderCallback,AX_main},...
        'Units','normalized','Position',[0.05 0.05 0.9 0.05]);

    plotmatrix(AX_main,randn(500,3));
    title('Random Plotmatrix');
end

function sliderCallback(~,~,AX_main)   % callback for slider
    plotmatrix(AX_main,randn(500,3));
    title('Random Plotmatrix NEW');
end
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏!我想我误解了AXES的概念.当我绘制到我创建的AXES手柄时,为什么该图的其他部分也会受到影响?如果有人能向我解释这个图形处理系统基本上是如何工作的,那也是非常好的!

matlab user-interface slider matlab-figure matlab-gui

2
推荐指数
1
解决办法
179
查看次数

Firestore 返回未定义的 documentSnapshot.createTime(使用 webproject 和 javascript)

我尝试获取时间戳,createTimeupdateTimeDocumentSnapshot 文档中所述。到目前为止,我已经完成了以下工作:

  • 已成功将 Firestore 与我的 javascript webproject 连接
  • 读写数据工作

那是我试图获取时间戳的代码:

db.collection("users").doc("user1").get().then(doc => {
    if (doc.exists) {
        console.log(doc.createTime);  // -> undefined (?)
        console.log(doc.updateTime);  // -> undefined (?)
        console.log(doc.readTime);    // -> undefined (?)
        console.log(doc.exists);      // -> true (works)
        console.log(doc.id);          // -> "user1" (works)
    } 
}).catch(error => {
    console.log("Error getting document:", error);
});
Run Code Online (Sandbox Code Playgroud)

为什么文档时间戳方法不起作用,而其他方法喜欢existsid正常工作?

javascript firebase google-cloud-firestore

2
推荐指数
1
解决办法
924
查看次数

使用 Tiktok(网页)流程登录示例

我希望用户在网络上使用 tikok 登录并获取他的基本信息,例如:

  • avarat_url
  • union_id(抖音提供的uniq用户标识)
  • display_name

Tiktok Login Kit for Web Documentation似乎缺少有关如何实现完整调用序列的完整示例。还有一些事情根本没有解释(比如回调 URL)。有人可以分享他们的完整解决方案以及如何将 tiktok 登录集成到网页上的代码示例吗?

oauth tiktok

2
推荐指数
1
解决办法
7539
查看次数