Latest News: OOTP PATCH 9.1.6 released! - OOTP 9 RELEASED! - Title Bout Championship Boxing 2.5 released! - OOTP 2007 receives Editors Choice Award from PC Gamer - Inside the Park Baseball Patch 1.03 released, DEMO now available

Click here to download Out of the Park Baseball 9!

Go Back   OOTP Developments Forums > OUT OF THE PARK BASEBALL 9 > OOTP 9 - Mods > Database Tools
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Database Tools Do you need to take a dump? SQL gurus welcome

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 08-04-2006, 11:52 AM   #1 (permalink)
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 323
Converting Height?

anyone know how any tips on how to convert the height in the sql dumps from cm to feet and inches using mysql? thanks.
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM
Zubes is offline   Reply With Quote
Old 08-28-2006, 10:00 PM   #2 (permalink)
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 323
anyone???
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM
Zubes is offline   Reply With Quote
Old 08-29-2006, 01:08 AM   #3 (permalink)
21C
Minors (Double A)
 
Join Date: Mar 2003
Location: Australia
Posts: 128
Divide it by 2.54 to get it into inches.

Edit - sorry, didn't see the part about doing it in MySQL. Can't help you with that.

Last edited by 21C : 08-29-2006 at 08:21 AM.
21C is offline   Reply With Quote
Old 09-05-2006, 05:15 PM   #4 (permalink)
Bat Boy
 
Join Date: Jul 2003
Location: Los Angeles, CA but currently in Putney, VT
Posts: 6
Well I think this may work for getting the height into inches (this is based upon mysql hopefully it works in other sql). I don't know much about sql besides administering databases online but I found this in one of hte books I have.

The modulo operator; evaluates to the remainder of m divided by m % n is the same as MOD(m,n).. As with division, the modulo operator with a divisor of zero returns NULL.

Here is a quote from Sam's MySQL

"The modulo operator; evaluates to the remainder of m dived by m % n is the same as MOD(m,n). As with division, the modulo operator with a divisor of zero returns NULL."

So therefore I think you can do the following

Multiply cm x .39 then divid by 12 and strip anything to the right of the decimal point if one is returned. If you dont have any decimals then it is obviously a nice round number divisible by .39 which is very unlikely. When you do have something that is stripped then you have to take the original number you got after doing the first operation and then use the % to get the remainder which you add on to the original cmx.39 result stripped of the decimals.

c=cm

(cmx.39)/12=a
a (rounded down, stripped of decimals whatever you want to call it or use to get a round number) is the number of feet.

a%12=r
R is the remainder and is the inches number. So therefore you can display as fllows

A feet r inches and then make sure that you put somethign in there so that it does not show anythign for the inches if the remainder comes back as 0 and so that it says inch rather than inches if it is 1.

Some modification will be needed as .39 is NOT an exact conversion factor so you may get a little error and you WILL need to round the inches using whatever method you choose so that you can get what you need, I'd say just round to the nearest whole number .
I hope this helps but as I don't really understand too much of any type of sql and this is from a mysql book I'm not sure it will help but I hope you find it useful and it helps you figure out your conundrum.


FIXED!
__________________
It's called baseball not foosball!

Last edited by YoVivoPorSPORTS : 09-07-2006 at 12:08 AM.
YoVivoPorSPORTS is offline   Reply With Quote
Old 09-14-2006, 12:11 PM   #5 (permalink)
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 323
this doesnt work, dont use it
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM
Zubes is offline   Reply With Quote
Old 09-22-2006, 03:44 PM   #6 (permalink)
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 323
i stand corrected, this formula will work.

the problem is that all the neccessary info wasnt here that i need to make it work, so i will reclarify it:

$total_inches = 0.3937008*$AR_result[ 'height' ];
$feet = $total_inches/12;
$inches=$total_inches%12;
then to display, all you need is this:

echo floor($feet)."' ".$inches."'';
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM
Zubes is offline   Reply With Quote
Old 09-22-2006, 03:47 PM   #7 (permalink)
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 323
converting height

$total_inches = 0.3937008*$AR_result[ 'height' ];
$feet = $total_inches/12;
$inches=$total_inches%12;
then to display, all you need is this:

echo floor($feet)."' ".$inches."'';

i got it to work doing this. seems i forgot to strip the decimals and round down the first time, but i stumbled across it the other day, and sicne you had given up on it i had forgotten it.

but thanks for the big step in the right direction.
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM
Zubes is offline   Reply With Quote
Old 09-22-2006, 03:48 PM   #8 (permalink)
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 323
converting height

big thanks to YoVivoPorSPORTS for intially starting to help me with this. no way i would have gotten this far without it.
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM
Zubes is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 08:47 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 Out of the Park Developments