views:

1092

answers:

1

In a previous question about overriding Time.now, I was working toward a solution of faking clock synchronization across all machines connecting to a given database. Overriding Time.now seemed the best way for the approach I was taking, however:

It appears as though I could get the result I was after via a much simpler line. If I can get the SQL server's current time, my life will be much simpler.

On each machine, I can do something like; Record create, examine creation_time in Record, Record delete, but if there is something simpler, I'll take it.

I've seen SELECT GETDATE() (oracle) and SELECT NOW() (mysql) and like forms. The people that review my code are unlikely to like direct-to-sql calls. I really need something through rails - if it exists.

+2  A: 

SELECT GetDate() would yield the current time from SQL Server

That's fine in Oracle, but not in MySQL. And for the sake of clean code, I'd rather do this through a rails interface than an implementation-specific one, if at all possible.
That doesn't work in Oracle... not sure why you'd say that. You said, "If I can get the SQL server's current time, my life will be much simpler" That's how you get SQL Server's Current time.