dnnwerk / dnnScript

Improve Stability & Performance of DNN (AKA DotNetNuke) CMS Platform
Other
20 stars 0 forks source link

Error on 9.3.1 #11

Open trouble2 opened 5 years ago

trouble2 commented 5 years ago

Running TurboDNN932.sql gives me:

System.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near ')'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at DotNetNuke.Data.SqlDatabaseConnectionProvider.ExecuteNonQuery(String connectionString, CommandType commandType, Int32 commandTimeout, String query) at DotNetNuke.Data.SqlDataProvider.ExecuteScriptInternal(String connectionString, String script, Int32 timeoutSec) ClientConnectionId:93e11e71-cc51-44a0-8758-08edbef8d56d Error Number:102,State:1,Class:15 IF dbo.[sys_currentDNNVersion]() >= 90300 Exec(N' CREATE FUNCTION dbo.[Export_GetActiveTabModules] (@TabID Int, -- Not Null @IncludeDeleted Bit) -- Not Null RETURNS TABLE AS RETURN ( SELECT DISTINCT TM.ModuleId FROM dbo.[TabModules] TM LEFT JOIN dbo.[TabVersions] TV ON TM.TabID = TV.TabId WHERE (TM.TabId = @TabID) AND (ISNull(TV.IsPublished, 1) = 1) AND (@IncludeDeleted = 1 OR TM.IsDeleted = 0)) ) ') ELSE IF dbo.[sys_currentDNNVersion]() >= 90100 Exec(N' CREATE FUNCTION dbo.[Export_GetActiveTabModules] (@TabID Int) -- Not Null RETURNS TABLE AS RETURN ( SELECT DISTINCT TM.ModuleId FROM dbo.[TabModules] TM LEFT JOIN dbo.[TabVersions] TV ON TM.TabID = TV.TabId WHERE TM.TabId = @TabID AND ISNull(TV.IsPublished, 1) = 1 ) ');

So what now?!?

trouble2 commented 5 years ago

Looks like you've got a ')' to much:

IF {databaseOwner}[{objectQualifier}sys_currentDNNVersion]() >= 90300 Exec(N' CREATE FUNCTION {databaseOwner}[{objectQualifier}ExportGetActiveTabModules] (@TabID Int, -- Not Null @IncludeDeleted Bit) -- Not Null RETURNS TABLE AS RETURN ( SELECT DISTINCT TM.ModuleId FROM {databaseOwner}[{objectQualifier}TabModules] TM LEFT JOIN {databaseOwner}[{objectQualifier}TabVersions] TV ON TM.TabID = TV.TabId WHERE (TM.TabId = @TabID) AND (ISNull(TV.IsPublished, 1) = 1) AND (@IncludeDeleted = 1 OR TM.IsDeleted = 0)) )_ ') ELSE IF {databaseOwner}[{objectQualifier}sys_currentDNNVersion]() >= 90100 Exec(N' CREATE FUNCTION {databaseOwner}[{objectQualifier}Export_GetActiveTabModules] (@TabID Int) -- Not Null RETURNS TABLE AS RETURN ( SELECT DISTINCT TM.ModuleId FROM {databaseOwner}[{objectQualifier}TabModules] TM LEFT JOIN {databaseOwner}[{objectQualifier}TabVersions] TV ON TM.TabID = TV.TabId WHERE TM.TabId = @TabID AND ISNull(TV.IsPublished, 1) = 1 ) '); GO

TheDeadlyBulb commented 3 years ago

This appears to still be an issue in TurboScripts Version 0.9.9 Rev z9.

FYI for these needing to FIX: Remove the extra ) on this line:

AND (@IncludeDeleted = 1 OR TM.IsDeleted = 0))

changing it to

AND (@IncludeDeleted = 1 OR TM.IsDeleted = 0)