RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-543712

Дима Й's questions

Martin Hope
Дима Й
Asked: 2025-02-14 06:58:39 +0000 UTC

通过 PDO 进行长 SELECT 查询

  • 3

有一个通过 PDO 进行的 mysql 查询

    $statement = $this->database->getConnection()->prepare(
        'SELECT a, b, c, d, e, f, g, h, timeReceipt
         FROM data
         WHERE idModem = :idModem
         AND  timeReceipt BETWEEN :startTime AND :endTime order by timeReceipt ASC'
    );
    $statement->execute([
        'startDatetime' => (int) $startDatetime,
        'endDatetime' => (int) $endDatetime,
        'idModem' => $idModem
    ]);
    $res = $statement->fetchAll(PDO::FETCH_NUM); 

从一个包含700多万条记录的表中查询。使用了两个索引:idModem(bigInt)和timeReceipt(bigInt)-timestump。结果是一个包含 720 个元素的关联数组。大约需要5秒钟才能完成。在此处输入图片描述

只是,通过微时间,这个片段大约需要5秒。

     $time4 = microtime(true);
         //запрос
     $time5 = microtime(true);

解释在此处输入图片描述

在 phpmyadmin 显示配置文件中查询执行时间;0.03c在不同的值下。为什么 PDO 中的查询执行如此缓慢?

php
  • 1 个回答
  • 85 Views
Martin Hope
Дима Й
Asked: 2024-04-23 00:34:53 +0000 UTC

更新 Bootstrup 5 工具提示中的文本(不带动画)

  • 5

当 ajax 响应到达时,我使用此设计来更新工具提示中的文本。

 let element = document.getElementById('idElement');
 const tooltipElement = bootstrap.Tooltip.getOrCreateInstance(element)
 tooltipElement.setContent({'.tooltip-inner': 'New text'})

这段代码有效。但更新的时候这个提示逐渐消失又出现。如何在不闪烁的情况下更新工具提示内容?也许,您需要以某种方式在更新阶段禁用动画或使用其他方法来更新工具提示。完全禁用动画是不合适的。引导程序 5.3.0-alpha3

javascript
  • 1 个回答
  • 35 Views
Martin Hope
Дима Й
Asked: 2024-03-14 17:00:03 +0000 UTC

连接另一个表中的数据

  • 5

我什至无法提出一个具体的问题来在互联网上找到答案。 有一个上诉
表,其中包含idAppeal、 userId和closeUserId列。 有一个包含idUser和昵称列 的用户表。我发出请求并通过closeUserId的left join粘贴昵称

SELECT  a.userId, a.closeUserId, u.nickname as userClosedName
FROM appeals a
left join users u on u.idUser = a.closeUserId   
WHERE a.idAppeal = :idAppeal


一切正常,但现在你需要在结果表中显示userId的相同昵称。你可以直接通过UNION来完成,但我确信有一个更短、更漂亮的解决方案,但我还无法实现

mysql
  • 1 个回答
  • 18 Views
Martin Hope
Дима Й
Asked: 2023-12-18 06:58:11 +0000 UTC

优化选择mysql

  • 5

