NO PROBLEM: Re: mysql DATETIME substraction problem/?
On Mon, 4 Nov 2002, gerald_clark wrote: You can't just subtract datetime fields. Check the date and time functions in the manual. Thanks, I should know I run the risk of posting a RTFM/FAQ when I'm tired! I got off track by misinterpreting In MySQL Version 3.23, you can use + and - instead of DATE_ADD() and DATE_SUB() in the manual when all I needed was UNIX_TIMESTAMP() (that I misinterpreted when I looked at it the first time). Anyhow, I can *nearly* just subtract datetime fields and all is right with the world. Jim On Mon, 4 Nov 2002, gerald_clark wrote: You can't just subtract datetime fields. Check the date and time functions in the manual. Jim Hogan wrote: Hello! I am working on an analysis that is very much dependent on calculating time differences in seconds. The most simple example: I have 3 variables: time_begin (DATETIME) time_end (DATETIME) and elapsed_ seconds (INT). The data in these DATETIMES looks fine -MM-DD HH:MM:SS as expected and actual differences between time_end and time_begin are usually on the order of 20-120 seconds. I run: UPDATE mytable SET elapsed_seconds=time_end-time_begin; When I browse the resulting data, the elapsed seconds often do, but do not always, agree with my own calculation of the elapsed seconds. For example, the first 12 rows look like: My calc elapsed_time 45 85 11 11 16 16 99 22 62 14 14 73 73 59 99 65 105 20 20 12 12 43 4083 That last one is a bit off!! There appeared to be a common problem with a 40-second difference, but obvioulsy that last one throws that pattern out the window! Anyhow, I have Googled quite a bit and have looked through http://www.mysql.com/doc/en/Date_and_time_functions.html several times and did not see a different function of syntax for the UPDATE that I want to do. That man page (in the section on DATE_SUB) says that as of MySQL 3.23 I can simply use +/- operators By way of troubleshooting, I created 6 other elapsed_time variables using small, medium and big int, and float, double and decimal to see if the result was different, but the result was the same for each. I'm guessing (and hoping!!) that I am missing something *very* basic in the structure of my UPDATE and will absolutely appreciate any pointers that could fix it. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
mysql DATETIME substraction problem/?
Hello! I am working on an analysis that is very much dependent on calculating time differences in seconds. The most simple example: I have 3 variables: time_begin (DATETIME) time_end (DATETIME) and elapsed_ seconds (INT). The data in these DATETIMES looks fine -MM-DD HH:MM:SS as expected and actual differences between time_end and time_begin are usually on the order of 20-120 seconds. I run: UPDATE mytable SET elapsed_seconds=time_end-time_begin; When I browse the resulting data, the elapsed seconds often do, but do not always, agree with my own calculation of the elapsed seconds. For example, the first 12 rows look like: My calc elapsed_time 45 85 11 11 16 16 9 9 22 62 14 14 73 73 59 99 65 105 20 20 12 12 43 4083 That last one is a bit off!! There appeared to be a common problem with a 40-second difference, but obvioulsy that last one throws that pattern out the window! Anyhow, I have Googled quite a bit and have looked through http://www.mysql.com/doc/en/Date_and_time_functions.html several times and did not see a different function of syntax for the UPDATE that I want to do. That man page (in the section on DATE_SUB) says that as of MySQL 3.23 I can simply use +/- operators By way of troubleshooting, I created 6 other elapsed_time variables using small, medium and big int, and float, double and decimal to see if the result was different, but the result was the same for each. I'm guessing (and hoping!!) that I am missing something *very* basic in the structure of my UPDATE and will absolutely appreciate any pointers that could fix it. -- -*- Jim Hogan [EMAIL PROTECTED] Seattle, WA - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Making MySQL insecure on purpose...
I have set up MySQl before and have done it the right way (I think!) My situation today? I am setting up MySQL on a Linux machine with a 1394- attached 80GB drive for a 3-week project after which my setup will be thrown away. Due to some software dependencies, this DB will need to be accessed by a Win2K box running MyODBC. An isolated, 2-node network. Well, I am 90 percent of the way there, DB us running and accessible on localhost with phpMyAdmin, but (after 2-3 hours of wresting) MyODBC client still returns 1130 errors...Unable to connect from host 192.168.1.100. Yes, I have looked through the docs and have made all changes to mysql:host/user that I could think of, have added skip-name-resolve to my.cnf options. Time is of the essence. To short-circuit this particular problem and perhaps get on with my real work, I ask: Is there a set of CNF and mysql DB entries that I could implement that would assure that I have the *least* secure MySQL config possible?!?!? *Then* if I'm still getting 1130s and such, well, I'll just have to troubleshoot some more!! Thanks, Jim - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Making MySQL insecure on purpose...
ROGER! Thanks a lot. After updating with that GRANT I am now looking at the main DB in EpiInfo 2000 via ODBC (EpiInfostats and graphics on the cheap courtesy of CDC if anybody cares) Anyhow, it seems I was being too specific in my user name in the ODBC config (jim@somehost instead of jim) given that I had turned resolution off in my.cnf. Or so it seems Anyhow, I am good to go now. Many thanks for saving me another 2-4 hours of head banging! Jim On Tue, 22 Oct 2002, Roger Davis wrote: Sounds like all is set up properly, but, have you give your mysql USERS permissions to connect from from the 192.168.1 network? The Really Insecure way of doing this is... GRANT ALL PRIVILEGES ON *.* TO mysqlusernamehere@% IDENTIFIED BY 'mypasswordhere'; FLUSH PRIVILEGES; Hope this helps Roger SQL, MySQL -Original Message- From: Jim Hogan [mailto:jimhogan;drizzle.com] Sent: Tuesday, October 22, 2002 11:32 PM To: [EMAIL PROTECTED] Subject: Making MySQL insecure on purpose... I have set up MySQl before and have done it the right way (I think!) My situation today? I am setting up MySQL on a Linux machine with a 1394- attached 80GB drive for a 3-week project after which my setup will be thrown away. Due to some software dependencies, this DB will need to be accessed by a Win2K box running MyODBC. An isolated, 2-node network. Well, I am 90 percent of the way there, DB us running and accessible on localhost with phpMyAdmin, but (after 2-3 hours of wresting) MyODBC client still returns 1130 errors...Unable to connect from host 192.168.1.100. Yes, I have looked through the docs and have made all changes to mysql:host/user that I could think of, have added skip-name-resolve to my.cnf options. Time is of the essence. To short-circuit this particular problem and perhaps get on with my real work, I ask: Is there a set of CNF and mysql DB entries that I could implement that would assure that I have the *least* secure MySQL config possible?!?!? *Then* if I'm still getting 1130s and such, well, I'll just have to troubleshoot some more!! Thanks, Jim - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- -*- Jim Hogan [EMAIL PROTECTED] Seattle, WA www.drizzle.com/~jimhogan - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php