@@ -62,6 +62,7 @@ std::string AdvanceOptions::allow_large_results_;
6262std::string AdvanceOptions::use_default_large_results_;
6363std::string AdvanceOptions::encryption_type_ = kDefaultEncryptionType ;
6464std::string AdvanceOptions::max_threads_ = std::to_string(kDefaultMaxThreads );
65+ std::string AdvanceOptions::max_retries_ = std::to_string(kDefaultMaxRetries );
6566
6667std::string const kLanguageDialect = " SQLDialect" ;
6768std::string const kLargeResultsDatasetId = " LargeResultsDatasetId" ;
@@ -82,6 +83,7 @@ std::string const kUseDefaultLargeResultsDataset =
8283 " UseDefaultLargeResultsDataset" ;
8384std::string const kEncryptionType = " EncryptionType" ;
8485std::string const kMaxThreads = " MaxThreads" ;
86+ std::string const kMaxRetries = " MaxRetries" ;
8587
8688// Control dimensions and positions
8789int const kHeight = 20 ;
@@ -341,6 +343,21 @@ void AdvanceOptions::CreateAdditionalControls(HFONT h_font) {
341343 h_max_threads_edit, GWL_STYLE ,
342344 GetWindowLongPtr (h_max_threads_edit, GWL_STYLE ) | ES_RIGHT | ES_NUMBER );
343345
346+ // max retries
347+ HWND h_max_retries_label =
348+ CreateLabel (adv_hwnd, " Max Retries:" , kXAxis , kYAxis + 390 , kWidth * 7 ,
349+ kHeight , WS_VISIBLE | SS_LEFT );
350+ SendMessage (h_max_retries_label, WM_SETFONT , (WPARAM )h_font, TRUE );
351+ HWND h_max_retries_edit =
352+ CreateEditBox (adv_hwnd, kinputComboBoxXAxis, kYAxis + 390 , kEditBoxWidth ,
353+ kEditBoxHeight , kIdcMaxRetriesEdit );
354+ SendMessage (h_max_retries_edit, WM_SETFONT , (WPARAM )h_font, TRUE );
355+ SetWindowSubclass (GetDlgItem (adv_hwnd, kIdcMaxRetriesEdit ), InputSubclassProc,
356+ 0 , 0 );
357+ SetWindowText (h_max_retries_edit, max_retries_.c_str ());
358+ SetWindowLongPtr (
359+ h_max_retries_edit, GWL_STYLE ,
360+ GetWindowLongPtr (h_max_retries_edit, GWL_STYLE ) | ES_RIGHT | ES_NUMBER );
344361 // TODO(b/497725655): Enable UI feature after public release
345362 // HWND h_variables_checkbox = CreateCheckBox(
346363 // adv_hwnd, "Use SQL_WVARCHAR instead of SQL_VARCHAR", kXAxis, kYAxis +
@@ -351,11 +368,11 @@ void AdvanceOptions::CreateAdditionalControls(HFONT h_font) {
351368 // SetWindowSubclass(GetDlgItem(adv_hwnd, kIdcVariableCheckbox),
352369 // CheckboxSubclassProc, 0, 0);
353370 HWND h_additional_projects_label =
354- CreateLabel (adv_hwnd, " Additional projects:" , kXAxis , kYAxis + 390 ,
371+ CreateLabel (adv_hwnd, " Additional projects:" , kXAxis , kYAxis + 420 ,
355372 kWidth * 5 , kHeight , WS_VISIBLE | SS_LEFT );
356373 SendMessage (h_additional_projects_label, WM_SETFONT , (WPARAM )h_font, TRUE );
357374 HWND h_additional_projects_edit =
358- CreateScrollableEditBox (adv_hwnd, kXAxis , kYAxis + 410 , kWidth + 380 ,
375+ CreateScrollableEditBox (adv_hwnd, kXAxis , kYAxis + 440 , kWidth + 380 ,
359376 kHeight + 32 , kIdcAdditionalProjectsEdit );
360377 SendMessage (h_additional_projects_edit, WM_SETFONT , (WPARAM )h_font, TRUE );
361378
@@ -364,11 +381,11 @@ void AdvanceOptions::CreateAdditionalControls(HFONT h_font) {
364381 InputSubclassProc, 0 , 0 );
365382
366383 HWND h_query_properties_label =
367- CreateLabel (adv_hwnd, " Query properties:" , kXAxis , kYAxis + 470 ,
384+ CreateLabel (adv_hwnd, " Query properties:" , kXAxis , kYAxis + 500 ,
368385 kWidth * 5 , kHeight , WS_VISIBLE | SS_LEFT );
369386 SendMessage (h_query_properties_label, WM_SETFONT , (WPARAM )h_font, TRUE );
370387 HWND h_query_properties_edit =
371- CreateScrollableEditBox (adv_hwnd, kXAxis , kYAxis + 485 , kWidth + 385 ,
388+ CreateScrollableEditBox (adv_hwnd, kXAxis , kYAxis + 520 , kWidth + 385 ,
372389 kHeight + 13 , kIdcQueryPropertiesEdit );
373390 SendMessage (h_query_properties_edit, WM_SETFONT , (WPARAM )h_font, TRUE );
374391
@@ -392,12 +409,12 @@ void AdvanceOptions::CreateAdditionalControls(HFONT h_font) {
392409}
393410
394411void AdvanceOptions::CreateButtons (HFONT h_font) {
395- HWND h_ok_button = CreateButton (adv_hwnd, " OK" , kOkButtonX + 2 , kButtonY + 15 ,
412+ HWND h_ok_button = CreateButton (adv_hwnd, " OK" , kOkButtonX + 2 , kButtonY + 38 ,
396413 kButtonWidth , kButtonHeight , kIdcOKButton );
397414 SendMessage (h_ok_button, WM_SETFONT , (WPARAM )h_font, TRUE );
398415
399416 HWND h_cancel_button =
400- CreateButton (adv_hwnd, " Cancel" , kCancelButtonX , kButtonY + 15 ,
417+ CreateButton (adv_hwnd, " Cancel" , kCancelButtonX , kButtonY + 38 ,
401418 kButtonWidth , kButtonHeight , kIdcCancelButton );
402419 SendMessage (h_cancel_button, WM_SETFONT , (WPARAM )h_font, TRUE );
403420}
@@ -565,6 +582,20 @@ LRESULT CALLBACK AdvanceOptions::AdvanceOptProc(HWND hwnd, UINT u_msg,
565582 ShowErrorWindow (hwnd, err_msg);
566583 return true ;
567584 }
585+ HWND h_max_retries_edit = GetDlgItem (hwnd, kIdcMaxRetriesEdit );
586+ char max_retries_buff[256 ] = {0 };
587+ GetWindowText (h_max_retries_edit, max_retries_buff,
588+ sizeof (max_retries_buff));
589+ if (isValidUint32 (max_retries_buff)) {
590+ max_retries_ = max_retries_buff;
591+ } else {
592+ std::string err_msg =
593+ " Invalid number of max retries: Valid values are in range [0," +
594+ std::to_string (UINT32_MAX ) + " ]" ;
595+ ShowErrorWindow (hwnd, err_msg);
596+ return true ;
597+ }
598+
568599 HWND h_additional_projects_edit =
569600 GetDlgItem (hwnd, kIdcAdditionalProjectsEdit );
570601 char additional_projects_buffer[1024 ] = {0 };
@@ -742,6 +773,7 @@ void AdvanceOptions::SetValues(Section const& attribute_map) {
742773 temp_expiration_ =
743774 GetValueOrDefault (attribute_map, kLargeResultsTempTableExpirationTime );
744775 max_threads_ = GetValueOrDefault (attribute_map, kMaxThreads );
776+ max_retries_ = GetValueOrDefault (attribute_map, kMaxRetries );
745777 session_location_ = GetValueOrDefault (attribute_map, kSessionLocation );
746778 additional_projects_ = GetValueOrDefault (attribute_map, kAdditionalProjects );
747779 query_properties_ = GetValueOrDefault (attribute_map, kQueryProperties );
@@ -766,6 +798,7 @@ void AdvanceOptions::ResetToDefaults() {
766798 rows_per_block_ = kDefaultRowsPerBlock ;
767799 default_string_length_ = kDefaultStringLength ;
768800 max_threads_ = std::to_string (kDefaultMaxThreads );
801+ max_retries_ = std::to_string (kDefaultMaxRetries );
769802 session_location_.clear ();
770803 additional_projects_.clear ();
771804 query_properties_.clear ();
@@ -798,7 +831,7 @@ void AdvanceOptions::Show(HWND hwnd) {
798831 RegisterClass (&wc_adv);
799832
800833 int window_width = 462 ;
801- int window_height = 620 ;
834+ int window_height = 650 ;
802835 int screen_width = GetSystemMetrics (SM_CXSCREEN );
803836 int screen_height = GetSystemMetrics (SM_CYSCREEN );
804837 int x_pos = (screen_width - window_width) / 2 ;
0 commit comments