有3张桌子。数据、调制解调器信息、数据响应。
data - 来自调制解调器的所有常规每分钟信息 +100 线/分钟(到目前为止总共约 150 万条),
modemsInfo - 有关调制解调器的信息、谁拥有它们等(目前约 10 条。超过 3000 条正在发布)未计划),
dataResponse - 调制解调器响应。本质上与data相同,但只有几行(到目前为止大约 10 行),
每 5 秒我收集一次所有所有者调制解调器的最新信息(下文中在idCompany代码中)。在某一时刻,请求时间花费了6秒,并且尚未传输任何数据和数据响应信息的调制解调器越多,采样时间就越差。+1与一个新的调制解调器。我使用各种文章和答案对其进行了修改和优化。变成了1.4秒。容易一点,但在我看来,这需要很长时间。请告诉我,谁不懒得鼓捣这个,还能做什么?它们通过serialNum和typeReceipt
相互连接,与**modeDialog** 填充数据表 相同:

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227124, '9faec1317eb285f9f20254b6d2e20670', 111111111111, 0, 83206, 76105, 10553, 25226, 80, 0, 411, 74, 22, 0, 0, 1, 0, 0, 0, 0, 1370562830, 0, '2023-12-17 14:00:10');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227122, '931a1e61b06b2fbcbdea07f6d8fe59ed', 111111111111, 0, 12809, 99159, 42986, 1461, 75, 0, 575, 838, 42, 0, 0, 1, 0, 0, 0, 0, 1370562830, 0, '2023-12-17 14:00:10');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227121, '393fd8d56d1338b6e5742a95bdd17a58', 822917000001, 0, 24478, 14257, 73864, 43259, 34, 31, 673, 936, 45, 0, 0, 1, 0, 0, 0, 0, 1370562830, 0, '2023-12-17 14:00:10');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227120, '6592908f518c9b43c0dfc6bcc798bfbd', 111111111111, 0, 55502, 40960, 80864, 26944, 81, 63, 876, 152, 80, 0, 0, 1, 0, 0, 0, 0, 1370562830, 0, '2023-12-17 14:00:10');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227119, 'b3f8f973c5f3ccabfc5f58be74249c9b', 822125000000, 0, 18944, 89632, 75158, 46181, 58, 87, 812, 368, 65, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:10');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227118, '08d986357608dd939184cfbdc1041a81', 822125000000, 0, 13852, 61660, 99013, 51948, 77, 78, 848, 558, 35, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:10');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227117, 'eaf4a664592b29aba94f5aefe4519c6e', 822917000001, 0, 19293, 14457, 81638, 5465, 26, 3, 818, 951, 95, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:10');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227116, 'e54394b113c5d91c77eb068772c234e7', 822917000001, 0, 56479, 56457, 32901, 75286, 69, 75, 456, 205, 38, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:09');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227115, 'a410df8e915d78d4e65020e16a9061e7', 111111111111, 0, 25941, 33667, 78140, 83016, 36, 83, 67, 314, 14, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:09');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227111, '43a8f3d4dbcf7af684d7ec31183f7c2c', 111111111111, 0, 28033, 69911, 41437, 97644, 20, 42, 742, 384, 88, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:09');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227110, '1e084b1a8028754ef6a6a6113f686638', 822917000001, 0, 58290, 28145, 8922, 54037, 12, 53, 135, 951, 29, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:09');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227109, 'bd5ab82e1aee708f560805983724568e', 822125000000, 0, 70906, 3568, 53202, 41062, 28, 28, 914, 527, 53, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:09');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227108, 'ea2247e979a8062840c650c0f5254036', 111111111111, 0, 81361, 46912, 87251, 11789, 9, 89, 452, 971, 75, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:09');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227104, '9642c393186c731193c51828490d76d3', 111111111111, 0, 94653, 222, 37479, 78288, 78, 89, 134, 96, 79, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:08');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227103, '7d5780e49716d92c33c2e6f500021026', 111111111111, 0, 76185, 85751, 46847, 66784, 97, 66, 725, 19, 59, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:08');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227102, 'dac779c303bcf599174685a4d629b657', 822125000000, 0, 8978, 23016, 82799, 36104, 66, 64, 550, 817, 26, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:08');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227101, 'f0db8b14b9357a5d0db62110939994e3', 822125000000, 0, 39960, 69244, 26330, 24935, 38, 43, 197, 554, 13, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:08');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227100, '8c9712df7f264efeb934753d64cbe232', 822917000001, 0, 78323, 9031, 9834, 23217, 94, 45, 461, 856, 58, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:08');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227099, '05c9d72b9f7dc9995c1c5d2981b1fb9d', 822125000000, 0, 25667, 74187, 25871, 42459, 59, 83, 858, 455, 45, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:08');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227098, 'adb125ba523e789c43b280bf23572ac4', 822917000001, 0, 42359, 72061, 36836, 29225, 40, 68, 677, 695, 40, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:08');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227097, 'f6c062d3b84362ec93a509a44f199f0f', 111111111111, 0, 40311, 80755, 36442, 33862, 6, 44, 452, 746, 52, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:08');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227096, '8b4c70bb37860e457170c7d57eb64b99', 822125000000, 0, 6601, 98527, 1455, 11081, 30, 57, 986, 818, 89, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:08');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227095, 'b6eef858ec15886c113510c970f64e23', 822917000001, 0, 99418, 31939, 52525, 90310, 80, 40, 970, 955, 20, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:08');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227090, 'b8c3812632b8582d874a2e89546e07d7', 822917000001, 0, 64064, 40638, 17418, 24982, 77, 30, 541, 585, 38, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:07');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227089, '26532d9cb67ded61bad390675ea4f552', 822917000001, 0, 22571, 41643, 52396, 62944, 54, 73, 448, 93, 22, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:07');


INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227082, '268405297d3e3fcccb2a17c0d3173dd0', 111111111111, 0, 73953, 44671, 71077, 64229, 39, 23, 358, 474, 83, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:07');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227081, '405d9b0bf00bd68fa256b094843dcee6', 111111111111, 0, 63800, 68218, 58017, 81928, 17, 79, 919, 195, 45, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:07');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227080, '81786eb3a525e88f8251e760f2bdaa0b', 822125000000, 0, 39770, 10714, 39325, 61061, 62, 69, 656, 316, 91, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:07');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227079, '8893945f6a00932f278011122e44558b', 822917000001, 0, 90452, 70936, 44922, 51558, 55, 95, 63, 50, 98, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:07');

INSERT INTO u2378356_ledMonitor.data (id, md5receipt, serialNum, mode, Ub, Ib, Up, IL, Ta, Tc, tL, tN, PL, Hand, Fire, Night, `Load`, Disch, OverIL, ShortL, ip, typeReceipt, timeReceipt) VALUES (1227078, 'b8f9b8c17c51ef0dca852868b144a67b', 111111111111, 0, 22306, 56306, 26453, 36391, 63, 32, 623, 93, 90, 0, 0, 1, 0, 0, 0, 0, 1370562830, 1, '2023-12-17 14:00:07');

填充dataResponse表:

INSERT INTO u2378356_ledMonitor.dataResponse (md5receipt, serialNum, text, ip, commandResponse, timeReceipt,
                                          typeReceipt)
VALUES ('1', null, '822917000001', 11212, '1', null, null);

INSERT INTO u2378356_ledMonitor.dataResponse (md5receipt, serialNum, text, ip, commandResponse, timeReceipt,
                                          typeReceipt)
VALUES ('2', null, '822917000000', 1212, '1', null, null);

INSERT INTO u2378356_ledMonitor.dataResponse (md5receipt, serialNum, text, ip, commandResponse, timeReceipt,
                                          typeReceipt)
VALUES ('3', null, '822917000001', null, '1', null, null);

INSERT INTO u2378356_ledMonitor.dataResponse (md5receipt, serialNum, text, ip, commandResponse, timeReceipt,
                                          typeReceipt)
VALUES ('4', null, '822125000000', 11313, '1', null, null);

INSERT INTO u2378356_ledMonitor.dataResponse (md5receipt, serialNum, text, ip, commandResponse, timeReceipt,
                                          typeReceipt)
VALUES ('5', null, '822125000000', 4114, '1', null, null);

INSERT INTO u2378356_ledMonitor.dataResponse (md5receipt, serialNum, text, ip, commandResponse, timeReceipt,
                                          typeReceipt)
VALUES ('6', null, '822917000001', 1212, '1', null, null);

INSERT INTO u2378356_ledMonitor.dataResponse (md5receipt, serialNum, text, ip, commandResponse, timeReceipt,
                                          typeReceipt)
VALUES ('9', null, '822917000001', 1212, '1', null, null);

