PDA

View Full Version : [Tool/Web/Other] [APP] INI2SQL INI to SQL converter!


gamer931215
02/04/2011, 12:29 PM
INI to MYSQL converter V1.1

What is it ?
With INI2SQL converter you can very easily convert MULTIPLE ini files into one .SQL file. This allows you to transfer a complete dini/y_ini (and other filesystems using the same format) userdatabase into a mysql database!

Screenshots
First screenshot: phpmyadmin (proove that it can succesfully import the generated .sql/.txt files)
Second screenshot: the app itself

http://i52.tinypic.com/wkk6c1.png

Why?
Many servers are still using .ini files, why ?
Probaly because they didnt expect to grow that big, or just because of the user-friendly systems for ini files.
But after a while if you reach up to 2000/3000 files, it will become really slow, and once your server is growing you would really appreciate an website where you can login with your in-game details.
Thats why i've written this app after reading Gh0sT_ (http://forum.sa-mp.com/showthread.php?t=245852)'s topic.


Is the source included ?
YES! in order to follow the rules, and just the fact that i have nothing to hide i decided to add the source as well.


System requirements
Windows XP or above
Microsoft .NET Framework 4.0 (http://www.microsoft.com/downloads/en/details.aspx?FamilyID=9cfb2d51-5ff4-4491-b0e5-b386f32c0992)

Changelog

1.1: I noticed that dini does NOT use spaces between "=" like Y_Ini does, i added a compability mode for this.


Download:
Mirror (http://solidfiles.com/d/f91d/)

Forum DL (you need to be logged in in order to see the link):

[MWR]Blood
02/04/2011, 12:33 PM
AWESOME!!!

blackwave
02/04/2011, 12:35 PM
Amazing. I really like systems such as this one. Will be pretty usefull.

linuxthefish
02/04/2011, 01:01 PM
I love this, i'm learning mySQL at the moment and this tool helps a lot! :)

Mixcraft
02/04/2011, 01:04 PM
Thats amazing!

gamer931215
02/04/2011, 01:11 PM
Small update, i noticed dini does not use spaces between the "=" character and the value, compability mode (checkbox) for this has been added, i might consider detecting this automaticly later.

[03]Garsino
02/04/2011, 01:13 PM
This is fucking hot! Awesome work, gamer931215!

WillyP
02/04/2011, 01:29 PM
WOW! Truly amazing.

royal_king
02/04/2011, 04:07 PM
Omfg this is fucking awesome! very useful!

gamer931215
02/04/2011, 05:19 PM
thanks all :)

XFlawless
03/04/2011, 06:30 AM
This tool is very useful, very helpful for beginners who wants to use mysql.

GaGlets(R)
03/04/2011, 12:23 PM
Epic work, just a little suggestion. Create some radio buttons where user can chose what type of ini system it was
i.e. dini, y_ini, djoson - probably not an ini but still could convert.

Y_Less
03/04/2011, 12:42 PM
This does not correctly support INI files (especially y_ini ones which support the full ini specification):


[section]
health=4.5 ; health in first section

[section_2]
health = 5.5 ; health in second section (independent value)

money 55 ; an equals sign is not required

; this is a comment btw

[section_3]
money = 6 ; This is also valid in y_ini

gamer931215
03/04/2011, 12:47 PM
@Y_Less, why is your ini file so weird then ? an normal ini file generated by y_ini or dini looks like this:


CPOutX = -3377.354980
CPOutY = -598.327697
CPOutZ = 4.933551
HouseName = MostWanted's house
HouseOwner = MostWanted940504
HouseLocation = Unknown
HousePassword = 1289815741
HouseCreator = MostWanted940504
HouseValue = 0
HouseStorage = 0
SpawnOutX = -3377.476318
SpawnOutY = -595.830627
SpawnOutZ = 4.933551
SpawnOutAngle = 362.782012
SpawnWorld = 0
SpawnInterior = 0
HouseInterior = 0


Which will convert into this:

INSERT INTO Houses(`CPOutX`,`CPOutY`,`CPOutZ`,`HouseName`,`Hou seOwner`,`HouseLocation`,`HousePassword`,`HouseCre ator`,`HouseValue`,`HouseStorage`,`SpawnOutX`,`Spa wnOutY`,`SpawnOutZ`,`SpawnOutAngle`,`SpawnWorld`,` SpawnInterior`,`HouseInterior`) VALUES (-3377.354980,-598.327697,4.933551,'MostWanted's house','MostWanted940504','Unknown','1289815741',' MostWanted940504',0,0,-3377.476318,-595.830627,4.933551,362.782012,0,0,0);


I will not support all ini files, just the default ones generated ingame with this normal output.

Medal Of Honor team
03/04/2011, 12:53 PM
really amazing!

BASITJALIL
03/04/2011, 12:54 PM
Your awesome gamer

HyperZ
03/04/2011, 01:00 PM
Good Job. :D

Malcor
16/04/2011, 04:15 PM
Thrn i can connect my ucp with this? Truly amazing buddy. Should be very usefull

Calgon
16/04/2011, 04:28 PM
I already made this in PHP, as a function so you could implement it in to a UCP or something. Oh well... Nothing can ever be original.

gamer931215
16/04/2011, 06:18 PM
I already made this in PHP, as a function so you could implement it in to a UCP or something. Oh well... Nothing can ever be original.

Hmm i've never seen it before, else i wouldnt have to make it if it already existed :/

[X]John_X
16/04/2011, 10:32 PM
Wtf? Awesome <3
/me Gives a Hot Cookie to gamer931215

Hal
18/04/2011, 01:42 AM
BEST. 1/1 Amazing!

iTorran
15/05/2011, 02:58 PM
nice, thx for this! just what i need

Y_Less
16/05/2011, 07:39 AM
@Y_Less, why is your ini file so weird then ? an normal ini file generated by y_ini or dini looks like this:


It's not weird, you're just not using the full range of features available for use in ini files, in fact I found a nice new one the other day:


[section]
arr[] = 5
arr[] = 6
arr[] = 11
arr[] = 5


That (in a section called "section", a very standard ini feature allowing you to separate data in to groups) will define an array called "arr" with 4 values (5, 6, 11, 5).

Another non-standard feature used in S.T.A.L.K.E.R. data files is extensions:


[section1]
data1 = 5
data2 = 6

[section2] : section1
data3 = 7
data4 = 9


That will create two groups of items - one called "section1" with TWO values and one called "section2" with FOUR values, as it inherits from "section1", but I have no intention of implementing these.

And comments are just as standard as sections and key/value pairs (arrays less so but interesting):

http://en.wikipedia.org/wiki/INI_file#Format

gamer931215
16/05/2011, 07:56 AM
It's not weird, you're just not using the full range of features available for use in ini files, in fact I found a nice new one the other day:


[section]
arr[] = 5
arr[] = 6
arr[] = 11
arr[] = 5


That (in a section called "section", a very standard ini feature allowing you to separate data in to groups) will define an array called "arr" with 4 values (5, 6, 11, 5).

Another non-standard feature used in S.T.A.L.K.E.R. data files is extensions:


[section1]
data1 = 5
data2 = 6

[section2] : section1
data3 = 7
data4 = 9


That will create two groups of items - one called "section1" with TWO values and one called "section2" with FOUR values, as it inherits from "section1", but I have no intention of implementing these.

And comments are just as standard as sections and key/value pairs (arrays less so but interesting):

http://en.wikipedia.org/wiki/INI_file#Format

Hmm you're right, i was maybe a bit too much enthusiastic saying it supports "every method" , but still it supports the most common way :P

Y_Less
16/05/2011, 12:18 PM
No, it doesn't - that was my point. It supports the dini way (which is only supported in y_ini as a later addition). That way is not the standard way of doing ini files at all, just the way dini does them.

1337connor
16/05/2011, 02:41 PM
This is fucking epic!

gamer931215
16/05/2011, 02:46 PM
No, it doesn't - that was my point. It supports the dini way (which is only supported in y_ini as a later addition). That way is not the standard way of doing ini files at all, just the way dini does them.

feel free to edit and/or make your own then.

Alvord
09/06/2011, 01:45 AM
I need some help with this. When I try to convert an INI file, it only reads the first line and nothing else. Any suggestions?

Thanks in advance!

Lorenc_
25/08/2011, 12:09 PM
Gamer, can you fix this and add SQLite support ? Thanks <3

TouR
25/08/2011, 12:15 PM
Well maybe the most usefull tool... You are very talented dude. Congratz

gamer931215
28/08/2011, 11:28 AM
Gamer, can you fix this and add SQLite support ? Thanks <3

as in.. INI to SQLite ? or SQLite to MySQL ?

Anyway isnt SQLite the same a mysql but then without a server (so using the same querys as in a MySQL database?), In that case this should just work.

Lorenc_
17/09/2011, 11:47 AM
as in.. INI to SQLite ? or SQLite to MySQL ?

Anyway isnt SQLite the same a mysql but then without a server (so using the same querys as in a MySQL database?), In that case this should just work.


Never mind that though, I've change to mysql.

Can you please add a option of having to insert Hashes?

Like you select which place for example.


Hash
------

[x] SHA1
[ ] MD5

Row
-------

[ ] USERNAME
[x] PASSWORD


This will insert


SHA1('mypassword')


I would be really damn grateful if you can do this :P

Thanks a lot for making this. If I had VB 2010 I'd do it, since I can't find my 2010 'C' cd I cannot get it. I only have VB 2008 atm.

gamer931215
17/09/2011, 05:23 PM
Never mind that though, I've change to mysql.

SHA1('mypassword')


As in hashing the passwords in the app, or litterly inserting the SHA1 function into the query ?

Y_Less
17/09/2011, 10:45 PM
Why?
Many servers are still using .ini files, why ?
Probaly because they didnt expect to grow that big, or just because of the user-friendly systems for ini files.
But after a while if you reach up to 2000/3000 files, it will become really slow, and once your server is growing you would really appreciate an website where you can login with your in-game details.
Thats why i've written this app after reading Gh0sT_ (http://forum.sa-mp.com/showthread.php?t=245852)'s topic.


Another issue - do you have any evidence or tests to support this? I read a very good article earlier today:

http://seldo.com/weblog/2011/08/11/orm_is_an_antipattern

One paragraph specifically:


But if your data is not relational, then you are adding a huge and unnecessary overhead by using SQL in the first place


That applies very much here - the fact that you can directly convert the INI files to SQL means you are going from something well suited to INI files (key/value pairs) to something designed for something else entirely (as the article says, asking questions). The better solution MAY be, again as mentioned in the article a "NoSQL" system - similar to SQL but just for storing key/value pairs (i.e. a very optimised INI system):


If your data is object in nature, then use object stores ("NoSQL"). They'll be much faster than a relational database.


I have stated in the past that the features afforded by SQL are largely wasted in SA:MP scripts - there are many features which COULD be used, but if you can do it in INI, SQL is a complete waste (especially a massively heavyweight SQL system like MySQL). If you could develop a NoSQL system for SA:MP that would be ideal.

And the argument that MySQL is good as you can access it from websites is utterly meaningless as you can do that with ANY existing system (SQLite, MySQL or just plain files).

Lorenc_
18/09/2011, 06:15 AM
As in hashing the passwords in the app, or litterly inserting the SHA1 function into the query ?

The sha1 function inside the query

Venice
18/09/2011, 07:43 AM
AWESOME

nescha
18/09/2011, 12:44 PM
Very useful, but for my use, i see this to late. :/

gamer931215
19/09/2011, 01:03 PM
Another issue - do you have any evidence or tests to support this? I read a very good article earlier today:

http://seldo.com/weblog/2011/08/11/orm_is_an_antipattern

One paragraph specifically:



That applies very much here - the fact that you can directly convert the INI files to SQL means you are going from something well suited to INI files (key/value pairs) to something designed for something else entirely (as the article says, asking questions). The better solution MAY be, again as mentioned in the article a "NoSQL" system - similar to SQL but just for storing key/value pairs (i.e. a very optimised INI system):



I have stated in the past that the features afforded by SQL are largely wasted in SA:MP scripts - there are many features which COULD be used, but if you can do it in INI, SQL is a complete waste (especially a massively heavyweight SQL system like MySQL). If you could develop a NoSQL system for SA:MP that would be ideal.

And the argument that MySQL is good as you can access it from websites is utterly meaningless as you can do that with ANY existing system (SQLite, MySQL or just plain files).

Its basicly just in my experience... i had a friend who had a website with a database of over the 100.000 .txt files, it took like 40 seconds to load the memberpage. We ported the website to MySQL and now it loads in 3-4 seconds, ofcourse the things in SA-MP will be a little bit different, like Y_INI is a lot more efficient as dini but still...

Btw im planning to port this app to c# and adding some new features like SHA1 and MD5 hashes (thanks to Lorenc_ for this idea), auto detecting the type of ini files ('=' or ' = ') and maybe some other benefits that INI files supports like Y_Less told me before.

Y_Less
19/09/2011, 01:07 PM
That really depends on your file structure. A database is just a structured representation of data. For example if you list members by looping through every file in a directory then yes, it will take a long time. If, on the other hand, you have a file for each player and a separate index file (or even multiple index files) then it will go much faster. But that's pretty much beside the point.

Fires
30/03/2012, 04:58 AM
I LOVE YOU <3
rep++

Niko_boy
30/03/2012, 08:23 AM
omg wow , i am really fan of mysql already :)
it will really help ALL :) <3

C0dy09
30/03/2012, 03:16 PM
WOW very useful! nice release!

CONTROLA
14/08/2012, 02:18 PM
Hey i'm using this but it only recognises the first data (Key)

Pic: http://i45.tinypic.com/dlkj1l.png

Can someone help me, please?

RcoNs!
14/08/2012, 10:02 PM
very great

Forever Alone
05/09/2012, 08:10 PM
Epic thread deserves a bump. Great job, was looking something like this (actually was just going to write something like this in PAWN).

solleo
02/11/2012, 08:38 AM
Guys, help please, when i'm try to convert more than one .ini file, i'm always getting this error : "Index was outside the bounds of the array"
How i can fix it? Help please)