Page 1 of 1

Addons that add new fields need updating for cSQL 6.0

PostPosted: Fri Mar 17, 2006 4:38 am
by Lawrence
Hello,

I just wanted to coordinate a plan for bringing any addons that introduce new field types, or add their own news fields directly to the field arrays, up to speed with the current development release of CorantoSQL, as it cleans up some broken functionality ( assuming all new fields it doesn't know about should default to datatype VARCHAR(255) ) and returns field creation power back to the addons that started it :)

Unfortunately, this breaks some addons that haven't properly taken advantage of this feature in the past.

I will help anyone interested in bringing their addons up to speed.

Lawrence

PostPosted: Fri Mar 17, 2006 4:41 am
by Lawrence
First fix: vBulletin (3.x) Comments:

Add the following code to both 'vBComments_AlterCSQLTable' and 'vBComments_AlterCSQLTable_Pre' subs:

Code: Select all
$sql_add_field = "ALTER TABLE $CConfig{'CorantoSQL_tblname'} ADD vBComments_threadlink varchar(255);";
$corantosql_dbh->do($sql_add_field);

PostPosted: Fri Mar 17, 2006 4:55 am
by Lawrence
Reviewing things further, any addon that just directly patches a field into @fieldDB_internalorder (i know, a few of mine do this too) ideally needs to do two things:

1) Hook some SQL field creation code into CorantoSQL_AddAField. Mainly so cSQL's initial news transfer routine can setup the database table properly.

example
Code: Select all
$addon->hook('CorantoSQL_AddAField','vBComments_AlterCSQLTable_Pre',10);

sub vBComments_AlterCSQLTable_Pre {
# This is the one that is run during CorantoSQL setup
my $corantosql_dbh = &CorantoSQL_connectdb();

my $sql_add_field = "ALTER TABLE $CConfig{'CorantoSQL_tblname'} ADD vBulletin_threadid int(10)\;";
$corantosql_dbh->do($sql_add_field);

$sql_add_field = "ALTER TABLE $CConfig{'CorantoSQL_tblname'} ADD vBComments_ForumProfile varchar(255);";
$corantosql_dbh->do($sql_add_field);

$sql_add_field = "ALTER TABLE $CConfig{'CorantoSQL_tblname'} ADD vBComments_threadlink varchar(255);";
$corantosql_dbh->do($sql_add_field);

$corantosql_dbh->disconnect();
}


2) Add a link to it's settings that calls a page which does something similar to #1.

PostPosted: Fri Mar 17, 2006 12:05 pm
by Feathers
Lawrence wrote:First fix: vBulletin (3.x) Comments:

Add the following code to both 'vBComments_AlterCSQLTable' and 'vBComments_AlterCSQLTable_Pre' subs:

Code: Select all
$sql_add_field = "ALTER TABLE $CConfig{'CorantoSQL_tblname'} ADD vBComments_threadlink varchar(255);";
$corantosql_dbh->do($sql_add_field);
Ooops! I realised yesterday that I should have done something like this when I added the new field.

Lawrence wrote:(i know, a few of mine do this too)
This was 'one of yours', I just hijacked it...do you want it back?

PostPosted: Mon Mar 20, 2006 5:55 am
by Lawrence
Not really, feathers :)

I think you are the best person to keep things as they are. I will simply submit patches back to you to fix things for cSQL 6.0. I am trying to bring every SQL-supporting addon up-to-speed because releasing the final 6.0 version.

Lawrence