INSERT INTO u2378356_ledMonitor.dataResponse (md5receipt, serialNum, text, ip, commandResponse, timeReceipt,
                                          typeReceipt)
VALUES ('10', null, '822917000001', null, '1', null, null);

INSERT INTO u2378356_ledMonitor.dataResponse (md5receipt, serialNum, text, ip, commandResponse, timeReceipt,
                                          typeReceipt)
VALUES ('11', null, '822917000001', 1212, '1', null, null);

INSERT INTO u2378356_ledMonitor.dataResponse (md5receipt, serialNum, text, ip, commandResponse, timeReceipt,
                                          typeReceipt)
VALUES ('12', null, '822917000001', 241515, '1', null, null);

INSERT INTO u2378356_ledMonitor.dataResponse (md5receipt, serialNum, text, ip, commandResponse, timeReceipt,
                                          typeReceipt)
VALUES ('13', null, '822917000000', 1535132, '1', null, null);

INSERT INTO u2378356_ledMonitor.dataResponse (md5receipt, serialNum, text, ip, commandResponse, timeReceipt,
                                          typeReceipt)
VALUES ('14', null, '822917000001', 4361, '2', null, null);

INSERT INTO u2378356_ledMonitor.dataResponse (md5receipt, serialNum, text, ip, commandResponse, timeReceipt,
                                          typeReceipt)
VALUES ('15', null, '822125000000', 346, '1', null, null);

INSERT INTO u2378356_ledMonitor.dataResponse (md5receipt, serialNum, text, ip, commandResponse, timeReceipt,
                                          typeReceipt)
VALUES ('16', null, '822125000000', 13464, '2', null, null);

填充modemsInfo表:

INSERT INTO u2378356_ledMonitor.modemsInfo (id, serialNum, idCompany, nameModem, phoneNumber, modeDialog,
                                        commandStatusGPRS, region, city, street, structure, latitude, longitude,
                                        timeActivation, timeRegister, idGroup, idIcon, model, keyDelete,
                                        endTimeKeyDelete, commandStatusSMS, billingPeriodDay, billingPeriodTime,
                                        identifySerialNum)
VALUES (21, 822917000001, 1, '1', '79803400001', 1, '?', null, null, null, null, null, null, '2023-12-17 16:02:58',
    '2023-12-17 16:02:58', 0, 0, 0, null, null, '?', '01', '00:00:00', 000001);

INSERT INTO u2378356_ledMonitor.modemsInfo (id, serialNum, idCompany, nameModem, phoneNumber, modeDialog,
                                        commandStatusGPRS, region, city, street, structure, latitude, longitude,
                                        timeActivation, timeRegister, idGroup, idIcon, model, keyDelete,
                                        endTimeKeyDelete, commandStatusSMS, billingPeriodDay, billingPeriodTime,
                                        identifySerialNum)
VALUES (22, 822125000000, 1, '2', '79803400000', 1, '?', null, null, null, null, null, null, '2023-12-17 16:04:08',
    '2023-12-17 16:04:08', 0, 0, 0, null, null, '?', '01', '00:00:00', 000000);

INSERT INTO u2378356_ledMonitor.modemsInfo (id, serialNum, idCompany, nameModem, phoneNumber, modeDialog,
                                        commandStatusGPRS, region, city, street, structure, latitude, longitude,
                                        timeActivation, timeRegister, idGroup, idIcon, model, keyDelete,
                                        endTimeKeyDelete, commandStatusSMS, billingPeriodDay, billingPeriodTime,
                                        identifySerialNum)
VALUES (44, 111111111111, 1, '3', '79802410000', 1, '?', null, null, null, null, null, null, '2023-12-17 21:21:57',
    '2023-12-17 21:20:37', 0, 0, 0, null, null, '?', '01', '00:00:00', 111111);

INSERT INTO u2378356_ledMonitor.modemsInfo (id, serialNum, idCompany, nameModem, phoneNumber, modeDialog,
                                        commandStatusGPRS, region, city, street, structure, latitude, longitude,
                                        timeActivation, timeRegister, idGroup, idIcon, model, keyDelete,
                                        endTimeKeyDelete, commandStatusSMS, billingPeriodDay, billingPeriodTime,
                                        identifySerialNum)
