embolalia/willie — pull request #381 by ProgressiveThinkin (2013-12-06 07:19:08+00:00)
Title: [DB] Fix errors related to trying to create a table using a list of tuples for columns

Trying to create a table by specifying a list of tuple data resulted in errors and failure to load modules.

Ex. bot.db.add_table('channel_moderation',[('nick','TEXT'),('offense_date','INTEGER DEFAULT 0')],'nick')

This patch properly detects such commands and parses them correctly.

NOTE: I tested this by running the following commands and all tables were created correctly
bot.db.add_table('channel_moderation',[('nick','TEXT'),('offense_date','INTEGER DEFAULT 0')],'nick')
bot.db.add_table('channel_moderation2',['nick'],'nick')
bot.db.add_table('channel_moderation3',[('nick','TEXT')],'nick')
bot.db.add_table('channel_moderation4',['nick','offense_date'],'nick')

Then verified existence via sqlite3 .schema:
CREATE TABLE channel_moderation (nick TEXT NOT NULL, offense_date INTEGER DEFAULT 0, PRIMARY KEY (nick));
CREATE TABLE channel_moderation2 (nick string NOT NULL, PRIMARY KEY (nick));
CREATE TABLE channel_moderation3 (nick TEXT NOT NULL, PRIMARY KEY (nick));
CREATE TABLE channel_moderation4 (nick string NOT NULL, offense_date string, PRIMARY KEY (nick));