Quick SQLite Field Creation
#4

Well, for best results you should do it manually. Only you know the range and type of all those variables. Probably many of them e.g. are boolean bits. Making everything a 32 bit int would then cause a massive overhead, and thats not only bad style, but it makes things inefficient (and strings wouldnt work at all). Using that many fields in a single table also makes things more complicated than neccessary. Be sure not to use "SELECT *", unless you want to torture the shit out of pawns sql interface. Certain queries will exceed the maximum query length of pawn and mysql, you wont be able to save everything with a single query, but youll have to use alternative saving techniques (I wouldnt recommend single-query-saves anyways, even for small tables, but thats a different story) . Handling such large tables is a pain.
Better use mutliple tables for different topics, and JOIN them where neccesary (though "SELECT *" still shouldnt be used then to keep things clean).


If you really want to parse this automatically, Id suggest a small script of some sort. Maybe PHP, or even pawn. Go through your variables line-by-line (assuming you only got one per line, else youll have to split lines by themselves again). Check the variables tag and eventually the array size, and add the corresponding field type to a CREATE TABLE query. Again, watch out not to hit the maximum query length, better stop every 50-60 fields and continue with ALTER TABLE.

Nevertheless, theres barely any case where you really need that many player variables when scripting properly. Your script could probably use some optimisation. Bad enough that its "200-300", not knowing the exact number is a clear sign of a bad style.
Reply


Messages In This Thread
Quick SQLite Field Creation - by Gazzy - 08.10.2015, 18:19
Re: Quick SQLite Field Creation - by Spmn - 08.10.2015, 19:22
Re: Quick SQLite Field Creation - by Vince - 08.10.2015, 19:30
Re: Quick SQLite Field Creation - by Mauzen - 08.10.2015, 19:49

Forum Jump:


Users browsing this thread: 1 Guest(s)