VALUES (45, null, 1, '4', '71112111111', 1, '?', null, null, null, null, null, null, null, '2023-12-17 22:16:13', 0, 0,
    0, null, null, '?', '01', '00:00:00', 112211);

INSERT INTO u2378356_ledMonitor.modemsInfo (id, serialNum, idCompany, nameModem, phoneNumber, modeDialog,
                                        commandStatusGPRS, region, city, street, structure, latitude, longitude,
                                        timeActivation, timeRegister, idGroup, idIcon, model, keyDelete,
                                        endTimeKeyDelete, commandStatusSMS, billingPeriodDay, billingPeriodTime,
                                        identifySerialNum)
VALUES (46, null, 1, '5', '73333333333', 0, '?', null, null, null, null, null, null, null, '2023-12-17 22:16:39', 0, 0,
    0, null, null, '?', '01', '00:00:00', 333333);

INSERT INTO u2378356_ledMonitor.modemsInfo (id, serialNum, idCompany, nameModem, phoneNumber, modeDialog,
                                        commandStatusGPRS, region, city, street, structure, latitude, longitude,
                                        timeActivation, timeRegister, idGroup, idIcon, model, keyDelete,
                                        endTimeKeyDelete, commandStatusSMS, billingPeriodDay, billingPeriodTime,
                                        identifySerialNum)
VALUES (47, null, 3, '6', '71333333333', 1, '?', null, null, null, null, null, null, null, '2023-12-17 22:16:57', 0, 0,
    0, null, null, '?', '01', '00:00:00', 121312);

INSERT INTO u2378356_ledMonitor.modemsInfo (id, serialNum, idCompany, nameModem, phoneNumber, modeDialog,
                                        commandStatusGPRS, region, city, street, structure, latitude, longitude,
                                        timeActivation, timeRegister, idGroup, idIcon, model, keyDelete,
                                        endTimeKeyDelete, commandStatusSMS, billingPeriodDay, billingPeriodTime,
                                        identifySerialNum)
VALUES (49, null, 1, '8', '73332223333', 1, '?', null, null, null, null, null, null, null, '2023-12-17 22:17:50', 16, 0,
    0, null, null, '?', '01', '00:00:00', 212211);

INSERT INTO u2378356_ledMonitor.modemsInfo (id, serialNum, idCompany, nameModem, phoneNumber, modeDialog,
                                        commandStatusGPRS, region, city, street, structure, latitude, longitude,
                                        timeActivation, timeRegister, idGroup, idIcon, model, keyDelete,
                                        endTimeKeyDelete, commandStatusSMS, billingPeriodDay, billingPeriodTime,
                                        identifySerialNum)
VALUES (50, null, 4, '9', '79802412222', 1, '?', null, null, null, null, null, null, null, '2023-12-17 22:18:14', 17, 0,
    0, null, null, '?', '01', '00:00:00', 112312);

INSERT INTO u2378356_ledMonitor.modemsInfo (id, serialNum, idCompany, nameModem, phoneNumber, modeDialog,
                                        commandStatusGPRS, region, city, street, structure, latitude, longitude,
                                        timeActivation, timeRegister, idGroup, idIcon, model, keyDelete,
                                        endTimeKeyDelete, commandStatusSMS, billingPeriodDay, billingPeriodTime,
                                        identifySerialNum)
VALUES (51, null, 1, '10', '71231231331', 1, '?', null, null, null, null, null, null, null, '2023-12-17 22:18:29', 24,
    0, 0, null, null, '?', '01', '00:00:00', 312312);

INSERT INTO u2378356_ledMonitor.modemsInfo (id, serialNum, idCompany, nameModem, phoneNumber, modeDialog,
                                        commandStatusGPRS, region, city, street, structure, latitude, longitude,
                                        timeActivation, timeRegister, idGroup, idIcon, model, keyDelete,
                                        endTimeKeyDelete, commandStatusSMS, billingPeriodDay, billingPeriodTime,
                                        identifySerialNum)
