<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[REXYGEN Community Forum / DbDrv driver - How to handle a MySQL TIMESTAMP]]></title>
	<link rel="self" href="https://www.rexygen.com/oldforum/extern.php?action=feed&amp;tid=43&amp;type=atom"/>
	<link href="http://www.rexygen.com/oldforum/viewtopic.php?id=43"/>
	<updated>2016-01-08T14:37:58Z</updated>
	<generator>FluxBB</generator>
	<id>http://www.rexygen.com/oldforum/viewtopic.php?id=43</id>
	<entry>
		<title type="html"><![CDATA[Re: DbDrv driver - How to handle a MySQL TIMESTAMP]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=201#p201"/>
		<content type="html"><![CDATA[<p>Yes we missed this problem when releasing version 2.10.7. If possible, use the documentation available from our server to use the most up-to-date revision.</p>]]></content>
		<author>
			<name><![CDATA[jaroslav_sobota]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=3</uri>
		</author>
		<updated>2016-01-08T14:37:58Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=201#p201</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: DbDrv driver - How to handle a MySQL TIMESTAMP]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=199#p199"/>
		<content type="html"><![CDATA[<div class="quotebox"><cite>jaroslav_sobota wrote:</cite><blockquote><div><p>Yes, see the DbDrv manual from <a href="http://www.rexcontrols.com/documentation-and-support" rel="nofollow">REX Control System documentation</a>, page 12. I&#039;ll improve the documentation, thanks for the question!</p></div></blockquote></div><p>My version of this document contained one single page which was not translated yet....yep, page 12... <img src="http://www.rexygen.com/oldforum/img/smilies/smile.png" width="15" height="15" alt="smile" /><br />Time to get revision 2.....</p>]]></content>
		<author>
			<name><![CDATA[scoobsalamander]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=6</uri>
		</author>
		<updated>2016-01-07T11:58:49Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=199#p199</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: DbDrv driver - How to handle a MySQL TIMESTAMP]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=198#p198"/>
		<content type="html"><![CDATA[<div class="quotebox"><cite>scoobsalamander wrote:</cite><blockquote><div><p>Aha, I see....is this documented somewhere?</p></div></blockquote></div><p>Yes, see the DbDrv manual from <a href="http://www.rexcontrols.com/documentation-and-support" rel="nofollow">REX Control System documentation</a>, page 12. I&#039;ll improve the documentation, thanks for the question!</p><div class="quotebox"><blockquote><div><p>Are there more data types which can be configured?</p></div></blockquote></div><p>Another prefix is &quot;s&quot; for strings but there is no way to use it in the algorithm so I did not mention it.</p>]]></content>
		<author>
			<name><![CDATA[jaroslav_sobota]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=3</uri>
		</author>
		<updated>2016-01-07T08:25:16Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=198#p198</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: DbDrv driver - How to handle a MySQL TIMESTAMP]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=197#p197"/>
		<content type="html"><![CDATA[<p>Aha, I see....is this documented somewhere? Are there more data types which can be configured?</p>]]></content>
		<author>
			<name><![CDATA[scoobsalamander]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=6</uri>
		</author>
		<updated>2016-01-06T23:15:32Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=197#p197</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: DbDrv driver - How to handle a MySQL TIMESTAMP]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=196#p196"/>
		<content type="html"><![CDATA[<p>The input flags of the database driver (DbDrv) starting with &quot;i&quot; are processed as long type, initial &quot;b&quot; denotes a bool type. This special implementation is case-sensitive. Either rename your flag to &quot;Barometric&quot; or &quot;pressure&quot; and it will work as expected. Btw that&#039;s the reason why I named the flags iday, imonth, etc.</p>]]></content>
		<author>
			<name><![CDATA[jaroslav_sobota]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=3</uri>
		</author>
		<updated>2016-01-06T12:10:20Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=196#p196</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: DbDrv driver - How to handle a MySQL TIMESTAMP]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=195#p195"/>
		<content type="html"><![CDATA[<p>...everything was working fine but now I noticed that for the barometric pressure reading I get the value &#039;on&#039;. All the other values are correct and if I try the query in phpMyAdmin I get the correct values from the database....</p><p>Any idea why this is not correct?</p><div class="codebox"><pre><code>ODBC { 
  Connection &quot;DRIVER=MySQL;SERVER=192.168.178.17;PORT=3306;DATABASE=REXcontrols;UID=REX;PWD=agusta;&quot; 
 
  Group {
	Mode 3
	SQL &quot;SELECT temp_C, dewpoint_C, rel_Humidity, precip_1hr, pressure, precip_today, DATE_FORMAT(observe_epoch,&#039;%Y&#039;), DATE_FORMAT(observe_epoch,&#039;%c&#039;), DATE_FORMAT(observe_epoch,&#039;%e&#039;), DATE_FORMAT(observe_epoch,&#039;%k&#039;), DATE_FORMAT(observe_epoch,&#039;%i&#039;), DATE_FORMAT(observe_epoch,&#039;%s&#039;), NOW()-observe_epoch, UNIX_TIMESTAMP(observe_epoch)-UNIX_TIMESTAMP(&#039;2000-01-01 00:00:00&#039;) FROM Weather_current_data ORDER BY observe_epoch DESC LIMIT 1&quot; 
    Period 60 
	Items &quot;OAT,DewPoint,Humidity,precip_1hr,barometric,precip_today,iyear,imonth,iday,ihour,imin,isec,ifresh,irextime&quot;
	}
}</code></pre></div><p><span class="postimg"><img src="http://www.rexygen.com/oldforum/img/members/6/2016-01-06-10_32_28-REXcontrols.jpg" alt="screenshot REXdraw" /></span></p><p><span class="postimg"><img src="https://www.rexygen.com/oldforum/img/members/6/2016-01-06-10_31_13-REXcontrols.jpg" alt="screenshot phpMyAdmin" /></span></p>]]></content>
		<author>
			<name><![CDATA[scoobsalamander]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=6</uri>
		</author>
		<updated>2016-01-06T09:37:50Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=195#p195</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: DbDrv driver - How to handle a MySQL TIMESTAMP]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=193#p193"/>
		<content type="html"><![CDATA[<p>Thx, it&#039;s working...</p>]]></content>
		<author>
			<name><![CDATA[scoobsalamander]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=6</uri>
		</author>
		<updated>2016-01-05T16:18:23Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=193#p193</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: DbDrv driver - How to handle a MySQL TIMESTAMP]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=191#p191"/>
		<content type="html"><![CDATA[<p>Assuming a table <strong>mydata</strong> with two columns <strong>time</strong> and <strong>value</strong>, the following definition in .rio file works for me:</p><div class="codebox"><pre><code>ODBC { 
  Connection &quot;DRIVER=MySQL;SERVER=127.0.0.1;PORT=3306;DATABASE=dbname;UID=dbuser;PWD=dbpassword;&quot; 
  Group { 
    Mode 3 
    SQL &quot;SELECT value, DATE_FORMAT(time,&#039;%Y&#039;), DATE_FORMAT(time,&#039;%c&#039;), DATE_FORMAT(time,&#039;%e&#039;), DATE_FORMAT(time,&#039;%k&#039;), DATE_FORMAT(time,&#039;%i&#039;), DATE_FORMAT(time,&#039;%s&#039;), NOW()-time, UNIX_TIMESTAMP(time)-UNIX_TIMESTAMP(&#039;2000-01-01 00:00:00&#039;) FROM `mydata` ORDER BY `time` DESC LIMIT 1&quot; 
    Period 5 
    Items &quot;temperature,iyear,imonth,iday,ihour,imin,isec,fresh,irextime&quot; 
  } 
}</code></pre></div><p>You can access the values in the algorithm using the following input flags:</p><ul><li><p>DB__temperature (type double)</p></li><li><p>DB__iyear (type long)</p></li><li><p>DB__imonth (type long)</p></li><li><p>DB__iday (type long)</p></li><li><p>DB__ihour (type long)</p></li><li><p>DB__imin (type long)</p></li><li><p>DB__isec (type long)</p></li><li><p>DB__fresh (type double, tells you how long it has been since the value was updated, in seconds)</p></li><li><p>DB__irextime (type long, allows you to compare time with the tsec output of the DATETIME function block)</p></li></ul><p>See <a href="https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html" rel="nofollow">date and time functions in MySQL</a> for detailed information, namely the <a href="https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format" rel="nofollow">formatting options of the DATE_FORMAT() function</a>.</p>]]></content>
		<author>
			<name><![CDATA[jaroslav_sobota]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=3</uri>
		</author>
		<updated>2016-01-04T23:17:08Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=191#p191</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[DbDrv driver - How to handle a MySQL TIMESTAMP]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=187#p187"/>
		<content type="html"><![CDATA[<p>I&#039;m trying to read a value(temperature) from a MySQL database with corresponding timestamp. <br />Everything is working but I only don&#039;t know how to handle the timestamp...now it is been seen as a double and the value is equal to the year 2015. All the rest is missing (month, day, time).</p><p>Is there a way how I can compare this timestamp with the actual time of the REXcore?</p>]]></content>
		<author>
			<name><![CDATA[scoobsalamander]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=6</uri>
		</author>
		<updated>2015-12-30T23:01:14Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=187#p187</id>
	</entry>
</feed>
