SQLite Question - 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)
+--- Thread: SQLite Question (
/showthread.php?tid=395076)
SQLite Question -
iTzZh - 25.11.2012
My registration/login/saving system is using SQLite. I have a small question that shouldn't be hard to fix but I just didn't know the fix lol.
Everything is working fine but when I add another variable that I want saved, I save the variable but it doesn't automatically add the column to the table. I save it as if there was that column because I thought it would automatically add it. How do I insert a new column into a table for a new variable? Thanks
Re: SQLite Question -
cessil - 25.11.2012
ALTER TABLE `<table name>` ADD COLUMN `<column name>` <type INTEGER/TEXT> <optional DEFAULT(value)>
example:
ALTER TABLE `users` ADD COLUMN `kills` INTEGER DEFAULT(0)
I recommend using slice's BUD for sqlite, it makes it a lot easier to use without having to worry about so much things.
In BUD you could just do BUD::VerifyColumn("kills", BUD::TYPE_NUMBER );
Re: SQLite Question -
iTzZh - 25.11.2012
Quote:
Originally Posted by cessil
ALTER TABLE `<table name>` ADD COLUMN `<column name>` <type INTEGER/TEXT> <optional DEFAULT(value)>
example:
ALTER TABLE `users` ADD COLUMN `kills` INTEGER DEFAULT(0)
I recommend using slice's BUD for sqlite, it makes it a lot easier to use without having to worry about so much things.
In BUD you could just do BUD::VerifyColumn("kills", BUD::TYPE_NUMBER );
|
Thanks! Pretty good advice. I'll look into it!