VALUES (52, null, 1, '11', '71231333331', 1, '?', null, null, null, null, null, null, null, '2023-12-17 22:18:50', 0, 0,
    0, null, null, '?', '01', '00:00:00', 123123);

采样结果:
在此输入图像描述

表格:

 create table if not exists data
(
id          bigint unsigned auto_increment
    primary key,
md5receipt  char(32)                            not null,
serialNum   bigint unsigned                     not null,
mode        tinyint unsigned                    not null,
Ub          mediumint unsigned                  not null,
Ib          mediumint unsigned                  not null,
Up          mediumint unsigned                  not null,
IL          mediumint unsigned                  not null,
Ta          tinyint                             not null,
Tc          tinyint                             not null,
tL          smallint unsigned                   not null,
tN          smallint unsigned                   not null,
PL          tinyint unsigned                    not null,
Hand        tinyint(1)                          not null,
Fire        tinyint(1)                          not null,
Night       tinyint(1)                          not null,
`Load`      tinyint(1)                          not null,
Disch       tinyint(1)                          not null,
OverIL      tinyint(1)                          not null,
ShortL      tinyint(1)                          not null,
ip          int unsigned                        not null,
typeReceipt tinyint(1)                          not null ,
timeReceipt timestamp default CURRENT_TIMESTAMP not null,
constraint md5receipt
    unique (md5receipt)
);

create index DsNtR
    on data (serialNum, typeReceipt);


create table if not exists dataResponse
(
id              bigint unsigned auto_increment
    primary key,
md5receipt      char(32)                            not null,
serialNum       bigint unsigned                     not null,
text            tinytext                            not null,
ip              int unsigned                        not null,
commandResponse char                                not null,
timeReceipt     timestamp default CURRENT_TIMESTAMP not null,
typeReceipt     tinyint(1)                          not null,
constraint md5receipt
    unique (md5receipt)
)
comment 'ответы устройств';

create index DRsNtR
    on dataResponse (serialNum, typeReceipt);

create table if not exists modemsInfo
(
id                bigint unsigned auto_increment
    primary key,
serialNum         bigint(12) unsigned zerofill               null,
idCompany         bigint unsigned                            not null,
nameModem         varchar(20)                                not null,
phoneNumber       char(11)                                   not null,
modeDialog        tinyint(1)       default 1                 not null,
commandStatusGPRS char             default '?'               not null,
region            tinytext                                   null,
city              tinytext                                   null,
street            tinytext                                   null,
structure         tinytext                                   null,
latitude          char(11)                                   null,
longitude         char(11)                                   null,
timeActivation    timestamp                                  null,
timeRegister      timestamp        default CURRENT_TIMESTAMP not null,
idGroup           bigint unsigned  default 0                 not null,
idIcon            tinyint unsigned default 0                 not null,
model             tinyint(1)                                 not null,
keyDelete         char(32)                                   null,
endTimeKeyDelete  timestamp                                  null,
commandStatusSMS  char             default '?'               not null,
billingPeriodDay  char(2)          default '01'              not null,
billingPeriodTime time             default '00:00:00'        not null,
identifySerialNum mediumint(6) unsigned zerofill             null,
constraint serialNum
    unique (serialNum)
);

create index MIsNmD
on modemsInfo (serialNum, modeDialog);

create index idCompany_2
on modemsInfo (idCompany);

create index idGroup
on modemsInfo (idGroup);

解释请求。我并不完全理解他给出的表格的所有复杂性。根据作者的说法,有很多值都是不好的(使用 where;使用 filesort、100% 过滤等......):
在此输入图像描述

以及请求本身。

