Home | Webstore
Latest News: OOTP 25 Available - FHM 10 Available - OOTP Go! Available

Out of the Park Baseball 25 Buy Now!

  

Go Back   OOTP Developments Forums > Out of the Park Baseball 25 > OOTP Mods > OOTP Mods - Database Tools
Register Blogs FAQ Calendar Today's Posts Search

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

Reply
 
Thread Tools
Old 09-02-2006, 04:46 AM   #1
Comedian2004
Hall Of Famer
 
Comedian2004's Avatar
 
Join Date: Nov 2004
Location: In a house in Saint Cloud, Florida.
Posts: 7,085
AU Change...

One of the limitations of the dump is that all of the players for the entire league are in one file. While this can be nice to have all this data in one file, it can be a pain to try to access it for certain things. A league of mine that is just over 50 years old is about 7.5 meg in size and has 89,000 lines in it. Each player in the league, retired, active, in jail or dead are listed in this file. Each player can have 1-4 lines. Total, vs. lhp, vs. rhp and post season. Add even more lines if there is a minor league system.

Now the problem is this: Player #1 is from 1952, while player 8814 is from 2005. So, the only way I can read in player 8814 is to read in the first 8,814 lines. Not very efficient.

Now this is not bad for programs that want to load in the entire league to compare stats, like AUCONTRACT or AUHOF, but if I just want to randomly load in a player, it can take as long as a minute on a large league.

Now a program such as AUReports does not need to load in the entire league, as it just deals with players from the current season. This is where the index can come in handy.

Here is how it works: Indexing would be done after you do a dump. I will make a stand alone program that will do the indexing, but it will also be built into every program that could use the indexing. Indexing can be turned off or on for each program. Some programs do not need to have indexing, such as AUlogo or AUPhoto.

The process is simple, well, in my mind, anyhow. It opens the player's hitting stats file, and reads the position. It will of course, be 1. It then writes to a file the number 000000, then reads in lines until it comes across the next player. Before reading in each line, it remembers what position it is in the file. So, when it gets to player 2, it sees the position is not 986, so it writes to the index file a 000986. Each of these numbers are on a separate line. So, it will then go through the entire file this way.

Now, when my program wants access to a certain player's stats, it can do some math to determine what the player's index is.

PLAYER_ID = 1 position in index file is 1
PLAYER_ID = 2 position in index file is 7
PLAYER_ID = 3 position in index file is 13

INDEX = (PLAYER_ID * 6) - 5

So, if the player's number is 10000, then the index would be 59995

I can then open the index file, go directly to position 59995 and grab the next 6 characters. I can then open the hitter's stat file, go to position 59995 and read in a line. I know this is the player. I can then continue to read in lines until it is no longer the player's line. Remember, they can have 1-whatever number of lines.

I would also have an option in my program to turn AUTOINDEX on. This would check the date of the dump files vs. the date of the index file. So, if the index file is older than the dump files, it will automatically index the files, if autoindex is on.

I know this may sound like a bunch of geek to a lot of people, but I thought I would share it with people that were interested.

I hope to start implementing this option in AUReport first, then let it carry over. Also, note, if your league is only a few years old, you would not use this option, as there are not that many players to search through.
__________________
Like BLUES? Visit www.smokestacklightnin.com, you will LOVE it! New show every Monday!! New Blues HOF![/COLOR][/FONT]

Last edited by Comedian2004; 09-02-2006 at 04:48 AM.
Comedian2004 is offline   Reply With Quote
Old 09-02-2006, 05:02 AM   #2
rasnell
Hall Of Famer
 
rasnell's Avatar
 
Join Date: Jan 2003
Location: Frankfort, Kentucky
Posts: 3,739
I'm so glad that we have an OOTP fan with this kind of programming understanding.
rasnell is offline   Reply With Quote
Reply

Bookmarks


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:40 PM.

 

Major League and Minor League Baseball trademarks and copyrights are used with permission of Major League Baseball. Visit MLB.com and MiLB.com.

Officially Licensed Product – MLB Players, Inc.

Out of the Park Baseball is a registered trademark of Out of the Park Developments GmbH & Co. KG

Google Play is a trademark of Google Inc.

Apple, iPhone, iPod touch and iPad are trademarks of Apple Inc., registered in the U.S. and other countries.

COPYRIGHT © 2023 OUT OF THE PARK DEVELOPMENTS. ALL RIGHTS RESERVED.

 

Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright © 2020 Out of the Park Developments