How to insert large amount of data to sql table? -
Dolke - 10.04.2019
Hello.
I have one problem.How can I save a lot of data in sql table with INSERT? I need to insert about 50 columns in table when player is registered to server.
Re: How to insert large amount of data to sql table? -
JesterlJoker - 10.04.2019
using transactions
Re: How to insert large amount of data to sql table? -
Gforcez - 10.04.2019
Quote:
Originally Posted by Dolke
Hello.
I have one problem.How can I save a lot of data in sql table with INSERT? I need to insert about 50 columns in table when player is registered to server.
|
Maybe start by looking what you're inserting. Maybe there's a better solution on a database level. What are you inserting when a player registers?
Re: How to insert large amount of data to sql table? -
Logic_ - 10.04.2019
50 fucking what? You really need to do your database organization and normalization if you've so much fields to put data for.
An example would be such as weapons data that is often saved in the players table should be saved separately, the houses and businesses should be loaded from their own table regardless if it's purchased or not by the player, etc.
You should show us the table so we can help you out
Re: How to insert large amount of data to sql table? -
Dolke - 10.04.2019
Here is the code for create table.I created table with DB Browser for SQLite and I want to save all of these when player registers (insert in table with values)
https://pastebin.com/98F8v1nT
Re: How to insert large amount of data to sql table? -
Dolke - 12.04.2019
BUMP !
Re: How to insert large amount of data to sql table? -
khRamin78 - 12.04.2019
try to optimize your sql database !
see
this method
if all is ok then you need to send big query to your database i think there wont be any problems using high string characters to sql server use like string[2048];
and you have to use << \ >> in while to avoid compiler error in pawno just like this sample code
PHP Code:
mysql_format(Handel,query,sizeof(query),"UPDATE accounts SET \
Bsqlid = %d,Hsqlid = %d,Rentsqlid = %d,LastLogin = '%s',\
Vehicle1 = %d,Vehicle2 = %d,Wanted = %d,Food = %f,Water = %f,\
Score = %d,Money = %d,BankMoney = %d,Ecash = %d,ProIncome = %d,\
etc
Re: How to insert large amount of data to sql table? -
BlackBank - 12.04.2019
Why you don't set a default value for all the columns you don't need to INSERT data for? Like for example 'admin', it can be default 0 when a player registers, and so there are more fields.
Re: How to insert large amount of data to sql table? -
Gforcez - 12.04.2019
Quote:
Originally Posted by BlackBank
Why you don't set a default value for all the columns you don't need to INSERT data for? Like for example 'admin', it can be default 0 when a player registers, and so there are more fields.
|
This is your solution right here. The values you want to set and doesn't have a default value (username, password and what more) you can just add in the INSERT statement.
Re: How to insert large amount of data to sql table? -
khRamin78 - 13.04.2019
Quote:
Originally Posted by BlackBank
Why you don't set a default value for all the columns you don't need to INSERT data for? Like for example 'admin', it can be default 0 when a player registers, and so there are more fields.
|
Quote:
Originally Posted by Gforcez
This is your solution right here. The values you want to set and doesn't have a default value (username, password and what more) you can just add in the INSERT statement.
|
anyway he should use large query when saving player global data with that amount of data
Re: How to insert large amount of data to sql table? -
Dolke - 16.04.2019
Okay I did it with default values and it works as expected but now how can I save and load player data?
Re: How to insert large amount of data to sql table? -
AmirSavand - 16.04.2019
Search for it, search for saving and loading systems, ton of examples and tutorials.
Re: How to insert large amount of data to sql table? -
Dolke - 16.04.2019
Yes I know how to save player with sqlite but if I need to save just small amount of data,but I do not know how to save large amount of data in UPDATE query
Re: How to insert large amount of data to sql table? -
BlackBank - 16.04.2019
Quote:
Originally Posted by Dolke
Yes I know how to save player with sqlite but if I need to save just small amount of data,but I do not know how to save large amount of data in UPDATE query
|
Why you need to save all data at once, if you are already saving small amount of data (when money changed etc)?