SELECT mI.idGroup, mI.id as idModem , mI.commandStatusGPRS, 
    mI.nameModem, mI.commandStatusSMS,
    mI.phoneNumber, mI.region, mI.city ,mI.street, mI.serialNum,
    mI.timeActivation as timeActivation, mI.structure, mI.model, 
    mI.modeDialog,d.timeReceipt as timeReceiptData , 
    dR.timeReceipt as timeReceiptResponse , d.Hand, d.PL, 
     d.`Load`, d.Mode, d.Disch, d.OverIL, d.ShortL, d.typeReceipt
FROM modemsInfo mI
left outer join data d on d.id = (SELECT MAX(da.id)
                                  FROM data da
                                  WHERE mI.serialNum = da.serialNum 
                                  AND mI.modeDialog=da.typeReceipt)
left outer join dataResponse dR on dR.id = (SELECT MAX(dR.id)
                                            FROM dataResponse dR
                                            WHERE mI.serialNum = 
                                                  dR.serialNum 
                                            AND mI.modeDialog = 
                                                dR.typeReceipt)
WHERE mI.idCompany = :idCompany
order by mI.idGroup DESC

表结构、文本查询、创建表的文本查询以及任何其他信息(如果需要)。

mysql
  • 1 个回答
  • 75 Views
Martin Hope
Дима Й
Asked: 2023-12-08 20:13:10 +0000 UTC

如何连接phpStorm主机上的Mysql

  • 5

我在另一栋大楼里有自己的服务器,有专用的 IP 和域。OpenServer 负责那里。通过 FTP 远程连接它以及 PHPStorm 中的数据库很容易。将所有内容传输到 reg.ru 上的远程服务器。FTP 连接没有问题。C mysql 困难。在 PHPstorm 中,连接时会抛出错误:[08S01] Communications link failure 最后一个数据包成功发送到服务器是在 0 毫秒前。驱动程序尚未收到来自服务器的任何数据包。没有合适的协议(协议已禁用或密码套件不合适)。在此输入图像描述

支持并没有多大帮助。他们给了我 SSH 说明来尝试。我也有一个错误。他们回复说不允许使用 SSH...并且“作为解决方案,您可以尝试配置 PHPStorm 并通过远程连接简单地连接到 MySQL。” 在用户的数据库设置中启用远程访问。如果有人想尝试自己的想法,我可以给你连接数据。在我设置好一切之前,数据库是临时的。所有数据都完全正确,因为支持人员写道,使用我的数据时有连接,我自己通过单独下载的mysql客户端检查了连接

mysql
  • 1 个回答
  • 24 Views
Martin Hope
Дима Й
Asked: 2023-12-06 14:44:00 +0000 UTC

从 phpstorm 内存复制/恢复表结构

  • 5

有phpstorm。数据库的工作是通过他进行的。由于明显的原因,数据库已被删除,并且无法再访问它。没有数据的表结构保留在phpstorm中。如何使用我不知道的 phpstorm 功能恢复此数据库(仅表)以及还剩下什么?可以用笔重写很长时间,按每一栏,但需要很长时间。已经这样做了) 在此输入图像描述

mysql
  • 1 个回答
  • 21 Views
Martin Hope
Дима Й
Asked: 2023-11-30 00:09:22 +0000 UTC

如何从外循环将键替换为 Twig 循环变量

  • 5

模板引擎有 2 个数组作为输入。

组数组


互连调制解调器阵列的阵列

它们有一个相交键,我想通过它“链接”它们。一个数组就是一组。第二个多维数组是调制解调器本身,它们被分为这些组。(idGroup 密钥等于调制解调器数组中的密钥)。该密钥应代替 XXXX。

{% for idGroup, groupInfoArray in ModemsAndGroup.arrayGroups %}
    {% for key, paramArray in ModemsAndGroup.arrayModems.XXXX  %}
    {% endfor %}
{% endfor %}

如果直接替换的话是不行的。

{% for idGroup, groupInfoArray in ModemsAndGroup.arrayGroups %}
    {% for key, paramArray in ModemsAndGroup.arrayModems.idGroup %}
    {% endfor %}
{% endfor %}

显然,如果你指定它,它就会起作用

