DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • April 20, 2018, 01:51:25 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Resource Pages

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

Posts: 1016

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)

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

Posts: 570

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.
Pages: [1]   Go Up
Jump to:  

DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
34 Guests, 1 User
Home Forums News Downloads Login Register Advanced Search