[Logo] Mango Community
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
SQL datasource ideas  XML
Forum Index » Mango M2M 1.12.5 and Earlier general discussion
Author Message
ronaldo

Initiate

Joined: 12/03/2010 08:03:04
Messages: 8
Location: Brazil
Offline

I am using the SQL datasource to receive status from devices not currently compatible with Mango.
Each time the SQL table is read, Mango gets all records again (since I am using no where condition).
This of course presents a few issues, mainly for raising alarms and state detection events.
I can solve this in a couple of ways (stored procedure, TOP clause, etc), but I would like to hear from the Mango developers how would they set up and use the SQL DS.
thanks
Ronaldo
mlohbihler

Master
[Avatar]

Joined: 01/03/2007 22:48:52
Messages: 1850
Offline

You could use a where clause to only get the most recent record.

Best regards,
Matthew Lohbihler
peadar

Initiate

Joined: 01/03/2010 17:08:43
Messages: 17
Location: ireland
Offline

you probably have an answer to this now old question, but i use something like:

select top 1 * from table where timeField > getdate()-1 order by id desc

it works well for me, and i can mess with the getdate() function to get the precise timing of entry eg:

SELECT......WHERE timeField BETWEEN getdate()-0.09 AND getdate()-0.08 ORDER BY id DESC

ps. its an MSSQL DB but works similarly with MYSQL

hope that helps someone

Peadar

peadar
 
Forum Index » Mango M2M 1.12.5 and Earlier general discussion
Go to:   
Powered by JForum 2.1.9 © JForum Team