@@ -63,6 +63,7 @@ std::string AdvanceOptions::allow_large_results_;
6363std::string AdvanceOptions::use_default_large_results_;
6464std::string AdvanceOptions::encryption_type_ = kDefaultEncryptionType ;
6565std::string AdvanceOptions::max_threads_ = std::to_string(kDefaultMaxThreads );
66+ std::string AdvanceOptions::max_retries_ = std::to_string(kDefaultMaxRetries );
6667
6768std::string const kLanguageDialect = " SQLDialect" ;
6869std::string const kLargeResultsDatasetId = " LargeResultsDatasetId" ;
@@ -83,6 +84,7 @@ std::string const kUseDefaultLargeResultsDataset =
8384 " UseDefaultLargeResultsDataset" ;
8485std::string const kEncryptionType = " EncryptionType" ;
8586std::string const kMaxThreads = " MaxThreads" ;
87+ std::string const kMaxRetries = " MaxRetries" ;
8688
8789// Control dimensions and positions
8890int const kHeight = 20 ;
@@ -342,6 +344,21 @@ void AdvanceOptions::CreateAdditionalControls(HFONT h_font) {
342344 h_max_threads_edit, GWL_STYLE ,
343345 GetWindowLongPtr (h_max_threads_edit, GWL_STYLE ) | ES_RIGHT | ES_NUMBER );
344346
347+ // max retries
348+ HWND h_max_retries_label =
349+ CreateLabel (adv_hwnd, " Max Retries:" , kXAxis , kYAxis + 390 , kWidth * 7 ,
350+ kHeight , WS_VISIBLE | SS_LEFT );
351+ SendMessage (h_max_retries_label, WM_SETFONT , (WPARAM )h_font, TRUE );
352+ HWND h_max_retries_edit =
353+ CreateEditBox (adv_hwnd, kinputComboBoxXAxis, kYAxis + 390 , kEditBoxWidth ,
354+ kEditBoxHeight , kIdcMaxRetriesEdit );
355+ SendMessage (h_max_retries_edit, WM_SETFONT , (WPARAM )h_font, TRUE );
356+ SetWindowSubclass (GetDlgItem (adv_hwnd, kIdcMaxRetriesEdit ), InputSubclassProc,
357+ 0 , 0 );
358+ SetWindowText (h_max_retries_edit, max_retries_.c_str ());
359+ SetWindowLongPtr (
360+ h_max_retries_edit, GWL_STYLE ,
361+ GetWindowLongPtr (h_max_retries_edit, GWL_STYLE ) | ES_RIGHT | ES_NUMBER );
345362 // TODO(b/497725655): Enable UI feature after public release
346363 // HWND h_variables_checkbox = CreateCheckBox(
347364 // adv_hwnd, "Use SQL_WVARCHAR instead of SQL_VARCHAR", kXAxis, kYAxis +
@@ -352,11 +369,11 @@ void AdvanceOptions::CreateAdditionalControls(HFONT h_font) {
352369 // SetWindowSubclass(GetDlgItem(adv_hwnd, kIdcVariableCheckbox),
353370 // CheckboxSubclassProc, 0, 0);
354371 HWND h_additional_projects_label =
355- CreateLabel (adv_hwnd, " Additional projects:" , kXAxis , kYAxis + 390 ,
372+ CreateLabel (adv_hwnd, " Additional projects:" , kXAxis , kYAxis + 420 ,
356373 kWidth * 5 , kHeight , WS_VISIBLE | SS_LEFT );
357374 SendMessage (h_additional_projects_label, WM_SETFONT , (WPARAM )h_font, TRUE );
358375 HWND h_additional_projects_edit =
359- CreateScrollableEditBox (adv_hwnd, kXAxis , kYAxis + 410 , kWidth + 380 ,
376+ CreateScrollableEditBox (adv_hwnd, kXAxis , kYAxis + 440 , kWidth + 380 ,
360377 kHeight + 32 , kIdcAdditionalProjectsEdit );
361378 SendMessage (h_additional_projects_edit, WM_SETFONT , (WPARAM )h_font, TRUE );
362379
@@ -365,11 +382,11 @@ void AdvanceOptions::CreateAdditionalControls(HFONT h_font) {
365382 InputSubclassProc, 0 , 0 );
366383
367384 HWND h_query_properties_label =
368- CreateLabel (adv_hwnd, " Query properties:" , kXAxis , kYAxis + 470 ,
385+ CreateLabel (adv_hwnd, " Query properties:" , kXAxis , kYAxis + 500 ,
369386 kWidth * 5 , kHeight , WS_VISIBLE | SS_LEFT );
370387 SendMessage (h_query_properties_label, WM_SETFONT , (WPARAM )h_font, TRUE );
371388 HWND h_query_properties_edit =
372- CreateScrollableEditBox (adv_hwnd, kXAxis , kYAxis + 485 , kWidth + 385 ,
389+ CreateScrollableEditBox (adv_hwnd, kXAxis , kYAxis + 520 , kWidth + 385 ,
373390 kHeight + 13 , kIdcQueryPropertiesEdit );
374391 SendMessage (h_query_properties_edit, WM_SETFONT , (WPARAM )h_font, TRUE );
375392
@@ -393,12 +410,12 @@ void AdvanceOptions::CreateAdditionalControls(HFONT h_font) {
393410}
394411
395412void AdvanceOptions::CreateButtons (HFONT h_font) {
396- HWND h_ok_button = CreateButton (adv_hwnd, " OK" , kOkButtonX + 2 , kButtonY + 15 ,
413+ HWND h_ok_button = CreateButton (adv_hwnd, " OK" , kOkButtonX + 2 , kButtonY + 38 ,
397414 kButtonWidth , kButtonHeight , kIdcOKButton );
398415 SendMessage (h_ok_button, WM_SETFONT , (WPARAM )h_font, TRUE );
399416
400417 HWND h_cancel_button =
401- CreateButton (adv_hwnd, " Cancel" , kCancelButtonX , kButtonY + 15 ,
418+ CreateButton (adv_hwnd, " Cancel" , kCancelButtonX , kButtonY + 38 ,
402419 kButtonWidth , kButtonHeight , kIdcCancelButton );
403420 SendMessage (h_cancel_button, WM_SETFONT , (WPARAM )h_font, TRUE );
404421}
@@ -566,6 +583,20 @@ LRESULT CALLBACK AdvanceOptions::AdvanceOptProc(HWND hwnd, UINT u_msg,
566583 ShowErrorWindow (hwnd, err_msg);
567584 return true ;
568585 }
586+ HWND h_max_retries_edit = GetDlgItem (hwnd, kIdcMaxRetriesEdit );
587+ char max_retries_buff[256 ] = {0 };
588+ GetWindowText (h_max_retries_edit, max_retries_buff,
589+ sizeof (max_retries_buff));
590+ if (isValidUint32 (max_retries_buff)) {
591+ max_retries_ = max_retries_buff;
592+ } else {
593+ std::string err_msg =
594+ " Invalid number of max retries: Valid values are in range [0," +
595+ std::to_string (UINT32_MAX ) + " ]" ;
596+ ShowErrorWindow (hwnd, err_msg);
597+ return true ;
598+ }
599+
569600 HWND h_additional_projects_edit =
570601 GetDlgItem (hwnd, kIdcAdditionalProjectsEdit );
571602 char additional_projects_buffer[1024 ] = {0 };
@@ -747,6 +778,7 @@ void AdvanceOptions::SetValues(Section const& attribute_map) {
747778 kDefaultLargeResultsTableExpiration );
748779 max_threads_ = GetValueOrDefault (attribute_map, kMaxThreads ,
749780 std::to_string (kDefaultMaxThreads ));
781+ max_retries_ = GetValueOrDefault (attribute_map, kMaxRetries );
750782 session_location_ = GetValueOrDefault (attribute_map, kSessionLocation );
751783 additional_projects_ = GetValueOrDefault (attribute_map, kAdditionalProjects );
752784 query_properties_ = GetValueOrDefault (attribute_map, kQueryProperties );
@@ -771,6 +803,7 @@ void AdvanceOptions::ResetToDefaults() {
771803 rows_per_block_ = kDefaultRowsPerBlock ;
772804 default_string_length_ = kDefaultStringLength ;
773805 max_threads_ = std::to_string (kDefaultMaxThreads );
806+ max_retries_ = std::to_string (kDefaultMaxRetries );
774807 session_location_.clear ();
775808 additional_projects_.clear ();
776809 query_properties_.clear ();
@@ -803,7 +836,7 @@ void AdvanceOptions::Show(HWND hwnd) {
803836 RegisterClass (&wc_adv);
804837
805838 int window_width = 462 ;
806- int window_height = 620 ;
839+ int window_height = 650 ;
807840 int screen_width = GetSystemMetrics (SM_CXSCREEN );
808841 int screen_height = GetSystemMetrics (SM_CYSCREEN );
809842 int x_pos = (screen_width - window_width) / 2 ;
0 commit comments