改变时间戳 [英] Altering timestamp

查看:86
本文介绍了改变时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,希望你们都做得很好。在过去的几周里,我试图做的并且一直在撕裂我的头发,当这些数据被XML数据源输入时,我试图更新MySQL数据库中的时间戳。数据以一组切片形式出现。每个Feed的切片数量可能不同,因此我必须动态地找到一种方法来获取现有的存储过程并对其进行扩展。我遇到的问题是时间戳可能不正确。我正在捕获记录在单独的字段中写入数据库的时间/日期。我要做的是:


1.计算从原始XML提要进来的记录数。

2.比较两个记录切片之间的时差。

3.获取批次的最后一条记录并在数据库中应用时间/日期。

4.应用该时间/日期标记减去以前记录的差异。


在我的存储过程中:


涉及两个SP,一个名为parse_raw,另一个get_node_content。 SP parse_raw调用get_node_content将原始XML分解为单个切片。

展开 | 选择 | Wrap | 行号

解决方案


尝试更新MySQL数据库中的时间戳



我不太关注你想要实现的目标,考虑到你的代码中没有UPDATE查询


我已经能够设置时间戳,但它设置在所有切片上


尝试使用正确的术语。时间戳在计算机语言中具有明确的含义,并且设置时间戳是没有意义的。

对不起,如果我误解了,可能是你发布的太多了。

您能否将代码缩小到您认为问题所在的位置?


好的,让我澄清问题出在哪里以及我想要解决的问题做。在原始数据Feed中,我正在以组的形式获取数据。从本质上讲,如果设备实际上具有正确的日期和时间,但它们没有,那么这将是正常的。当这些设备首次上线时,它们从01/01/2000 00:00:00开始。涉及的表是:

展开 | 选择 | Wrap | 行号


我刚注意到这些记录的时间很好,它是错误的日期。因为SP从get_node_content获取返回的记录,是否有一种方法可以在插入时更改记录的日期?我会看到我能在这里发现什么来试图自己解决我的问题。如果有人能想到某种方式只改变日期,请随意开火:)


Hello everyone, hope you are all doing fine. What I''m attempting to do and have been tearing my hair out over for the last few weeks is trying to update timestamps in my MySQL database when this data gets fed in by an XML data feed. The data comes in as a group of slices. The number of slices per feed could be different so I have to dynamically find a way to take my existing stored procedure and expand on it. The problem I have is the timestamps can be incorrect. I am capturing the time/date that the record gets written to the database in a separate field. What I''m trying to do is:

1. Count the number of records that come in from the raw XML feed.
2. Compare the time difference between two of the record slices.
3. Take the last record of the batch and apply the time/date in the database.
4. Apply that time/date stamp less the difference for the previous records.

Onto my Stored Procedures:

There are two SPs involved, one is named parse_raw and the other get_node_content. The SP parse_raw calls get_node_content to break the raw XML into individual slices.

Expand|Select|Wrap|Line Numbers

解决方案

trying to update timestamps in my MySQL database

I don''t quite follow what you are trying to achieve, considering there is no UPDATE query in your code

I have been able to get the time stamp to be set but it sets on all the slices

Try to use correct terminology. A timestamp has a definite meaning in computer language and to SET a timestamp is meaningless.
I''m sorry if I have mis-understood, it may be you have posted too much.
Could you narrow the code down to where you think the problem is?


Ok, let me clarify where the problem is and what I''m trying to do. In the raw data feed, I''m getting data in groups. Essentially, this would be fine if the devices actually had the correct date and time but they do not. When these devices first come online, they start at 01/01/2000 00:00:00. The table involved is:

Expand|Select|Wrap|Line Numbers


I just noticed that the time of these records is fine, it is the date that is wrong. Is there a method of changing the date of the record when it gets inserted since the SP takes the returned record from get_node_content? I''ll see what I can uncover here to try to resolve my problem on my own. If anyone can think of some way to change only the date, feel free to fire away :)


这篇关于改变时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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