DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • July 28, 2014, 09:36:28 PM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

Pages: [1]   Go Down
  Print  
Author Topic: synctable(); Help  (Read 388 times)
0 Members and 1 Guest are viewing this topic.
KaosKaizer
Mod God
*****
Offline Offline

Posts: 1014


Zeno's Arrow never hits the mark.


View Profile
« on: June 18, 2011, 07:31:26 PM »

I was recently made aware of the synctable() function and that I should use that instead of using direct SQL with db_query to create tables. I have a question... Will it also update the table if it already exists? If so, how would I use it to change the name of a column? I have "gender" and "description" that I want to change to "sex" and "desc" in the "deities" table. Please and thank you Smiley

(I don't know how to use it, but I do have an example that I am learning from that Afkamm posted in Stephen's Changelog module discussion)
Logged

My Mods
I'm not currently a fully active member of DP, though I do respond to most PMs.
Boris735
Mod God
*****
Offline Offline

Posts: 550


View Profile
« Reply #1 on: June 19, 2011, 02:48:25 AM »

I'm afraid that synctable() isn't smart enough to know how to rename columns -- it only accepts a table description, not an alteration.  So if you gave it a descriptor with different column names it will remove the old columns and add ones with the new names, but it won't know (and there's no way to tell it) that any data in them should be retained.

This makes it suitable for use in installations to create tables or update them with new columns, but not suitable for column renames.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Welcome to DragonPrime - The LoGD Resource Community!

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Who's Online
22 Guests, 3 Users
The Doctor, randomchaos, Akasha
DragonPrime LoGD
Recent Topics
Home Forums News Links Downloads Login Register Advanced Search