Solved MySql/SQLite and 70 columns.

Discussion in 'Plugin Development' started by bfgbfggf, May 31, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    bfgbfggf

    Can I just create Table in SQLite or MySql with 70 columns (actual I thought about 61, but in minecraft 1.6 that will be 66/67)? one row per player.

    But in code I only want to get 2-5 columns from 1-30 rows. (for each use)
     
  2. If you only need a few topic-specific data from a player you can create multiple tables containing those things.

    For example, instead of having a player table that contains kills, deaths, inventory, money, bed location, bank storage, etc... you can create a table for kill stats, a table for inventory, money and bank stuff and a table for saved locations.
     
  3. Offline

    bfgbfggf

    Digi
    ;/ in my table i have: Points, KilledMobs, KilledPlayers, Killed Bosses, DeathByMobs, DeathsByPlayers and... columns for every mob. So... I can only create 3 tables.
    1. Points, KilledMobs, KilledPlayers, Killed Bosses, DeathByMobs, DeathsByPlayers + Player
    2. Mobs (24 columns + Player)
    3. Monsters (28 columns + Player)
    (don't ask why I have 24 mobs / 28 monsters)

    NOTE: eg: KilledMobs isn't calculate from adding all count of kill of every mob.


    Note2: for Points that must be double. for all others just int. And text for player
     
  4. It's kinda bad design to hardcode types into the database, adds extra work in the future, I suggest you make a 'kills' table with columns for player, entity type and count then set primary key on player and entitytype together (not individual).

    Then you can just do: SELECT `count` FROM `kills` WHERE `player` = '...' AND `entitytype` = '...'

    And I also suggest you just use the ID from the EntityType enum.

    Or you could also add index key on the player column if you're ever going to grab all rows by killer.
     
  5. Offline

    bfgbfggf

    Digi
    eem... table for every entity?
     
  6. bfgbfggf
    No... a row for every player-entitytype combination.
     
  7. Offline

    bfgbfggf

    Digi ahhhh :p Ok I try that :p
     
Thread Status:
Not open for further replies.

Share This Page