@@ -2410,8 +2410,10 @@ SQLActiveCode.prototype.init = function(opts) {
24102410
24112411
24122412SQLActiveCode . prototype . runProg = function ( ) {
2413-
2413+ var result_mess = "success"
2414+ var scrubber_dfd , history_dfd , saveCode
24142415 // Clear any old results
2416+ saveCode = "True"
24152417 let divid = this . divid + '_sql_out' ;
24162418 let respDiv = document . getElementById ( divid ) ;
24172419 if ( respDiv ) {
@@ -2423,12 +2425,37 @@ SQLActiveCode.prototype.runProg = function() {
24232425 try {
24242426 var res = this . db . exec ( query ) ;
24252427 } catch ( error ) {
2426- $ ( this . output ) . text ( error )
2427- $ ( this . outDiv ) . show ( )
2428- return
2428+ result_mess = error . toString ( ) ;
2429+ $ ( this . output ) . text ( error ) ;
2430+ $ ( this . outDiv ) . show ( ) ;
2431+
24292432 }
2433+ this . logRunEvent ( {
2434+ 'div_id' : this . divid ,
2435+ 'code' : this . editor . getValue ( ) ,
2436+ 'lang' : this . language ,
2437+ 'errinfo' : result_mess ,
2438+ 'to_save' : saveCode ,
2439+ 'prefix' : this . pretext ,
2440+ 'suffix' : this . suffix ,
2441+ 'partner' : this . partner
2442+ } ) ; // Log the run event
24302443
2431- //
2444+ var __ret = this . manage_scrubber ( scrubber_dfd , history_dfd , saveCode ) ;
2445+ history_dfd = __ret . history_dfd ;
2446+ saveCode = __ret . saveCode ;
2447+
2448+ history_dfd . then ( function ( ) {
2449+ if ( this . slideit ) {
2450+ $ ( this . historyScrubber ) . on ( "slidechange" , this . slideit . bind ( this ) ) ;
2451+ }
2452+ $ ( this . historyScrubber ) . slider ( "enable" ) ;
2453+ } ) ;
2454+
2455+ if ( result_mess != "success" ) {
2456+ return ;
2457+ }
2458+ // Create a nice table to show the result of the query
24322459 if ( res [ 0 ] . values . length > 100 ) {
24332460 $ ( this . output ) . text ( "Result set is longer than 100 rows limiting output to first 100" )
24342461 }
0 commit comments