Bug in mojoportal.data.pgsql/dbmoduledefinition.cs

This forum is for questions about contributing to the project or proposing features that you would like to develop for the project. 

This thread is closed to new posts. You must sign in to post in the forums.
10/13/2009 12:45:28 PM
Gravatar
Total Posts 1

Bug in mojoportal.data.pgsql/dbmoduledefinition.cs

Hello, while cruising on my mojoportal local instance, I discovered a problem when trying to add a new feature. The "addmoduledefinition" is missing a db insert into table mp_sitemoduledefinitions

Here is the patch. Add this code right before last line of code ("return newID;") in addmoduledefinition method:

I should have surrounded the whole function with a transaction, but it works for now. Next move would be to implement the whole insert in a postgreSQL function.

if (siteId > -1)

{

// now add to mp_SiteModuleDefinitions

sqlCommand = new StringBuilder();

sqlCommand.Append("INSERT INTO mp_sitemoduledefinitions (");

sqlCommand.Append("SiteID, ");

sqlCommand.Append("SiteGuid, ");

sqlCommand.Append("FeatureGuid, ");

sqlCommand.Append("ModuleDefID ) ");

 

sqlCommand.Append(" VALUES (");

sqlCommand.Append(":SiteID, ");

sqlCommand.Append("(SELECT SiteGuid FROM mp_Sites WHERE SiteID = :SiteID LIMIT 1), ");

sqlCommand.Append("(SELECT Guid FROM mp_ModuleDefinitions WHERE ModuleDefID = :ModuleDefID LIMIT 1), ");

sqlCommand.Append(":ModuleDefID ) ; ");

 

arParams = new NpgsqlParameter[2];

 

arParams[0] = new NpgsqlParameter("SiteID", NpgsqlTypes.NpgsqlDbType.Integer);

arParams[0].Direction = ParameterDirection.Input;

arParams[0].Value = siteId;

 

arParams[1] = new NpgsqlParameter("ModuleDefID", NpgsqlTypes.NpgsqlDbType.Integer);

arParams[1].Direction = ParameterDirection.Input;

arParams[1].Value = newID;

 

NpgsqlHelper.ExecuteNonQuery(

GetWriteConnectionString(),CommandType.Text,

sqlCommand.ToString(),

arParams);

}

10/13/2009 12:54:16 PM
Gravatar
Total Posts 18439

Re: Bug in mojoportal.data.pgsql/dbmoduledefinition.cs

Hi,

Thanks, I will fix this in my copy now.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.