SA-MP Forums Archive
Dini to SQLite converter.... Does it exist? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dini to SQLite converter.... Does it exist? (/showthread.php?tid=111110)



Dini to SQLite converter.... Does it exist? - Outbreak - 29.11.2009

I've got a nice register and login system going with SQLite. At the moment its in very early stages, so i wont be converting jsut yet since im developing more functions and commands to work with the new database and account system.

Anyway...

I'm wondering if there is any dini to SQLite conversion, i tried searching for dini to sqlite, found nothing useful.

So if there isn't such a converter out there. How would i do it?

I'm needing to get the name of each ini file. For example.

[sLK]Outbreak.ini i would need to only get the name, then add the name to the database along with the information contained within the file.

So, are there any methods where i could start up a simple gamemode with a function to check a specified folder.

Inside the folder will be 15k + ini files. So im guessing it'll take some time to fully convert them. But how could i get the name of the ini file without needing to input any name or information, or connect to the server with each name?


EDIT:

Just experimenting i managed to find a way that it is possible.. The only draw back is it requires me to input every single account name into the gamemode.

pawn Код:
FileNames[][] =
{
  "[sLK]Outbreak",
  "Outbreak"
};
Then i create a function, and format a string to match the path of the file and loop through FileNames checking for the name of the file within the specified directory.

If all else fails i will do it that way. But I'm hoping theres another way where i can create a function to get the file names automatically


Re: Dini to SQLite converter.... Does it exist? - Finn - 29.11.2009

Maybe you could make a script which loads the stuff from the INI files and then saves the information into SQL database.


Re: Dini to SQLite converter.... Does it exist? - Outbreak - 29.11.2009

That is what i want to do, but i need a way to get each file name first... The information gathering and adding it to the SQLite DB is the easy part.

I just don't really want to have to put in every single account name... 15,000+ names would take ages


Re: Dini to SQLite converter.... Does it exist? - Outbreak - 30.11.2009

Bring
Up
My
Post


I now have a working conversion script that i finished making today.

The only draw back is it needs each name to be wrote into the gamemode to loop through them.

I'm looking for a function to get file names from a directory, that way i dont have to input 17180 names


Re: Dini to SQLite converter.... Does it exist? - Zeex - 30.11.2009

I think it can't be made with PAWN only (it would be so with fmatch() but it is broken ). AFAIK there is a function in YSF called ffind but since it doesn't work with 0.3 you need extract it from there and make a little plugin (or just run your server with 0.2X).



Re: Dini to SQLite converter.... Does it exist? - Outbreak - 30.11.2009

Mines 0.2x I don't like 0.3a at all so won't be switching.

So any existing function i could use compatable with 0.2x is what i need... I'll see what i can do with YSF


EDIT:

Tried using it, i get this error

error 017: undefined symbol "ffind"

EDIT AGAIN:

No worries i found the native for it... So im gonna tes tit out now (crosses fingers)


Re: Dini to SQLite converter.... Does it exist? - Zeex - 30.11.2009

It seems you didn't include YSF.inc -> http://y-less.pastebin.ca/1324341

Quote:
Originally Posted by Outbreak
No worries i found the native for it... So im gonna tes tit out now (crosses fingers)
Oh well


Re: Dini to SQLite converter.... Does it exist? - Outbreak - 30.11.2009

Ain't really sure what im meant to do now to get it working right...


I need it to get each file name that has a ini extension...


Heres what i tried... It's noobish

pawn Код:
stock ConvertINI()
{
   new File[128];

   for(new i=0; i<=17180; i++)
   {
     ffind("accounts/*.ini", File, sizeof(File), i);
     if(dini_Exists(File))
     {
        printf("%s found", File);
        SaveToDB(File);
     }
     else
     {
        printf("File %s not found", File);
     }
   }
 }
also tried ffind as a statement but its not working right at all...


Re: Dini to SQLite converter.... Does it exist? - mprofitt - 30.11.2009

Quote:
Originally Posted by Outbreak
I've got a nice register and login system going with SQLite. At the moment its in very early stages, so i wont be converting jsut yet since im developing more functions and commands to work with the new database and account system.

Anyway...

I'm wondering if there is any dini to SQLite conversion, i tried searching for dini to sqlite, found nothing useful.

So if there isn't such a converter out there. How would i do it?

I'm needing to get the name of each ini file. For example.

[sLK]Outbreak.ini i would need to only get the name, then add the name to the database along with the information contained within the file.

So, are there any methods where i could start up a simple gamemode with a function to check a specified folder.

Inside the folder will be 15k + ini files. So im guessing it'll take some time to fully convert them. But how could i get the name of the ini file without needing to input any name or information, or connect to the server with each name?


EDIT:

Just experimenting i managed to find a way that it is possible.. The only draw back is it requires me to input every single account name into the gamemode.

pawn Код:
FileNames[][] =
{
  "[sLK]Outbreak",
  "Outbreak"
};
Then i create a function, and format a string to match the path of the file and loop through FileNames checking for the name of the file within the specified directory.

If all else fails i will do it that way. But I'm hoping theres another way where i can create a function to get the file names automatically
It is easy. All you have to do is load the .INI file into a spreadsheet as a CVS file. You then export the file as a CVS file using ; as the delimiter, create the table and correct number of fields in SQL and import the CVS file to the table.




Re: Dini to SQLite converter.... Does it exist? - Outbreak - 30.11.2009

Quote:
Originally Posted by mprofitt
Quote:
Originally Posted by Outbreak
I've got a nice register and login system going with SQLite. At the moment its in very early stages, so i wont be converting jsut yet since im developing more functions and commands to work with the new database and account system.

Anyway...

I'm wondering if there is any dini to SQLite conversion, i tried searching for dini to sqlite, found nothing useful.

So if there isn't such a converter out there. How would i do it?

I'm needing to get the name of each ini file. For example.

[sLK]Outbreak.ini i would need to only get the name, then add the name to the database along with the information contained within the file.

So, are there any methods where i could start up a simple gamemode with a function to check a specified folder.

Inside the folder will be 15k + ini files. So im guessing it'll take some time to fully convert them. But how could i get the name of the ini file without needing to input any name or information, or connect to the server with each name?


EDIT:

Just experimenting i managed to find a way that it is possible.. The only draw back is it requires me to input every single account name into the gamemode.

pawn Код:
FileNames[][] =
{
  "[sLK]Outbreak",
  "Outbreak"
};
Then i create a function, and format a string to match the path of the file and loop through FileNames checking for the name of the file within the specified directory.

If all else fails i will do it that way. But I'm hoping theres another way where i can create a function to get the file names automatically
It is easy. All you have to do is load the .INI file into a spreadsheet as a CVS file. You then export the file as a CVS file using ; as the delimiter, create the table and correct number of fields in SQL and import the CVS file to the table.

Easy doing it 17180 times 1 time per file?


I tihnk i've fixed it anyway I forgot to add this line after ffind

pawn Код:
format(File, 128, "%s.ini", File);
Im prety sure that will fix it.. im about to test now