ericberman / MyFlightbookWeb

The website and service for MyFlightbook
49 stars 18 forks source link

How are we getting an 8710 query with "AND flights.idaircraft IN ()" in the sql restriction? #908

Closed ericberman closed 2 years ago

ericberman commented 2 years ago

Referrer requested: https://myflightbook.com/logbook/Member/8710Form.aspx/Model?=@&naked=1 Last page requested by user = https:myflightbook.com/logbook/Member/8710Form.aspx/Model?=@&naked=1

Message: Exception of type 'System.Web.HttpUnhandledException' was thrown. Source: System.Web Target site Boolean HandleError(System.Exception)

Stack trace: at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.d523.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Util.WithinCancellableCallbackTaskAwaitable.WithinCancellableCallbackTaskAwaiter.GetResult() at System.Web.UI.Page.d515.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.UI.Page.d__554.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar) at ASP.member_8710form_aspx.EndProcessRequest(IAsyncResult ar) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)OverallData: System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> MyFlightbook.MyFlightbookException: Exception creating temporary table: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') GROUP BY flights.idFlight, aircraft.idaircraft

ORDER BY flights.date DESC' at line 74 flightsForUserWithQuery SELECT flights.idFlight, flights.date, flights.idaircraft, flights.cInstrumentApproaches, flights.cLandings, flights.crosscountry, flights.night, flights.IMC, flights.simulatedInstrument, flights.dualReceived, flights.PIC, flights.totalFlightTime, flights.fHold, flights.Route, flights.Comments, flights.username, flights.groundSim, flights.fPublic, flights.hobbsStart, flights.hobbsEnd, IF(YEAR(flights.dtEngineStart) < 100, NULL, flights.dtEngineStart) AS dtEngineStart, IF(YEAR(flights.dtEngineEnd) < 100, NULL, flights.dtEngineEnd) AS dtEngineEnd, IF(YEAR(flights.dtFlightStart) < 100, NULL, flights.dtFlightStart) AS dtFlightStart, IF(YEAR(flights.dtFlightEnd) < 100, NULL, flights.dtFlightEnd) AS dtFlightEnd, flights.cfi, flights.SIC, flights.cNightLandings, flights.cFullStopLandings, flights.idCatClassOverride, flights.FlightHash, flights.SignatureHash, flights.CFIComment, flights.SignatureDate, flights.CFICertificate, flights.CFIExpiration, flights.CFIUserName, flights.CFIEmail, flights.CFIName, IF (flights.DigitizedSignature IS NOT NULL AND Length(DigitizedSignature) > 0, 1, 0) AS HasDigitizedSignature, flights.SignatureState,

IF (coalesce(flights.Telemetry, ft.idflight) IS NULL, 0, 1) AS FlightDataLength,
ft.distance,
ft.flightpath,
ft.telemetrytype,
ft.metadata,
fp2.DateValue AS blockOut,
CONCAT('[', GROUP_CONCAT(DISTINCT IF(fv.idFlightVideos IS NULL, '', JSON_OBJECT("ID", fv.idFlightVideos, "FlightID", fv.idFlight, "VideoReference", fv.vidRef, "Comment", fv.comment)) SEPARATOR ', '), ']') AS FlightVids,
CONCAT('[', GROUP_CONCAT(DISTINCT IF(fdc.idprop IS NULL, '', JSON_ARRAY(fdc.idprop, fdc.idPropType, ELT(cpt.type + 1, fdc.IntValue, fdc.DecValue, IF(fdc.IntValue<>0, 'true', 'false'), fdc.DateValue, fdc.DateValue, fdc.StringValue, fdc.DecValue))) ORDER BY CONCAT(cpt.sortkey, cpt.FormatString) ASC SEPARATOR ', '), ']') AS CustomPropsJSON,
GROUP_CONCAT(DISTINCT REPLACE(cpt.FormatString, '{0}', ELT(cpt.type + 1, fdc.IntValue, fdc.DecValue, '', fdc.DateValue, fdc.DateValue, fdc.StringValue, fdc.DecValue)) SEPARATOR ' ') AS CustomProperties,
models.*,
IF(models.fTAA <> 0 OR (aircraft.HasTAAUpgrade  <> 0 AND (aircraft.GlassUpgradeDate IS NULL OR flights.date >= aircraft.GlassUpgradeDate)), 1, 0) AS IsTAA,
if (flights.idCatClassOverride = 0 OR flights.idCatClassOverride=models.idCategoryClass, 0, 1) AS IsOverridden,
if (flights.idCatClassOverride = 0, models.idcategoryclass, flights.idCatClassOverride) AS CatClassOverride,
TRIM(CONCAT(models.model, ', ', manufacturers.Manufacturer, ' ',  models.typename, ' ', models.modelname)) AS ModelDisplay,
TRIM(CONCAT(manufacturers.Manufacturer, ' ', models.model)) AS ShortModelDisplay,
IF(models.family is null OR models.family='', models.model, models.family) AS FamilyDisplay,
IF (aircraft.Tailnumber LIKE '#%', CONCAT('(', models.model, ')'), aircraft.tailnumber) AS 'TailNumberDisplay',
aircraft.TailNumber AS RawTailNumber,
aircraft.InstanceType,
CONCAT(IF(ccOver.CatClass is null, ccOrig.CatClass, ccOver.CatClass), IF(models.typename='','', CONCAT(' (', models.typename, ')'))) AS CatClassDisplay

FROM flights INNER JOIN aircraft ON flights.idaircraft = aircraft.idaircraft INNER JOIN models ON aircraft.idmodel = models.idmodel INNER JOIN manufacturers ON manufacturers.idmanufacturer = models.idmanufacturer INNER JOIN categoryclass ccOrig ON (models.idCategoryClass = ccOrig.idCatClass)

LEFT JOIN flighttelemetry ft ON (flights.idflight=ft.idflight) LEFT JOIN categoryclass ccOver ON (flights.idCatClassOverride = ccOver.idCatClass) LEFT JOIN FlightProperties fdc ON flights.idFlight=fdc.idFlight LEFT JOIN custompropertytypes cpt ON fdc.idPropType=cpt.idPropType LEFT JOIN flightvideos fv ON fv.idflight=flights.idflight LEFT JOIN FlightProperties fp2 ON flights.idflight=fp2.idflight AND fp2.idproptype=187 WHERE flights.UserName=?uName AND (flights.date >= '2022-02-01') AND flights.idaircraft IN () GROUP BY flights.idFlight, aircraft.idaircraft

ORDER BY flights.date DESC, dtFlightStart DESC, dtEngineStart DESC, blockOut DESC, hobbsStart DESC, flights.idFlight DESC

ericberman commented 2 years ago

Haven't seen this happen, but code is now throwing an exception.