{% for idGroup, groupInfoArray in ModemsAndGroup.arrayGroups %}
    {% for key, paramArray in ModemsAndGroup.arrayModems['3504']  %}
    {% endfor %}
{% endfor %}

如何让用户在Fora的头部看到替换后的组ID?

twig
  • 1 个回答
  • 26 Views
Martin Hope
Дима Й
Asked: 2023-07-31 19:35:35 +0000 UTC

mysql每月采样,考虑一个月的29、30和31天

  • 6

是否可以仅使用mysql 进行一个月的选择,还是需要连接 php?条件:取该月的某一天。如果数字是从1 号到28 号,那么只需到下个月的同一天(因为所有这些数字都在下个月)。

如果取了29 日,并且下一个没有29 日(只有 28 天),则直到28 日(含)。

如果取了30号,而下一张没有30号(只有29或28天),则一直到29或28号。

对于31号,也是类似的,如果下个月既没有31,也没有30,也没有29,那么最多包括30或29或28(取决于它的数量)。这在某种程度上是移动运营商使用的计费周期。

php
  • 1 个回答
  • 58 Views
Martin Hope
Дима Й
Asked: 2023-06-11 20:38:21 +0000 UTC

从几个表中选择,按每个表的时间排序

  • 5

让我稍微简化一下表格。我有 6 张桌子。

  1. modemsInfo (id, idUser, idGroup, infoText) // 关于调制解调器的信息
  2. groupModems (id, idUser, nameGroup) // 有关可以包含调制解调器的组的信息
  3. data (idModem, Time, text) // 调制解调器发送的一般信息
  4. dataResponseConfig (idModem, Time, text) // 从调制解调器收到的配置信息
  5. dataResponseReset (idModem, Time, text) // 重置从调制解调器收到的结果
  6. queueSmsLog (idModem, Time, text) // SMS 发送到调制解调器

我需要从用户的调制解调器发出信息。我选择调制解调器并从表中粘贴最后的响应(在列 ( Time ) 中排序并设置限制 1):general ( data )、config ( dataResponseConfig )、reset ( dataResponseReset ) 和 smsLog ( queueSmsLog )。一切正常,直到任何表中都没有相同的时间值(Time)。有重复项。我正在使用这个查询。我觉得问题出在请求的最后,但是没有足够的知识来解决它。

SELECT gM.nameGroup as nameGroup, mI.infoText, qSL.Time, qSL.text,
       dRC.Time ,dRR.Time, data.Time, data.text
FROM groupModems gM
 left outer JOIN modemsInfo mI ON mI.idUser = gM.idUser AND mI.idGroup = gM.id
 left outer JOIN data ON mI.id = data.idModem
 left outer JOIN queueSmsLog qSL ON mI.id = qSL.idModem
 left outer JOIN dataResponseConfig dRC ON mI.id = dRC.idModem
 left outer JOIN dataResponseReset dRR ON mI.id = dRR.idModem
WHERE gM.idUser = :user_id
AND (data.Time = (SELECT `Time`
                  FROM data
                  WHERE  mI.id = data.idModem
                  ORDER BY `Time` DESC
                  LIMIT 1)
     OR data.Time IS NULL)
AND (dRC.Time = (SELECT `Time`
                 FROM dataResponseConfig
                 WHERE  mI.id = dataResponseConfig.idModem
                 ORDER BY `Time` DESC
                 LIMIT 1)
     OR dRC.Time IS NULL)
AND (dRR.Time = (SELECT `Time`
                 FROM dataResponseReset
                 WHERE  mI.id = dataResponseReset.idModem
                 ORDER BY `Time` DESC
                 LIMIT 1)
     OR dRR.Time IS NULL)
AND (qSL.Time = (SELECT  `Time`
                 FROM queueSmsLog
                 WHERE  mI.id = queueSmsLog.idModem
                 ORDER BY id DESC
                 LIMIT 1)
    OR qSL.Time IS NULL) 

IS NULL - 用于万一在调制解调器响应的表中根本没有信息

mysql
  • 1 个回答
  • 20 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5