From 883d971ca91e0d89f038f51d60c6ce4826838178 Mon Sep 17 00:00:00 2001 From: Marcin Marek Date: Mon, 25 Jul 2016 11:42:46 +0200 Subject: [PATCH] branch fix after rebase --- CMakeLists.txt | 13 +- MySQLWorkbench.sln | 62 - .../xcschemes/MySQLWorkbench.xcscheme | 14 +- .../xcschemes/MySQLWorkbenchCom.xcscheme | 6 + .../xcshareddata/xcschemes/WBExtras.xcscheme | 2 +- .../xcshareddata/xcschemes/base.xcscheme | 2 +- .../xcshareddata/xcschemes/cairo.so.xcscheme | 2 +- .../xcshareddata/xcschemes/cdbc.xcscheme | 2 +- .../xcshareddata/xcschemes/db.grt.xcscheme | 2 +- .../db.mysql.diff.reporting.wbp.xcscheme | 2 +- .../xcschemes/db.mysql.editors.wbp.xcscheme | 2 +- .../xcschemes/db.mysql.editors.xcscheme | 2 +- .../xcschemes/db.mysql.grt.xcscheme | 2 +- .../xcschemes/db.mysql.parser.grt.xcscheme | 2 +- .../xcschemes/db.mysql.query.grt.xcscheme | 2 +- .../xcschemes/db.mysql.sqlparser.grt.xcscheme | 2 +- .../xcschemes/db.mysql.wbp.xcscheme | 2 +- .../xcschemes/db.search.wbp.xcscheme | 2 +- .../xcshareddata/xcschemes/grt.xcscheme | 2 +- .../xcshareddata/xcschemes/mforms.so.xcscheme | 2 +- .../xcshareddata/xcschemes/mforms.xcscheme | 2 +- .../xcschemes/mysql.canvas.xcscheme | 8 +- .../xcschemes/mysql.parser.xcscheme | 14 +- .../xcschemes/sql.parser.xcscheme | 2 +- .../xcschemes/utilities.grt.xcscheme | 80 + .../wb.fabric.interface.grt.xcscheme | 2 +- .../xcschemes/wb.model.editors.wbp.xcscheme | 2 +- .../xcschemes/wb.model.editors.xcscheme | 2 +- .../xcschemes/wb.model.grt.xcscheme | 2 +- .../xcschemes/wb.model.snippets.wbp.xcscheme | 2 +- .../xcschemes/wb.mysql.import.grt.xcscheme | 2 +- .../xcschemes/wb.printing.wbp.xcscheme | 2 +- .../xcschemes/wb.printing.xcscheme | 2 +- .../xcschemes/wbcopytables.xcscheme | 2 +- .../xcschemes/wbprivate.be.xcscheme | 2 +- .../xcschemes/wbpublic.be.xcscheme | 2 +- .../xcshareddata/xcschemes/wbtests.xcscheme | 4 +- PrepareOutputDir.cmd | 13 +- .../wbprivate/model/wb_component_basic.cpp | 6 +- .../wbprivate/model/wb_component_physical.cpp | 24 +- backend/wbprivate/model/wb_history_tree.cpp | 2 +- .../wbprivate/model/wb_model_diagram_form.cpp | 24 +- .../wbprivate/model/wb_overview_physical.cpp | 6 +- .../model/wb_overview_physical_schema.cpp | 10 +- .../model/wb_overview_privileges.cpp | 4 +- .../wb_physical_model_diagram_features.cpp | 5 +- .../sqlide/db_sql_editor_history_be.cpp | 12 +- .../sqlide/db_sql_editor_history_be.h | 13 +- .../wbprivate/sqlide/db_sql_editor_log.cpp | 4 +- .../wbprivate/sqlide/query_side_palette.cpp | 16 +- backend/wbprivate/sqlide/result_form_view.cpp | 22 +- .../wbprivate/sqlide/spatial_data_view.cpp | 4 +- backend/wbprivate/sqlide/spatial_draw_box.cpp | 5 +- .../wbprivate/sqlide/wb_live_schema_tree.cpp | 2 +- .../wbprivate/sqlide/wb_live_schema_tree.h | 11 +- .../wbprivate/sqlide/wb_sql_editor_buffer.cpp | 37 +- .../wbprivate/sqlide/wb_sql_editor_form.cpp | 180 +- backend/wbprivate/sqlide/wb_sql_editor_form.h | 8 +- .../sqlide/wb_sql_editor_form_ui.cpp | 15 +- .../wbprivate/sqlide/wb_sql_editor_help.cpp | 52 +- .../wbprivate/sqlide/wb_sql_editor_panel.cpp | 52 +- .../sqlide/wb_sql_editor_result_panel.cpp | 28 +- .../sqlide/wb_sql_editor_result_panel.h | 6 +- .../sqlide/wb_sql_editor_snippets.cpp | 16 +- .../sqlide/wb_sql_editor_tree_controller.cpp | 155 +- .../sqlide/wb_sql_editor_tree_controller.h | 7 +- backend/wbprivate/workbench/stdafx.h | 3 + .../unit-tests/wb_copy_paste_test.cpp | 4 +- .../wbprivate/workbench/upgrade_helper.cpp | 4 +- backend/wbprivate/workbench/wb_command_ui.cpp | 20 +- .../wbprivate/workbench/wb_context_names.h | 1 + backend/wbprivate/workbench/wb_context_ui.cpp | 70 +- backend/wbprivate/workbench/wb_context_ui.h | 5 +- .../workbench/wb_context_ui_home.cpp | 732 +- backend/wbprivate/workbench/wb_db_schema.cpp | 10 +- backend/wbprivate/workbench/wb_model_file.cpp | 6 +- backend/wbprivate/workbench/wb_model_file.h | 2 +- .../workbench/wb_model_file_upgrade.cpp | 18 +- backend/wbprivate/workbench/wb_overview.cpp | 2 +- backend/wbprivate/workbench/wb_tunnel.cpp | 68 +- backend/wbprivate/workbench/wb_version.h | 7 +- backend/wbprivate/workbench/wmi.cpp | 80 +- backend/wbpublic/CMakeLists.txt | 9 +- backend/wbpublic/grt/common.cpp | 2 +- backend/wbpublic/grt/common.h | 8 - backend/wbpublic/grt/editor_base.cpp | 8 +- backend/wbpublic/grt/grt_dispatcher.h | 38 +- backend/wbpublic/grt/grt_manager.cpp | 49 +- backend/wbpublic/grt/grt_manager.h | 5 +- backend/wbpublic/grt/grt_shell.cpp | 6 +- backend/wbpublic/grt/grt_threaded_task.cpp | 10 +- backend/wbpublic/grt/plugin_manager.cpp | 77 +- backend/wbpublic/grt/spatial_handler.cpp | 34 +- backend/wbpublic/grt/validation_manager.cpp | 6 +- backend/wbpublic/grtdb/db_object_filter.cpp | 2 +- backend/wbpublic/grtdb/db_object_helpers.cpp | 54 +- .../grtdb/db_object_master_filter.cpp | 2 +- backend/wbpublic/grtdb/editor_dbobject.h | 4 +- .../wbpublic/grtdb/editor_routinegroup.cpp | 2 +- backend/wbpublic/grtdb/editor_table.cpp | 44 +- .../grtsqlparser/mysql_parser_services.cpp | 4 +- .../grtsqlparser/mysql_parser_services.h | 4 +- .../wbpublic/grtsqlparser/sql_parser_base.cpp | 10 +- backend/wbpublic/grtsqlparser/sql_specifics.h | 8 +- backend/wbpublic/grtui/binary_data_editor.cpp | 109 +- backend/wbpublic/grtui/connection_page.h | 4 +- backend/wbpublic/grtui/db_conn_be.cpp | 4 +- backend/wbpublic/grtui/geom_draw_box.cpp | 2 +- .../wbpublic/grtui/grtdb_connect_panel.cpp | 117 +- .../grtui/grtdb_connection_editor.cpp | 18 +- .../wbpublic/grtui/wizard_progress_page.cpp | 22 +- .../wbpublic/objimpl/db.ng/db_ng_Editor.cpp | 56 + backend/wbpublic/objimpl/db.ng/db_ng_Editor.h | 31 + backend/wbpublic/objimpl/db.ng/db_ng_Ide.cpp | 53 + backend/wbpublic/objimpl/db.ng/db_ng_Ide.h | 32 + .../wbpublic/objimpl/db.ng/db_ng_Sheet.cpp | 64 + backend/wbpublic/objimpl/db.ng/db_ng_Sheet.h | 34 + .../objimpl/db.query/db_query_Resultset.cpp | 4 +- backend/wbpublic/objimpl/db/db_Column.cpp | 64 +- .../wrapper/parser_ContextReference.cpp | 44 +- .../wrapper/parser_ContextReference_impl.h | 4 +- .../wbpublic/sqlide/column_width_cache.cpp | 16 +- backend/wbpublic/sqlide/recordset_be.cpp | 11 +- backend/wbpublic/sqlide/recordset_be.h | 10 +- .../wbpublic/sqlide/recordset_cdbc_storage.h | 4 +- .../wbpublic/sqlide/recordset_data_storage.h | 8 +- .../wbpublic/sqlide/recordset_sql_storage.h | 4 +- .../sqlide/recordset_sqlite_storage.h | 4 +- .../recordset_table_inserts_storage.cpp | 2 +- .../sqlide/recordset_table_inserts_storage.h | 6 +- .../sqlide/recordset_text_storage.cpp | 4 +- .../wbpublic/sqlide/recordset_text_storage.h | 6 +- backend/wbpublic/sqlide/sql_editor_be.cpp | 329 +- backend/wbpublic/sqlide/sql_editor_be.h | 48 +- .../wbpublic/sqlide/sql_script_run_wizard.cpp | 6 +- .../mysql_objects_name_cache_test.cpp | 340 + .../wbpublic/sqlide/unit-tests/sql_editor.cpp | 2 +- backend/wbpublic/sqlide/var_grid_model_be.cpp | 8 +- backend/wbpublic/wbcanvas/base_bridge.cpp | 10 +- backend/wbpublic/wbpublic.be.vcxproj | 41 +- backend/wbpublic/wbpublic.be.vcxproj.filters | 46 +- .../sqlide.wr/src/SQLEditorFormWrapper.h | 6 +- .../windows/sqlide.wr/src/recordset_wr.cpp | 2 +- .../windows/wbprivate.wr/src/WbCallbacks.cpp | 2 +- .../windows/wbpublic.wr/src/DelegateWrapper.h | 2 +- backend/windows/wbpublic.wr/src/GrtManager.h | 36 +- build/debian.in/changelog | 27 +- build/debian.in/control | 2 +- build/debian.in/rules | 118 +- build/gen_deb_sources.py | 10 +- build/make_dmg.sh | 11 +- build/msi/resources/MySQLWorkbench.X.ico | Bin 0 -> 44189 bytes build/msi/source/mysql_workbench.xml | 1 + build/msi/source/mysql_workbench_fragment.xml | 76 +- build/mysql-workbench.spec.in | 257 +- ext/scintilla/cocoa/ScintillaView.mm | 13 +- frontend/common/advanced_sidebar.cpp | 46 +- frontend/common/advanced_sidebar.h | 2 +- frontend/common/grt_code_editor.cpp | 2 +- frontend/common/grt_python_debugger.cpp | 2 +- frontend/common/grt_shell_window.cpp | 50 +- .../common/new_server_instance_wizard.cpp | 8 +- frontend/common/output_view.cpp | 2 +- frontend/common/plugin_install_window.cpp | 6 +- frontend/common/plugin_manager_window.cpp | 16 +- frontend/common/preferences_form.cpp | 153 +- frontend/common/server_instance_editor.cpp | 55 +- frontend/linux/linux_utilities/CMakeLists.txt | 1 + .../linux/linux_utilities/form_view_base.cpp | 18 +- .../linux/linux_utilities/gtk_helpers.cpp | 5 +- frontend/linux/linux_utilities/main_app.h | 64 + .../linux_utilities/plugin_editor_base.cpp | 6 +- .../linux/linux_utilities/widget_saver.cpp | 6 +- frontend/linux/sqlide/CMakeLists.txt | 1 + frontend/linux/sqlide/recordset_view.cpp | 2 +- frontend/linux/workbench/CMakeLists.txt | 5 +- .../linux/workbench/diagram_size_form.cpp | 2 +- frontend/linux/workbench/main_form.cpp | 35 +- .../linux/workbench/model_diagram_panel.cpp | 14 +- frontend/linux/workbench/model_panel.cpp | 2 +- frontend/linux/workbench/mysql-workbench.in | 1 + frontend/linux/workbench/overview_panel.cpp | 2 +- frontend/linux/workbench/program.h | 5 +- frontend/linux/workbench/properties_tree.cpp | 6 +- frontend/linux/workbench/sqlide_form.cpp | 10 +- frontend/linux/workbench/workbench.css | 33 + frontend/mac/English.lproj/DiagramOptions.xib | 20 +- .../mac/English.lproj/IconCollectionView.xib | 27 +- frontend/mac/English.lproj/MainMenu.xib | 8 +- frontend/mac/English.lproj/MainWindow.xib | 12 +- .../mac/English.lproj/WbResultsetView.xib | 15 +- frontend/mac/components/MTabSwitcher.h | 1 + frontend/mac/components/MTabSwitcher.mm | 1695 + frontend/mac/components/MVerticalLayoutView.m | 1 + frontend/mac/components/WBBasePanel.mm | 5 - .../mac/components/WBColorCell/WBColorCell.m | 7 +- frontend/mac/components/WBSidebarPanel.mm | 25 +- .../Sources/GrayTabs/WBGrayTabView.m | 31 +- frontend/mac/mforms/RecordGridView.mm | 2 +- frontend/mac/plugin/WBPluginEditorBase.mm | 14 +- frontend/mac/plugin/WBPluginWindowBase.h | 1 - frontend/mac/plugin/WBPluginWindowBase.mm | 4 +- frontend/mac/resultset/MResultsetViewer.mm | 12 +- frontend/mac/sqlide/WBSQLQueryPanel.mm | 10 +- frontend/mac/sqlide/WBSQLQueryPanel.xib | 33 +- frontend/mac/utilities/MCPPUtilities.mm | 19 +- .../mac/workbench/MainWindowController.mm | 10 +- frontend/mac/workbench/WBMFormsPluginPanel.h | 6 +- frontend/mac/workbench/WBMFormsPluginPanel.mm | 6 - frontend/mac/workbench/WBMainController.mm | 17 +- frontend/mac/workbench/WBModelDiagram.xib | 37 +- frontend/mac/workbench/WBModelOverview.xib | 31 +- .../mac/workbench/WBModelOverviewPanel.mm | 2 - frontend/mac/workbench/WBOverviewPanel.mm | 4 +- frontend/mac/workbench/WBPluginPanel.mm | 2 +- .../mac/workbench/WBPluginWindowController.mm | 2 +- frontend/mac/workbench/WBSQLQueryUI.mm | 6 +- .../MySQLWorkbench/Properties/AssemblyInfo.cs | 4 +- generated/CMakeLists.txt | 1 + generated/Makefile | 3 + generated/generate.cmd | 1 + generated/grts/structs.app.h | 11 +- generated/grts/structs.db.h | 5 +- generated/grts/structs.db.mgmt.h | 13 +- generated/grts/structs.db.migration.h | 16 +- generated/grts/structs.db.mssql.h | 5 +- generated/grts/structs.db.mysql.h | 5 +- generated/grts/structs.db.ng.h | 381 + generated/grts/structs.db.query.h | 26 +- generated/grts/structs.db.sybase.h | 5 +- generated/grts/structs.eer.h | 11 +- generated/grts/structs.h | 2 + generated/grts/structs.model.h | 22 +- generated/grts/structs.ui.h | 23 +- generated/grts/structs.workbench.h | 46 +- generated/grts/structs.workbench.logical.h | 15 +- generated/grts/structs.workbench.model.h | 17 +- .../grts/structs.workbench.model.reporting.h | 11 +- generated/grts/structs.workbench.physical.h | 29 +- generated/grts/structs.wrapper.h | 19 +- images/home/CMakeLists.txt | 20 +- images/home/sidebar_migration.png | Bin 0 -> 3021 bytes images/home/sidebar_migration@2x.png | Bin 0 -> 2246 bytes images/home/sidebar_modeling.png | Bin 0 -> 4121 bytes images/home/sidebar_modeling@2x.png | Bin 0 -> 4482 bytes images/home/sidebar_wb.png | Bin 0 -> 1951 bytes images/home/sidebar_wb@2x.png | Bin 0 -> 4348 bytes images/home/sidebar_wbx.png | Bin 0 -> 2266 bytes images/home/sidebar_wbx@2x.png | Bin 0 -> 4038 bytes images/home/wb_x_js_tile.png | Bin 0 -> 5370 bytes images/home/wb_x_js_tile@2x.png | Bin 0 -> 12063 bytes images/home/wb_x_py_tile.png | Bin 0 -> 5505 bytes images/home/wb_x_py_tile@2x.png | Bin 0 -> 12820 bytes images/home/wb_x_tile.png | Bin 0 -> 7721 bytes images/home/wb_x_tile@2x.png | Bin 0 -> 19514 bytes images/ui/CMakeLists.txt | 3 + images/ui/folder.png | Bin 0 -> 3630 bytes images/ui/mac/wb_tab-close-white.png | Bin 0 -> 892 bytes images/ui/mac/wb_tab-close-white@2x.png | Bin 0 -> 926 bytes images/ui/mac/wb_tab-close_high-white.png | Bin 0 -> 863 bytes images/ui/mac/wb_tab-close_high-white@2x.png | Bin 0 -> 896 bytes images/ui/session-switch.png | Bin 0 -> 3561 bytes images/ui/session.png | Bin 0 -> 4139 bytes library/base.wr/src/LogWrapper.cpp | 14 +- library/base.wr/src/LogWrapper.h | 23 +- library/base/CMakeLists.txt | 1 + library/base/base.vcxproj.filters | 32 +- library/base/base/c++helpers.h | 35 + library/base/base/common.h | 8 + library/base/base/data_types.h | 90 +- library/base/base/drawing.h | 14 +- library/base/base/geometry.h | 6 +- library/base/base/jsonparser.h | 6 +- library/base/base/log.h | 68 +- library/base/base/mem_stat.h | 35 + library/base/base/session_wrapper.h | 28 + library/base/base/string_utilities.h | 21 +- library/base/base/threading.h | 16 +- library/base/base/util_functions.h | 4 +- library/base/boost_fix.cpp | 21 + library/base/config_file.cpp | 6 +- library/base/data_types.cpp | 27 +- library/base/drawing_gtk.cpp | 4 + library/base/drawing_win.cpp | 6 +- library/base/event_log.cpp | 352 + library/base/jsonparser.cpp | 42 +- library/base/log.cpp | 82 +- library/base/mem_stat.cpp | 74 + library/base/notifications.cpp | 12 +- library/base/profiling.cpp | 12 +- library/base/session_wrapper.cpp | 108 + library/base/stdafx.h | 5 +- library/base/string_utilities.cpp | 22 +- library/base/threaded_timer.cpp | 8 +- library/base/threading.cpp | 114 +- .../base/unit-tests/string_utilities_test.cpp | 76 +- library/base/util_functions.cpp | 63 +- library/cdbc/src/driver_manager.cpp | 22 + library/cdbc/src/driver_manager.h | 1 + library/forms/CMakeLists.txt | 2 +- library/forms/ProjectForm.cpp | 160 + library/forms/app.cpp | 2 +- library/forms/cocoa/EmbedableFindPane.xib | 19 +- library/forms/cocoa/MFBox.h | 13 +- library/forms/cocoa/MFBox.mm | 4 +- library/forms/cocoa/MFButton.mm | 49 +- library/forms/cocoa/MFCodeEditor.mm | 37 +- library/forms/cocoa/MFContainerBase.h | 3 +- library/forms/cocoa/MFContainerBase.mm | 31 +- library/forms/cocoa/MFDrawBox.h | 6 +- library/forms/cocoa/MFDrawBox.mm | 21 +- library/forms/cocoa/MFFindPanel.mm | 4 +- library/forms/cocoa/MFForm.h | 9 +- library/forms/cocoa/MFForm.mm | 132 +- library/forms/cocoa/MFImageBox.h | 3 +- library/forms/cocoa/MFImageBox.mm | 23 +- library/forms/cocoa/MFLabel.h | 4 +- library/forms/cocoa/MFLabel.mm | 50 +- library/forms/cocoa/MFListBox.mm | 24 +- library/forms/cocoa/MFMForms.mm | 6 +- library/forms/cocoa/MFMenu.mm | 30 +- library/forms/cocoa/MFPanel.mm | 190 +- library/forms/cocoa/MFProgressBar.h | 3 +- library/forms/cocoa/MFProgressBar.mm | 16 +- library/forms/cocoa/MFRadioButton.mm | 6 +- library/forms/cocoa/MFScrollPanel.mm | 63 +- library/forms/cocoa/MFSplitter.mm | 56 +- library/forms/cocoa/MFTabView.mm | 43 +- library/forms/cocoa/MFTable.h | 26 +- library/forms/cocoa/MFTextBox.mm | 34 +- library/forms/cocoa/MFTextEntry.mm | 23 +- library/forms/cocoa/MFToolBar.mm | 140 +- library/forms/cocoa/MFTreeView.mm | 88 +- library/forms/cocoa/MFUtilities.mm | 54 +- library/forms/cocoa/MFView.h | 29 +- library/forms/cocoa/MFView.mm | 291 +- library/forms/cocoa/MFWizard.mm | 6 - library/forms/cocoa/MHudController.mm | 6 +- library/forms/code_editor.cpp | 173 +- library/forms/filechooser.cpp | 2 +- library/forms/gtk/lf_code_editor.h | 4 +- library/forms/gtk/lf_form.h | 5 +- library/forms/gtk/lf_imagebox.h | 2 +- library/forms/gtk/lf_popup.h | 4 +- library/forms/gtk/lf_treeview.h | 1 + library/forms/gtk/lf_view.h | 12 +- library/forms/gtk/lf_wizard.h | 3 +- library/forms/gtk/src/lf_code_editor.cpp | 9 +- library/forms/gtk/src/lf_drawbox.cpp | 2 +- library/forms/gtk/src/lf_listbox.cpp | 4 +- library/forms/gtk/src/lf_menubar.cpp | 18 +- library/forms/gtk/src/lf_panel.cpp | 1 + library/forms/gtk/src/lf_popover.cpp | 5 +- library/forms/gtk/src/lf_popup.cpp | 10 +- library/forms/gtk/src/lf_scrollpanel.cpp | 3 +- library/forms/gtk/src/lf_textbox.cpp | 62 +- library/forms/gtk/src/lf_textentry.cpp | 6 +- library/forms/gtk/src/lf_toolbar.cpp | 43 +- library/forms/gtk/src/lf_treeview.cpp | 4 +- library/forms/gtk/src/lf_utilities.cpp | 19 +- library/forms/gtk/src/lf_view.cpp | 26 +- library/forms/gtk/src/lf_wizard.cpp | 14 +- library/forms/home_screen.cpp | 165 +- library/forms/home_screen_connections.cpp | 18 +- library/forms/home_screen_documents.cpp | 6 +- library/forms/home_screen_x_connections.cpp | 366 +- library/forms/jsonview.cpp | 215 +- library/forms/menubar.cpp | 2 +- library/forms/mforms.cpp | 6 +- library/forms/mforms/ProjectForm.h | 49 + library/forms/mforms/appview.h | 6 +- library/forms/mforms/box.h | 11 +- library/forms/mforms/code_editor.h | 21 +- library/forms/mforms/home_screen.h | 17 +- library/forms/mforms/home_screen_helpers.h | 15 +- .../forms/mforms/home_screen_x_connections.h | 23 +- library/forms/mforms/jsonview.h | 27 +- library/forms/mforms/textbox.h | 16 - library/forms/mforms/toolbar.h | 9 +- library/forms/mforms/treeview.h | 11 + library/forms/mforms/utilities.h | 36 +- library/forms/mforms/view.h | 14 +- library/forms/mysql.forms.vcxproj | 5 +- library/forms/mysql.forms.vcxproj.filters | 13 +- library/forms/password_cache.cpp | 12 +- library/forms/simpleform.cpp | 39 +- library/forms/stdafx.h | 7 +- library/forms/stub/src/stub_app.cpp | 2 - library/forms/stub/src/stub_utilities.cpp | 12 +- library/forms/stub/src/stub_view.cpp | 6 +- library/forms/stub/stub_app.h | 5 - library/forms/stub/stub_view.h | 6 +- library/forms/swig/mforms.i | 4 +- library/forms/tabswitcher.cpp | 19 +- library/forms/tabview.cpp | 6 +- library/forms/toolbar.cpp | 2 +- library/forms/treeview.cpp | 113 +- library/forms/unit-tests/json_test.cpp | 2 +- library/forms/utilities.cpp | 35 +- library/forms/view.cpp | 18 +- .../forms/winforms/mforms.wr.vcxproj.filters | 2 +- library/forms/winforms/src/wf_app.h | 2 - library/forms/winforms/src/wf_code_editor.cpp | 55 +- library/forms/winforms/src/wf_code_editor.h | 4 + library/forms/winforms/src/wf_form.cpp | 16 +- library/forms/winforms/src/wf_form.h | 2 +- library/forms/winforms/src/wf_gridview.cpp | 17 - library/forms/winforms/src/wf_hypertext.cpp | 4 +- library/forms/winforms/src/wf_label.cpp | 4 +- library/forms/winforms/src/wf_listbox.cpp | 2 +- library/forms/winforms/src/wf_mforms.cpp | 6 +- library/forms/winforms/src/wf_progressbar.cpp | 25 +- library/forms/winforms/src/wf_tabview.cpp | 4 +- library/forms/winforms/src/wf_textbox.cpp | 27 +- library/forms/winforms/src/wf_textbox.h | 3 - library/forms/winforms/src/wf_treenode.cpp | 11 + library/forms/winforms/src/wf_treenode.h | 1 + library/forms/winforms/src/wf_treeview.cpp | 54 +- library/forms/winforms/src/wf_treeview.h | 8 + library/forms/winforms/src/wf_utilities.cpp | 100 +- library/forms/winforms/src/wf_view.cpp | 24 +- library/forms/winforms/src/wf_view.h | 7 +- library/forms/winforms/src/wf_wizard.cpp | 8 +- library/grt/src/diff/changefactory.cpp | 12 +- library/grt/src/diff/grtdiff.cpp | 4 +- library/grt/src/diff/grtlistdiff.cpp | 2 +- library/grt/src/grt.h | 11 +- library/grt/src/grtpp_helper.cpp | 80 +- library/grt/src/grtpp_module_cpp.cpp | 4 +- library/grt/src/grtpp_module_python.cpp | 6 +- library/grt/src/grtpp_shell.cpp | 60 +- library/grt/src/grtpp_undo_manager.cpp | 8 +- library/grt/src/grtpp_util.cpp | 2 +- library/grt/src/python_context.cpp | 26 +- library/grt/src/serializer.cpp | 4 +- library/grt/src/unserializer.cpp | 16 +- library/grt/unit-tests/diff/comparer_test.cpp | 143 +- .../unit-tests/diff/grtdiff_alter_test.cpp | 124 +- library/mysql.canvas/src/mdc_back_layer.cpp | 4 +- library/mysql.canvas/src/mdc_canvas_item.cpp | 4 +- .../src/mdc_canvas_view_macosx.cpp | 6 +- .../mysql.canvas/src/mdc_canvas_view_macosx.h | 3 +- .../src/mdc_canvas_view_opengl.cpp | 4 +- .../src/mdc_canvas_view_windows.cpp | 24 +- library/parsers/CMakeLists.txt | 75 + .../code-completion/mysql-code-completion.cpp | 42 +- .../code-completion/mysql-code-completion.h | 60 + .../mysql_object_names_cache.cpp | 72 +- .../mysql_object_names_cache.h | 220 + library/parsers/ecma-parser.cpp | 43 +- library/parsers/grammar-parser/ANTLRv3Lexer.c | 65555 ++++++++++++++++ library/parsers/grammar-parser/ANTLRv3Lexer.h | 698 + .../parsers/grammar-parser/ANTLRv3Parser.c | 18821 +++++ .../parsers/grammar-parser/ANTLRv3Parser.h | 1216 + library/parsers/grammars/CMakeLists.txt | 45 + library/parsers/grammars/ECMA.g | 33 +- library/parsers/grammars/MySQL.g | 5063 ++ library/parsers/grammars/MySQLSimpleParser.g | 469 +- library/parsers/grammars/build-parsers | 79 + library/parsers/grammars/build-parsers-mac | 25 + library/parsers/grammars/build-parsers.cmd | 26 + library/parsers/grammars/predefined.tokens | 681 + library/parsers/grammars/readme.txt | 6 + .../English.lproj/InfoPlist.strings | 2 + .../test.parser/English.lproj/MainMenu.xib | 951 + library/parsers/grammars/test.parser/main.m | 14 + .../mysql.parser.xcodeproj/project.pbxproj | 513 + .../test.parser/mysql_parser-Info.plist | 32 + .../test.parser/mysql_parserAppDelegate.h | 56 + .../test.parser/mysql_parserAppDelegate.m | 1058 + .../test.parser/mysql_parser_Prefix.pch | 7 + library/parsers/mysql-parser-common.cpp | 767 + library/parsers/mysql-parser-common.h | 76 + library/parsers/mysql-parser.cpp | 224 +- library/parsers/mysql-parser.h | 79 + library/parsers/mysql-recognition-types.h | 216 + library/parsers/mysql-scanner.cpp | 1385 + library/parsers/mysql-scanner.h | 106 + library/parsers/mysql-syntax-check.cpp | 185 + library/parsers/mysql-syntax-check.h | 47 + library/parsers/parsers-common.cpp | 57 +- library/parsers/parsers-common.h | 163 + library/parsers/parsers.vcxproj.filters | 150 +- library/parsers/stdafx.cpp | 22 + .../parsers/unit-tests/mysql_parser_test.cpp | 906 + library/sql.parser/source/CMakeLists.txt | 5 +- library/sql.parser/source/m_string.h | 33 +- modules/db.mysql.parser/CMakeLists.txt | 2 +- .../src/mysql_parser_module.cpp | 780 +- .../db.mysql.parser/src/mysql_parser_module.h | 123 +- modules/db.mysql.parser/src/stdafx.h | 1 + .../unit-tests/mysql_parser_module_tests.cpp | 2 +- modules/db.mysql.sqlparser/CMakeLists.txt | 8 +- .../src/db.mysql.sqlparser.cpp | 2 + .../src/mysql_invalid_sql_parser.cpp | 2 +- .../src/mysql_invalid_sql_parser.h | 10 +- .../src/mysql_sql_facade.cpp | 24 +- .../src/mysql_sql_inserts_loader.cpp | 2 +- .../src/mysql_sql_inserts_loader.h | 12 +- .../src/mysql_sql_normalizer.cpp | 2 +- .../src/mysql_sql_normalizer.h | 10 +- .../src/mysql_sql_parser.cpp | 2 +- .../db.mysql.sqlparser/src/mysql_sql_parser.h | 12 +- .../src/mysql_sql_schema_rename.cpp | 4 +- .../src/mysql_sql_schema_rename.h | 12 +- .../src/mysql_sql_semantic_check.h | 12 +- .../src/mysql_sql_specifics.cpp | 4 +- .../src/mysql_sql_specifics.h | 12 +- .../src/mysql_sql_statement_decomposer.cpp | 2 +- .../src/mysql_sql_statement_decomposer.h | 12 +- .../src/mysql_sql_syntax_check.cpp | 4 +- .../src/mysql_sql_syntax_check.h | 12 +- .../unit-tests/test_mysql_sql_parser.cpp | 2 +- .../db.mysql/src/db_mysql_catalog_report.h | 2 +- modules/db.mysql/src/db_mysql_params.cpp | 2 +- modules/db.mysql/src/module_db_mysql.cpp | 2 +- .../db.mysql/unit-tests/sql_create_test.cpp | 2 +- modules/interfaces/plugin.h | 1 - modules/utilities/CMakeLists.txt | 1 + modules/utilities/src/utilities.cpp | 2 +- modules/wb.model/src/reporting.cpp | 4 +- modules/wb.model/src/wb_model.cpp | 4 +- .../src/wb_mysql_import_dbd4.cpp | 32 +- .../backend/db_mysql_diff_reporting.cpp | 4 +- .../backend/mysql_relationship_editor.cpp | 2 +- .../backend/mysql_schema_editor.cpp | 4 +- plugins/db.mysql.editors/backend/stdafx.h | 1 + plugins/db.mysql.editors/linux/CMakeLists.txt | 2 +- .../linux/mysql_editor_priv_page.cpp | 2 +- .../macosx/MySQLRelationshipEditor.xib | 911 +- .../macosx/MySQLRoutineEditor.xib | 906 +- .../macosx/MySQLRoutineGroupEditor.xib | 907 +- .../macosx/MySQLSchemaEditor.xib | 903 +- .../macosx/MySQLTableEditor.xib | 277 +- .../macosx/MySQLViewEditor.xib | 903 +- .../db.mysql.editors/macosx/PrivilegesTab.xib | 46 +- .../db.mysql.editors/macosx/RoleEditor.xib | 19 +- .../db.mysql.editors/macosx/UserEditor.xib | 919 +- plugins/db.mysql/CMakeLists.txt | 1 + .../db.mysql/backend/db_alter_script_be.cpp | 12 +- .../db.mysql/backend/db_mysql_sql_export.cpp | 10 +- .../backend/db_mysql_sql_script_sync.cpp | 34 +- .../backend/db_mysql_validation_page.cpp | 10 +- plugins/db.mysql/backend/db_plugin_be.cpp | 103 +- plugins/db.mysql/backend/db_rev_eng_be.cpp | 2 +- plugins/db.mysql/backend/db_rev_eng_be.h | 2 +- plugins/db.mysql/backend/diff_tree.cpp | 2 +- plugins/db.mysql/backend/diff_tree.h | 18 +- plugins/db.mysql/backend/sql_import_be.cpp | 4 +- plugins/db.mysql/backend/sql_import_be.h | 2 +- .../unit-tests/db_mysql_plugin_test.cpp | 218 +- .../unit-tests/model_diff_apply_test.cpp | 2 +- plugins/db.mysql/backend/wb_plugin_be.cpp | 8 +- plugins/db.mysql/db.mysql.wbp.vcxproj | 12 +- .../db.mysql/frontend/db_forward_engineer.cpp | 4 +- .../frontend/db_forward_engineer_script.cpp | 2 +- .../db.mysql/frontend/db_synchronize_any.cpp | 6 +- .../frontend/multi_source_selector_page.h | 24 +- .../frontend/synchronize_differences_page.cpp | 8 +- plugins/db.search/DbSearchPanel.cpp | 18 +- plugins/db.search/register_plugin.cpp | 16 +- plugins/migration/copytable/converter.cpp | 8 +- plugins/migration/copytable/copytable.cpp | 624 +- plugins/migration/copytable/main.cpp | 10 +- .../wb.admin/frontend/wb_admin_connections.py | 22 +- plugins/wb.admin/frontend/wb_admin_logs.py | 2 +- .../wb.admin/frontend/wb_admin_perfschema.py | 111 +- .../wb.admin/frontend/wb_admin_security.py | 22 +- .../frontend/wb_admin_server_status.py | 10 +- plugins/wb.admin/frontend/wb_admin_utils.py | 4 +- .../backend/wb_editor_storednote.cpp | 4 +- plugins/wb.model.editors/linux/CMakeLists.txt | 2 +- .../linux/editor_image_fe.cpp | 2 +- .../wb.model.editors/linux/editor_note_fe.cpp | 2 +- .../linux/editor_stored_note_fe.cpp | 2 +- .../macosx/WbModelImageEditor.mm | 14 +- .../macosx/WbModelImageEditor.xib | 7 +- .../macosx/WbModelNoteEditor.xib | 135 +- .../macosx/WbModelStoredNoteEditor.mm | 25 +- .../macosx/WbModelStoredNoteEditor.xib | 6 +- .../macosx/WbPhysicalLayerEditor.xib | 7 +- plugins/wb.model.snippets/CMakeLists.txt | 1 + .../wb.printing/linux/wb_printing_linux.cpp | 9 + plugins/wb.printing/macosx/PrintDialog.mm | 2 +- .../wb.printing/windows/wrapper/stdafx.cpp | 38 +- prefix/db.mysql.parser.grt_prefix.h | 2 + prefix/db.mysql.sqlparser.grt_prefix.h | 1 + prefix/mforms_prefix.h | 3 +- prefix/mysql.canvas_prefix.h | 1 + prefix/parsers_prefix.h | 59 + prefix/wb.ng.grt.prefix.h | 22 + prefix/wb.ng.wbp_prefix.h | 36 + prefix/wbprivate.be_prefix.h | 6 + prefix/wbpublic.be_prefix.h | 1 + res/grt/CMakeLists.txt | 1 + res/grt/structs.db.ng.xml | 33 + res/grt/structs.workbench.xml | 3 + res/wbdata/CMakeLists.txt | 1 - res/wbdata/code_editor.xml | 101 +- res/wbdata/main_menu.xml | 108 +- 600 files changed, 115342 insertions(+), 7567 deletions(-) create mode 100644 MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/utilities.grt.xcscheme create mode 100644 backend/wbpublic/objimpl/db.ng/db_ng_Editor.cpp create mode 100644 backend/wbpublic/objimpl/db.ng/db_ng_Editor.h create mode 100644 backend/wbpublic/objimpl/db.ng/db_ng_Ide.cpp create mode 100644 backend/wbpublic/objimpl/db.ng/db_ng_Ide.h create mode 100644 backend/wbpublic/objimpl/db.ng/db_ng_Sheet.cpp create mode 100644 backend/wbpublic/objimpl/db.ng/db_ng_Sheet.h create mode 100644 backend/wbpublic/sqlide/unit-tests/mysql_objects_name_cache_test.cpp create mode 100644 build/msi/resources/MySQLWorkbench.X.ico create mode 100644 frontend/linux/linux_utilities/main_app.h create mode 100644 frontend/linux/workbench/workbench.css create mode 100644 frontend/mac/components/MTabSwitcher.mm create mode 100644 generated/grts/structs.db.ng.h create mode 100644 images/home/sidebar_migration.png create mode 100644 images/home/sidebar_migration@2x.png create mode 100644 images/home/sidebar_modeling.png create mode 100644 images/home/sidebar_modeling@2x.png create mode 100644 images/home/sidebar_wb.png create mode 100644 images/home/sidebar_wb@2x.png create mode 100644 images/home/sidebar_wbx.png create mode 100644 images/home/sidebar_wbx@2x.png create mode 100644 images/home/wb_x_js_tile.png create mode 100644 images/home/wb_x_js_tile@2x.png create mode 100644 images/home/wb_x_py_tile.png create mode 100644 images/home/wb_x_py_tile@2x.png create mode 100644 images/home/wb_x_tile.png create mode 100644 images/home/wb_x_tile@2x.png create mode 100644 images/ui/folder.png create mode 100644 images/ui/mac/wb_tab-close-white.png create mode 100644 images/ui/mac/wb_tab-close-white@2x.png create mode 100644 images/ui/mac/wb_tab-close_high-white.png create mode 100644 images/ui/mac/wb_tab-close_high-white@2x.png create mode 100644 images/ui/session-switch.png create mode 100644 images/ui/session.png create mode 100644 library/base/base/c++helpers.h create mode 100644 library/base/base/mem_stat.h create mode 100644 library/base/base/session_wrapper.h create mode 100644 library/base/boost_fix.cpp create mode 100644 library/base/event_log.cpp create mode 100644 library/base/mem_stat.cpp create mode 100644 library/base/session_wrapper.cpp create mode 100644 library/forms/ProjectForm.cpp create mode 100644 library/forms/mforms/ProjectForm.h create mode 100644 library/parsers/CMakeLists.txt create mode 100644 library/parsers/code-completion/mysql-code-completion.h create mode 100644 library/parsers/code-completion/mysql_object_names_cache.h create mode 100644 library/parsers/grammar-parser/ANTLRv3Lexer.c create mode 100644 library/parsers/grammar-parser/ANTLRv3Lexer.h create mode 100644 library/parsers/grammar-parser/ANTLRv3Parser.c create mode 100644 library/parsers/grammar-parser/ANTLRv3Parser.h create mode 100644 library/parsers/grammars/CMakeLists.txt create mode 100644 library/parsers/grammars/MySQL.g create mode 100644 library/parsers/grammars/build-parsers create mode 100644 library/parsers/grammars/build-parsers-mac create mode 100644 library/parsers/grammars/build-parsers.cmd create mode 100644 library/parsers/grammars/predefined.tokens create mode 100644 library/parsers/grammars/readme.txt create mode 100644 library/parsers/grammars/test.parser/English.lproj/InfoPlist.strings create mode 100644 library/parsers/grammars/test.parser/English.lproj/MainMenu.xib create mode 100644 library/parsers/grammars/test.parser/main.m create mode 100644 library/parsers/grammars/test.parser/mysql.parser.xcodeproj/project.pbxproj create mode 100644 library/parsers/grammars/test.parser/mysql_parser-Info.plist create mode 100644 library/parsers/grammars/test.parser/mysql_parserAppDelegate.h create mode 100644 library/parsers/grammars/test.parser/mysql_parserAppDelegate.m create mode 100644 library/parsers/grammars/test.parser/mysql_parser_Prefix.pch create mode 100644 library/parsers/mysql-parser-common.cpp create mode 100644 library/parsers/mysql-parser-common.h create mode 100644 library/parsers/mysql-parser.h create mode 100644 library/parsers/mysql-recognition-types.h create mode 100644 library/parsers/mysql-scanner.cpp create mode 100644 library/parsers/mysql-scanner.h create mode 100644 library/parsers/mysql-syntax-check.cpp create mode 100644 library/parsers/mysql-syntax-check.h create mode 100644 library/parsers/parsers-common.h create mode 100644 library/parsers/stdafx.cpp create mode 100644 library/parsers/unit-tests/mysql_parser_test.cpp create mode 100644 prefix/parsers_prefix.h create mode 100644 prefix/wb.ng.grt.prefix.h create mode 100644 prefix/wb.ng.wbp_prefix.h create mode 100644 res/grt/structs.db.ng.xml diff --git a/CMakeLists.txt b/CMakeLists.txt index 1be2625b9..3de42249e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ string(STRIP ${WB_VERSION} WB_VERSION) # Look for our custom modules in cmake/Modules: set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/build/cmake/Modules/") -if(ENABLE_COTIRE) +if(ENABLE_COTIRE AND CMAKE_VERSION VERSION_GREATER "2.8.11") include(cotire) set_property(DIRECTORY PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "COPY_UNITY") endif() @@ -66,9 +66,18 @@ if (USE_BUNDLED_MYSQLDUMP) set(USE_BUNDLED_MYSQLDUMP -DHAVE_BUNDLED_MYSQLDUMP=1) endif () - +find_package(Threads) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) +include(ssl) + +IF (WITH_SSL) + MYSQL_CHECK_SSL() + MESSAGE(STATUS "SSL_LIBRARIES: ${SSL_LIBRARIES}") + MESSAGE(STATUS "SSL_DEFINES: ${SSL_DEFINES}") + MESSAGE(STATUS "SSL_INCLUDE_DIRS: ${SSL_INCLUDE_DIRS}") +ENDIF() + # All known publicly available versions of Antlr3C are buggy diff --git a/MySQLWorkbench.sln b/MySQLWorkbench.sln index 59aa01de4..9a8dc39a4 100644 --- a/MySQLWorkbench.sln +++ b/MySQLWorkbench.sln @@ -551,16 +551,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "linux", "linux", "{FADA09F1 EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "utilities.grt", "modules\utilities\utilities.grt.vcxproj", "{B94B7613-CBA5-4B30-834D-E16F414D1B1C}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "11 - MySQLWorkbench.X", "11 - MySQLWorkbench.X", "{AAF3C627-781D-449B-BFDD-3863A20E4BC5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MySQLWorkbench.X", "MySQLWorkbench.X\win\workbench\MySQLWorkbench.X.csproj", "{09F90191-FE11-4C84-9336-16153CE8A370}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqlworkbench.x.wr", "MySQLWorkbench.X\win\mysqlworkbench.x.wr\mysqlworkbench.x.wr.vcxproj", "{46C043BE-3C98-4BCE-AECA-8D31F9035062}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ide", "ide", "{610F6D5E-D80D-49B6-9F8C-DB2308901B0D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wb.x.ide", "MySQLWorkbench.X\ide\wb.x.ide\wb.x.ide.vcxproj", "{70E71FFB-AB26-498A-B756-9EE4315E5D9B}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -1401,54 +1391,6 @@ Global {B94B7613-CBA5-4B30-834D-E16F414D1B1C}.Release|x64.Build.0 = Release|x64 {B94B7613-CBA5-4B30-834D-E16F414D1B1C}.Release|x86.ActiveCfg = Release|Win32 {B94B7613-CBA5-4B30-834D-E16F414D1B1C}.Release|x86.Build.0 = Release|Win32 - {09F90191-FE11-4C84-9336-16153CE8A370}.Debug|x64.ActiveCfg = Debug|x64 - {09F90191-FE11-4C84-9336-16153CE8A370}.Debug|x64.Build.0 = Debug|x64 - {09F90191-FE11-4C84-9336-16153CE8A370}.Debug|x86.ActiveCfg = Debug|x86 - {09F90191-FE11-4C84-9336-16153CE8A370}.Debug|x86.Build.0 = Debug|x86 - {09F90191-FE11-4C84-9336-16153CE8A370}.Release_OSS|x64.ActiveCfg = Release|x64 - {09F90191-FE11-4C84-9336-16153CE8A370}.Release_OSS|x64.Build.0 = Release|x64 - {09F90191-FE11-4C84-9336-16153CE8A370}.Release_OSS|x86.ActiveCfg = Release|x86 - {09F90191-FE11-4C84-9336-16153CE8A370}.Release_OSS|x86.Build.0 = Release|x86 - {09F90191-FE11-4C84-9336-16153CE8A370}.Release_Testing|x64.ActiveCfg = Release|x64 - {09F90191-FE11-4C84-9336-16153CE8A370}.Release_Testing|x64.Build.0 = Release|x64 - {09F90191-FE11-4C84-9336-16153CE8A370}.Release_Testing|x86.ActiveCfg = Release|x86 - {09F90191-FE11-4C84-9336-16153CE8A370}.Release_Testing|x86.Build.0 = Release|x86 - {09F90191-FE11-4C84-9336-16153CE8A370}.Release|x64.ActiveCfg = Release|x64 - {09F90191-FE11-4C84-9336-16153CE8A370}.Release|x64.Build.0 = Release|x64 - {09F90191-FE11-4C84-9336-16153CE8A370}.Release|x86.ActiveCfg = Release|x86 - {09F90191-FE11-4C84-9336-16153CE8A370}.Release|x86.Build.0 = Release|x86 - {46C043BE-3C98-4BCE-AECA-8D31F9035062}.Debug|x64.ActiveCfg = Debug|x64 - {46C043BE-3C98-4BCE-AECA-8D31F9035062}.Debug|x64.Build.0 = Debug|x64 - {46C043BE-3C98-4BCE-AECA-8D31F9035062}.Debug|x86.ActiveCfg = Debug|Win32 - {46C043BE-3C98-4BCE-AECA-8D31F9035062}.Debug|x86.Build.0 = Debug|Win32 - {46C043BE-3C98-4BCE-AECA-8D31F9035062}.Release_OSS|x64.ActiveCfg = Release_OSS|x64 - {46C043BE-3C98-4BCE-AECA-8D31F9035062}.Release_OSS|x64.Build.0 = Release_OSS|x64 - {46C043BE-3C98-4BCE-AECA-8D31F9035062}.Release_OSS|x86.ActiveCfg = Release_OSS|Win32 - {46C043BE-3C98-4BCE-AECA-8D31F9035062}.Release_OSS|x86.Build.0 = Release_OSS|Win32 - {46C043BE-3C98-4BCE-AECA-8D31F9035062}.Release_Testing|x64.ActiveCfg = Release|x64 - {46C043BE-3C98-4BCE-AECA-8D31F9035062}.Release_Testing|x64.Build.0 = Release|x64 - {46C043BE-3C98-4BCE-AECA-8D31F9035062}.Release_Testing|x86.ActiveCfg = Release|Win32 - {46C043BE-3C98-4BCE-AECA-8D31F9035062}.Release_Testing|x86.Build.0 = Release|Win32 - {46C043BE-3C98-4BCE-AECA-8D31F9035062}.Release|x64.ActiveCfg = Release|x64 - {46C043BE-3C98-4BCE-AECA-8D31F9035062}.Release|x64.Build.0 = Release|x64 - {46C043BE-3C98-4BCE-AECA-8D31F9035062}.Release|x86.ActiveCfg = Release|Win32 - {46C043BE-3C98-4BCE-AECA-8D31F9035062}.Release|x86.Build.0 = Release|Win32 - {70E71FFB-AB26-498A-B756-9EE4315E5D9B}.Debug|x64.ActiveCfg = Debug|x64 - {70E71FFB-AB26-498A-B756-9EE4315E5D9B}.Debug|x64.Build.0 = Debug|x64 - {70E71FFB-AB26-498A-B756-9EE4315E5D9B}.Debug|x86.ActiveCfg = Debug|Win32 - {70E71FFB-AB26-498A-B756-9EE4315E5D9B}.Debug|x86.Build.0 = Debug|Win32 - {70E71FFB-AB26-498A-B756-9EE4315E5D9B}.Release_OSS|x64.ActiveCfg = Release_OSS|x64 - {70E71FFB-AB26-498A-B756-9EE4315E5D9B}.Release_OSS|x64.Build.0 = Release_OSS|x64 - {70E71FFB-AB26-498A-B756-9EE4315E5D9B}.Release_OSS|x86.ActiveCfg = Release_OSS|Win32 - {70E71FFB-AB26-498A-B756-9EE4315E5D9B}.Release_OSS|x86.Build.0 = Release_OSS|Win32 - {70E71FFB-AB26-498A-B756-9EE4315E5D9B}.Release_Testing|x64.ActiveCfg = Release|x64 - {70E71FFB-AB26-498A-B756-9EE4315E5D9B}.Release_Testing|x64.Build.0 = Release|x64 - {70E71FFB-AB26-498A-B756-9EE4315E5D9B}.Release_Testing|x86.ActiveCfg = Release|Win32 - {70E71FFB-AB26-498A-B756-9EE4315E5D9B}.Release_Testing|x86.Build.0 = Release|Win32 - {70E71FFB-AB26-498A-B756-9EE4315E5D9B}.Release|x64.ActiveCfg = Release|x64 - {70E71FFB-AB26-498A-B756-9EE4315E5D9B}.Release|x64.Build.0 = Release|x64 - {70E71FFB-AB26-498A-B756-9EE4315E5D9B}.Release|x86.ActiveCfg = Release|Win32 - {70E71FFB-AB26-498A-B756-9EE4315E5D9B}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1544,9 +1486,5 @@ Global {0F784E6B-0382-43A0-9251-28DE3FBA9550} = {1BBD1428-D18C-48EB-BA2E-01667E0A9A59} {FADA09F1-53E8-4972-B77B-AEF3945D383A} = {1BBD1428-D18C-48EB-BA2E-01667E0A9A59} {B94B7613-CBA5-4B30-834D-E16F414D1B1C} = {72E9A6AB-79B2-461F-B45A-924CC08E9007} - {09F90191-FE11-4C84-9336-16153CE8A370} = {AAF3C627-781D-449B-BFDD-3863A20E4BC5} - {46C043BE-3C98-4BCE-AECA-8D31F9035062} = {AAF3C627-781D-449B-BFDD-3863A20E4BC5} - {610F6D5E-D80D-49B6-9F8C-DB2308901B0D} = {AAF3C627-781D-449B-BFDD-3863A20E4BC5} - {70E71FFB-AB26-498A-B756-9EE4315E5D9B} = {610F6D5E-D80D-49B6-9F8C-DB2308901B0D} EndGlobalSection EndGlobal diff --git a/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/MySQLWorkbench.xcscheme b/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/MySQLWorkbench.xcscheme index f9dc9f123..5207dd4ea 100644 --- a/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/MySQLWorkbench.xcscheme +++ b/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/MySQLWorkbench.xcscheme @@ -46,16 +46,6 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "NO"> - - - - + + diff --git a/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/MySQLWorkbenchCom.xcscheme b/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/MySQLWorkbenchCom.xcscheme index 2411facf1..ea8582ba6 100644 --- a/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/MySQLWorkbenchCom.xcscheme +++ b/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/MySQLWorkbenchCom.xcscheme @@ -149,6 +149,12 @@ ReferencedContainer = "container:MySQLWorkbench.xcodeproj"> + + + + @@ -46,7 +46,7 @@ @@ -64,7 +64,7 @@ diff --git a/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/mysql.parser.xcscheme b/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/mysql.parser.xcscheme index 478a082bd..6b6670d39 100644 --- a/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/mysql.parser.xcscheme +++ b/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/mysql.parser.xcscheme @@ -1,6 +1,6 @@ @@ -46,8 +46,8 @@ @@ -64,8 +64,8 @@ diff --git a/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/sql.parser.xcscheme b/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/sql.parser.xcscheme index 99b7d8fb2..5f940a3c6 100644 --- a/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/sql.parser.xcscheme +++ b/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/sql.parser.xcscheme @@ -1,6 +1,6 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/wb.fabric.interface.grt.xcscheme b/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/wb.fabric.interface.grt.xcscheme index bb4253a13..bbe862f16 100644 --- a/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/wb.fabric.interface.grt.xcscheme +++ b/MySQLWorkbench.xcodeproj/xcshareddata/xcschemes/wb.fabric.interface.grt.xcscheme @@ -1,6 +1,6 @@ nul 2> nul xcopy /i /s /y /d %RES_DIR%\wbdata\data.db %TARGET_DIR%\data\. 1> nul 2> nul echo Copy parser grammar + support files -xcopy /i /s /y /d %LIBRARY_DIR%\mysql.parser\MySQL.tokens %TARGET_DIR%\data 1> nul 2> nul -xcopy /i /s /y /d %LIBRARY_DIR%\mysql.parser\grammar\MySQL.g %TARGET_DIR%\data 1> nul 2> nul +xcopy /i /s /y /d %LIBRARY_DIR%\parsers\MySQL.tokens %TARGET_DIR%\data 1> nul 2> nul +xcopy /i /s /y /d %LIBRARY_DIR%\parsers\MySQLSimpleParser.tokens %TARGET_DIR%\data 1> nul 2> nul +xcopy /i /s /y /d %LIBRARY_DIR%\parsers\ECMA.tokens %TARGET_DIR%\data 1> nul 2> nul +xcopy /i /s /y /d %LIBRARY_DIR%\parsers\grammars\MySQL.g %TARGET_DIR%\data 1> nul 2> nul +xcopy /i /s /y /d %LIBRARY_DIR%\parsers\grammars\MySQLSimpleParser.g %TARGET_DIR%\data 1> nul 2> nul +xcopy /i /s /y /d %LIBRARY_DIR%\parsers\grammars\ECMA.g %TARGET_DIR%\data 1> nul 2> null if not exist %TARGET_DIR%\mysql.profiles mkdir %TARGET_DIR%\mysql.profiles copy %RES_DIR%\mysql.profiles\*.xml %TARGET_DIR%\mysql.profiles\. 1> nul 2> nul @@ -215,6 +219,11 @@ echo * gdal library + tools ... copy %EXT_LIB_DIR%\gdal\gdal.dll %TARGET_DIR%\. copy %EXT_LIB_DIR%\gdal\*.exe %TARGET_DIR%\. +echo * ng library ... +copy %EXT_LIB_DIR%\ngshell\%2\*.dll %TARGET_DIR%\. +if not exist %TARGET_DIR%\modules\js mkdir %TARGET_DIR%\modules\js +copy %EXT_LIB_DIR%\ngshell\%2\modules\js\*.* %TARGET_DIR%\modules\js. + echo * Templates if not exist %TARGET_DIR%\modules\data\sqlide mkdir %TARGET_DIR%\modules\data\sqlide xcopy /i /s /y /d %RES_DIR%\sqlidedata\templates\*.* %TARGET_DIR%\modules\data\sqlide\. 1> nul 2> nul diff --git a/backend/wbprivate/model/wb_component_basic.cpp b/backend/wbprivate/model/wb_component_basic.cpp index ef6ce8a90..604b95bc5 100644 --- a/backend/wbprivate/model/wb_component_basic.cpp +++ b/backend/wbprivate/model/wb_component_basic.cpp @@ -439,11 +439,11 @@ model_ObjectRef WBComponentBasic::paste_object(ModelDiagramForm *view, const grt void WBComponentBasic::activate_canvas_object(const model_ObjectRef &figure, bool newwindow) { if (figure.is_instance(workbench_model_NoteFigure::static_class_name())) - bec::GRTManager::get().open_object_editor(figure, newwindow ? bec::ForceNewWindowFlag : bec::NoFlags); + bec::GRTManager::get()->open_object_editor(figure, newwindow ? bec::ForceNewWindowFlag : bec::NoFlags); else if (figure.is_instance(workbench_model_ImageFigure::static_class_name())) - bec::GRTManager::get().open_object_editor(figure, newwindow ? bec::ForceNewWindowFlag : bec::NoFlags); + bec::GRTManager::get()->open_object_editor(figure, newwindow ? bec::ForceNewWindowFlag : bec::NoFlags); else if (figure.is_instance(model_Layer::static_class_name())) - bec::GRTManager::get().open_object_editor(figure, newwindow ? bec::ForceNewWindowFlag : bec::NoFlags); + bec::GRTManager::get()->open_object_editor(figure, newwindow ? bec::ForceNewWindowFlag : bec::NoFlags); } diff --git a/backend/wbprivate/model/wb_component_physical.cpp b/backend/wbprivate/model/wb_component_physical.cpp index 3dcc739bd..18368f1cf 100644 --- a/backend/wbprivate/model/wb_component_physical.cpp +++ b/backend/wbprivate/model/wb_component_physical.cpp @@ -130,7 +130,7 @@ void WBComponentPhysical::load_app_options(bool update) if (list.is_valid()) { - log_debug("Loaded connection list, %i connections found.\n", (int)list.count()); + logDebug("Loaded connection list, %i connections found.\n", (int)list.count()); bool changed = false; while (mgmt->storedConns().count() > 0) mgmt->storedConns().remove(0); @@ -559,7 +559,7 @@ db_DatabaseObjectRef WBComponentPhysical::add_new_db_table(const db_SchemaRef &s table= schema->addNewTable(*get_parent_for_object(schema)->rdbms()->databaseObjectPackage()); if (table.has_member("tableEngine")) - table.set_member("tableEngine", bec::GRTManager::get().get_app_option("db.mysql.Table:tableEngine")); + table.set_member("tableEngine", bec::GRTManager::get()->get_app_option("db.mysql.Table:tableEngine")); undo.end(_("Create Table")); @@ -1810,12 +1810,12 @@ std::string WBComponentPhysical::get_object_tooltip(const model_ObjectRef &objec } catch(std::invalid_argument &e) { - log_warning("base::reflow_text throw an exception: %s\n", e.what()); + logWarning("base::reflow_text throw an exception: %s\n", e.what()); comment = "??Invalid text??"; } catch(std::logic_error &e) { - log_warning("base::reflow_text throw an exception: %s\n", e.what()); + logWarning("base::reflow_text throw an exception: %s\n", e.what()); comment = "??Invalid text result??"; } comment.append("\n"); @@ -1859,12 +1859,12 @@ std::string WBComponentPhysical::get_object_tooltip(const model_ObjectRef &objec } catch(std::invalid_argument &e) { - log_warning("base::reflow_text throw an exception: %s\n", e.what()); + logWarning("base::reflow_text throw an exception: %s\n", e.what()); comment = "??Invalid text??"; } catch(std::logic_error &e) { - log_warning("base::reflow_text throw an exception: %s\n", e.what()); + logWarning("base::reflow_text throw an exception: %s\n", e.what()); comment = "??Invalid text result??"; } comment.append("\n"); @@ -1886,12 +1886,12 @@ std::string WBComponentPhysical::get_object_tooltip(const model_ObjectRef &objec } catch(std::invalid_argument &e) { - log_warning("base::reflow_text throw an exception: %s\n", e.what()); + logWarning("base::reflow_text throw an exception: %s\n", e.what()); comment = "??Invalid text??"; } catch(std::logic_error &e) { - log_warning("base::reflow_text throw an exception: %s\n", e.what()); + logWarning("base::reflow_text throw an exception: %s\n", e.what()); comment = "??Invalid text result??"; } comment.append("\n"); @@ -2061,10 +2061,10 @@ void WBComponentPhysical::activate_canvas_object(const model_ObjectRef &figure, GrtObjectRef object(get_object_for_figure(figure)); if (object.is_valid()) - bec::GRTManager::get().open_object_editor(object, newwindow ? bec::ForceNewWindowFlag : bec::NoFlags); + bec::GRTManager::get()->open_object_editor(object, newwindow ? bec::ForceNewWindowFlag : bec::NoFlags); else if (workbench_physical_ConnectionRef::can_wrap(figure)) - bec::GRTManager::get().open_object_editor(figure, newwindow ? bec::ForceNewWindowFlag : bec::NoFlags); + bec::GRTManager::get()->open_object_editor(figure, newwindow ? bec::ForceNewWindowFlag : bec::NoFlags); } @@ -2589,7 +2589,7 @@ void WBComponentPhysical::model_object_list_changed(grt::internal::OwnedList *li { gchar *data; gsize length; - std::string path= base::makePath(bec::GRTManager::get().get_tmp_dir(), object->filename()); + std::string path= base::makePath(bec::GRTManager::get()->get_tmp_dir(), object->filename()); if (g_file_get_contents(path.c_str(), &data, &length, NULL)) { @@ -2644,7 +2644,7 @@ void WBComponentPhysical::model_object_list_changed(grt::internal::OwnedList *li #if 0 if (object->filename() != "") { - std::string path= base::makePath(bec::GRTManager::get().get_tmp_dir(), object->filename()); + std::string path= base::makePath(bec::GRTManager::get()->get_tmp_dir(), object->filename()); std::string tmp= base::dirname(path.c_str()); g_mkdir_with_parents(tmp.c_str(), 0700); diff --git a/backend/wbprivate/model/wb_history_tree.cpp b/backend/wbprivate/model/wb_history_tree.cpp index c21acf35e..39f8d0f24 100644 --- a/backend/wbprivate/model/wb_history_tree.cpp +++ b/backend/wbprivate/model/wb_history_tree.cpp @@ -116,7 +116,7 @@ void HistoryTree::handle_change() if (!_refresh_pending) { _refresh_pending = true; - bec::GRTManager::get().run_once_when_idle(this, boost::bind(&HistoryTree::refresh, this)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&HistoryTree::refresh, this)); } } diff --git a/backend/wbprivate/model/wb_model_diagram_form.cpp b/backend/wbprivate/model/wb_model_diagram_form.cpp index c59d33023..4b1dbb2b6 100644 --- a/backend/wbprivate/model/wb_model_diagram_form.cpp +++ b/backend/wbprivate/model/wb_model_diagram_form.cpp @@ -320,7 +320,7 @@ void ModelDiagramForm::revalidate_menu() _menu->set_item_enabled("wb.edit.selectSimilar", has_selection_); _menu->set_item_enabled("wb.edit.selectConnected", get_selection().count() == 1); - _menu->set_item_checked("wb.edit.toggleGridAlign", bec::GRTManager::get().get_app_option_int("AlignToGrid", 0) != 0); + _menu->set_item_checked("wb.edit.toggleGridAlign", bec::GRTManager::get()->get_app_option_int("AlignToGrid", 0) != 0); _menu->set_item_checked("wb.edit.toggleGrid", get_diagram_options().get_int("ShowGrid", 1) != 0); _menu->set_item_checked("wb.edit.togglePageGrid", get_diagram_options().get_int("ShowPageGrid", 1) != 0); _menu->set_item_checked("wb.edit.toggleFKHighlight", get_diagram_options().get_int("ShowFKHighlight", 0) != 0); @@ -482,7 +482,7 @@ void ModelDiagramForm::activate_catalog_tree_item(const grt::ValueRef &value) { db_DatabaseObjectRef object(db_DatabaseObjectRef::cast_from(value)); - bec::GRTManager::get().open_object_editor(object); + bec::GRTManager::get()->open_object_editor(object); } } @@ -491,10 +491,10 @@ void ModelDiagramForm::selection_changed() { get_wb()->request_refresh(RefreshSelection, "", 0); - if (bec::GRTManager::get().in_main_thread()) + if (bec::GRTManager::get()->in_main_thread()) revalidate_menu(); else - bec::GRTManager::get().run_once_when_idle(boost::bind(&ModelDiagramForm::revalidate_menu, this)); + bec::GRTManager::get()->run_once_when_idle(boost::bind(&ModelDiagramForm::revalidate_menu, this)); } //-------------------------------------------------------------------------------------------------- @@ -504,7 +504,7 @@ void ModelDiagramForm::diagram_changed(grt::internal::OwnedList* olist, bool add { _idle_node_mark.disconnect(); if (added) - _idle_node_mark = bec::GRTManager::get().run_once_when_idle(boost::bind(&ModelDiagramForm::mark_catalog_node, this, val, true)); + _idle_node_mark = bec::GRTManager::get()->run_once_when_idle(boost::bind(&ModelDiagramForm::mark_catalog_node, this, val, true)); } void ModelDiagramForm::mark_catalog_node(grt::ValueRef val, bool mark) @@ -522,7 +522,7 @@ void ModelDiagramForm::attach_canvas_view(mdc::CanvasView *cview) _view= cview; cview->set_tag(_model_diagram.id()); - cview->set_grid_snapping(bec::GRTManager::get().get_app_option_int("AlignToGrid", 0) != 0); + cview->set_grid_snapping(bec::GRTManager::get()->get_app_option_int("AlignToGrid", 0) != 0); cview->get_background_layer()->set_grid_visible(_model_diagram->options().get_int("ShowGrid", 1)!=0); cview->get_background_layer()->set_paper_visible(_model_diagram->options().get_int("ShowPageGrid", 1)!=0); @@ -1144,7 +1144,7 @@ double ModelDiagramForm::get_zoom() bec::Clipboard *ModelDiagramForm::get_clipboard() { - return bec::GRTManager::get().get_clipboard(); + return bec::GRTManager::get()->get_clipboard(); } @@ -1186,7 +1186,7 @@ bool ModelDiagramForm::can_paste() { if (!(*iter).is_valid()) { - log_warning("copy buffer has null value"); + logWarning("copy buffer has null value"); return false; } bool result= false; @@ -1349,7 +1349,7 @@ void ModelDiagramForm::paste() } } else - log_warning("Don't know how to paste %s\n", iter->class_name().c_str()); + logWarning("Don't know how to paste %s\n", iter->class_name().c_str()); } context.finish(); undo.end(strfmt(_("Paste %s"), get_clipboard()->get_content_description().c_str())); @@ -1617,7 +1617,7 @@ bool ModelDiagramForm::search_and_focus_object(const std::string &text) if (found_object.is_valid()) { - bec::GRTManager::get().replace_status_text(strfmt(_("Found %s '%s'"), + bec::GRTManager::get()->replace_status_text(strfmt(_("Found %s '%s'"), found_object.get_metaclass()->get_attribute("caption").c_str(), found_object->name().c_str())); @@ -1628,9 +1628,9 @@ bool ModelDiagramForm::search_and_focus_object(const std::string &text) else { if (_model_diagram->selection().count() > 0) - bec::GRTManager::get().replace_status_text(_("No more matches")); + bec::GRTManager::get()->replace_status_text(_("No more matches")); else - bec::GRTManager::get().replace_status_text(_("No match found")); + bec::GRTManager::get()->replace_status_text(_("No match found")); } _model_diagram->selection().remove_all(); diff --git a/backend/wbprivate/model/wb_overview_physical.cpp b/backend/wbprivate/model/wb_overview_physical.cpp index c38bf60f9..d824993f4 100644 --- a/backend/wbprivate/model/wb_overview_physical.cpp +++ b/backend/wbprivate/model/wb_overview_physical.cpp @@ -89,7 +89,7 @@ OverviewBE::Node * PhysicalSchemataNode::create_child_node(db_SchemaRef schema) bool PhysicalSchemataNode::add_object(WBContext *wb) { - bec::GRTManager::get().open_object_editor(wb->get_component()->add_new_db_schema(model)); + bec::GRTManager::get()->open_object_editor(wb->get_component()->add_new_db_schema(model)); return true; } @@ -322,7 +322,7 @@ bool SQLScriptsNode::add_new(WBContext *wb) { WBComponentPhysical *compo= wb->get_component(); - bec::GRTManager::get().open_object_editor(compo->add_new_stored_script(_model, "")); + bec::GRTManager::get()->open_object_editor(compo->add_new_stored_script(_model, "")); return true; } @@ -398,7 +398,7 @@ bool NotesNode::add_new(WBContext *wb) { WBComponentPhysical *compo= wb->get_component(); - bec::GRTManager::get().open_object_editor(compo->add_new_stored_note(_model, "")); + bec::GRTManager::get()->open_object_editor(compo->add_new_stored_note(_model, "")); return true; } diff --git a/backend/wbprivate/model/wb_overview_physical_schema.cpp b/backend/wbprivate/model/wb_overview_physical_schema.cpp index 110f06e8d..907cf4e6c 100644 --- a/backend/wbprivate/model/wb_overview_physical_schema.cpp +++ b/backend/wbprivate/model/wb_overview_physical_schema.cpp @@ -435,7 +435,7 @@ void PhysicalSchemaNode::delete_object(WBContext *wb) bool PhysicalSchemaNode::activate(WBContext *wb) { - bec::GRTManager::get().open_object_editor(object); + bec::GRTManager::get()->open_object_editor(object); return true; } @@ -463,28 +463,28 @@ void PhysicalSchemaNode::refresh() bool PhysicalSchemaNode::add_new_db_table(WBContext *wb) { - bec::GRTManager::get().open_object_editor(wb->get_component()->add_new_db_table(db_SchemaRef::cast_from(object))); + bec::GRTManager::get()->open_object_editor(wb->get_component()->add_new_db_table(db_SchemaRef::cast_from(object))); return true; } bool PhysicalSchemaNode::add_new_db_view(WBContext *wb) { - bec::GRTManager::get().open_object_editor(wb->get_component()->add_new_db_view(db_SchemaRef::cast_from(object))); + bec::GRTManager::get()->open_object_editor(wb->get_component()->add_new_db_view(db_SchemaRef::cast_from(object))); return true; } bool PhysicalSchemaNode::add_new_db_routine_group(WBContext *wb) { - bec::GRTManager::get().open_object_editor(wb->get_component()->add_new_db_routine_group(db_SchemaRef::cast_from(object))); + bec::GRTManager::get()->open_object_editor(wb->get_component()->add_new_db_routine_group(db_SchemaRef::cast_from(object))); return true; } bool PhysicalSchemaNode::add_new_db_routine(WBContext *wb) { - bec::GRTManager::get().open_object_editor(wb->get_component()->add_new_db_routine(db_SchemaRef::cast_from(object))); + bec::GRTManager::get()->open_object_editor(wb->get_component()->add_new_db_routine(db_SchemaRef::cast_from(object))); return true; } diff --git a/backend/wbprivate/model/wb_overview_privileges.cpp b/backend/wbprivate/model/wb_overview_privileges.cpp index 28b232da3..83c20a926 100644 --- a/backend/wbprivate/model/wb_overview_privileges.cpp +++ b/backend/wbprivate/model/wb_overview_privileges.cpp @@ -301,14 +301,14 @@ bool wb::internal::PrivilegeInfoNode::is_pasteable(bec::Clipboard *clip) bool wb::internal::PrivilegeInfoNode::add_new_user(WBContext *wb) { - bec::GRTManager::get().open_object_editor(wb->get_component()->add_new_user(workbench_physical_ModelRef::cast_from(object->owner()))); + bec::GRTManager::get()->open_object_editor(wb->get_component()->add_new_user(workbench_physical_ModelRef::cast_from(object->owner()))); return true; } bool wb::internal::PrivilegeInfoNode::add_new_role(WBContext *wb) { - bec::GRTManager::get().open_object_editor(wb->get_component()->add_new_role(workbench_physical_ModelRef::cast_from(object->owner()))); + bec::GRTManager::get()->open_object_editor(wb->get_component()->add_new_role(workbench_physical_ModelRef::cast_from(object->owner()))); return true; } diff --git a/backend/wbprivate/model/wb_physical_model_diagram_features.cpp b/backend/wbprivate/model/wb_physical_model_diagram_features.cpp index 8f81655f9..a10b7de4f 100644 --- a/backend/wbprivate/model/wb_physical_model_diagram_features.cpp +++ b/backend/wbprivate/model/wb_physical_model_diagram_features.cpp @@ -71,7 +71,6 @@ class wb::Tooltip : public mforms::Popover void set_text(const std::string &text) { _label.set_text(text); - set_size(_label.get_preferred_width(), _label.get_preferred_height()); } }; @@ -483,11 +482,11 @@ mdc::CanvasView *PhysicalModelDiagramFeatures::get_canvas_view() bec::GRTManager::Timer *PhysicalModelDiagramFeatures::run_every(const boost::function &slot, double seconds) { - return bec::GRTManager::get().run_every(slot, seconds); + return bec::GRTManager::get()->run_every(slot, seconds); } void PhysicalModelDiagramFeatures::cancel_timer(bec::GRTManager::Timer *timer) { - bec::GRTManager::get().cancel_timer(timer); + bec::GRTManager::get()->cancel_timer(timer); } diff --git a/backend/wbprivate/sqlide/db_sql_editor_history_be.cpp b/backend/wbprivate/sqlide/db_sql_editor_history_be.cpp index 8097bfd15..04530355e 100644 --- a/backend/wbprivate/sqlide/db_sql_editor_history_be.cpp +++ b/backend/wbprivate/sqlide/db_sql_editor_history_be.cpp @@ -157,7 +157,7 @@ void DbSqlEditorHistory::EntriesModel::reset() void DbSqlEditorHistory::EntriesModel::load() { - std::string sql_history_dir= base::makePath(bec::GRTManager::get().get_user_datadir(), SQL_HISTORY_DIR_NAME); + std::string sql_history_dir= base::makePath(bec::GRTManager::get()->get_user_datadir(), SQL_HISTORY_DIR_NAME); g_mkdir_with_parents(sql_history_dir.c_str(), 0700); { GError *error= NULL; @@ -314,7 +314,7 @@ void DbSqlEditorHistory::EntriesModel::delete_entries(const std::vector } catch (const std::exception &exc) { - log_error("Error deleting log entry %s: %s\n", entry_path(row).c_str(), exc.what()); + logError("Error deleting log entry %s: %s\n", entry_path(row).c_str(), exc.what()); } Cell row_begin = _data.begin() + row * _column_count; _data.erase(row_begin, row_begin + _column_count); @@ -329,7 +329,7 @@ std::string DbSqlEditorHistory::EntriesModel::entry_path(size_t index) { std::string name; get_field(index, 0, name); - std::string storage_file_path= base::makePath(bec::GRTManager::get().get_user_datadir(), SQL_HISTORY_DIR_NAME); + std::string storage_file_path= base::makePath(bec::GRTManager::get()->get_user_datadir(), SQL_HISTORY_DIR_NAME); storage_file_path= base::makePath(storage_file_path, name); return storage_file_path; } @@ -466,13 +466,13 @@ void DbSqlEditorHistory::DetailsModel::load(const std::string &storage_file_path _last_loaded_row = (int)_row_count - 1; } else - log_error("Can't open SQL history file %s\n", storage_file_path.c_str()); + logError("Can't open SQL history file %s\n", storage_file_path.c_str()); } } std::string DbSqlEditorHistory::DetailsModel::storage_file_path() const { - std::string storage_file_path= base::makePath(bec::GRTManager::get().get_user_datadir(), SQL_HISTORY_DIR_NAME); + std::string storage_file_path= base::makePath(bec::GRTManager::get()->get_user_datadir(), SQL_HISTORY_DIR_NAME); storage_file_path= base::makePath(storage_file_path, format_time(_datestamp, "%Y-%m-%d")); return storage_file_path; } @@ -482,7 +482,7 @@ void DbSqlEditorHistory::DetailsModel::save() std::string storage_file_path= this->storage_file_path(); std::ofstream ofs; { - std::string storage_file_dir= base::makePath(bec::GRTManager::get().get_user_datadir(), SQL_HISTORY_DIR_NAME); + std::string storage_file_dir= base::makePath(bec::GRTManager::get()->get_user_datadir(), SQL_HISTORY_DIR_NAME); if (g_mkdir_with_parents(storage_file_dir.c_str(), 0700) != -1) { bool is_file_new= (g_file_test(storage_file_path.c_str(), G_FILE_TEST_EXISTS) == 0); diff --git a/backend/wbprivate/sqlide/db_sql_editor_history_be.h b/backend/wbprivate/sqlide/db_sql_editor_history_be.h index e12e981b2..97d92d71a 100644 --- a/backend/wbprivate/sqlide/db_sql_editor_history_be.h +++ b/backend/wbprivate/sqlide/db_sql_editor_history_be.h @@ -30,11 +30,10 @@ class MYSQLWBBACKEND_PUBLIC_FUNC DbSqlEditorHistory { public: typedef std::shared_ptr Ref; - static Ref create(bec::GRTManager *grtm) { return Ref(new DbSqlEditorHistory(grtm)); } + static Ref create() { return Ref(new DbSqlEditorHistory()); } virtual ~DbSqlEditorHistory(); protected: - DbSqlEditorHistory(bec::GRTManager *grtm); - bec::GRTManager *_grtm; + DbSqlEditorHistory(); public: void reset(); @@ -58,9 +57,9 @@ class MYSQLWBBACKEND_PUBLIC_FUNC DbSqlEditorHistory public: friend class DbSqlEditorHistory; typedef std::shared_ptr Ref; - static Ref create(bec::GRTManager *grtm) { return Ref(new DetailsModel(grtm)); } + static Ref create() { return Ref(new DetailsModel()); } protected: - DetailsModel(bec::GRTManager *grtm); + DetailsModel(); public: void add_entries(const std::list &statements); @@ -97,9 +96,9 @@ class MYSQLWBBACKEND_PUBLIC_FUNC DbSqlEditorHistory friend class DbSqlEditorHistory; typedef std::shared_ptr Ref; - static Ref create(DbSqlEditorHistory *owner, bec::GRTManager *grtm) { return Ref(new EntriesModel(owner, grtm)); } + static Ref create(DbSqlEditorHistory *owner) { return Ref(new EntriesModel(owner)); } protected: - EntriesModel(DbSqlEditorHistory *owner, bec::GRTManager *grtm); + EntriesModel(DbSqlEditorHistory *owner); DbSqlEditorHistory *_owner; diff --git a/backend/wbprivate/sqlide/db_sql_editor_log.cpp b/backend/wbprivate/sqlide/db_sql_editor_log.cpp index f9ce2c66e..ba4c6a64f 100644 --- a/backend/wbprivate/sqlide/db_sql_editor_log.cpp +++ b/backend/wbprivate/sqlide/db_sql_editor_log.cpp @@ -48,7 +48,7 @@ DbSqlEditorLog::DbSqlEditorLog(SqlEditorForm *owner, int max_entry_count) : VarGridModel(), _owner(owner), _max_entry_count(max_entry_count) { reset(); - std::string log_dir = base::joinPath(bec::GRTManager::get().get_user_datadir().c_str(), "log", ""); + std::string log_dir = base::joinPath(bec::GRTManager::get()->get_user_datadir().c_str(), "log", ""); create_directory(log_dir, 0700); _log_file_name = base::joinPath(log_dir.c_str(), sanitize_file_name("sql_actions_" + owner->get_session_name() + ".log").c_str(), ""); @@ -309,7 +309,7 @@ RowId DbSqlEditorLog::add_message(int msg_type, const std::string &context, cons } else { - log_error("DbSqlEditorLog::add_message called with no log file name set\n"); + logError("DbSqlEditorLog::add_message called with no log file name set\n"); return -1; } diff --git a/backend/wbprivate/sqlide/query_side_palette.cpp b/backend/wbprivate/sqlide/query_side_palette.cpp index 4bddd0eb3..164e8a439 100644 --- a/backend/wbprivate/sqlide/query_side_palette.cpp +++ b/backend/wbprivate/sqlide/query_side_palette.cpp @@ -196,7 +196,7 @@ class SnippetListView : public BaseSnippetList } catch (std::exception &exc) { - log_warning("Error switching snippet category: %s\n", exc.what()); + logWarning("Error switching snippet category: %s\n", exc.what()); } refresh_snippets(); } @@ -267,7 +267,7 @@ QuerySidePalette::QuerySidePalette(const SqlEditorForm::Ref &owner) { _help_timer = NULL; _no_help = true; - _automatic_help = bec::GRTManager::get().get_app_option_int("DbSqlEditor:DisableAutomaticContextHelp", 1) == 0; + _automatic_help = bec::GRTManager::get()->get_app_option_int("DbSqlEditor:DisableAutomaticContextHelp", 1) == 0; _switching_help = false; _help_task = GrtThreadedTask::create(); _help_task->desc("Context Help Task"); @@ -329,7 +329,7 @@ QuerySidePalette::QuerySidePalette(const SqlEditorForm::Ref &owner) scoped_connect(_snippet_list->signal_selection_changed(), boost::bind(&QuerySidePalette::snippet_selection_changed, this)); - std::string old_category = bec::GRTManager::get().get_app_option_string("DbSqlEditor:SelectedSnippetCategory"); + std::string old_category = bec::GRTManager::get()->get_app_option_string("DbSqlEditor:SelectedSnippetCategory"); if (!old_category.empty()) { mforms::ToolBarItem *item = _snippet_toolbar->find_item("select_category"); @@ -359,7 +359,7 @@ QuerySidePalette::~QuerySidePalette() void QuerySidePalette::cancel_timer() { if (_help_timer != NULL) - bec::GRTManager::get().cancel_timer(_help_timer); + bec::GRTManager::get()->cancel_timer(_help_timer); } //-------------------------------------------------------------------------------------------------- @@ -397,7 +397,7 @@ void QuerySidePalette::handle_notification(const std::string &name, void *sender { check_format_structures(editor); cancel_timer(); - _help_timer = bec::GRTManager::get().run_every(boost::bind(&QuerySidePalette::find_context_help, this, editor), 0.7); + _help_timer = bec::GRTManager::get()->run_every(boost::bind(&QuerySidePalette::find_context_help, this, editor), 0.7); } } } @@ -680,7 +680,7 @@ void QuerySidePalette::snippet_toolbar_item_activated(ToolBarItem* item) if (action == "select_category") { _snippet_list->show_category(item->get_text()); - bec::GRTManager::get().set_app_option("DbSqlEditor:SelectedSnippetCategory", grt::StringRef(item->get_text())); + bec::GRTManager::get()->set_app_option("DbSqlEditor:SelectedSnippetCategory", grt::StringRef(item->get_text())); } else { @@ -824,7 +824,7 @@ void QuerySidePalette::help_toolbar_item_activated(ToolBarItem* item) { _automatic_help = item->get_checked(); _manual_help_item->set_enabled(!_automatic_help); - bec::GRTManager::get().set_app_option("DbSqlEditor:DisableAutomaticContextHelp", grt::IntegerRef(_automatic_help ? 0 : 1)); + bec::GRTManager::get()->set_app_option("DbSqlEditor:DisableAutomaticContextHelp", grt::IntegerRef(_automatic_help ? 0 : 1)); show_help_hint_or_update(); @@ -1056,7 +1056,7 @@ void QuerySidePalette::refresh_snippets() } catch (std::exception &exc) { - log_error("Error loading DB snippets: %s\n", exc.what()); + logError("Error loading DB snippets: %s\n", exc.what()); } } _snippet_list->refresh_snippets(); diff --git a/backend/wbprivate/sqlide/result_form_view.cpp b/backend/wbprivate/sqlide/result_form_view.cpp index cb760f5a3..aa513581d 100644 --- a/backend/wbprivate/sqlide/result_form_view.cpp +++ b/backend/wbprivate/sqlide/result_form_view.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -35,7 +35,7 @@ #include "mforms/gridview.h" #include "mforms/utilities.h" -#include "mforms/treenodeview.h" +#include "mforms/treeview.h" #include "mforms/textbox.h" #include "mforms/label.h" #include "mforms/tabview.h" @@ -158,7 +158,7 @@ class SelectorFieldView : public ResultFormView::FieldView class SetFieldView : public ResultFormView::FieldView { - mforms::TreeNodeView _tree; + mforms::TreeView _tree; void changed() { @@ -290,6 +290,8 @@ class BlobFieldView : public ResultFormView::FieldView class GeomFieldView : public ResultFormView::FieldView { mforms::Box _box; + mforms::Box _imageBox; + mforms::Label _srid; mforms::TextBox _text; GeomDrawBox _image; std::string _raw_data; @@ -326,13 +328,16 @@ class GeomFieldView : public ResultFormView::FieldView public: GeomFieldView(const std::string &name, const std::string &type, bool editable, const boost::function &change_callback, const boost::function &view_callback) - : FieldView(name, change_callback), _box(true), _text(mforms::VerticalScrollBar) + : FieldView(name, change_callback), _box(true), _imageBox(false), _text(mforms::VerticalScrollBar) { _view_type = 0; _box.set_spacing(8); + _imageBox.set_spacing(8); _image.set_size(150, 150); - _box.add(&_image, false, true); + _imageBox.add(&_image, false, true); + _imageBox.add_end(&_srid, false, false); + _box.add(&_imageBox, false, true); _box.add(&_text, true, true); } @@ -341,6 +346,7 @@ class GeomFieldView : public ResultFormView::FieldView virtual void set_value(const std::string &value, bool is_null) { _image.set_data(value); + _srid.set_text("SRID: "+base::to_string(_image.getSrid())); _text.set_read_only(false); _raw_data = value; update(); @@ -684,7 +690,7 @@ std::string ResultFormView::get_full_column_type(SqlEditorForm *editor, const st } catch (std::exception &e) { - log_exception(("Exception getting column information: "+q).c_str(), e); + logException(("Exception getting column information: "+q).c_str(), e); } } return ""; @@ -708,6 +714,8 @@ void ResultFormView::init_for_resultset(Recordset::Ptr rset_ptr, SqlEditorForm * Recordset_cdbc_storage::Ref storage(std::dynamic_pointer_cast(rset->data_storage())); + _table.suspend_layout(); + std::vector &field_info(storage->field_info()); _table.set_row_count((int)field_info.size()); @@ -750,5 +758,7 @@ void ResultFormView::init_for_resultset(Recordset::Ptr rset_ptr, SqlEditorForm * } _tbar.insert_item(i+1, _geom_type_item); } + + _table.resume_layout(); } } diff --git a/backend/wbprivate/sqlide/spatial_data_view.cpp b/backend/wbprivate/sqlide/spatial_data_view.cpp index d13afd6e9..cfe3f28c7 100644 --- a/backend/wbprivate/sqlide/spatial_data_view.cpp +++ b/backend/wbprivate/sqlide/spatial_data_view.cpp @@ -59,7 +59,7 @@ class RecordsetLayer : public spatial::Layer if (rs && !_loaded) { _loaded = true; - log_info("Loading %li rows/features from resultset\n", (long)rs->row_count()); + logInfo("Loading %li rows/features from resultset\n", (long)rs->row_count()); _render_progress = 0.0; ssize_t row_count = rs->row_count(); @@ -346,7 +346,7 @@ void SpatialDataView::change_tool(mforms::ToolBarItem *item) int SpatialDataView::get_option(const char* opt_name, int default_value) { - return bec::GRTManager::get().get_app_option_int(opt_name, default_value) != 0; + return bec::GRTManager::get()->get_app_option_int(opt_name, default_value) != 0; } void SpatialDataView::area_selected() diff --git a/backend/wbprivate/sqlide/spatial_draw_box.cpp b/backend/wbprivate/sqlide/spatial_draw_box.cpp index 2a7abbe66..afe1f4473 100644 --- a/backend/wbprivate/sqlide/spatial_draw_box.cpp +++ b/backend/wbprivate/sqlide/spatial_draw_box.cpp @@ -738,13 +738,12 @@ void SpatialDrawBox::repaint(cairo_t *crt, int x, int y, int w, int h) { for (std::vector::const_iterator pin = _pins.begin(); pin != _pins.end(); ++pin) { - int w, h; int x, y; if (pin->icon) { world_to_screen(pin->lat, pin->lon, x, y); - mforms::Utilities::get_icon_size(pin->icon, w, h); - mforms::Utilities::paint_icon(cr.get_cr(), pin->icon, x-w/2, y-h+2); + base::Size size = mforms::Utilities::getImageSize(pin->icon); + mforms::Utilities::paint_icon(cr.get_cr(), pin->icon, x - size.width / 2, y - size.height + 2); } } } diff --git a/backend/wbprivate/sqlide/wb_live_schema_tree.cpp b/backend/wbprivate/sqlide/wb_live_schema_tree.cpp index 66519ec4d..34c610711 100644 --- a/backend/wbprivate/sqlide/wb_live_schema_tree.cpp +++ b/backend/wbprivate/sqlide/wb_live_schema_tree.cpp @@ -1011,7 +1011,7 @@ std::string LiveSchemaTree::get_field_description(const mforms::TreeNodeRef& nod catch (std::exception &e) { text = _("Unable to retrieve node description."); - log_error("Exception retrieving node description : %s\n", strfmt("%s", e.what()).c_str()); + logError("Exception retrieving node description : %s\n", strfmt("%s", e.what()).c_str()); } return text; diff --git a/backend/wbprivate/sqlide/wb_live_schema_tree.h b/backend/wbprivate/sqlide/wb_live_schema_tree.h index 7bc8b637d..0a0b51989 100644 --- a/backend/wbprivate/sqlide/wb_live_schema_tree.h +++ b/backend/wbprivate/sqlide/wb_live_schema_tree.h @@ -15,13 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA - */ -#ifndef _WB_LIVE_SCHEMA_TREE_H_ -#define _WB_LIVE_SCHEMA_TREE_H_ +#pragma once -#include "grtpp.h" +#include "grt.h" #include "grt/tree_model.h" #include "workbench/wb_backend_public_interface.h" #include "base/string_utilities.h" @@ -332,7 +330,6 @@ namespace wb protected: std::weak_ptr _fetch_delegate; std::weak_ptr _delegate; - grt::GRT* _grt; std::string _active_schema; mforms::TreeView* _model_view; @@ -361,7 +358,7 @@ namespace wb GPatternSpec* pattern = NULL); bool is_object_type(ObjectTypeValidation validation, ObjectType type); public: - LiveSchemaTree(grt::GRT* grtm); + LiveSchemaTree(); virtual ~LiveSchemaTree(); void set_model_view(mforms::TreeView* target); @@ -447,5 +444,3 @@ namespace wb bec::IconId get_node_icon(ObjectType type); }; }; - -#endif diff --git a/backend/wbprivate/sqlide/wb_sql_editor_buffer.cpp b/backend/wbprivate/sqlide/wb_sql_editor_buffer.cpp index 75b06661e..01aa0b90b 100644 --- a/backend/wbprivate/sqlide/wb_sql_editor_buffer.cpp +++ b/backend/wbprivate/sqlide/wb_sql_editor_buffer.cpp @@ -79,7 +79,7 @@ void SqlEditorForm::save_workspace(const std::string &workspace_name, bool is_au // if we're autosaving, just use the same path from previous saves if (!is_autosave || _autosave_path.empty()) { - std::string path_prefix = base::makePath(bec::GRTManager::get().get_user_datadir(), + std::string path_prefix = base::makePath(bec::GRTManager::get()->get_user_datadir(), "sql_workspaces"); if (!g_file_test(path_prefix.c_str(), G_FILE_TEST_EXISTS)) { @@ -153,7 +153,7 @@ void SqlEditorForm::save_workspace(const std::string &workspace_name, bool is_au } catch (std::exception &e) { - log_error("Could not auto-save editor %s\n", editor->get_title().c_str()); + logError("Could not auto-save editor %s\n", editor->get_title().c_str()); mforms::Utilities::show_error("Auto save", base::strfmt("Could not save contents of tab %s.\n%s", editor->get_title().c_str(), e.what()), @@ -166,7 +166,7 @@ void SqlEditorForm::save_workspace(const std::string &workspace_name, bool is_au std::string SqlEditorForm::find_workspace_state(const std::string &workspace_name, std::auto_ptr &lock_file) { - std::string path_prefix = base::makePath(bec::GRTManager::get().get_user_datadir(), "sql_workspaces"); + std::string path_prefix = base::makePath(bec::GRTManager::get()->get_user_datadir(), "sql_workspaces"); // find workspaces on disk std::string workspace_path; @@ -255,7 +255,7 @@ struct GuardBoolFlag // Restore a previously saved workspace for this connection. The loaded data is deleted immediately after loading (unless its an autosave) bool SqlEditorForm::load_workspace(const std::string &workspace_name) { - std::string path_prefix = base::makePath(bec::GRTManager::get().get_user_datadir(), "sql_workspaces"); + std::string path_prefix = base::makePath(bec::GRTManager::get()->get_user_datadir(), "sql_workspaces"); GuardBoolFlag flag(&_loading_workspace); @@ -311,12 +311,12 @@ bool SqlEditorForm::load_workspace(const std::string &workspace_name) try { base::remove(info_file); } catch (std::exception &e) { - log_error("Could not delete autosave file %s\n%s\n", info_file.c_str(), e.what()); + logError("Could not delete autosave file %s\n%s\n", info_file.c_str(), e.what()); } try { base::remove(text_file); } catch (std::exception &e) { - log_error("Could not delete autosave file %s\n%s\n", text_file.c_str(), e.what()); + logError("Could not delete autosave file %s\n%s\n", text_file.c_str(), e.what()); } } // remove the pre-created editor @@ -379,7 +379,7 @@ bool SqlEditorForm::load_workspace(const std::string &workspace_name) try { base::remove(file.first); } catch (std::exception &e) { - log_error("Could not delete autosave file %s\n%s\n", file.first.c_str(), e.what()); + logError("Could not delete autosave file %s\n%s\n", file.first.c_str(), e.what()); } } // remove the pre-created editor @@ -396,7 +396,7 @@ bool SqlEditorForm::load_workspace(const std::string &workspace_name) char *line = strtok(data, "\n"); while (line) { - if (base::starts_with(line, "expanded=")) + if (base::hasPrefix(line, "expanded=")) { char *value = strchr(line, '='); if (value) @@ -416,7 +416,7 @@ bool SqlEditorForm::load_workspace(const std::string &workspace_name) _autosave_lock = lock_file.release(); _autosave_path = workspace_path; - bec::GRTManager::get().replace_status_text(_("Restored last session state")); + bec::GRTManager::get()->replace_status_text(_("Restored last session state")); } else { @@ -543,7 +543,7 @@ void SqlEditorForm::sql_editor_panel_switched() { SqlEditorPanel *panel = active_sql_editor_panel(); if (panel) - bec::GRTManager::get().run_once_when_idle((bec::UIForm*)panel, boost::bind(&mforms::View::focus, panel->editor_be()->get_editor_control())); + bec::GRTManager::get()->run_once_when_idle((bec::UIForm*)panel, boost::bind(&mforms::View::focus, panel->editor_be()->get_editor_control())); validate_menubar(); } @@ -579,7 +579,8 @@ void SqlEditorForm::sql_editor_panel_closed(mforms::AppView *view) void SqlEditorForm::save_workspace_order(const std::string &prefix) { if (prefix.empty()) - log_error("save with empty path\n"); + logError("save with empty path\n"); + if (_tabdock) { std::wofstream orderFile; @@ -602,7 +603,7 @@ void SqlEditorForm::sql_editor_reordered(SqlEditorPanel *panel, int to) /// Reorder the GRT lists int from_index = (int)grtobj()->queryEditors().get_index(panel->grtobj()); if (from_index == (int)grt::BaseListRef::npos) - log_fatal("Could not find reordered editor in GRT object list\n"); + logFatal("Could not find reordered editor in GRT object list\n"); // first build an array of result panel objects, in the same order as the tabview std::vector > panels; @@ -641,7 +642,7 @@ void SqlEditorForm::sql_editor_reordered(SqlEditorPanel *panel, int to) } if (to_index < 0) { - log_fatal("Unable to find suitable target index for reorder\n"); + logFatal("Unable to find suitable target index for reorder\n"); return; } @@ -685,7 +686,7 @@ int SqlEditorForm::sql_editor_count() SqlEditorPanel *SqlEditorForm::new_sql_script_file() { SqlEditorPanel *panel = add_sql_editor(false); - bec::GRTManager::get().replace_status_text(_("Added new script editor")); + bec::GRTManager::get()->replace_status_text(_("Added new script editor")); update_menu_and_toolbar(); return panel; } @@ -693,7 +694,7 @@ SqlEditorPanel *SqlEditorForm::new_sql_script_file() SqlEditorPanel *SqlEditorForm::new_sql_scratch_area(bool start_collapsed) { SqlEditorPanel *panel = add_sql_editor(true, start_collapsed); - bec::GRTManager::get().replace_status_text(_("Added new scratch query editor")); + bec::GRTManager::get()->replace_status_text(_("Added new scratch query editor")); update_menu_and_toolbar(); return panel; } @@ -704,7 +705,7 @@ void SqlEditorForm::open_file(const std::string &path, bool in_new_tab, bool ask { std::string file_path = path; - bec::GRTManager::get().replace_status_text(base::strfmt(_("Opening %s..."), path.c_str())); + bec::GRTManager::get()->replace_status_text(base::strfmt(_("Opening %s..."), path.c_str())); if (askForFile) { @@ -718,7 +719,7 @@ void SqlEditorForm::open_file(const std::string &path, bool in_new_tab, bool ask } if (file_path.empty()) { - bec::GRTManager::get().replace_status_text(_("Cancelled open file")); + bec::GRTManager::get()->replace_status_text(_("Cancelled open file")); return; } } @@ -758,7 +759,7 @@ void SqlEditorForm::open_file(const std::string &path, bool in_new_tab, bool ask } catch (std::exception &exc) { - log_error("Cannot open file %s: %s\n", file_path.c_str(), exc.what()); + logError("Cannot open file %s: %s\n", file_path.c_str(), exc.what()); if (in_new_tab) remove_sql_editor(panel); mforms::Utilities::show_error(_("Open File"), diff --git a/backend/wbprivate/sqlide/wb_sql_editor_form.cpp b/backend/wbprivate/sqlide/wb_sql_editor_form.cpp index e32ad7c66..3207192eb 100644 --- a/backend/wbprivate/sqlide/wb_sql_editor_form.cpp +++ b/backend/wbprivate/sqlide/wb_sql_editor_form.cpp @@ -105,11 +105,11 @@ CATCH_EXCEPTION_AND_DISPATCH(statement) #define CATCH_ANY_EXCEPTION_AND_DISPATCH_TO_DEFAULT_LOG(statement) \ catch (sql::SQLException &e)\ {\ - _grtm->get_grt()->send_error(strfmt(SQL_EXCEPTION_MSG_FORMAT, e.getErrorCode(), e.what()), statement);\ + grt::GRT::get()->send_error(strfmt(SQL_EXCEPTION_MSG_FORMAT, e.getErrorCode(), e.what()), statement);\ }\ catch (std::exception &e)\ {\ - _grtm->get_grt()->send_error(strfmt(EXCEPTION_MSG_FORMAT, e.what()), statement);\ + grt::GRT::get()->send_error(strfmt(EXCEPTION_MSG_FORMAT, e.what()), statement);\ } @@ -179,7 +179,7 @@ SqlEditorForm::Ref SqlEditorForm::create(wb::WBContextSQLIDE *wbsql, const db_mg void SqlEditorForm::set_tab_dock(mforms::DockingPoint *dp) { _tabdock = dp; - grtobj()->dockingPoint(mforms_to_grt(_grtm->get_grt(), dp)); + grtobj()->dockingPoint(mforms_to_grt(dp)); scoped_connect(_tabdock->signal_view_switched(), boost::bind(&SqlEditorForm::sql_editor_panel_switched, this)); scoped_connect(_tabdock->signal_view_undocked(), boost::bind(&SqlEditorForm::sql_editor_panel_closed, this, _1)); } @@ -245,7 +245,6 @@ void SqlEditorForm::report_connection_failure(const grt::server_denied &info, co SqlEditorForm::SqlEditorForm(wb::WBContextSQLIDE *wbsql) : _wbsql(wbsql), - _grtm(wbsql->get_grt_manager()), _menu(NULL), // Please use NULL where pointers are assigned, not 0, to avoid confusing the param with ctor flags or similar! _toolbar(NULL), _autosave_lock(NULL), @@ -262,16 +261,16 @@ SqlEditorForm::SqlEditorForm(wb::WBContextSQLIDE *wbsql) _last_server_running_state(UnknownState), _auto_completion_cache(NULL), _column_width_cache(NULL), - exec_sql_task(GrtThreadedTask::create(_grtm)), + exec_sql_task(GrtThreadedTask::create()), _is_running_query(false), _live_tree(SqlEditorTreeController::create(this)), _side_palette_host(NULL), _side_palette(NULL), - _history(DbSqlEditorHistory::create(_grtm)), + _history(DbSqlEditorHistory::create()), _serverIsOffline(false) { _startup_done = false; - _log = DbSqlEditorLog::create(this, _grtm, 500); + _log = DbSqlEditorLog::create(this, 500); NotificationCenter::get()->add_observer(this, "GNApplicationActivated"); NotificationCenter::get()->add_observer(this, "GNMainFormChanged"); @@ -284,7 +283,7 @@ SqlEditorForm::SqlEditorForm(wb::WBContextSQLIDE *wbsql) _last_log_message_timestamp = timestamp(); - int keep_alive_interval= _grtm->get_app_option_int("DbSqlEditor:KeepAliveInterval", 600); + int keep_alive_interval= bec::GRTManager::get()->get_app_option_int("DbSqlEditor:KeepAliveInterval", 600); if (keep_alive_interval != 0) { @@ -294,10 +293,10 @@ SqlEditorForm::SqlEditorForm(wb::WBContextSQLIDE *wbsql) _lower_case_table_names = 0; - _continue_on_error= (_grtm->get_app_option_int("DbSqlEditor:ContinueOnError", 0) != 0); + _continue_on_error= (bec::GRTManager::get()->get_app_option_int("DbSqlEditor:ContinueOnError", 0) != 0); // set initial autocommit mode value - _usr_dbc_conn->autocommit_mode= (_grtm->get_app_option_int("DbSqlEditor:AutocommitMode", 1) != 0); + _usr_dbc_conn->autocommit_mode= (bec::GRTManager::get()->get_app_option_int("DbSqlEditor:AutocommitMode", 1) != 0); } //-------------------------------------------------------------------------------------------------- @@ -371,7 +370,7 @@ void SqlEditorForm::finish_startup() _live_tree->finish_init(); - std::string cache_dir = _grtm->get_user_datadir() + "/cache/"; + std::string cache_dir = bec::GRTManager::get()->get_user_datadir() + "/cache/"; try { base::create_directory(cache_dir, 0700); // No-op if the folder already exists. @@ -381,9 +380,9 @@ void SqlEditorForm::finish_startup() logError("Could not create %s: %s\n", cache_dir.c_str(), e.what()); } - // We moved this here, cause it needs schema_sidebar to be fully created, - // due to some race conditions that occurs sometimes. - if (_grtm->get_app_option_int("DbSqlEditor:CodeCompletionEnabled") == 1 && connected()) + // we moved this here, cause it needs schema_sidebar to be fully created, + // due to some race conditions that occurs sometimes + if (bec::GRTManager::get()->get_app_option_int("DbSqlEditor:CodeCompletionEnabled") == 1 && connected()) { try { @@ -437,7 +436,7 @@ void SqlEditorForm::finish_startup() if (_usr_dbc_conn && !_usr_dbc_conn->active_schema.empty()) _live_tree->on_active_schema_change(_usr_dbc_conn->active_schema); - _grtm->run_once_when_idle(this, boost::bind(&SqlEditorForm::update_menu_and_toolbar, this)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&SqlEditorForm::update_menu_and_toolbar, this)); this->check_server_problems(); @@ -451,7 +450,7 @@ void SqlEditorForm::finish_startup() GRTNotificationCenter::get()->send_grt("GRNSQLEditorOpened", grtobj(), grt::DictRef()); - int keep_alive_interval= _grtm->get_app_option_int("DbSqlEditor:KeepAliveInterval", 600); + int keep_alive_interval= bec::GRTManager::get()->get_app_option_int("DbSqlEditor:KeepAliveInterval", 600); // We have to set these variables so that the server doesn't timeout before we ping everytime // From http://dev.mysql.com/doc/refman/5.7/en/communication-errors.html for reasones to loose the connection @@ -557,7 +556,7 @@ void SqlEditorForm::handle_grt_notification(const std::string &name, grt::Object } // reconnect when idle, to avoid any deadlocks if (conn.is_valid() && conn == connection_descriptor()) - _grtm->run_once_when_idle(this, boost::bind(&WBContextSQLIDE::reconnect_editor, wbsql(), this)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&WBContextSQLIDE::reconnect_editor, wbsql(), this)); } } } @@ -604,7 +603,7 @@ void SqlEditorForm::reset_keep_alive_thread() } } -grt::StringRef SqlEditorForm::do_disconnect(grt::GRT *grt) +grt::StringRef SqlEditorForm::do_disconnect() { if (_usr_dbc_conn->ref.get()) { @@ -626,11 +625,11 @@ grt::StringRef SqlEditorForm::do_disconnect(grt::GRT *grt) void SqlEditorForm::close() { - grt::ValueRef option(_grtm->get_app_option("workbench:SaveSQLWorkspaceOnClose")); + grt::ValueRef option(bec::GRTManager::get()->get_app_option("workbench:SaveSQLWorkspaceOnClose")); if (option.is_valid() && *grt::IntegerRef::cast_from(option)) { - _grtm->replace_status_text("Saving workspace state..."); + bec::GRTManager::get()->replace_status_text("Saving workspace state..."); if (_autosave_path.empty()) { save_workspace(sanitize_file_name(get_session_name()), false); @@ -700,13 +699,13 @@ void SqlEditorForm::close() _tabdock->close_all_views(); _closing = false; } - _grtm->replace_status_text("Closing SQL Editor..."); + bec::GRTManager::get()->replace_status_text("Closing SQL Editor..."); wbsql()->editor_will_close(this); - exec_sql_task->exec(true, boost::bind(&SqlEditorForm::do_disconnect, this, _1)); + exec_sql_task->exec(true, boost::bind(&SqlEditorForm::do_disconnect, this)); exec_sql_task->disconnect_callbacks(); reset_keep_alive_thread(); - _grtm->replace_status_text("SQL Editor closed"); + bec::GRTManager::get()->replace_status_text("SQL Editor closed"); delete _menu; _menu = NULL; @@ -743,7 +742,7 @@ bool SqlEditorForm::get_session_variable(sql::Connection *dbc_conn, const std::s void SqlEditorForm::schema_tree_did_populate() { - if (!_pending_expand_nodes.empty() && _grtm->get_app_option_int("DbSqlEditor:SchemaTreeRestoreState", 1)) + if (!_pending_expand_nodes.empty() && bec::GRTManager::get()->get_app_option_int("DbSqlEditor:SchemaTreeRestoreState", 1)) { std::string schema, groups; base::partition(_pending_expand_nodes, ":", schema, groups); @@ -808,7 +807,7 @@ void SqlEditorForm::cache_sql_mode() if (sql_mode != _sql_mode) { _sql_mode= sql_mode; - _grtm->run_once_when_idle(this, boost::bind(&SqlEditorForm::update_sql_mode_for_editors, this)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&SqlEditorForm::update_sql_mode_for_editors, this)); } } } @@ -1012,7 +1011,7 @@ void SqlEditorForm::refresh_log_messages(bool ignore_last_message_timestamp) if (!ignore_last_message_timestamp) { double now = timestamp(); - int progress_status_update_interval = (int)(_grtm->get_app_option_int("DbSqlEditor:ProgressStatusUpdateInterval", 500) / 1000.); + int progress_status_update_interval = (int)(bec::GRTManager::get()->get_app_option_int("DbSqlEditor:ProgressStatusUpdateInterval", 500) / 1000.); if (_last_log_message_timestamp + progress_status_update_interval < now) is_refresh_needed= true; @@ -1048,7 +1047,7 @@ void SqlEditorForm::init_connection(sql::Connection* dbc_conn_ref, const db_mgmt } // check if SQL_SAFE_UPDATES should be enabled (only for user connections, don't do it for the aux connection) - if (_grtm->get_app_option_int("DbSqlEditor:SafeUpdates", 1) && user_connection) + if (bec::GRTManager::get()->get_app_option_int("DbSqlEditor:SafeUpdates", 1) && user_connection) sql_script.push_back("SET SQL_SAFE_UPDATES=1"); std::auto_ptr stmt(dbc_conn_ref->createStatement()); @@ -1108,13 +1107,13 @@ void SqlEditorForm::create_connection(sql::Dbc_connection_handler::Ref &dbc_conn sql::DriverManager *dbc_drv_man= sql::DriverManager::getDriverManager(); - db_mgmt_ConnectionRef temp_connection = db_mgmt_ConnectionRef::cast_from(grt::CopyContext(db_mgmt_conn.get_grt()).copy(db_mgmt_conn)); + db_mgmt_ConnectionRef temp_connection = db_mgmt_ConnectionRef::cast_from(grt::CopyContext().copy(db_mgmt_conn)); - int read_timeout = _grtm->get_app_option_int("DbSqlEditor:ReadTimeOut"); + int read_timeout = bec::GRTManager::get()->get_app_option_int("DbSqlEditor:ReadTimeOut"); if (read_timeout > 0) temp_connection->parameterValues().set("OPT_READ_TIMEOUT", grt::IntegerRef(read_timeout)); - int connect_timeout = _grtm->get_app_option_int("DbSqlEditor:ConnectionTimeOut"); + int connect_timeout = bec::GRTManager::get()->get_app_option_int("DbSqlEditor:ConnectionTimeOut"); if (connect_timeout > 0) temp_connection->parameterValues().set("OPT_CONNECT_TIMEOUT", grt::IntegerRef(connect_timeout)); @@ -1163,7 +1162,7 @@ void SqlEditorForm::create_connection(sql::Dbc_connection_handler::Ref &dbc_conn dbc_conn->ref->setSchema(default_schema); dbc_conn->active_schema = default_schema; - _grtm->run_once_when_idle(this, boost::bind(&set_active_schema, shared_from_this(), default_schema)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&set_active_schema, shared_from_this(), default_schema)); } catch (std::exception &exc) { @@ -1253,7 +1252,7 @@ bool SqlEditorForm::connect(std::shared_ptr tunnel) // connection must happen in the worker thread try { - exec_sql_task->exec(true, boost::bind(&SqlEditorForm::do_connect, this, _1, tunnel, auth, &error_ptr)); + exec_sql_task->exec(true, boost::bind(&SqlEditorForm::do_connect, this, tunnel, auth, &error_ptr)); //check if user cancelled if (_cancel_connect) //return false, so it looks like the server is down @@ -1317,7 +1316,7 @@ bool SqlEditorForm::connect(std::shared_ptr tunnel) // assumes setup_side_palette() is called in finish_init(), signalizing that the editor was already initialized once if (_side_palette) // we're in a thread here, so make sure the notification is sent from the main thread { - _grtm->run_once_when_idle(this, boost::bind(&SqlEditorForm::update_connected_state, this)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&SqlEditorForm::update_connected_state, this)); } return true; @@ -1327,7 +1326,7 @@ bool SqlEditorForm::connect(std::shared_ptr tunnel) void SqlEditorForm::update_connected_state() { - grt::DictRef args(_grtm->get_grt()); + grt::DictRef args(true); args.gset("connected", connected()); GRTNotificationCenter::get()->send_grt("GRNSQLEditorReconnected", grtobj(), args); @@ -1358,7 +1357,7 @@ std::string SqlEditorForm::get_client_lib_version() //-------------------------------------------------------------------------------------------------- -grt::StringRef SqlEditorForm::do_connect(grt::GRT *grt, std::shared_ptr tunnel, sql::Authentication::Ref &auth, ConnectionErrorInfo *err_ptr) +grt::StringRef SqlEditorForm::do_connect(std::shared_ptr tunnel, sql::Authentication::Ref &auth, ConnectionErrorInfo *err_ptr) { try { @@ -1421,7 +1420,7 @@ grt::StringRef SqlEditorForm::do_connect(grt::GRT *grt, std::shared_ptrname(grt::StringRef(_connection_details["dbmsProductName"])); db_query_EditorRef editor(grtobj()); @@ -1451,7 +1450,7 @@ grt::StringRef SqlEditorForm::do_connect(grt::GRT *grt, std::shared_ptrref.get(), "lower_case_table_names", value)) _lower_case_table_names = base::atoi(value, 0); - parser::MySQLParserServices::Ref services = parser::MySQLParserServices::get(grt); + parser::MySQLParserServices::Ref services = parser::MySQLParserServices::get(); _work_parser_context = services->createParserContext(rdbms()->characterSets(), _version, _lower_case_table_names != 0); _work_parser_context->use_sql_mode(_sql_mode); } @@ -1480,8 +1479,8 @@ grt::StringRef SqlEditorForm::do_connect(grt::GRT *grt, std::shared_ptrget_grt()->get_module("WbAdmin"); - grt::BaseListRef args(_grtm->get_grt()); + grt::Module *m = grt::GRT::get()->get_module("WbAdmin"); + grt::BaseListRef args(true); args.ginsert(_connection); if (!m || *grt::IntegerRef::cast_from(m->call_function("checkConnectionForRemoteAdmin", args)) == 0) { @@ -1497,8 +1496,8 @@ grt::StringRef SqlEditorForm::do_connect(grt::GRT *grt, std::shared_ptrcreateParserContext(GrtCharacterSetsRef(grt), bec::int_to_version(grt, 50503), true); + parser::MySQLParserServices::Ref services = parser::MySQLParserServices::get(); + _work_parser_context = services->createParserContext(GrtCharacterSetsRef(true), bec::int_to_version(50503), true); _work_parser_context->use_sql_mode(_sql_mode); return grt::StringRef(); @@ -1513,8 +1512,8 @@ grt::StringRef SqlEditorForm::do_connect(grt::GRT *grt, std::shared_ptrget_grt()->get_module("WbAdmin"); - grt::BaseListRef args(_grtm->get_grt()); + grt::GRT::get()->get_module("WbAdmin"); + grt::BaseListRef args(true); args.ginsert(_connection); } @@ -1523,8 +1522,8 @@ grt::StringRef SqlEditorForm::do_connect(grt::GRT *grt, std::shared_ptrcreateParserContext(GrtCharacterSetsRef(grt), bec::int_to_version(grt, 50503), true); + parser::MySQLParserServices::Ref services = parser::MySQLParserServices::get(); + _work_parser_context = services->createParserContext(GrtCharacterSetsRef(true), bec::int_to_version(50503), true); _work_parser_context->use_sql_mode(_sql_mode); return grt::StringRef(); @@ -1804,7 +1803,7 @@ void SqlEditorForm::cancel_query() if (_usr_dbc_conn->is_stop_query_requested) { - _grtm->replace_status_text("Query Cancelled"); + bec::GRTManager::get()->replace_status_text("Query Cancelled"); set_log_message(log_message_index, DbSqlEditorLog::NoteMsg, _("OK - Query cancelled"), STATEMENT, timer.duration_formatted()); } else @@ -1844,11 +1843,11 @@ void SqlEditorForm::explain_current_statement() SqlEditorResult *result = panel->add_panel_for_recordset(Recordset::Ref()); result->set_title("Explain"); - grt::BaseListRef args(_grtm->get_grt()); + grt::BaseListRef args(true); args.ginsert(panel->grtobj()); args.ginsert(result->grtobj()); // run the visual explain plugin, so it will fill the result panel - _grtm->get_grt()->call_module_function("SQLIDEQueryAnalysis", "visualExplain", args); + grt::GRT::get()->call_module_function("SQLIDEQueryAnalysis", "visualExplain", args); } } @@ -1870,7 +1869,7 @@ void SqlEditorForm::exec_sql_retaining_editor_contents(const std::string &sql_sc exec_sql_task->exec(sync, - boost::bind(&SqlEditorForm::do_exec_sql, this, _1, + boost::bind(&SqlEditorForm::do_exec_sql, this, weak_ptr_from(this), std::shared_ptr(new std::string(sql_script)), editor, (ExecFlags)(dont_add_limit_clause?DontAddLimitClause:0), RecordsetsRef())); @@ -1893,7 +1892,7 @@ RecordsetsRef SqlEditorForm::exec_sql_returning_results(const std::string &sql_s RecordsetsRef rsets(new Recordsets()); - do_exec_sql(_grtm->get_grt(), weak_ptr_from(this), std::shared_ptr(new std::string(sql_script)), + do_exec_sql(weak_ptr_from(this), std::shared_ptr(new std::string(sql_script)), NULL, (ExecFlags)(dont_add_limit_clause?DontAddLimitClause:0), rsets); return rsets; @@ -1945,7 +1944,7 @@ bool SqlEditorForm::exec_editor_sql(SqlEditorPanel *editor, bool sync, bool curr flags = (ExecFlags)(flags | NeedNonStdDelimiter); if (dont_add_limit_clause) flags = (ExecFlags)(flags | DontAddLimitClause); - if (_grtm->get_app_option_int("DbSqlEditor:ShowWarnings", 1)) + if (bec::GRTManager::get()->get_app_option_int("DbSqlEditor:ShowWarnings", 1)) flags = (ExecFlags)(flags | ShowWarnings); auto_save(); @@ -1960,7 +1959,7 @@ bool SqlEditorForm::exec_editor_sql(SqlEditorPanel *editor, bool sync, bool curr exec_sql_task->exec( sync, - boost::bind(&SqlEditorForm::do_exec_sql, this, _1, weak_ptr_from(this), shared_sql, + boost::bind(&SqlEditorForm::do_exec_sql, this, weak_ptr_from(this), shared_sql, (SqlEditorPanel*)NULL, flags, rsets) ); @@ -1972,7 +1971,7 @@ bool SqlEditorForm::exec_editor_sql(SqlEditorPanel *editor, bool sync, bool curr else exec_sql_task->exec( sync, - boost::bind(&SqlEditorForm::do_exec_sql, this, _1, weak_ptr_from(this), shared_sql, + boost::bind(&SqlEditorForm::do_exec_sql, this, weak_ptr_from(this), shared_sql, editor, flags, RecordsetsRef()) ); @@ -1981,12 +1980,10 @@ bool SqlEditorForm::exec_editor_sql(SqlEditorPanel *editor, bool sync, bool curr void SqlEditorForm::update_live_schema_tree(const std::string &sql) { - if(_grtm) - _grtm->run_once_when_idle(this, boost::bind(&SqlEditorForm::handle_command_side_effects, this, sql)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&SqlEditorForm::handle_command_side_effects, this, sql)); } - -grt::StringRef SqlEditorForm::do_exec_sql(grt::GRT *grt, Ptr self_ptr, std::shared_ptr sql, +grt::StringRef SqlEditorForm::do_exec_sql(Ptr self_ptr, std::shared_ptr sql, SqlEditorPanel *editor, ExecFlags flags, RecordsetsRef result_list) { bool use_non_std_delimiter = (flags & NeedNonStdDelimiter) != 0; @@ -1997,12 +1994,12 @@ grt::StringRef SqlEditorForm::do_exec_sql(grt::GRT *grt, Ptr self_ptr, std::shar bool query_ps_stats = collect_ps_statement_events(); std::string query_ps_statement_events_error; std::string statement; - int max_query_size_to_log = _grtm->get_app_option_int("DbSqlEditor:MaxQuerySizeToHistory", 0); + int max_query_size_to_log = bec::GRTManager::get()->get_app_option_int("DbSqlEditor:MaxQuerySizeToHistory", 0); int limit_rows = 0; - if (_grtm->get_app_option_int("SqlEditor:LimitRows") != 0) - limit_rows = _grtm->get_app_option_int("SqlEditor:LimitRowsCount", 0); + if (bec::GRTManager::get()->get_app_option_int("SqlEditor:LimitRows") != 0) + limit_rows = bec::GRTManager::get()->get_app_option_int("SqlEditor:LimitRowsCount", 0); - _grtm->replace_status_text(_("Executing Query...")); + bec::GRTManager::get()->replace_status_text(_("Executing Query...")); std::shared_ptr self_ref= (self_ptr).lock(); SqlEditorForm *self= (self_ref).get(); @@ -2062,7 +2059,7 @@ grt::StringRef SqlEditorForm::do_exec_sql(grt::GRT *grt, Ptr self_ptr, std::shar } // Intentionally allow any value. For values <= 0 show no result set at all. - ssize_t max_resultset_count = _grtm->get_app_option_int("DbSqlEditor::MaxResultsets", 50); + ssize_t max_resultset_count = bec::GRTManager::get()->get_app_option_int("DbSqlEditor::MaxResultsets", 50); ssize_t total_result_count = (editor != NULL) ? editor->resultset_count() : 0; // Consider pinned result sets. bool results_left = false; @@ -2098,7 +2095,7 @@ grt::StringRef SqlEditorForm::do_exec_sql(grt::GRT *grt, Ptr self_ptr, std::shar // for select queries add limit clause if specified by global option if (!is_multiple_statement && (Sql_syntax_check::sql_select == statement_type)) { - data_storage= Recordset_cdbc_storage::create(_grtm); + data_storage= Recordset_cdbc_storage::create(); data_storage->set_gather_field_info(true); data_storage->rdbms(rdbms()); data_storage->dbms_conn(_usr_dbc_conn); @@ -2237,7 +2234,7 @@ grt::StringRef SqlEditorForm::do_exec_sql(grt::GRT *grt, Ptr self_ptr, std::shar bool reuse_log_msg= false; if ((updated_rows_count < 0) || is_multiple_statement) { - for (size_t processed_substatements_count= 0; processed_substatements_count < multiple_statement_count; ++processed_substatements_count) + for (std::size_t processed_substatements_count= 0; processed_substatements_count < multiple_statement_count; ++processed_substatements_count) { do { @@ -2312,7 +2309,7 @@ grt::StringRef SqlEditorForm::do_exec_sql(grt::GRT *grt, Ptr self_ptr, std::shar { if (!data_storage) { - data_storage= Recordset_cdbc_storage::create(_grtm); + data_storage= Recordset_cdbc_storage::create(); data_storage->set_gather_field_info(true); data_storage->rdbms(rdbms()); data_storage->dbms_conn(_usr_dbc_conn); @@ -2387,12 +2384,12 @@ grt::StringRef SqlEditorForm::do_exec_sql(grt::GRT *grt, Ptr self_ptr, std::shar "limit in the preferences."), _("OK"), "", ""), true, false); } - _grtm->replace_status_text(_("Query Completed")); + bec::GRTManager::get()->replace_status_text(_("Query Completed")); interrupted = false; stop_processing_sql_script: if (interrupted) - _grtm->replace_status_text(_("Query interrupted")); + bec::GRTManager::get()->replace_status_text(_("Query interrupted")); // try to minimize the times this is called, since this will change the state of the connection // after a user query is ran (eg, it will reset all warnings) if (ran_set_sql_mode) @@ -2517,7 +2514,7 @@ void SqlEditorForm::handle_command_side_effects(const std::string &sql) std::string default_schema= connection_descriptor()->parameterValues().get_string("schema", ""); if (schema_name == default_schema) default_schema = ""; - _grtm->run_once_when_idle(this, boost::bind(&set_active_schema, shared_from_this(), default_schema)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&set_active_schema, shared_from_this(), default_schema)); } } else @@ -2598,11 +2595,12 @@ void SqlEditorForm::continue_on_error(bool val) return; _continue_on_error= val; - _grtm->set_app_option("DbSqlEditor:ContinueOnError", grt::IntegerRef((int)_continue_on_error)); + bec::GRTManager::get()->set_app_option("DbSqlEditor:ContinueOnError", grt::IntegerRef((int)_continue_on_error)); if (_menu) - _menu->set_item_checked("query.stopOnError", !continue_on_error()); - set_editor_tool_items_checked("query.stopOnError", !continue_on_error()); + _menu->set_item_checked("query.continueOnError", continue_on_error()); + set_editor_tool_items_checked("query.continueOnError", continue_on_error()); + active_sql_editor_panel()->editor_be()->set_continue_on_error(continue_on_error()); } @@ -2671,7 +2669,7 @@ void SqlEditorForm::apply_changes_to_recordset(Recordset::Ptr rs_ptr) else skip_commit = true; // if we're in an open tx, then do not commit - bool is_data_changes_commit_wizard_enabled= (0 != _grtm->get_app_option_int("DbSqlEditor:IsDataChangesCommitWizardEnabled", 1)); + bool is_data_changes_commit_wizard_enabled= (0 != bec::GRTManager::get()->get_app_option_int("DbSqlEditor:IsDataChangesCommitWizardEnabled", 1)); if (is_data_changes_commit_wizard_enabled) { run_data_changes_commit_wizard(rs_ptr, skip_commit); @@ -2681,7 +2679,7 @@ void SqlEditorForm::apply_changes_to_recordset(Recordset::Ptr rs_ptr) sql_storage->is_sql_script_substitute_enabled(false); scoped_connection on_sql_script_run_error_conn(sql_storage->on_sql_script_run_error.connect(on_sql_script_run_error)); - rs->do_apply_changes(_grtm->get_grt(), rs_ptr, Recordset_data_storage::Ptr(data_storage_ref), skip_commit); + rs->do_apply_changes(rs_ptr, Recordset_data_storage::Ptr(data_storage_ref), skip_commit); } // Since many messages could have been added it is possible the @@ -2709,7 +2707,7 @@ bool SqlEditorForm::run_data_changes_commit_wizard(Recordset::Ptr rs_ptr, bool s std::string sql_script_text= Recordset_sql_storage::statements_as_sql_script(sql_script.statements); // No need for online DDL settings or callback as we are dealing with data here, not metadata. - SqlScriptRunWizard wizard(_grtm, rdbms_version(), "", ""); + SqlScriptRunWizard wizard(rdbms_version(), "", ""); scoped_connection c1(on_sql_script_run_error.connect(boost::bind(&SqlScriptApplyPage::on_error, wizard.apply_page, _1, _2, _3))); scoped_connection c2(on_sql_script_run_progress.connect(boost::bind(&SqlScriptApplyPage::on_exec_progress, wizard.apply_page, _1))); @@ -2731,7 +2729,7 @@ void SqlEditorForm::apply_object_alter_script(const std::string &alter_script, b std::list statements; sql_splitter->splitSqlScript(alter_script, statements); - int max_query_size_to_log = _grtm->get_app_option_int("DbSqlEditor:MaxQuerySizeToHistory", 0); + int max_query_size_to_log = bec::GRTManager::get()->get_app_option_int("DbSqlEditor:MaxQuerySizeToHistory", 0); /* this doesn't really work std::list failback_statements; @@ -2836,7 +2834,7 @@ void SqlEditorForm::apply_object_alter_script(const std::string &alter_script, b // Run refresh on main thread, but only if there's not another refresh pending already. if (!_overviewRefreshPending.connected()) { - _overviewRefreshPending = _grtm->run_once_when_idle(this, boost::bind(&SqlEditorTreeController::refresh_live_object_in_overview, + _overviewRefreshPending = bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&SqlEditorTreeController::refresh_live_object_in_overview, _live_tree, db_object_type, schema_name, db_object->oldName(), db_object->name())); } } @@ -2844,7 +2842,7 @@ void SqlEditorForm::apply_object_alter_script(const std::string &alter_script, b //_live_tree->refresh_live_object_in_editor(obj_editor, false); if (!_editorRefreshPending.connected()) { - _editorRefreshPending = _grtm->run_once_when_idle(this, boost::bind(&SqlEditorTreeController::refresh_live_object_in_editor, + _editorRefreshPending = bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&SqlEditorTreeController::refresh_live_object_in_editor, _live_tree, obj_editor, false)); } } @@ -2862,7 +2860,7 @@ void SqlEditorForm::apply_data_changes_commit(const std::string &sql_script_text if (!sql_storage) return; - int max_query_size_to_log = _grtm->get_app_option_int("DbSqlEditor:MaxQuerySizeToHistory", 0); + int max_query_size_to_log = bec::GRTManager::get()->get_app_option_int("DbSqlEditor:MaxQuerySizeToHistory", 0); Sql_script sql_script= sql_storage->sql_script_substitute(); sql_script.statements.clear(); @@ -2874,7 +2872,7 @@ void SqlEditorForm::apply_data_changes_commit(const std::string &sql_script_text scoped_connection on_sql_script_run_statistics_conn(sql_storage->on_sql_script_run_statistics.connect(on_sql_script_run_statistics)); sql_storage->sql_script_substitute(sql_script); - rs->do_apply_changes(_grtm->get_grt(), rs_ptr, Recordset_data_storage::Ptr(data_storage_ref), skip_commit); + rs->do_apply_changes(rs_ptr, Recordset_data_storage::Ptr(data_storage_ref), skip_commit); if (!max_query_size_to_log || max_query_size_to_log >= (int)sql_script_text.size() ) _history->add_entry(sql_script.statements); @@ -2972,11 +2970,11 @@ void SqlEditorForm::active_schema(const std::string &value) update_editor_title_schema(value); if (value.empty()) - grt_manager()->replace_status_text(_("Active schema was cleared")); + bec::GRTManager::get()->replace_status_text(_("Active schema was cleared")); else - grt_manager()->replace_status_text(strfmt(_("Active schema changed to %s"), value.c_str())); + bec::GRTManager::get()->replace_status_text(strfmt(_("Active schema changed to %s"), value.c_str())); - _grtm->get_grt()->call_module_function("Workbench", "saveConnections", grt::BaseListRef()); + grt::GRT::get()->call_module_function("Workbench", "saveConnections", grt::BaseListRef()); } CATCH_ANY_EXCEPTION_AND_DISPATCH(_("Set active schema")) } @@ -2991,7 +2989,7 @@ db_mgmt_RdbmsRef SqlEditorForm::rdbms() return db_mgmt_RdbmsRef::cast_from(_connection->driver()->owner()); } else - return db_mgmt_RdbmsRef::cast_from(_grtm->get_grt()->get("/wb/rdbmsMgmt/rdbms/0/")); + return db_mgmt_RdbmsRef::cast_from(grt::GRT::get()->get("/wb/rdbmsMgmt/rdbms/0/")); } @@ -3094,7 +3092,7 @@ std::set SqlEditorForm::valid_charsets() if (_charsets.empty()) { grt::ListRef list = rdbms()->characterSets(); - for (size_t i = 0; i < list->count(); i++) + for (std::size_t i = 0; i < list->count(); i++) _charsets.insert(base::tolower(*list[i]->name())); // 3 character sets were added in version 5.5.3. Remove them from the list if the current version @@ -3117,7 +3115,7 @@ bool SqlEditorForm::save_snippet() if (!panel) return false; std::string text; - size_t start, end; + std::size_t start, end; if (panel->editor_be()->selected_range(start, end)) text = panel->editor_be()->selected_text(); else @@ -3127,11 +3125,11 @@ bool SqlEditorForm::save_snippet() return false; DbSqlEditorSnippets::get_instance()->add_snippet("", text, true); - _grtm->replace_status_text("SQL saved to snippets list."); + bec::GRTManager::get()->replace_status_text("SQL saved to snippets list."); _side_palette->refresh_snippets(); - _grtm->run_once_when_idle(this, boost::bind(&QuerySidePalette::edit_last_snippet, _side_palette)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&QuerySidePalette::edit_last_snippet, _side_palette)); return true; } @@ -3147,7 +3145,7 @@ bool SqlEditorForm::can_close_(bool interactive) { if (exec_sql_task && exec_sql_task->is_busy()) { - _grtm->replace_status_text(_("Cannot close SQL IDE while being busy")); + bec::GRTManager::get()->replace_status_text(_("Cannot close SQL IDE while being busy")); return false; } @@ -3155,14 +3153,14 @@ bool SqlEditorForm::can_close_(bool interactive) return false; _live_tree->prepare_close(); - _grtm->set_app_option("DbSqlEditor:ActiveSidePaletteTab", grt::IntegerRef(_side_palette->get_active_tab())); + bec::GRTManager::get()->set_app_option("DbSqlEditor:ActiveSidePaletteTab", grt::IntegerRef(_side_palette->get_active_tab())); bool check_scratch_editors = true; bool save_workspace_on_close = false; // if Save of workspace on close is enabled, we don't need to check whether there are unsaved // SQL editors but other stuff should be checked. - grt::ValueRef option(_grtm->get_app_option("workbench:SaveSQLWorkspaceOnClose")); + grt::ValueRef option(bec::GRTManager::get()->get_app_option("workbench:SaveSQLWorkspaceOnClose")); if (option.is_valid() && *grt::IntegerRef::cast_from(option)) { save_workspace_on_close = true; @@ -3306,7 +3304,7 @@ void SqlEditorForm::note_connection_open_outcome(int error) if (_last_server_running_state != newState && newState != UnknownState) { - grt::DictRef info(_grtm->get_grt()); + grt::DictRef info(true); _last_server_running_state = newState; if (newState == RunningState) diff --git a/backend/wbprivate/sqlide/wb_sql_editor_form.h b/backend/wbprivate/sqlide/wb_sql_editor_form.h index ace2c3af5..e0324f65b 100644 --- a/backend/wbprivate/sqlide/wb_sql_editor_form.h +++ b/backend/wbprivate/sqlide/wb_sql_editor_form.h @@ -151,7 +151,6 @@ class MYSQLWBBACKEND_PUBLIC_FUNC SqlEditorForm : public bec::UIForm, grt::GRTObs void restore_last_workspace(); public: - bec::GRTManager * grt_manager() const { return _grtm; } wb::WBContextSQLIDE *wbsql() const { return _wbsql; } db_query_EditorRef grtobj(); @@ -163,7 +162,6 @@ class MYSQLWBBACKEND_PUBLIC_FUNC SqlEditorForm : public bec::UIForm, grt::GRTObs private: wb::WBContextSQLIDE *_wbsql; GrtVersionRef _version; - bec::GRTManager *_grtm; mforms::MenuBar *_menu; mforms::ToolBar *_toolbar; std::string _connection_info; @@ -241,10 +239,10 @@ class MYSQLWBBACKEND_PUBLIC_FUNC SqlEditorForm : public bec::UIForm, grt::GRTObs std::map _connection_details; std::set _charsets; - grt::StringRef do_connect(grt::GRT *grt, std::shared_ptr tunnel, sql::Authentication::Ref &auth, + grt::StringRef do_connect(std::shared_ptr tunnel, sql::Authentication::Ref &auth, struct ConnectionErrorInfo *autherr_ptr); std::string get_client_lib_version(); - grt::StringRef do_disconnect(grt::GRT *grt); + grt::StringRef do_disconnect(); void update_connected_state(); public: @@ -365,7 +363,7 @@ class MYSQLWBBACKEND_PUBLIC_FUNC SqlEditorForm : public bec::UIForm, grt::GRTObs }; void update_live_schema_tree(const std::string &sql); - grt::StringRef do_exec_sql(grt::GRT *grt, Ptr self_ptr, std::shared_ptr sql, + grt::StringRef do_exec_sql(Ptr self_ptr, std::shared_ptr sql, SqlEditorPanel *editor, ExecFlags flags, RecordsetsRef result_list); void handle_command_side_effects(const std::string &sql); diff --git a/backend/wbprivate/sqlide/wb_sql_editor_form_ui.cpp b/backend/wbprivate/sqlide/wb_sql_editor_form_ui.cpp index 140008324..51f2169a0 100644 --- a/backend/wbprivate/sqlide/wb_sql_editor_form_ui.cpp +++ b/backend/wbprivate/sqlide/wb_sql_editor_form_ui.cpp @@ -62,6 +62,7 @@ mforms::ToolBar *SqlEditorForm::get_toolbar() if (!_toolbar) { _toolbar = _wbsql->get_cmdui()->create_toolbar("data/dbquery_toolbar.xml", boost::bind(&SqlEditorForm::activate_command, this, _1)); + _toolbar->set_name("dbquery"); update_menu_and_toolbar(); update_toolbar_icons(); @@ -95,9 +96,9 @@ void SqlEditorForm::limit_rows(const std::string &limit_text) } } - bec::GRTManager::get().set_app_option("SqlEditor:LimitRows", grt::IntegerRef(limit > 0)); + bec::GRTManager::get()->set_app_option("SqlEditor:LimitRows", grt::IntegerRef(limit > 0)); if (limit > 0) - bec::GRTManager::get().set_app_option("SqlEditor:LimitRowsCount", grt::IntegerRef(limit)); + bec::GRTManager::get()->set_app_option("SqlEditor:LimitRowsCount", grt::IntegerRef(limit)); // special handling for custom values not in the predefined list mforms::MenuItem *citem = menu->find_item("custom"); @@ -136,7 +137,7 @@ mforms::MenuBar *SqlEditorForm::get_menubar() _menu = _wbsql->get_cmdui()->create_menubar_for_context(WB_CONTEXT_QUERY); // special handling for Query -> Row Limit submenu - int limit_count = bec::GRTManager::get().get_app_option_int("SqlEditor:LimitRows") ? bec::GRTManager::get().get_app_option_int("SqlEditor:LimitRowsCount") : 0; + int limit_count = bec::GRTManager::get()->get_app_option_int("SqlEditor:LimitRows") ? bec::GRTManager::get()->get_app_option_int("SqlEditor:LimitRowsCount") : 0; mforms::MenuItem *limit_item = _menu->find_item("limit_rows"); if (limit_item) @@ -212,7 +213,7 @@ mforms::MenuBar *SqlEditorForm::get_menubar() void SqlEditorForm::update_menu_and_toolbar() { - if (!bec::GRTManager::get().in_main_thread()) + if (!bec::GRTManager::get()->in_main_thread()) { exec_sql_task->execute_in_main_thread(boost::bind(&SqlEditorForm::update_menu_and_toolbar, this), false, @@ -261,7 +262,7 @@ void SqlEditorForm::update_menu_and_toolbar() set_editor_tool_items_enbled("query.continueOnError", connected); set_editor_tool_items_checked("query.autocommit", auto_commit()); set_editor_tool_items_checked("query.continueOnError", _continue_on_error); - set_editor_tool_items_checked("query.toggleLimit", bec::GRTManager::get().get_app_option_int("SqlEditor:LimitRows") != 0); + set_editor_tool_items_checked("query.toggleLimit", bec::GRTManager::get()->get_app_option_int("SqlEditor:LimitRows") != 0); } //-------------------------------------------------------------------------------------------------- @@ -353,7 +354,7 @@ void SqlEditorForm::setup_side_palette() _side_palette_host = _side_palette; #endif - _side_palette->set_active_tab(bec::GRTManager::get().get_app_option_int("DbSqlEditor:ActiveSidePaletteTab", 0)); + _side_palette->set_active_tab(bec::GRTManager::get()->get_app_option_int("DbSqlEditor:ActiveSidePaletteTab", 0)); } //-------------------------------------------------------------------------------------------------- @@ -586,7 +587,7 @@ void SqlEditorForm::handle_tab_menu_action(const std::string &action, int tab_in else if (action == "close_tab") { if (_tabdock->view_at_index(tab_index)->on_close()) - bec::GRTManager::get().run_once_when_idle(this, boost::bind(&mforms::DockingPoint::close_view_at_index, _tabdock, tab_index)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&mforms::DockingPoint::close_view_at_index, _tabdock, tab_index)); } else if (action == "close_other_tabs") { diff --git a/backend/wbprivate/sqlide/wb_sql_editor_help.cpp b/backend/wbprivate/sqlide/wb_sql_editor_help.cpp index bc73e3cac..a42e30a8e 100644 --- a/backend/wbprivate/sqlide/wb_sql_editor_help.cpp +++ b/backend/wbprivate/sqlide/wb_sql_editor_help.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -47,7 +47,7 @@ std::string DbSqlEditorContextHelp::lookup_topic_for_string(const SqlEditorForm: { try { - log_debug2("Validating topic: %s\n", topic.c_str()); + logDebug2("Validating topic: %s\n", topic.c_str()); sql::Dbc_connection_handler::Ref conn; base::RecMutexLock aux_dbc_conn_mutex = form->ensure_valid_aux_connection(conn); @@ -66,7 +66,7 @@ std::string DbSqlEditorContextHelp::lookup_topic_for_string(const SqlEditorForm: { // It's an exception but not relevant for the rest of the code. We just did not get a topic // (maybe the server was busy or not reachable). - log_debug2("Exception caught while looking up topic\n"); + logDebug2("Exception caught while looking up topic\n"); } } } @@ -385,7 +385,7 @@ std::string object_from_token(MySQLScanner &scanner) bool DbSqlEditorContextHelp::get_help_text(const SqlEditorForm::Ref &form, const std::string &topic, std::string &title, std::string &text) { - log_debug2("Looking up help topic: %s\n", topic.c_str()); + logDebug2("Looking up help topic: %s\n", topic.c_str()); if (!topic.empty()) { try @@ -407,7 +407,7 @@ bool DbSqlEditorContextHelp::get_help_text(const SqlEditorForm::Ref &form, const } catch (...) { - log_debug2("Exception caught while looking up help text\n"); + logDebug2("Exception caught while looking up help text\n"); } } return false; @@ -421,7 +421,7 @@ bool DbSqlEditorContextHelp::get_help_text(const SqlEditorForm::Ref &form, const std::string DbSqlEditorContextHelp::find_help_topic_from_position(const SqlEditorForm::Ref &form, const std::string &query, std::pair caret) { - log_debug2("Finding help topic\n"); + logDebug2("Finding help topic\n"); // Ensure our translation list has the same size as there are query types. g_assert((sizeof(query_type_to_help_topic) / sizeof(query_type_to_help_topic[0])) == QtSentinel); @@ -440,25 +440,25 @@ std::string DbSqlEditorContextHelp::find_help_topic_from_position(const SqlEdito // syntax errors. So we check first these special cases if we can solve them by // parsing. If not we continue with our normal strategy. MySQLRecognizer recognizer(form->server_version(), form->sql_mode(), form->valid_charsets()); - recognizer.parse(query.c_str(), query.length(), true, PuGeneric); + recognizer.parse(query.c_str(), query.length(), true, MySQLParseUnit::PuGeneric); MySQLRecognizerTreeWalker walker = recognizer.tree_walker(); - bool found_token = walker.advance_to_position((int)caret.second, (int)caret.first); + bool found_token = walker.advanceToPosition((int)caret.second, (int)caret.first); if (found_token && recognizer.has_errors()) { // We can only assume success if the first error is after our position. Otherwise // we cannot predict what's in the syntax tree. - MySQLParserErrorInfo error = recognizer.error_info().front(); + ParserErrorInfo error = recognizer.error_info().front(); found_token = ((int)error.line > caret.second || - (int)error.line == caret.second && (int)error.charOffset > caret.first); + ((int)error.line == caret.second && (int)error.charOffset > caret.first)); } if (found_token) { - std::string text = base::tolower(walker.token_text()); - switch (walker.token_type()) + std::string text = base::tolower(walker.tokenText()); + switch (walker.tokenType()) { case CHAR_SYMBOL: - switch (walker.parent_type()) + switch (walker.parentType()) { case FUNCTION_CALL_TOKEN: return "char function"; @@ -467,14 +467,14 @@ std::string DbSqlEditorContextHelp::find_help_topic_from_position(const SqlEdito return "show character set"; } - if (walker.look_ahead(false) != OPEN_PAR_SYMBOL) + if (walker.lookAhead(false) != OPEN_PAR_SYMBOL) return "char byte"; return "char"; case DISTINCT_SYMBOL: - if (walker.up() && walker.token_type() == FUNCTION_CALL_TOKEN) + if (walker.up() && walker.tokenType() == FUNCTION_CALL_TOKEN) { - if (walker.look_ahead(true) == COUNT_SYMBOL) + if (walker.lookAhead(true) == COUNT_SYMBOL) return "count distinct"; } break; @@ -485,25 +485,25 @@ std::string DbSqlEditorContextHelp::find_help_topic_from_position(const SqlEdito if (text == "merge") { - if (walker.previous_type() == EQUAL_OPERATOR) + if (walker.previousType() == EQUAL_OPERATOR) { - if (!walker.previous_sibling()) + if (!walker.previousSibling()) break; } - if (walker.previous_type() == ENGINES_SYMBOL || walker.previous_type() == TYPE_SYMBOL) + if (walker.previousType() == ENGINES_SYMBOL || walker.previousType() == TYPE_SYMBOL) return "merge"; } break; case YEAR_SYMBOL: - if (walker.parent_type() == DATA_TYPE_TOKEN) + if (walker.parentType() == DATA_TYPE_TOKEN) return "year data type"; else return "year"; break; default: - switch (walker.parent_type()) + switch (walker.parentType()) { case LABEL_TOKEN: return "labels"; @@ -522,19 +522,19 @@ std::string DbSqlEditorContextHelp::find_help_topic_from_position(const SqlEdito if (found_token) { - MySQLQueryType type = walker.get_current_query_type(); + MySQLQueryType type = walker.getCurrentQueryType(); if (topic == "INSERT" || type == QtInsert) { if (type == QtInsert) - walker.go_to_subquery_start(); // Go back to the start of this specific subquery. + walker.goToSubQueryStart(); // Go back to the start of this specific subquery. // Insert is a major keyword, so it has an own AST tree. Hence go down to the first child // for the next scan (which must be non-recursive). walker.next(); // The current position should now be on the INSERT keyword. - if (walker.advance_to_type(SELECT_SYMBOL, false)) + if (walker.advanceToType(SELECT_SYMBOL, false)) return "insert select"; return "insert"; } @@ -590,7 +590,7 @@ std::string DbSqlEditorContextHelp::topic_from_position(const SqlEditorForm::Ref const std::string &query, std::pair caret) { // TODO: switch to use a parser context instead of the form reference. - log_debug2("Trying to get help topic at position <%li, %li>, from query: %s...\n", (long)caret.first, + logDebug2("Trying to get help topic at position <%li, %li>, from query: %s...\n", (long)caret.first, (long)caret.second, query.substr(0, 300).c_str()); // First collect all tokens up to the caret position. @@ -974,7 +974,7 @@ std::string DbSqlEditorContextHelp::topic_from_position(const SqlEditorForm::Ref */ std::string DbSqlEditorContextHelp::topic_with_single_topic_equivalent(MySQLScanner &scanner) { - log_debug2("Trying single word topics\n"); + logDebug2("Trying single word topics\n"); std::string topic = base::tolower(scanner.token_text()); diff --git a/backend/wbprivate/sqlide/wb_sql_editor_panel.cpp b/backend/wbprivate/sqlide/wb_sql_editor_panel.cpp index b0ec84418..393b28b8d 100644 --- a/backend/wbprivate/sqlide/wb_sql_editor_panel.cpp +++ b/backend/wbprivate/sqlide/wb_sql_editor_panel.cpp @@ -81,11 +81,11 @@ SqlEditorPanel::SqlEditorPanel(SqlEditorForm *owner, bool is_scratch, bool start // (and hence an own parser), to allow concurrent and multi threaded work. parser::MySQLParserServices::Ref services = parser::MySQLParserServices::get(); - parser::ParserContext::Ref context = services->createParserContext(owner->rdbms()->characterSets(), + parser::MySQLParserContext::Ref context = services->createParserContext(owner->rdbms()->characterSets(), owner->rdbms_version(), owner->lower_case_table_names() != 0); _editor = MySQLEditor::create(context, owner->work_parser_context(), grtobj); - _editor->sql_check_progress_msg_throttle(bec::GRTManager::get().get_app_option_int("DbSqlEditor:ProgressStatusUpdateInterval", 500)/(double)1000); + _editor->sql_check_progress_msg_throttle(bec::GRTManager::get()->get_app_option_int("DbSqlEditor:ProgressStatusUpdateInterval", 500)/(double)1000); _editor->set_auto_completion_cache(owner->auto_completion_cache()); _editor->set_sql_mode(owner->sql_mode()); _editor->set_current_schema(owner->active_schema()); @@ -99,7 +99,7 @@ SqlEditorPanel::SqlEditorPanel(SqlEditorForm *owner, bool is_scratch, bool start _editor_box.add(setup_editor_toolbar(), false, true); _editor_box.add_end(code_editor, true, true); - code_editor->set_font(grt::StringRef::cast_from(bec::GRTManager::get().get_app_option("workbench.general.Editor:Font"))); + code_editor->set_font(grt::StringRef::cast_from(bec::GRTManager::get()->get_app_option("workbench.general.Editor:Font"))); code_editor->set_status_text(""); code_editor->set_show_find_panel_callback(boost::bind(&SqlEditorPanel::show_find_panel, this, _1, _2)); @@ -112,9 +112,9 @@ SqlEditorPanel::SqlEditorPanel(SqlEditorForm *owner, bool is_scratch, bool start UIForm::scoped_connect(_splitter.signal_position_changed(), boost::bind(&SqlEditorPanel::splitter_resized, this)); _tab_action_box.set_spacing(4); _tab_action_box.add_end(&_tab_action_info, false, true); - _tab_action_box.add_end(&_tab_action_icon, false, false); - _tab_action_box.add_end(&_tab_action_revert, false, false); - _tab_action_box.add_end(&_tab_action_apply, false, false); + _tab_action_box.add_end(&_tab_action_icon, false, true); + _tab_action_box.add_end(&_tab_action_revert, false, true); + _tab_action_box.add_end(&_tab_action_apply, false, true); _tab_action_icon.set_image(mforms::App::get()->get_resource_path("mini_notice.png")); _tab_action_icon.show(false); _tab_action_info.show(false); @@ -195,7 +195,7 @@ bool SqlEditorPanel::can_close() bool check_editors = true; // if Save of workspace on close is enabled, we don't need to check whether there are unsaved scratch // SQL editors but other stuff should be checked. - grt::ValueRef option(bec::GRTManager::get().get_app_option("workbench:SaveSQLWorkspaceOnClose")); + grt::ValueRef option(bec::GRTManager::get()->get_app_option("workbench:SaveSQLWorkspaceOnClose")); if (option.is_valid() && *grt::IntegerRef::cast_from(option)) check_editors = false; @@ -333,7 +333,7 @@ void SqlEditorPanel::splitter_resized() { if (_lower_tabview.page_count() > 0) { - bec::GRTManager::get().set_app_option("DbSqlEditor:ResultSplitterPosition", + bec::GRTManager::get()->set_app_option("DbSqlEditor:ResultSplitterPosition", grt::IntegerRef(_splitter.get_divider_position())); } } @@ -521,7 +521,7 @@ SqlEditorPanel::LoadResult SqlEditorPanel::load_from(const std::string &file, co if (!g_file_get_contents(file.c_str(), &data, &length, &error)) { - log_error("Could not read file %s: %s\n", file.c_str(), error->message); + logError("Could not read file %s: %s\n", file.c_str(), error->message); std::string what = error->message; g_error_free(error); throw std::runtime_error(what); @@ -565,7 +565,7 @@ SqlEditorPanel::LoadResult SqlEditorPanel::load_from(const std::string &file, co if (!file_mtime(file, _file_timestamp)) { - log_warning("Can't get timestamp for %s\n", file.c_str()); + logWarning("Can't get timestamp for %s\n", file.c_str()); _file_timestamp = 0; } return Loaded; @@ -620,13 +620,13 @@ bool SqlEditorPanel::save() // File extension check is already done in FileChooser. - bec::GRTManager::get().replace_status_text(strfmt(_("Saving SQL script to '%s'..."), _filename.c_str())); + bec::GRTManager::get()->replace_status_text(strfmt(_("Saving SQL script to '%s'..."), _filename.c_str())); std::pair text = text_data(); if (!g_file_set_contents(_filename.c_str(), text.first, text.second, &error)) { - log_error("Could not save script %s: %s\n", _filename.c_str(), error->message); - bec::GRTManager::get().replace_status_text(strfmt(_("Error saving SQL script to '%s'."), _filename.c_str())); + logError("Could not save script %s: %s\n", _filename.c_str(), error->message); + bec::GRTManager::get()->replace_status_text(strfmt(_("Error saving SQL script to '%s'."), _filename.c_str())); mforms::Utilities::show_error(strfmt(_("Error writing file %s"), _filename.c_str()), error->message, _("OK")); @@ -639,7 +639,7 @@ bool SqlEditorPanel::save() _is_scratch = false; // saving a file makes it not a scratch buffer anymore file_mtime(_filename, _file_timestamp); - bec::GRTManager::get().replace_status_text(strfmt(_("SQL script saved to '%s'"), _filename.c_str())); + bec::GRTManager::get()->replace_status_text(strfmt(_("SQL script saved to '%s'"), _filename.c_str())); // update autosave state _form->auto_save(); @@ -663,7 +663,7 @@ void SqlEditorPanel::revert_to_saved() NotificationCenter::get()->send("GNDocumentOpened", this, info); } _form->auto_save(); - bec::GRTManager::get().replace_status_text(strfmt(_("Reverted to saved '%s'"), _filename.c_str())); + bec::GRTManager::get()->replace_status_text(strfmt(_("Reverted to saved '%s'"), _filename.c_str())); } } @@ -728,7 +728,7 @@ void SqlEditorPanel::auto_save(const std::string &path) std::pair text = text_data(); if (!g_file_set_contents(fn.c_str(), text.first, text.second, &error)) { - log_error("Could not save snapshot of editor contents to %s: %s\n", fn.c_str(), error->message); + logError("Could not save snapshot of editor contents to %s: %s\n", fn.c_str(), error->message); std::string msg(strfmt("Could not save snapshot of editor contents to %s: %s", fn.c_str(), error->message)); g_error_free(error); throw std::runtime_error(msg); @@ -743,7 +743,7 @@ void SqlEditorPanel::auto_save(const std::string &path) } catch (std::exception &e) { - log_warning("Error deleting autosave file %s: %s\n", fn.c_str(), e.what()); + logWarning("Error deleting autosave file %s: %s\n", fn.c_str(), e.what()); } } } @@ -756,11 +756,11 @@ void SqlEditorPanel::delete_auto_save(const std::string &path) try { base::remove(base::makePath(path, _autosave_file_suffix+".autosave")); - } catch (std::exception &exc) { log_warning("Could not delete auto-save file: %s\n", exc.what()); } + } catch (std::exception &exc) { logWarning("Could not delete auto-save file: %s\n", exc.what()); } try { base::remove(base::makePath(path, _autosave_file_suffix+".info")); - } catch (std::exception &exc) { log_warning("Could not delete auto-save file: %s\n", exc.what()); } + } catch (std::exception &exc) { logWarning("Could not delete auto-save file: %s\n", exc.what()); } } //-------------------------------------------------------------------------------------------------- @@ -1079,7 +1079,7 @@ void SqlEditorPanel::query_finished() void SqlEditorPanel::query_failed(const std::string &message) { - log_error("Unhandled error during query: %s\n", message.c_str()); + logError("Unhandled error during query: %s\n", message.c_str()); _busy = false; _form->set_busy_tab(-1); @@ -1165,7 +1165,7 @@ void SqlEditorPanel::lower_tab_switched() // if a lower tab view selection has changed, we make sure it's visible if (!_busy && _lower_tabview.page_count() > 0) // if we're running a query, then let dock_result handle this { - int position = bec::GRTManager::get().get_app_option_int("DbSqlEditor:ResultSplitterPosition", 200); + int position = bec::GRTManager::get()->get_app_option_int("DbSqlEditor:ResultSplitterPosition", 200); if (position > _splitter.get_height() - 100) position = _splitter.get_height() - 100; _splitter.set_divider_position(position); @@ -1243,14 +1243,14 @@ SqlEditorResult *SqlEditorPanel::result_panel(int i) void SqlEditorPanel::add_panel_for_recordset_from_main(Recordset::Ref rset) { - if (bec::GRTManager::get().in_main_thread()) + if (bec::GRTManager::get()->in_main_thread()) { SqlEditorForm::RecordsetData *rdata = dynamic_cast(rset->client_data()); rdata->result_panel = add_panel_for_recordset(rset); } else - bec::GRTManager::get().run_once_when_idle(dynamic_cast(this), + bec::GRTManager::get()->run_once_when_idle(dynamic_cast(this), boost::bind(&SqlEditorPanel::add_panel_for_recordset_from_main, this, rset)); } @@ -1281,7 +1281,7 @@ void SqlEditorPanel::dock_result_panel(SqlEditorResult *result) _splitter.set_expanded(false, true); if (_was_empty) { - int position = bec::GRTManager::get().get_app_option_int("DbSqlEditor:ResultSplitterPosition", 200); + int position = bec::GRTManager::get()->get_app_option_int("DbSqlEditor:ResultSplitterPosition", 200); if (position > _splitter.get_height() - 100) position = _splitter.get_height() - 100; _splitter.set_divider_position(position); @@ -1307,7 +1307,7 @@ void SqlEditorPanel::lower_tab_reordered(mforms::View *view, int from, int to) size_t from_index = grtobj()->resultPanels().get_index(dynamic_cast(view)->grtobj()); if (from_index == grt::BaseListRef::npos) { - log_fatal("Result panel is not in resultPanels() list\n"); + logFatal("Result panel is not in resultPanels() list\n"); return; } @@ -1348,7 +1348,7 @@ void SqlEditorPanel::lower_tab_reordered(mforms::View *view, int from, int to) } if (to_index < 0) { - log_fatal("Unable to find suitable target index for reorder\n"); + logFatal("Unable to find suitable target index for reorder\n"); return; } diff --git a/backend/wbprivate/sqlide/wb_sql_editor_result_panel.cpp b/backend/wbprivate/sqlide/wb_sql_editor_result_panel.cpp index 82ac18261..976991feb 100644 --- a/backend/wbprivate/sqlide/wb_sql_editor_result_panel.cpp +++ b/backend/wbprivate/sqlide/wb_sql_editor_result_panel.cpp @@ -113,7 +113,7 @@ SqlEditorResult::SqlEditorResult(SqlEditorPanel *owner) add(&_tabview, true, true); _switcher.attach_to_tabview(&_tabview); - _switcher.set_collapsed(bec::GRTManager::get().get_app_option_int("Recordset:SwitcherCollapsed", 0) != 0); + _switcher.set_collapsed(bec::GRTManager::get()->get_app_option_int("Recordset:SwitcherCollapsed", 0) != 0); add(&_switcher, false, true); _switcher.signal_changed()->connect(boost::bind(&SqlEditorResult::switch_tab, this)); @@ -230,7 +230,7 @@ void SqlEditorResult::set_recordset(Recordset::Ref rset) mforms::GridView* grid = mforms::manage(mforms::GridView::create(rset)); { - std::string font = bec::GRTManager::get().get_app_option_string("workbench.general.Resultset:Font"); + std::string font = bec::GRTManager::get()->get_app_option_string("workbench.general.Resultset:Font"); if (!font.empty()) grid->set_font(font); @@ -408,7 +408,7 @@ void SqlEditorResult::switch_tab() } catch (std::exception &exc) { - log_error("Error executing visual explain: %s\n", exc.what()); + logError("Error executing visual explain: %s\n", exc.what()); mforms::Utilities::show_error("Execution Plan", "An internal error occurred while building the execution plan, please file a bug report.", "OK"); } @@ -453,7 +453,7 @@ void SqlEditorResult::switcher_collapsed() relayout(); - bec::GRTManager::get().set_app_option("Recordset:SwitcherCollapsed", grt::IntegerRef(state?1:0)); + bec::GRTManager::get()->set_app_option("Recordset:SwitcherCollapsed", grt::IntegerRef(state?1:0)); } @@ -463,9 +463,9 @@ void SqlEditorResult::show_export_recordset() { RETURN_IF_FAIL_TO_RETAIN_WEAK_PTR (Recordset, _rset, rs) { - grt::ValueRef option(bec::GRTManager::get().get_app_option("Recordset:LastExportPath")); + grt::ValueRef option(bec::GRTManager::get()->get_app_option("Recordset:LastExportPath")); std::string path = option.is_valid() ? grt::StringRef::cast_from(option) : ""; - option = bec::GRTManager::get().get_app_option("Recordset:LastExportExtension"); + option = bec::GRTManager::get()->get_app_option("Recordset:LastExportExtension"); std::string extension = option.is_valid() ? grt::StringRef::cast_from(option) : ""; InsertsExportForm exporter(0/*mforms::Form::main_form()*/, rs_ref, extension); exporter.set_title(_("Export Resultset")); @@ -473,16 +473,16 @@ void SqlEditorResult::show_export_recordset() exporter.set_path(path); path = exporter.run(); if (path.empty()) - bec::GRTManager::get().replace_status_text(_("Export resultset canceled")); + bec::GRTManager::get()->replace_status_text(_("Export resultset canceled")); else { - bec::GRTManager::get().replace_status_text(strfmt(_("Exported resultset to %s"), path.c_str())); - bec::GRTManager::get().set_app_option("Recordset:LastExportPath", grt::StringRef(path)); + bec::GRTManager::get()->replace_status_text(strfmt(_("Exported resultset to %s"), path.c_str())); + bec::GRTManager::get()->set_app_option("Recordset:LastExportPath", grt::StringRef(path)); extension = base::extension(path); if (!extension.empty() && extension[0] == '.') extension = extension.substr(1); if (!extension.empty()) - bec::GRTManager::get().set_app_option("Recordset:LastExportExtension", grt::StringRef(extension)); + bec::GRTManager::get()->set_app_option("Recordset:LastExportExtension", grt::StringRef(extension)); } } } @@ -509,7 +509,7 @@ void SqlEditorResult::show_import_recordset() module->call_function("importRecordsetDataFromFile", args); } else - log_fatal("resultset GRT obj is NULL\n"); + logFatal("resultset GRT obj is NULL\n"); } } catch (const std::exception &exc) @@ -559,7 +559,7 @@ void SqlEditorResult::onRecordsetColumnsResized(const std::vector cols) if (!widths.empty()) { boost::function f = boost::bind(&ColumnWidthCache::save_columns_width, _owner->owner()->column_width_cache(), widths); - bec::GRTManager::get().get_dispatcher()->execute_async_function("store column widths", boost::bind(&run_and_return, f)); + bec::GRTManager::get()->get_dispatcher()->execute_async_function("store column widths", boost::bind(&run_and_return, f)); } } @@ -589,7 +589,7 @@ void SqlEditorResult::reset_column_widths() std::vector SqlEditorResult::get_autofit_column_widths(Recordset *rs) { std::vector widths(rs->get_column_count()); - std::string font = bec::GRTManager::get().get_app_option_string("workbench.general.Resultset:Font"); + std::string font = bec::GRTManager::get()->get_app_option_string("workbench.general.Resultset:Font"); for (size_t c = rs->get_column_count(), j = 0; j < c; j++) { @@ -938,7 +938,7 @@ static std::string render_stages(std::vector &stages) cairo_save(cr); cairo_set_source_rgb(cr, 0, 0, 0); cairo_move_to(cr, floor(capx) + 30, capy + 25 + ext.y_bearing); - if (base::starts_with(stages[i].name, "stage/sql/")) + if (base::hasPrefix(stages[i].name, "stage/sql/")) cairo_show_text(cr, base::strfmt("%s - %.4fms", stages[i].name.c_str() + sizeof("stage/sql/")-1, stages[i].wait_time).c_str()); else cairo_show_text(cr, base::strfmt("%s - %.4fms", stages[i].name.c_str(), stages[i].wait_time).c_str()); diff --git a/backend/wbprivate/sqlide/wb_sql_editor_result_panel.h b/backend/wbprivate/sqlide/wb_sql_editor_result_panel.h index 6fe69f055..0d94fa8bf 100644 --- a/backend/wbprivate/sqlide/wb_sql_editor_result_panel.h +++ b/backend/wbprivate/sqlide/wb_sql_editor_result_panel.h @@ -41,7 +41,7 @@ namespace mforms class ToolBar; class ToolBarItem; class ContextMenu; - class TreeNodeView; + class TreeView; class GridView; }; @@ -145,8 +145,8 @@ class MYSQLWBBACKEND_PUBLIC_FUNC SqlEditorResult : public mforms::AppView void add_switch_toggle_toolbar_item(mforms::ToolBar *tbar); - void copy_column_info_name(mforms::TreeNodeView *tree); - void copy_column_info(mforms::TreeNodeView *tree); + void copy_column_info_name(mforms::TreeView *tree); + void copy_column_info(mforms::TreeView *tree); void copy_column_name(); void copy_all_column_names(); diff --git a/backend/wbprivate/sqlide/wb_sql_editor_snippets.cpp b/backend/wbprivate/sqlide/wb_sql_editor_snippets.cpp index ec4f375ce..72c644288 100644 --- a/backend/wbprivate/sqlide/wb_sql_editor_snippets.cpp +++ b/backend/wbprivate/sqlide/wb_sql_editor_snippets.cpp @@ -230,7 +230,7 @@ void DbSqlEditorSnippets::load_from_db(SqlEditorForm *editor) if (editor) { if (_snippet_db.empty()) - _snippet_db = bec::GRTManager::get().get_app_option_string("workbench:InternalSchema"); + _snippet_db = bec::GRTManager::get()->get_app_option_string("workbench:InternalSchema"); sql::Dbc_connection_handler::Ref conn; @@ -263,7 +263,7 @@ void DbSqlEditorSnippets::load_from_db(SqlEditorForm *editor) } catch (std::exception &e) { - log_error("Error querying snippets table: %s\n", e.what()); + logError("Error querying snippets table: %s\n", e.what()); mforms::Utilities::show_error("Shared Snippets", base::strfmt("Unable to load server stored snippets.\n%s", e.what()), "OK"); @@ -290,7 +290,7 @@ int DbSqlEditorSnippets::add_db_snippet(const std::string &name, const std::stri std::string error = internal_schema.create_snippets_table_exist(); if (!error.empty()) { - log_warning("Could not create table %s.snippet: %s\n", _snippet_db.c_str(), error.c_str()); + logWarning("Could not create table %s.snippet: %s\n", _snippet_db.c_str(), error.c_str()); mforms::Utilities::show_error("Shared Snippets", "Unable to setup server stored snippets.\n"+error, "OK"); return 0; } @@ -302,7 +302,7 @@ int DbSqlEditorSnippets::add_db_snippet(const std::string &name, const std::stri } catch (std::exception &exc) { - log_error("Error saving snippet: %s\n", exc.what()); + logError("Error saving snippet: %s\n", exc.what()); mforms::Utilities::show_error("Shared Snippets", base::strfmt("Error adding new snippet: %s", exc.what()), "OK"); @@ -325,7 +325,7 @@ void DbSqlEditorSnippets::delete_db_snippet(int snippet_id) } catch (std::exception &exc) { - log_error("Error saving snippet: %s\n", exc.what()); + logError("Error saving snippet: %s\n", exc.what()); mforms::Utilities::show_error("Shared Snippets", base::strfmt("Error deleting snippet: %s", exc.what()), "OK"); @@ -426,7 +426,7 @@ DbSqlEditorSnippets::DbSqlEditorSnippets(wb::WBContextSQLIDE *sqlide, const std: g_mkdir_with_parents(_path.c_str(), 0700); // copy the standard files - std::string datadir = bec::GRTManager::get().get_data_file_path("snippets"); + std::string datadir = bec::GRTManager::get()->get_data_file_path("snippets"); { GDir *dir = g_dir_open(datadir.c_str(), 0, NULL); if (dir) @@ -445,7 +445,7 @@ DbSqlEditorSnippets::DbSqlEditorSnippets(wb::WBContextSQLIDE *sqlide, const std: void DbSqlEditorSnippets::copy_original_file(const std::string& name, bool overwrite) { - std::string datadir = bec::GRTManager::get().get_data_file_path("snippets"); + std::string datadir = bec::GRTManager::get()->get_data_file_path("snippets"); std::string dest = base::makePath(_path, name); bool target_exists = g_file_test(dest.c_str(), G_FILE_TEST_EXISTS) == TRUE; if (!target_exists || overwrite) @@ -540,7 +540,7 @@ bool DbSqlEditorSnippets::set_field(const bec::NodeId &node, ColumnId column, co } catch (std::exception &exc) { - log_error("Error saving snippet: %s\n", exc.what()); + logError("Error saving snippet: %s\n", exc.what()); mforms::Utilities::show_error("Shared Snippets", base::strfmt("Error deleting snippet: %s", exc.what()), "OK"); diff --git a/backend/wbprivate/sqlide/wb_sql_editor_tree_controller.cpp b/backend/wbprivate/sqlide/wb_sql_editor_tree_controller.cpp index 178a621f1..de1d52d56 100644 --- a/backend/wbprivate/sqlide/wb_sql_editor_tree_controller.cpp +++ b/backend/wbprivate/sqlide/wb_sql_editor_tree_controller.cpp @@ -98,11 +98,11 @@ CATCH_EXCEPTION_AND_DISPATCH(statement) #define CATCH_ANY_EXCEPTION_AND_DISPATCH_TO_DEFAULT_LOG(statement) \ catch (sql::SQLException &e)\ {\ -_grtm->get_grt()->send_error(strfmt(SQL_EXCEPTION_MSG_FORMAT, e.getErrorCode(), e.what()), statement);\ +grt::GRT::get()->send_error(strfmt(SQL_EXCEPTION_MSG_FORMAT, e.getErrorCode(), e.what()), statement);\ }\ catch (std::exception &e)\ {\ -_grtm->get_grt()->send_error(strfmt(EXCEPTION_MSG_FORMAT, e.what()), statement);\ +grt::GRT::get()->send_error(strfmt(EXCEPTION_MSG_FORMAT, e.what()), statement);\ } @@ -122,29 +122,27 @@ std::shared_ptr SqlEditorTreeController::create(SqlEdit SqlEditorTreeController::SqlEditorTreeController(SqlEditorForm *owner) - : _owner(owner), _grtm(owner->grt_manager()), - _schema_side_bar(NULL), _admin_side_bar(NULL), - _task_tabview(NULL), - _taskbar_box(NULL), + : _owner(owner), + _schema_side_bar(nullptr), _admin_side_bar(nullptr), + _task_tabview(nullptr), + _taskbar_box(nullptr), _schema_tree(&_base_schema_tree), - _base_schema_tree(_grtm->get_grt()), - _filtered_schema_tree(_grtm->get_grt()), - live_schema_fetch_task(GrtThreadedTask::create(_grtm)), - live_schemata_refresh_task(GrtThreadedTask::create(_grtm)), + live_schema_fetch_task(GrtThreadedTask::create()), + live_schemata_refresh_task(GrtThreadedTask::create()), _is_refreshing_schema_tree(false), _unified_mode(false), _use_show_procedure(false), - _side_splitter(NULL), - _info_tabview(NULL), - _object_info(NULL), - _session_info(NULL) + _side_splitter(nullptr), + _info_tabview(nullptr), + _object_info(nullptr), + _session_info(nullptr) { grt::GRTNotificationCenter::get()->add_grt_observer(this, "GRNDBObjectEditorCreated"); grt::GRTNotificationCenter::get()->add_grt_observer(this, "GRNPreferencesDidClose"); grt::GRTNotificationCenter::get()->add_grt_observer(this, "GRNSQLEditorReconnected"); - _base_schema_tree.is_schema_contents_enabled(_grtm->get_app_option_int("DbSqlEditor:ShowSchemaTreeSchemaContents", 1) != 0); - _filtered_schema_tree.is_schema_contents_enabled(_grtm->get_app_option_int("DbSqlEditor:ShowSchemaTreeSchemaContents", 1) != 0); + _base_schema_tree.is_schema_contents_enabled(bec::GRTManager::get()->get_app_option_int("DbSqlEditor:ShowSchemaTreeSchemaContents", 1) != 0); + _filtered_schema_tree.is_schema_contents_enabled(bec::GRTManager::get()->get_app_option_int("DbSqlEditor:ShowSchemaTreeSchemaContents", 1) != 0); _base_schema_tree.sql_editor_text_insert_signal.connect(boost::bind(&SqlEditorTreeController::insert_text_to_active_editor, this, _1)); _filtered_schema_tree.sql_editor_text_insert_signal.connect(boost::bind(&SqlEditorTreeController::insert_text_to_active_editor, this, _1)); @@ -180,7 +178,7 @@ SqlEditorTreeController::~SqlEditorTreeController() void SqlEditorTreeController::finish_init() { - _unified_mode = _grtm->get_app_option_int("DbSqlEditor:SidebarModeCombined", 0) == 1; + _unified_mode = bec::GRTManager::get()->get_app_option_int("DbSqlEditor:SidebarModeCombined", 0) == 1; // Box to host the management and SQL IDE task bars in tab view or stacked mode. _taskbar_box = new mforms::Box(false); @@ -202,7 +200,7 @@ void SqlEditorTreeController::finish_init() _task_tabview->add_page(_admin_side_bar, _("Management")); _task_tabview->add_page(_schema_side_bar, _("Schemas")); - int i = _grtm->get_app_option_int("DbSqlEditor:ActiveTaskTab", 0); + int i = bec::GRTManager::get()->get_app_option_int("DbSqlEditor:ActiveTaskTab", 0); if (i < 0) i = 0; else if (i >= 2) @@ -221,7 +219,7 @@ void SqlEditorTreeController::finish_init() _schema_side_bar->set_filtered_schema_model(&_filtered_schema_tree); _schema_side_bar->set_selection_color(base::HighlightColor); - int initial_splitter_pos = _grtm->get_app_option_int("DbSqlEditor:SidebarInitialSplitterPos", 500); + int initial_splitter_pos = bec::GRTManager::get()->get_app_option_int("DbSqlEditor:SidebarInitialSplitterPos", 500); _side_splitter = mforms::manage(new mforms::Splitter(false, true)); #ifdef _WIN32 @@ -274,7 +272,7 @@ void SqlEditorTreeController::finish_init() tree_refresh(); // make sure to restore the splitter pos after layout is ready - _grtm->run_once_when_idle(this, boost::bind(&mforms::Splitter::set_divider_position, _side_splitter, initial_splitter_pos)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&mforms::Splitter::set_divider_position, _side_splitter, initial_splitter_pos)); // Connect the splitter change event after the setup is done to avoid wrong triggering. _splitter_connection = _side_splitter->signal_position_changed()->connect(boost::bind(&SqlEditorTreeController::sidebar_splitter_changed, this)); @@ -282,7 +280,7 @@ void SqlEditorTreeController::finish_init() // Setup grt access to sidebar. db_query_EditorRef editor(_owner->wbsql()->get_grt_editor_object(_owner)); if (editor.is_valid()) - editor->sidebar(mforms_to_grt(_grtm->get_grt(), _admin_side_bar, "TaskSidebar")); + editor->sidebar(mforms_to_grt(_admin_side_bar, "TaskSidebar")); if (!_owner->connected()) _info_tabview->set_active_tab(1); @@ -295,12 +293,12 @@ void SqlEditorTreeController::prepare_close() _splitter_connection.disconnect(); if (_schema_side_bar) - _grtm->set_app_option("DbSqlEditor:SidebarCollapseState", grt::StringRef(_schema_side_bar->get_collapse_states())); + bec::GRTManager::get()->set_app_option("DbSqlEditor:SidebarCollapseState", grt::StringRef(_schema_side_bar->get_collapse_states())); int tab = _task_tabview->get_active_tab(); - _grtm->set_app_option("DbSqlEditor:ActiveTaskTab", grt::IntegerRef(tab)); + bec::GRTManager::get()->set_app_option("DbSqlEditor:ActiveTaskTab", grt::IntegerRef(tab)); tab = _info_tabview->get_active_tab(); - _grtm->set_app_option("DbSqlEditor:ActiveInfoTab", grt::IntegerRef(tab)); + bec::GRTManager::get()->set_app_option("DbSqlEditor:ActiveInfoTab", grt::IntegerRef(tab)); } @@ -331,7 +329,7 @@ void SqlEditorTreeController::schema_row_selected() // send out notification about selection change - grt::DictRef info(_grtm->get_grt()); + grt::DictRef info(true); info.gset("selection-size", (int)nodes.size()); grt::GRTNotificationCenter::get()->send_grt("GRNLiveDBObjectSelectionDidChange", _owner->wbsql()->get_grt_editor_object(_owner), info); } @@ -353,14 +351,14 @@ void SqlEditorTreeController::sidebar_splitter_changed() { int pos = _side_splitter->get_divider_position(); if (pos > 0) - _grtm->set_app_option("DbSqlEditor:SidebarInitialSplitterPos", grt::IntegerRef(pos)); + bec::GRTManager::get()->set_app_option("DbSqlEditor:SidebarInitialSplitterPos", grt::IntegerRef(pos)); } //-------------------------------------------------------------------------------------------------- bool SqlEditorTreeController::fetch_data_for_filter(const std::string &schema_filter, const std::string &object_filter, const wb::LiveSchemaTree::NewSchemaContentArrivedSlot &arrived_slot) { - std::string wb_internal_schema = _grtm->get_app_option_string("workbench:InternalSchema"); + std::string wb_internal_schema = bec::GRTManager::get()->get_app_option_string("workbench:InternalSchema"); sql::Dbc_connection_handler::Ref conn; @@ -400,10 +398,11 @@ bool SqlEditorTreeController::fetch_data_for_filter(const std::string &schema_fi // If the remote search is available performs the search if (remote_search_enabled) { - bool sync= !_grtm->in_main_thread(); + bool sync= !bec::GRTManager::get()->in_main_thread(); logDebug3("Fetch data for filter %s.%s\n", schema_filter.c_str(), object_filter.c_str()); + live_schema_fetch_task->exec(sync, - boost::bind(&SqlEditorTreeController::do_fetch_data_for_filter, this, _1, + boost::bind(&SqlEditorTreeController::do_fetch_data_for_filter, this, weak_ptr_from(this), schema_filter, object_filter, arrived_slot)); } @@ -423,7 +422,7 @@ std::list SqlEditorTreeController::fetch_schema_list() RecMutexLock aux_dbc_conn_mutex(_owner->ensure_valid_aux_connection(conn)); - bool show_metadata_schemata= (0 != _grtm->get_app_option_int("DbSqlEditor:ShowMetadataSchemata", 0)); + bool show_metadata_schemata= (0 != bec::GRTManager::get()->get_app_option_int("DbSqlEditor:ShowMetadataSchemata", 0)); std::auto_ptr rs(conn->ref->getMetaData()->getSchemata()); while (rs->next()) @@ -460,10 +459,11 @@ bool SqlEditorTreeController::fetch_schema_contents(const std::string &schema_na // in windows we use TreeViewAdv feature to expand nodes asynchronously // that is this function is already called from a separate thread // and it must have items loaded when it returns. - bool sync= !_grtm->in_main_thread(); + bool sync= !bec::GRTManager::get()->in_main_thread(); logDebug3("Fetch schema contents for %s\n", schema_name.c_str()); + live_schema_fetch_task->exec(sync, - boost::bind(&SqlEditorTreeController::do_fetch_live_schema_contents, this, _1, + boost::bind(&SqlEditorTreeController::do_fetch_live_schema_contents, this, weak_ptr_from(this), schema_name, arrived_slot)); return true;//! @@ -486,7 +486,7 @@ mforms::View *SqlEditorTreeController::get_sidebar() return _side_splitter; } -grt::StringRef SqlEditorTreeController::do_fetch_live_schema_contents(grt::GRT *grt, std::weak_ptr self_ptr, const std::string &schema_name, wb::LiveSchemaTree::NewSchemaContentArrivedSlot arrived_slot) +grt::StringRef SqlEditorTreeController::do_fetch_live_schema_contents(std::weak_ptr self_ptr, const std::string &schema_name, wb::LiveSchemaTree::NewSchemaContentArrivedSlot arrived_slot) { RETVAL_IF_FAIL_TO_RETAIN_WEAK_PTR (SqlEditorTreeController, self_ptr, self, grt::StringRef("")) try @@ -572,7 +572,7 @@ grt::StringRef SqlEditorTreeController::do_fetch_live_schema_contents(grt::GRT * if (arrived_slot) { boost::function schema_contents_arrived = boost::bind(arrived_slot, schema_name, tables, views, procedures, functions, false); - _grtm->run_once_when_idle(this, schema_contents_arrived); + bec::GRTManager::get()->run_once_when_idle(this, schema_contents_arrived); } // Let the owner form know we got fresh schema meta data. Can be used to update caches. @@ -587,7 +587,7 @@ grt::StringRef SqlEditorTreeController::do_fetch_live_schema_contents(grt::GRT * { StringListPtr empty_list; boost::function schema_contents_arrived = boost::bind(arrived_slot, schema_name, empty_list, empty_list, empty_list, empty_list, false); - _grtm->run_once_when_idle(this, schema_contents_arrived); + bec::GRTManager::get()->run_once_when_idle(this, schema_contents_arrived); } } @@ -596,7 +596,7 @@ grt::StringRef SqlEditorTreeController::do_fetch_live_schema_contents(grt::GRT * //-------------------------------------------------------------------------------------------------- -grt::StringRef SqlEditorTreeController::do_fetch_data_for_filter(grt::GRT *grt, std::weak_ptr self_ptr, const std::string &schema_filter, const std::string &object_filter, wb::LiveSchemaTree::NewSchemaContentArrivedSlot arrived_slot) +grt::StringRef SqlEditorTreeController::do_fetch_data_for_filter(std::weak_ptr self_ptr, const std::string &schema_filter, const std::string &object_filter, wb::LiveSchemaTree::NewSchemaContentArrivedSlot arrived_slot) { RETVAL_IF_FAIL_TO_RETAIN_WEAK_PTR (SqlEditorTreeController, self_ptr, self, grt::StringRef("")) @@ -606,7 +606,7 @@ grt::StringRef SqlEditorTreeController::do_fetch_data_for_filter(grt::GRT *grt, std::map schema_directory; std::string last_schema; - std::string wb_internal_schema = _grtm->get_app_option_string("workbench:InternalSchema"); + std::string wb_internal_schema = bec::GRTManager::get()->get_app_option_string("workbench:InternalSchema"); try { @@ -635,7 +635,7 @@ grt::StringRef SqlEditorTreeController::do_fetch_data_for_filter(grt::GRT *grt, if (schema != last_schema && last_schema != "") { if (arrived_slot) - _grtm->run_once_when_idle(this, boost::bind(arrived_slot, last_schema, tables, views, procedures, functions, true)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(arrived_slot, last_schema, tables, views, procedures, functions, true)); tables->clear(); views->clear(); @@ -656,7 +656,7 @@ grt::StringRef SqlEditorTreeController::do_fetch_data_for_filter(grt::GRT *grt, } if (last_schema != "" && arrived_slot) - _grtm->run_once_when_idle(this, boost::bind(arrived_slot, last_schema, tables, views, procedures, functions, true)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(arrived_slot, last_schema, tables, views, procedures, functions, true)); } else { @@ -1235,7 +1235,7 @@ void SqlEditorTreeController::tree_refresh() if (_owner->connected()) { live_schemata_refresh_task->exec(false, - boost::bind((grt::StringRef(SqlEditorTreeController::*)(grt::GRT *, SqlEditorForm::Ptr))&SqlEditorTreeController::do_refresh_schema_tree_safe, this, _1, + boost::bind((grt::StringRef(SqlEditorTreeController::*)(SqlEditorForm::Ptr))&SqlEditorTreeController::do_refresh_schema_tree_safe, this, weak_ptr_from(_owner))); _schema_tree->set_enabled(true); } @@ -1263,7 +1263,7 @@ bool SqlEditorTreeController::sidebar_action(const std::string& name) _task_tabview->set_active_tab(1); _task_tabview->show(true); - _grtm->set_app_option("DbSqlEditor:SidebarModeCombined", grt::IntegerRef(0)); + bec::GRTManager::get()->set_app_option("DbSqlEditor:SidebarModeCombined", grt::IntegerRef(0)); _admin_side_bar->update_mode_buttons(false); _schema_side_bar->update_mode_buttons(false); } @@ -1282,7 +1282,7 @@ bool SqlEditorTreeController::sidebar_action(const std::string& name) _taskbar_box->add(_schema_side_bar, true, true); _schema_side_bar->focus(); - _grtm->set_app_option("DbSqlEditor:SidebarModeCombined", grt::IntegerRef(1)); + bec::GRTManager::get()->set_app_option("DbSqlEditor:SidebarModeCombined", grt::IntegerRef(1)); _admin_side_bar->update_mode_buttons(true); _schema_side_bar->update_mode_buttons(true); } @@ -1433,7 +1433,7 @@ void SqlEditorTreeController::do_alter_live_object(wb::LiveSchemaTree::ObjectTyp } // reset_references on the catalog is called when we try to apply changes (generate the alter script). - db_mysql_CatalogRef client_state_catalog= _grtm->get_grt()->create_object("db.mysql.Catalog"); + db_mysql_CatalogRef client_state_catalog= grt::GRT::get()->create_object("db.mysql.Catalog"); client_state_catalog->name("default"); client_state_catalog->oldName("default"); client_state_catalog->version(rdbms->version()); @@ -1459,7 +1459,7 @@ void SqlEditorTreeController::do_alter_live_object(wb::LiveSchemaTree::ObjectTyp } else { - schema = _grtm->get_grt()->create_object("db.mysql.Schema"); + schema = grt::GRT::get()->create_object("db.mysql.Schema"); schema->owner(client_state_catalog); schema->name(used_schema_name); @@ -1490,12 +1490,12 @@ void SqlEditorTreeController::do_alter_live_object(wb::LiveSchemaTree::ObjectTyp } // if this is a View, then auto-reformat it before sending it to parser/editor - if (type == wb::LiveSchemaTree::View && _grtm->get_app_option_int("DbSqlEditor:ReformatViewDDL", 0)) + if (type == wb::LiveSchemaTree::View && bec::GRTManager::get()->get_app_option_int("DbSqlEditor:ReformatViewDDL", 0)) { try { - grt::Module *module = _grtm->get_grt()->get_module("SQLIDEUtils"); - grt::BaseListRef args(_grtm->get_grt()); + grt::Module *module = grt::GRT::get()->get_module("SQLIDEUtils"); + grt::BaseListRef args(true); args.ginsert(grt::StringRef(ddl_script)); ddl_script = grt::StringRef::cast_from(module->call_function("reformatSQLStatement", args)); } @@ -1611,7 +1611,7 @@ void SqlEditorTreeController::open_alter_object_editor(db_DatabaseObjectRef obje } sql::Dbc_connection_handler::Ref conn; - grt::NormalizedComparer comparer(_grtm->get_grt()); + grt::NormalizedComparer comparer; { RecMutexLock lock(_owner->ensure_valid_aux_connection(conn)); //db_object->customData().set("CaseSensitive",grt::IntegerRef(conn->ref->getMetaData()->storesMixedCaseIdentifiers())); @@ -1643,7 +1643,7 @@ void SqlEditorTreeController::open_alter_object_editor(db_DatabaseObjectRef obje // TODO: make docking/non-docking switchable via preferences. //_context_ui->get_wb()->open_object_editor(db_object, bec::StandaloneWindowFlag); - _grtm->open_object_editor(object, bec::ForceNewWindowFlag); + bec::GRTManager::get()->open_object_editor(object, bec::ForceNewWindowFlag); } //-------------------------------------------------------------------------------------------------- @@ -1655,14 +1655,14 @@ std::string SqlEditorTreeController::run_execute_routine_wizard(wb::LiveSchemaTr if (script.second.empty()) return ""; // get_object_create_script() already showed an error. - db_mysql_RoutineRef routine(_grtm->get_grt()); - parser::MySQLParserServices::Ref services = parser::MySQLParserServices::get(_grtm->get_grt()); + db_mysql_RoutineRef routine(grt::Initialized); + parser::MySQLParserServices::Ref services = parser::MySQLParserServices::get(); - db_mysql_CatalogRef catalog(_grtm->get_grt()); + db_mysql_CatalogRef catalog(grt::Initialized); catalog->version(_owner->rdbms_version()); grt::replace_contents(catalog->simpleDatatypes(), _owner->rdbms()->simpleDatatypes()); - db_mysql_SchemaRef schema(_grtm->get_grt()); + db_mysql_SchemaRef schema(grt::Initialized); schema->owner(catalog); schema->name(schema_name); catalog->schemata().insert(schema); @@ -1702,7 +1702,7 @@ std::string SqlEditorTreeController::run_execute_routine_wizard(wb::LiveSchemaTr db_SchemaRef SqlEditorTreeController::create_new_schema(db_CatalogRef owner) { - db_SchemaRef object= _grtm->get_grt()->create_object(owner->schemata()->content_type_spec().object_class); + db_SchemaRef object= grt::GRT::get()->create_object(owner->schemata()->content_type_spec().object_class); object->owner(owner); object->name("new_schema"); owner->schemata().insert(object); @@ -1714,7 +1714,7 @@ db_SchemaRef SqlEditorTreeController::create_new_schema(db_CatalogRef owner) db_TableRef SqlEditorTreeController::create_new_table(db_SchemaRef owner) { - db_TableRef object= _grtm->get_grt()->create_object(owner->tables()->content_type_spec().object_class); + db_TableRef object= grt::GRT::get()->create_object(owner->tables()->content_type_spec().object_class); object->owner(owner); object->name("new_table"); owner->tables().insert(object); @@ -1724,7 +1724,7 @@ db_TableRef SqlEditorTreeController::create_new_table(db_SchemaRef owner) db_ViewRef SqlEditorTreeController::create_new_view(db_SchemaRef owner) { - db_ViewRef object= _grtm->get_grt()->create_object(owner->views()->content_type_spec().object_class); + db_ViewRef object= grt::GRT::get()->create_object(owner->views()->content_type_spec().object_class); object->owner(owner); object->name("new_view"); owner->views().insert(object); @@ -1734,7 +1734,7 @@ db_ViewRef SqlEditorTreeController::create_new_view(db_SchemaRef owner) db_RoutineRef SqlEditorTreeController::create_new_routine(db_SchemaRef owner, wb::LiveSchemaTree::ObjectType type) { - db_RoutineRef object= _grtm->get_grt()->create_object(owner->routines()->content_type_spec().object_class); + db_RoutineRef object= grt::GRT::get()->create_object(owner->routines()->content_type_spec().object_class); object->owner(owner); if (type == wb::LiveSchemaTree::Procedure) @@ -1768,7 +1768,7 @@ void SqlEditorTreeController::tree_create_object(wb::LiveSchemaTree::ObjectType std::string SqlEditorTreeController::generate_alter_script(const db_mgmt_RdbmsRef &rdbms, db_DatabaseObjectRef db_object, std::string algorithm, std::string lock) { - DbMySQLImpl *diffsql_module = _grtm->get_grt()->find_native_module("DbMySQL"); + DbMySQLImpl *diffsql_module = grt::GRT::get()->find_native_module("DbMySQL"); db_CatalogRef server_cat= db_CatalogRef::cast_from(db_object->customData().get("serverStateCatalog")); db_CatalogRef client_cat= db_CatalogRef::cast_from(db_object->customData().get("clientStateCatalog")); @@ -1776,7 +1776,7 @@ std::string SqlEditorTreeController::generate_alter_script(const db_mgmt_RdbmsRe db_CatalogRef client_cat_copy= db_CatalogRef::cast_from(grt::copy_object(client_cat)); db_CatalogRef server_cat_copy= db_CatalogRef::cast_from(grt::copy_object(server_cat)); - grt::DictRef diff_options(_grtm->get_grt()); + grt::DictRef diff_options(true); //diff_options.set("CaseSensitive",db_object->customData().get("CaseSensitive")); grt::DictRef db_settings = grt::DictRef::cast_from(db_object->customData().get("DBSettings")); if (_owner->rdbms_version().is_valid() && is_supported_mysql_version_at_least(_owner->rdbms_version(), 5, 6)) @@ -1912,10 +1912,10 @@ std::string SqlEditorTreeController::get_object_ddl_script(wb::LiveSchemaTree::O ddl_script.clear(); std::string err = e.what(); logError("Error getting SQL definition for %s.%s: %s\n", schema_name.c_str(), obj_name.c_str(), e.what()); - if (_grtm->in_main_thread()) + if (bec::GRTManager::get()->in_main_thread()) mforms::Utilities::show_error("Error getting DDL for object", e.what(), "OK", "", ""); else - _grtm->run_once_when_idle(boost::bind(&mforms::Utilities::show_error, "Error getting DDL for object", err, "OK", "", "")); + bec::GRTManager::get()->run_once_when_idle(boost::bind(&mforms::Utilities::show_error, "Error getting DDL for object", err, "OK", "", "")); } } return ddl_script; @@ -2130,12 +2130,12 @@ void SqlEditorTreeController::refresh_live_object_in_editor(bec::DBObjectEditorB ddl_script= get_object_ddl_script(db_object_type, schema_name, obj_name); if (!ddl_script.empty()) { - if (db_object_type == wb::LiveSchemaTree::View && _grtm->get_app_option_int("DbSqlEditor:ReformatViewDDL", 0)) + if (db_object_type == wb::LiveSchemaTree::View && bec::GRTManager::get()->get_app_option_int("DbSqlEditor:ReformatViewDDL", 0)) { try { - grt::Module *module = _grtm->get_grt()->get_module("SQLIDEUtils"); - grt::BaseListRef args(_grtm->get_grt()); + grt::Module *module = grt::GRT::get()->get_module("SQLIDEUtils"); + grt::BaseListRef args(true); args.ginsert(grt::StringRef(ddl_script)); ddl_script = grt::StringRef::cast_from(module->call_function("reformatSQLStatement", args)); } @@ -2219,14 +2219,14 @@ bool SqlEditorTreeController::parse_ddl_into_catalog(db_mysql_CatalogRef catalog { std::string currentSqlMode = _owner->work_parser_context()->get_sql_mode(); - grt::DictRef options(_grtm->get_grt()); + grt::DictRef options(true); options.set("reuse_existing_objects", grt::IntegerRef(1)); options.set("schema", grt::StringRef(schema)); if (!sqlMode.empty()) _owner->work_parser_context()->use_sql_mode(sqlMode); - parser::MySQLParserServices::Ref services = parser::MySQLParserServices::get(_grtm->get_grt()); + parser::MySQLParserServices::Ref services = parser::MySQLParserServices::get(); size_t errorCount = services->parseSQLIntoCatalog(_owner->work_parser_context(), catalog, sql, options); bool haveErrors = false; @@ -2481,7 +2481,6 @@ void SqlEditorTreeController::create_live_table_stubs(bec::DBObjectEditorBE *tab std::string database_package= *_owner->rdbms()->databaseObjectPackage(); std::string schema_typename= database_package + ".Schema"; std::string table_typename= database_package + ".Table"; - grt::GRT *grt= _grtm->get_grt(); std::string prev_schema_name; @@ -2501,7 +2500,7 @@ void SqlEditorTreeController::create_live_table_stubs(bec::DBObjectEditorBE *tab schema= find_named_object_in_list(schemata, schema_name); if (!schema.is_valid()) { - schema= grt->create_object(schema_typename); + schema= grt::GRT::get()->create_object(schema_typename); schema->owner(catalog); schema->name(schema_name); schema->oldName(schema_name); @@ -2514,7 +2513,7 @@ void SqlEditorTreeController::create_live_table_stubs(bec::DBObjectEditorBE *tab table= find_named_object_in_list(tables, table_name); if (!table.is_valid()) { - table= grt->create_object(table_typename); + table= grt::GRT::get()->create_object(table_typename); table->owner(schema); table->name(table_name); table->oldName(table_name); @@ -2550,7 +2549,7 @@ bool SqlEditorTreeController::expand_live_table_stub(bec::DBObjectEditorBE *tabl SqlFacade::Ref sql_facade= SqlFacade::instance_for_rdbms(_owner->rdbms()); Sql_parser::Ref sql_parser= sql_facade->sqlParser(); sql_parser->messages_enabled(false); - grt::DictRef options(_grtm->get_grt()); + grt::DictRef options(true); { std::string sql_mode; sql::Dbc_connection_handler::Ref conn; @@ -2564,7 +2563,7 @@ bool SqlEditorTreeController::expand_live_table_stub(bec::DBObjectEditorBE *tabl if (!schema.is_valid()) { // target schema doesn't exist yet, create a stub for it - schema = db_mysql_SchemaRef(catalog.get_grt()); + schema = db_mysql_SchemaRef(grt::Initialized); schema->owner(catalog); schema->name(schema_name); schema->comment("stub"); @@ -2629,7 +2628,7 @@ void SqlEditorTreeController::on_active_schema_change(const std::string &schema) _filtered_schema_tree.set_active_schema(schema); if (_schema_side_bar != NULL) - _grtm->run_once_when_idle(this, boost::bind(&mforms::View::set_needs_repaint, _schema_side_bar->get_schema_tree())); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&mforms::View::set_needs_repaint, _schema_side_bar->get_schema_tree())); } //-------------------------------------------------------------------------------------------------- @@ -2642,7 +2641,7 @@ void SqlEditorTreeController::mark_busy(bool busy) //-------------------------------------------------------------------------------------------------- -grt::StringRef SqlEditorTreeController::do_refresh_schema_tree_safe(grt::GRT *grt, SqlEditorForm::Ptr self_ptr) +grt::StringRef SqlEditorTreeController::do_refresh_schema_tree_safe(SqlEditorForm::Ptr self_ptr) { RETVAL_IF_FAIL_TO_RETAIN_WEAK_PTR (SqlEditorForm, self_ptr, self, grt::StringRef("")) @@ -2654,8 +2653,8 @@ grt::StringRef SqlEditorTreeController::do_refresh_schema_tree_safe(grt::GRT *gr std::list fsl = fetch_schema_list(); schema_list->assign(fsl.begin(), fsl.end()); - _grtm->run_once_when_idle(this, boost::bind(&LiveSchemaTree::update_schemata, _schema_tree, schema_list)); - _grtm->run_once_when_idle(this, boost::bind(&SqlEditorForm::schema_tree_did_populate, _owner)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&LiveSchemaTree::update_schemata, _schema_tree, schema_list)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&SqlEditorForm::schema_tree_did_populate, _owner)); _is_refreshing_schema_tree= false; @@ -2689,7 +2688,7 @@ void SqlEditorTreeController::handle_grt_notification(const std::string &name, g } else if (name == "GRNPreferencesDidClose" && info.get_int("saved") == 1) { - if (_grtm->get_app_option_int("DbSqlEditor:SidebarModeCombined", 0) == 1) + if (bec::GRTManager::get()->get_app_option_int("DbSqlEditor:SidebarModeCombined", 0) == 1) sidebar_action("switch_mode_on"); else sidebar_action("switch_mode_off"); @@ -2720,13 +2719,13 @@ void SqlEditorTreeController::context_menu_will_show(mforms::MenuItem *parent_it { if (!parent_item) { - grt::DictRef info(_owner->grt_manager()->get_grt()); + grt::DictRef info(true); db_query_EditorRef sender(_owner->wbsql()->get_grt_editor_object(_owner)); grt::ListRef selection(grt::ListRef::cast_from(_schema_tree->get_selected_objects())); - info.set("menu", mforms_to_grt(info.get_grt(), _schema_side_bar->get_context_menu())); + info.set("menu", mforms_to_grt(_schema_side_bar->get_context_menu())); info.gset("menu-plugins-index", _schema_side_bar->get_context_menu()->get_item_index(_schema_side_bar->get_context_menu()->find_item("refresh"))-2); info.set("selection", selection); diff --git a/backend/wbprivate/sqlide/wb_sql_editor_tree_controller.h b/backend/wbprivate/sqlide/wb_sql_editor_tree_controller.h index 8e7411511..0e8518e0c 100644 --- a/backend/wbprivate/sqlide/wb_sql_editor_tree_controller.h +++ b/backend/wbprivate/sqlide/wb_sql_editor_tree_controller.h @@ -71,7 +71,6 @@ class MYSQLWBBACKEND_PUBLIC_FUNC SqlEditorTreeController : public base::trackabl SqlEditorTreeController(SqlEditorForm *owner); SqlEditorForm *_owner; - bec::GRTManager *_grtm; wb::SimpleSidebar *_schema_side_bar; wb::SimpleSidebar *_admin_side_bar; @@ -116,14 +115,14 @@ class MYSQLWBBACKEND_PUBLIC_FUNC SqlEditorTreeController : public base::trackabl std::string generate_alter_script(const db_mgmt_RdbmsRef &rdbms, db_DatabaseObjectRef db_object, std::string algorithm, std::string lock); private: - grt::StringRef do_fetch_live_schema_contents(grt::GRT *grt, std::weak_ptr self_ptr, const std::string &schema_name, wb::LiveSchemaTree::NewSchemaContentArrivedSlot arrived_slot); + grt::StringRef do_fetch_live_schema_contents(std::weak_ptr self_ptr, const std::string &schema_name, wb::LiveSchemaTree::NewSchemaContentArrivedSlot arrived_slot); wb::LiveSchemaTree::ObjectType fetch_object_type(const std::string& schema_name, const std::string& obj_name); void fetch_column_data(const std::string& schema_name, const std::string& obj_name, wb::LiveSchemaTree::ObjectType type, const wb::LiveSchemaTree::NodeChildrenUpdaterSlot &updater_slot); void fetch_trigger_data(const std::string& schema_name, const std::string& obj_name, wb::LiveSchemaTree::ObjectType type, const wb::LiveSchemaTree::NodeChildrenUpdaterSlot &updater_slot); void fetch_index_data(const std::string& schema_name, const std::string& obj_name, wb::LiveSchemaTree::ObjectType type, const wb::LiveSchemaTree::NodeChildrenUpdaterSlot &updater_slot); void fetch_foreign_key_data(const std::string& schema_name, const std::string& obj_name, wb::LiveSchemaTree::ObjectType type, const wb::LiveSchemaTree::NodeChildrenUpdaterSlot &updater_slot); - grt::StringRef do_fetch_data_for_filter(grt::GRT *grt, std::weak_ptr self_ptr, const std::string &schema_filter, const std::string &object_filter, wb::LiveSchemaTree::NewSchemaContentArrivedSlot arrived_slot); + grt::StringRef do_fetch_data_for_filter(std::weak_ptr self_ptr, const std::string &schema_filter, const std::string &object_filter, wb::LiveSchemaTree::NewSchemaContentArrivedSlot arrived_slot); void schema_row_selected(); void side_bar_filter_changed(const std::string& filter); @@ -139,7 +138,7 @@ class MYSQLWBBACKEND_PUBLIC_FUNC SqlEditorTreeController : public base::trackabl void open_alter_object_editor(db_DatabaseObjectRef object, db_CatalogRef server_state_catalog); private: - grt::StringRef do_refresh_schema_tree_safe(grt::GRT *grt, std::weak_ptr self_ptr); + grt::StringRef do_refresh_schema_tree_safe(std::weak_ptr self_ptr); int insert_text_to_active_editor(const std::string& str); private: diff --git a/backend/wbprivate/workbench/stdafx.h b/backend/wbprivate/workbench/stdafx.h index b443a4b76..73db2014a 100644 --- a/backend/wbprivate/workbench/stdafx.h +++ b/backend/wbprivate/workbench/stdafx.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -64,6 +65,8 @@ #include +#include + #include "grts/structs.db.mgmt.h" #include "grts/structs.db.mysql.h" #include "grts/structs.model.h" diff --git a/backend/wbprivate/workbench/unit-tests/wb_copy_paste_test.cpp b/backend/wbprivate/workbench/unit-tests/wb_copy_paste_test.cpp index 49e603123..f2aa08f74 100644 --- a/backend/wbprivate/workbench/unit-tests/wb_copy_paste_test.cpp +++ b/backend/wbprivate/workbench/unit-tests/wb_copy_paste_test.cpp @@ -103,8 +103,8 @@ TEST_FUNCTION(1) compo->copy_object_to_clipboard(source, context); - ensure("clipboard has data", bec::GRTManager::get().get_clipboard()->get_data().empty()==false); - copy = workbench_physical_TableFigureRef::cast_from(bec::GRTManager::get().get_clipboard()->get_data().front()); + ensure("clipboard has data", bec::GRTManager::get()->get_clipboard()->get_data().empty()==false); + copy = workbench_physical_TableFigureRef::cast_from(bec::GRTManager::get()->get_clipboard()->get_data().front()); ensure("copy is valid", copy.is_valid()); ensure("copy worked", copy.id() != source.id()); diff --git a/backend/wbprivate/workbench/upgrade_helper.cpp b/backend/wbprivate/workbench/upgrade_helper.cpp index 953a423fd..06ff2beb5 100644 --- a/backend/wbprivate/workbench/upgrade_helper.cpp +++ b/backend/wbprivate/workbench/upgrade_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -34,7 +34,7 @@ void XMLTraverser::cache_object_nodes(xmlNodePtr node) { if (node == NULL) { - log_error("XMLTraverser::cache_object_nodes node is NULL"); + logError("XMLTraverser::cache_object_nodes node is NULL"); return; } xmlNodePtr child= node->children; diff --git a/backend/wbprivate/workbench/wb_command_ui.cpp b/backend/wbprivate/workbench/wb_command_ui.cpp index c52fe7b0c..ad3d58d2b 100644 --- a/backend/wbprivate/workbench/wb_command_ui.cpp +++ b/backend/wbprivate/workbench/wb_command_ui.cpp @@ -220,7 +220,7 @@ bool CommandUI::validate_command_item(const app_CommandItemRef &item, const wb:: _wb->update_plugin_arguments_pool(argpool); argpool["app.PluginInputDefinition:string"]= grt::StringRef(cmd.args); - return bec::GRTManager::get().check_plugin_runnable(plugin, argpool); + return bec::GRTManager::get()->check_plugin_runnable(plugin, argpool); } } else if (cmd.type == "call") @@ -231,7 +231,7 @@ bool CommandUI::validate_command_item(const app_CommandItemRef &item, const wb:: grt::Module *m = grt::GRT::get()->get_module(module); if (m && m->has_function(function)) return true; - log_info("Invalid function %s.%s\n", module.c_str(), function.c_str()); + logInfo("Invalid function %s.%s\n", module.c_str(), function.c_str()); return false; } } @@ -246,7 +246,7 @@ bool CommandUI::validate_plugin_command(app_PluginRef plugin) bool result = false; if (plugin.is_valid()) { - if (bec::GRTManager::get().check_plugin_runnable(plugin, _argpool)) + if (bec::GRTManager::get()->check_plugin_runnable(plugin, _argpool)) result = true; } @@ -556,7 +556,7 @@ void CommandUI::add_scripts_menu(mforms::MenuItem *parent) { try { - std::list pyfiles = base::scan_for_files_matching(base::makePath(bec::GRTManager::get().get_user_script_path(), "*.py")); + std::list pyfiles = base::scan_for_files_matching(base::makePath(bec::GRTManager::get()->get_user_script_path(), "*.py")); std::vector files; std::copy(pyfiles.begin(), pyfiles.end(), std::back_inserter(files)); @@ -676,7 +676,7 @@ void CommandUI::add_menu_items_for_context(const std::string &context, mforms::M if (!plugin.is_valid()) { if (!base::hasSuffix(mitem.id(), "/SE") || _include_se) - log_warning("Plugin item %s was not found\n", cmd.name.c_str()); + logWarning("Plugin item %s was not found\n", cmd.name.c_str()); // if plugin is missing, check if it's supposed to be there if (!_include_se || !base::hasSuffix(mitem.id(), "/SE")) continue; @@ -699,7 +699,7 @@ void CommandUI::add_menu_items_for_context(const std::string &context, mforms::M else { if (!base::hasSuffix(mitem.id(), "/SE") || _include_se) - log_warning("Module function %s was not found\n", cmd.name.c_str()); + logWarning("Module function %s was not found\n", cmd.name.c_str()); // if plugin is missing, check if it's supposed to be there if (!_include_se || !base::hasSuffix(mitem.id(), "/SE")) continue; @@ -835,7 +835,7 @@ mforms::ToolBar *CommandUI::create_toolbar(const std::string &toolbar_file) mforms::ToolBar *CommandUI::create_toolbar(const std::string &toolbar_file, const boost::function &activate_slot) { - app_ToolbarRef toolbar(app_ToolbarRef::cast_from(grt::GRT::get()->unserialize(bec::GRTManager::get().get_data_file_path(toolbar_file)))); + app_ToolbarRef toolbar(app_ToolbarRef::cast_from(grt::GRT::get()->unserialize(bec::GRTManager::get()->get_data_file_path(toolbar_file)))); grt::ListRef plist(toolbar->items()); mforms::ToolBar *tbar = new mforms::ToolBar(); @@ -944,7 +944,7 @@ mforms::ToolBar *CommandUI::create_toolbar(const std::string &toolbar_file, cons } else { - log_warning("invalid toolbar item type %s", titem->itemType().c_str()); + logWarning("invalid toolbar item type %s", titem->itemType().c_str()); continue; } /* @@ -1065,7 +1065,7 @@ void CommandUI::add_builtin_command(const std::string &name, cmd.validate= validate; if (_builtin_commands.find(name) != _builtin_commands.end()) - log_warning("%s built-in command is being overwritten", name.c_str()); + logWarning("%s built-in command is being overwritten", name.c_str()); _builtin_commands[name]= cmd; } @@ -1214,7 +1214,7 @@ void CommandUI::revalidate_edit_menu_items() if (mforms::Utilities::in_main_thread()) _validate_edit_menu_items(); else - bec::GRTManager::get().run_once_when_idle(boost::bind(&CommandUI::revalidate_edit_menu_items, this)); + bec::GRTManager::get()->run_once_when_idle(boost::bind(&CommandUI::revalidate_edit_menu_items, this)); //mforms::Utilities::perform_from_main_thread((boost::bind(&CommandUI::revalidate_edit_menu_items, this), (void*)0)); // NOTE : using perform_from_main_thread causes a _grtm reference on the BaseEditor to to get lost in the process, diff --git a/backend/wbprivate/workbench/wb_context_names.h b/backend/wbprivate/workbench/wb_context_names.h index af0ed5e03..73d5fa66d 100644 --- a/backend/wbprivate/workbench/wb_context_names.h +++ b/backend/wbprivate/workbench/wb_context_names.h @@ -31,5 +31,6 @@ #define WB_CONTEXT_EDITOR "editor" // object editors #define WB_CONTEXT_PHYSICAL_OVERVIEW "overview.physical" #define WB_CONTEXT_QUERY "dbquery" +#define WB_CONTEXT_NG "ng" #endif diff --git a/backend/wbprivate/workbench/wb_context_ui.cpp b/backend/wbprivate/workbench/wb_context_ui.cpp index 7968981df..b093d35a8 100644 --- a/backend/wbprivate/workbench/wb_context_ui.cpp +++ b/backend/wbprivate/workbench/wb_context_ui.cpp @@ -25,7 +25,7 @@ #include "base/log.h" #include "base/notifications.h" -#include "grtpp.h" +#include "grt.h" #include "grts/structs.h" #include "grts/structs.app.h" @@ -53,7 +53,10 @@ #include "mforms/appview.h" -#include "home_screen.h" +#include "mforms/home_screen.h" +#include "mforms/home_screen_x_connections.h" +#include "mforms/home_screen_connections.h" +#include "mforms/home_screen_documents.h" #include "wb_command_ui.h" @@ -67,12 +70,20 @@ DEFAULT_LOG_DOMAIN(DOMAIN_WB_CONTEXT_UI) //-------------------------------------------------------------------------------------------------- -WBContextUI::WBContextUI(bool verbose) - : _wb(new WBContext(this, verbose)), _command_ui(new CommandUI(_wb)) +std::shared_ptr WBContextUI::get() +{ + static std::shared_ptr _singleton(new WBContextUI()); + return _singleton; +} + +//-------------------------------------------------------------------------------------------------- + +WBContextUI::WBContextUI() + : _wb(new WBContext(false)), _command_ui(new CommandUI(_wb)) { _shell_window= 0; - _output_view = NULL; + _output_view = nullptr; _active_form= 0; _active_main_form= 0; @@ -83,17 +94,17 @@ WBContextUI::WBContextUI(bool verbose) _quitting= false; _processing_action_open_connection = false; - _home_screen = NULL; + _home_screen = nullptr; // to notify that the save status of the doc has changed - //_wb->get_grt()->get_undo_manager()->signal_changed().connect(boost::bind(&WBContextUI::history_changed, this)); - scoped_connect(_wb->get_grt()->get_undo_manager()->signal_changed(),boost::bind(&WBContextUI::history_changed, this)); + //grt::GRT::get()->get_undo_manager()->signal_changed().connect(boost::bind(&WBContextUI::history_changed, this)); + scoped_connect(grt::GRT::get()->get_undo_manager()->signal_changed(),boost::bind(&WBContextUI::history_changed, this)); // stuff to do when the active form is switched in the UI (through set_active_form) _form_change_signal.connect(boost::bind(&WBContextUI::form_changed, this)); _output_view = mforms::manage(new OutputView(_wb)); - scoped_connect(_output_view->get_be()->signal_show(),boost::bind(&WBContextUI::show_output, this)); + scoped_connect(_output_view->get_be()->signal_show(), boost::bind(&WBContextUI::show_output, this)); } //-------------------------------------------------------------------------------------------------- @@ -101,7 +112,6 @@ WBContextUI::WBContextUI(bool verbose) WBContextUI::~WBContextUI() { _wb->do_close_document(true); - delete _addon_download_window; delete _plugin_install_window; @@ -115,7 +125,7 @@ WBContextUI::~WBContextUI() bool WBContextUI::init(WBFrontendCallbacks *callbacks, WBOptions *options) { // Log set folders. - log_info("Initializing workbench context UI with these values:\n" + logInfo("Initializing workbench context UI with these values:\n" "\tbase dir: %s\n\tplugin path: %s\n\tstruct path: %s\n\tmodule path: %s\n\t" "library path: %s\n\tuser data dir: %s\n\topen at start: %s\n\topen type: %s\n\trun at startup: %s\n\t" "run type: %s\n\tForce SW rendering: %s\n\tForce OpenGL: %s\n\tquit when done: %s\n", @@ -149,11 +159,11 @@ bool WBContextUI::init(WBFrontendCallbacks *callbacks, WBOptions *options) } catch (const std::exception& e) { - log_error("WBContextUI::init, exception '%s'\n", e.what()); // log_error logs to stderr too in debug mode. + logError("WBContextUI::init, exception '%s'\n", e.what()); // log_error logs to stderr too in debug mode. } catch (...) { - log_error("Some exception has happened. It was caught at WBContextUI::init.\n"); + logError("Some exception has happened. It was caught at WBContextUI::init.\n"); } return flag; @@ -173,10 +183,10 @@ GRTShellWindow* WBContextUI::get_shell_window() void WBContextUI::init_finish(WBOptions *options) { g_assert(_wb->get_root().is_valid()); - show_home_screen(); + show_home_screen(options->showClassicHome); _wb->init_finish_(options); - NotificationCenter::get()->send("GNAppStarted", NULL); + NotificationCenter::get()->send("GNAppStarted", nullptr); } @@ -191,14 +201,14 @@ bool WBContextUI::request_quit() if (_quitting) return true; - if (!_wb->get_grt_manager()->in_main_thread()) + if (!bec::GRTManager::get()->in_main_thread()) g_warning("request_quit() called in worker thread"); { NotificationInfo info; info["cancel"] = "0"; - NotificationCenter::get()->send("GNAppShouldClose", NULL, info); + NotificationCenter::get()->send("GNAppShouldClose", nullptr, info); if (info["cancel"] != "0") return false; @@ -210,7 +220,7 @@ bool WBContextUI::request_quit() if (_wb->get_sqlide_context() && !_wb->get_sqlide_context()->request_quit()) return false; - if (_shell_window != NULL && !_shell_window->request_quit()) + if (_shell_window != nullptr && !_shell_window->request_quit()) return false; return true; @@ -252,7 +262,7 @@ void WBContextUI::history_changed() if (_wb->has_unsaved_changes() != _last_unsaved_changes_state) _wb->request_refresh(RefreshDocument, "", (NativeHandle)0); - _wb->get_grt_manager()->run_once_when_idle(boost::bind(&CommandUI::revalidate_edit_menu_items, get_command_ui())); + bec::GRTManager::get()->run_once_when_idle(boost::bind(&CommandUI::revalidate_edit_menu_items, get_command_ui())); _last_unsaved_changes_state= _wb->has_unsaved_changes(); } @@ -340,7 +350,7 @@ void WBContextUI::add_backend_builtin_commands() _command_ui->add_builtin_command("show_about", boost::bind(&WBContextUI::show_about, this)); _command_ui->add_builtin_command("overview.home", - boost::bind(&WBContextUI::show_home_screen, this)); + boost::bind(&WBContextUI::show_home_screen, this, true)); _command_ui->add_builtin_command("show_output_form", boost::bind(&WBContextUI::show_output, this)); @@ -480,7 +490,7 @@ bec::ValueInspectorBE *WBContextUI::create_inspector_for_selection(bec::UIForm * { items.push_back(strfmt("%s: %s", selection[0]->name().c_str(), selection[0].get_metaclass()->get_attribute("caption").c_str())); - return ValueInspectorBE::create(_wb->get_grt_manager()->get_grt(), selection[0], false, true); + return ValueInspectorBE::create(selection[0], false, true); } else { @@ -493,7 +503,7 @@ bec::ValueInspectorBE *WBContextUI::create_inspector_for_selection(bec::UIForm * list.push_back(selection.get(i)); } - return ValueInspectorBE::create(_wb->get_grt_manager()->get_grt(), list); + return ValueInspectorBE::create(list); } } @@ -517,7 +527,7 @@ bec::ValueInspectorBE *WBContextUI::create_inspector_for_selection(std::vectorget_attribute("caption").c_str())); - return ValueInspectorBE::create(_wb->get_grt_manager()->get_grt(), selection[0], false, true); + return ValueInspectorBE::create(selection[0], false, true); } } else @@ -533,7 +543,7 @@ bec::ValueInspectorBE *WBContextUI::create_inspector_for_selection(std::vectorget_grt_manager()->get_grt(), list); + return ValueInspectorBE::create(list); } } @@ -544,7 +554,7 @@ std::string WBContextUI::get_description_for_selection(grt::ListRef & { std::string res; - if (get_physical_overview() != NULL) + if (get_physical_overview() != nullptr) { grt::ListRef selection(get_physical_overview()->get_selection()); activeObjList= selection; @@ -597,7 +607,7 @@ std::string WBContextUI::get_description_for_selection(bec::UIForm *form, grt::L std::string res; - activeObjList= grt::ListRef(selection.get_grt()); + activeObjList= grt::ListRef(true); std::string comment_mem_name("comment"); std::string descr_mem_name("description"); @@ -654,7 +664,7 @@ void WBContextUI::set_description_for_selection(const grt::ListRef &o std::string comment_mem_name("comment"); std::string descr_mem_name("description"); - grt::AutoUndo undo(_wb->get_grt()); + grt::AutoUndo undo; for (size_t c= objList.count(), i= 0; i < c; i++) { @@ -725,7 +735,7 @@ void WBContextUI::set_doc_properties(const std::string &caption, const std::stri { app_DocumentInfoRef info= _wb->get_document()->info(); - grt::AutoUndo undo(_wb->get_grt()); + grt::AutoUndo undo; info->caption(caption); info->version(version); info->author(author); @@ -775,7 +785,7 @@ bool WBContextUI::add_paper_size(const std::string &name, double width, double h if (grt::find_named_object_in_list(_wb->get_root()->options()->paperTypes(), name).is_valid()) return false; - app_PaperTypeRef type(_wb->get_grt_manager()->get_grt()); + app_PaperTypeRef type(grt::Initialized); type->owner(_wb->get_root()->options()); type->name(name); type->width(width); @@ -798,7 +808,7 @@ app_PageSettingsRef WBContextUI::get_page_settings() else { // XXX add proper initialization for non-trivial types in structs.app.h too. - app_PageSettingsRef settings= app_PageSettingsRef(_wb->get_grt()); + app_PageSettingsRef settings= app_PageSettingsRef(grt::Initialized); settings->scale(1); settings->paperType(app_PaperTypeRef()); diff --git a/backend/wbprivate/workbench/wb_context_ui.h b/backend/wbprivate/workbench/wb_context_ui.h index a46cc4782..3d239797d 100644 --- a/backend/wbprivate/workbench/wb_context_ui.h +++ b/backend/wbprivate/workbench/wb_context_ui.h @@ -49,7 +49,6 @@ class PluginInstallWindow; class AddOnDownloadWindow; namespace mforms { - enum class HomeScreenAction; class HomeScreen; class XConnectionsSection; class ConnectionsSection; @@ -186,7 +185,7 @@ namespace wb { void add_backend_builtin_commands(); void show_about(); - void show_home_screen(); + void show_home_screen(bool startClassic); void show_web_page(const std::string& url, bool internal_browser); void show_help_index(); void locate_log_file(); @@ -199,8 +198,6 @@ namespace wb { void start_plugin(const std::string& title, const std::string& command, const bec::ArgumentPool &defaults, bool force_external = false); - static void home_action_callback(mforms::HomeScreenAction action, const base::any &object, WBContextUI *self); - db_mgmt_ConnectionRef getConnectionById(const std::string &id); mforms::anyMap connectionToMap(db_mgmt_ConnectionRef connection); diff --git a/backend/wbprivate/workbench/wb_context_ui_home.cpp b/backend/wbprivate/workbench/wb_context_ui_home.cpp index 5dd45c51d..7f439da8f 100644 --- a/backend/wbprivate/workbench/wb_context_ui_home.cpp +++ b/backend/wbprivate/workbench/wb_context_ui_home.cpp @@ -27,7 +27,7 @@ #include "mforms/menu.h" -#include "grtpp.h" +#include "grt.h" #include "grts/structs.app.h" #include "grts/structs.h" @@ -48,9 +48,13 @@ #include "new_connection_wizard.h" #include "select_option_dialog.h" #include "wb_model_file.h" - -#include "home_screen.h" +#include "base/data_types.h" +#include "mforms/home_screen.h" +#include "mforms/home_screen_x_connections.h" +#include "mforms/home_screen_connections.h" +#include "mforms/home_screen_documents.h" #include +#include "base/session_wrapper.h" DEFAULT_LOG_DOMAIN(DOMAIN_WB_CONTEXT_UI); @@ -288,10 +292,12 @@ void WBContextUI::show_about() * Creates the main home screen (Workbench Central, Workspace) if not yet done and docks it to * the main application window. */ -void WBContextUI::show_home_screen() + +void WBContextUI::show_home_screen(bool startClassic) { if (_home_screen != NULL) { + _home_screen->showSection(startClassic ? 1 : 0); mforms::App::get()->select_view(_home_screen); return; } @@ -300,19 +306,40 @@ void WBContextUI::show_home_screen() if (_home_screen == NULL) { // The home screen and its content is freed in AppView::close() during undock_view(...). - _home_screen = mforms::manage(new HomeScreen(_command_ui, _wb->get_root()->rdbmsMgmt())); - _home_screen->set_callback((home_screen_action_callback)&WBContextUI::home_action_callback, this); - _home_screen->handle_context_menu = boost::bind(&WBContextUI::handle_home_context_menu, this, _1, _2); + _home_screen = mforms::manage(new mforms::HomeScreen); + _home_screen->set_menubar(_command_ui->create_menubar_for_context(WB_CONTEXT_HOME_GLOBAL)); + _home_screen->onHomeScreenAction = std::bind(&WBContextUI::handle_home_action, this, std::placeholders::_1, std::placeholders::_2); + _home_screen->handleContextMenu = std::bind(&WBContextUI::handle_home_context_menu, this, std::placeholders::_1, std::placeholders::_2); + + // now we have to add sections + _xConnectionsSection = mforms::manage(new mforms::XConnectionsSection(_home_screen)); + _xConnectionsSection->set_name("Home X Connections Section"); + _home_screen->addSection(_xConnectionsSection); + + _connectionsSection = mforms::manage(new mforms::ConnectionsSection(_home_screen)); + _connectionsSection->set_name("Home Connections Section"); + _connectionsSection->getConnectionInfoCallback = std::bind([=](const std::string &connectionId)->mforms::anyMap { + return connectionToMap(getConnectionById(connectionId)); + }, std::placeholders::_1); + _home_screen->addSection(_connectionsSection); + + _documentsSection = mforms::manage(new mforms::DocumentsSection(_home_screen)); + _documentsSection->set_name("Documents Section"); + _home_screen->addSection(_documentsSection); + + _home_screen->addSectionEntry("sidebar_migration.png", nullptr, [this]() { + logInfo("Opening Migration Wizard...\n"); + _wb->add_new_plugin_window("wb.migration.open", "Migration Wizard"); + }, false); // Setup context menus. mforms::Menu *menu; - { std::list groups; bec::ArgumentPool argument_pool; _wb->update_plugin_arguments_pool(argument_pool); groups.push_back("Menu/Home/Connections"); - bec::MenuItemList pitems = _wb->get_grt_manager()->get_plugin_context_menu_items(groups, argument_pool); + bec::MenuItemList pitems = bec::GRTManager::get()->get_plugin_context_menu_items(groups, argument_pool); if (!pitems.empty()) { menu = mforms::manage(new mforms::Menu()); @@ -321,6 +348,11 @@ void WBContextUI::show_home_screen() } } + menu = mforms::manage(new mforms::Menu()); + menu->add_item(_("Open Project"), "open_project"); + menu->add_item(_("Delete Project..."), "delete_project"); + _home_screen->set_menu(menu, mforms::HomeMenuXConnection); + menu = mforms::manage(new mforms::Menu()); menu->add_item(_("Open Connection"), "open_connection"); menu->add_item(_("Edit Connection..."), "edit_connection"); @@ -332,9 +364,9 @@ void WBContextUI::show_home_screen() std::list groups; bec::ArgumentPool argument_pool; _wb->update_plugin_arguments_pool(argument_pool); - argument_pool.add_entries_for_object("selectedConnection", db_mgmt_ConnectionRef(_wb->get_grt()), "db.mgmt.Connection"); + argument_pool.add_entries_for_object("selectedConnection", db_mgmt_ConnectionRef(grt::Initialized), "db.mgmt.Connection"); groups.push_back("Menu/Home/Connections"); - bec::MenuItemList pitems = _wb->get_grt_manager()->get_plugin_context_menu_items(groups, argument_pool); + bec::MenuItemList pitems = bec::GRTManager::get()->get_plugin_context_menu_items(groups, argument_pool); if (!pitems.empty()) { menu->add_separator(); @@ -367,7 +399,7 @@ void WBContextUI::show_home_screen() argument_pool.add_simple_value("selectedGroupName", grt::StringRef("")); groups.push_back("Menu/Home/ConnectionGroup"); - bec::MenuItemList pitems = _wb->get_grt_manager()->get_plugin_context_menu_items(groups, argument_pool); + bec::MenuItemList pitems = bec::GRTManager::get()->get_plugin_context_menu_items(groups, argument_pool); if (!pitems.empty()) { menu->add_items_from_list(pitems); @@ -377,21 +409,6 @@ void WBContextUI::show_home_screen() menu->add_item(_("Delete Group..."), "delete_connection_group"); _home_screen->set_menu(menu, HomeMenuConnectionGroup); - - menu = mforms::manage(new mforms::Menu()); - menu->add_item(_("Move To Top"), "move_connection_to_top"); - menu->add_item(_("Move Up"), "move_connection_up"); - menu->add_item(_("Move Down"), "move_connection_down"); - menu->add_item(_("Move To End"), "move_connection_to_end"); - - menu->add_separator(); - menu->add_item(_("Edit Connection..."), "edit_connection"); - menu->add_item(_("Delete Connection..."), "delete_fabric_connection"); - - menu->add_separator(); - menu->add_item(_("Delete Connections to Managed Servers..."), "delete_fabric_connection_servers"); - - _home_screen->set_menu(menu, HomeMenuConnectionFabric); menu = mforms::manage(new mforms::Menu()); menu->add_item(_("Open Model"), "open_model_from_list"); @@ -401,7 +418,7 @@ void WBContextUI::show_home_screen() _wb->update_plugin_arguments_pool(argument_pool); argument_pool.add_simple_value("selectedModelFile", grt::ValueRef()); groups.push_back("Menu/Home/ModelFiles"); - bec::MenuItemList pitems = _wb->get_grt_manager()->get_plugin_context_menu_items(groups, argument_pool); + bec::MenuItemList pitems = bec::GRTManager::get()->get_plugin_context_menu_items(groups, argument_pool); if (!pitems.empty()) { menu->add_separator(); @@ -425,7 +442,7 @@ void WBContextUI::show_home_screen() _wb->update_plugin_arguments_pool(argument_pool); argument_pool.add_simple_value("selectedModelFile", grt::ValueRef()); groups.push_back("Menu/Home/ModelFiles"); // TODO: do we need a different group for the action menu? - bec::MenuItemList pitems = _wb->get_grt_manager()->get_plugin_context_menu_items(groups, argument_pool); + bec::MenuItemList pitems = bec::GRTManager::get()->get_plugin_context_menu_items(groups, argument_pool); if (!pitems.empty()) { menu->add_separator(); @@ -444,7 +461,6 @@ void WBContextUI::show_home_screen() { refresh_home_documents(); refresh_home_connections(); - refresh_home_starters(); } catch (const std::exception *exc) { error = exc->what(); } @@ -456,28 +472,134 @@ void WBContextUI::show_home_screen() if (!error.empty()) { std::string message = base::strfmt(_("Error while setting up home screen. The error message is: %s"), error.c_str()); - log_error("%s\n", message.c_str()); + logError("%s\n", message.c_str()); mforms::Utilities::show_error(_("Home Screen Error"), message, _("Close")); } _home_screen->setup_done(); + + if (!_oldAuthList.empty()) + { + std::string tmp; + std::vector::const_iterator it; + for (it = _oldAuthList.begin(); it != _oldAuthList.end(); ++it) + { + tmp.append("\n"); + tmp.append((*it)->name()); + tmp.append(" user name:"); + tmp.append((*it)->parameterValues().get_string("userName")); + } + + int rc = mforms::Utilities::show_warning("Connections using old authentication protocol found", + "While loading the stored connections some were found to use the old authentication protocol. " + "This is no longer supported by MySQL Workbench and the MySQL client library. Click on the \"More Info\" button for a more detailed explanation.\n\n" + "With this change it is essential that user accounts are converted to the new password storage or you can no longer connect with MySQL Workbench using these accounts.\n\n" + "The following connections are affected:\n" + +tmp, + "Change", "Ignore", "More Info"); + if (rc == mforms::ResultOther) + { + mforms::Utilities::open_url("http://mysqlworkbench.org/2014/03/mysql-workbench-6-1-updating-accounts-using-the-old-pre-4-1-1-authentication-protocol/"); + } + else if (rc == mforms::ResultOk) + { + std::vector::const_iterator it; + for (it = _oldAuthList.begin(); it != _oldAuthList.end(); ++it) + { + if((*it).is_valid()) + { + if ((*it)->parameterValues().has_key("useLegacyAuth")) + (*it)->parameterValues().remove("useLegacyAuth"); + } + } + _oldAuthList.clear(); + } + } + + _home_screen->showSection(startClassic ? 1 : 0); _initializing_home_screen = false; } //-------------------------------------------------------------------------------------------------- -void WBContextUI::home_action_callback(HomeScreenAction action, const grt::ValueRef &object, WBContextUI *self) +db_mgmt_ConnectionRef WBContextUI::getConnectionById(const std::string &id) { - try + grt::ListRef connections(_wb->get_root()->rdbmsMgmt()->storedConns()); + for (std::size_t i = 0; i < connections->count(); ++i) { - self->handle_home_action(action, object); + if (connections[i].id() == id) + return connections[i]; } - catch (const std::exception &exc) + + return db_mgmt_ConnectionRef(); +} + +//-------------------------------------------------------------------------------------------------- + +static bool isSSHConnection(const db_mgmt_ConnectionRef &connection) +{ + if (connection.is_valid()) + { + std::string driver = connection->driver().is_valid() ? connection->driver()->name() : ""; + return (driver == "MysqlNativeSSH"); + } + return false; +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Determines if the given connection is a local connection (i.e. to the current box). + */ +static bool isLocalConnection(const db_mgmt_ConnectionRef &connection) +{ + if (connection.is_valid()) + { + std::string hostname= connection->parameterValues().get_string("hostName"); + + if (!isSSHConnection(connection) && (hostname == "localhost" || hostname.empty() || hostname == "127.0.0.1")) + return true; + } + return false; +} + +anyMap WBContextUI::connectionToMap(db_mgmt_ConnectionRef connection) +{ + anyMap output; + + if (!connection.is_valid()) + return output; + + db_mgmt_ServerInstanceRef instance; + grt::ListRef instances = _wb->get_root()->rdbmsMgmt()->storedInstances(); + for (grt::ListRef::const_iterator iterator = instances.begin(); + iterator != instances.end(); iterator++) { - std::string message = base::strfmt("Exception caught while processing action from home screen: %s", exc.what()); - log_error("%s\n", message.c_str()); - mforms::Utilities::show_error("Internal Error", message, _("Close")); + if ((*iterator)->connection() == connection) + { + instance = *iterator; + break; + } } + + output = grt::convert(connection->parameterValues()); + + if (instance->serverInfo().is_valid()) + output.insert({"serverInfo", grt::convert(instance->serverInfo())}); + else + output.insert({"serverInfo", base::any()}); + + if (instance->loginInfo().is_valid()) + output.insert({"loginInfo", grt::convert(instance->loginInfo())}); + else + output.insert({"loginInfo", base::any()}); + + output.insert({"isLocalConnection", isLocalConnection(connection)}); + output.insert({"isSSHConnection", isSSHConnection(connection)}); + output.insert({"hostIdentifier", std::string(connection->hostIdentifier())}); + std::string name = connection->name(); + output.insert({"name", name}); + return output; } //-------------------------------------------------------------------------------------------------- @@ -488,84 +610,71 @@ void WBContextUI::home_action_callback(HomeScreenAction action, const grt::Value */ void WBContextUI::remove_connection(const db_mgmt_ConnectionRef &connection) { - grt::GRT *grt = connection->get_grt(); - grt::BaseListRef args(grt); + grt::BaseListRef args(true); args->insert_unchecked(connection); - grt::ValueRef result = grt->call_module_function("Workbench", "deleteConnection", args); + grt::ValueRef result = grt::GRT::get()->call_module_function("Workbench", "deleteConnection", args); } //-------------------------------------------------------------------------------------------------- -void WBContextUI::handle_home_context_menu(const grt::ValueRef &object, const std::string &action) +void WBContextUI::handle_home_context_menu(const base::any &object, const std::string &action) { if (action == "open_connection") { - handle_home_action(ActionOpenConnectionFromList, object); + handle_home_action(HomeScreenAction::ActionOpenConnectionFromList, object); } - else if (action == "delete_connection" || action == "delete_fabric_connection" || action == "delete_fabric_connection_servers") + else if (action == "delete_connection") { - db_mgmt_ConnectionRef connection(db_mgmt_ConnectionRef::cast_from(object)); - + db_mgmt_ConnectionRef connection = getConnectionById(object.as()); + std::string name = connection->name(); std::string title; std::string warning; - if (action == "delete_fabric_connection_servers") - { - title = _("Delete Managed Server Connections"); - warning = strfmt(_("Do you really want to delete managed server connections on this fabric node: %s?"), name.c_str()); - } - else - { - title = _("Delete Connection"); - warning = strfmt(_("Do you want to delete connection %s?"), name.c_str()); - } + title = _("Delete Connection"); + warning = strfmt(_("Do you want to delete connection %s?"), name.c_str()); int answer = Utilities::show_warning(title, warning, _("Delete"), _("Cancel")); if (answer == mforms::ResultOk) { - // In case it is not a single connection, implies it is a fabric connection and we need to - // delete the connections to the managed servers - if (action != "delete_connection") - handle_home_context_menu(grt::StringRef(name), "internal_delete_connection_group"); - - // Connection is not deleted when we are just deleting the children of a fabric connection - if (action != "delete_fabric_connection_servers") - remove_connection(connection); - + remove_connection(connection); refresh_home_connections(); } } else if (action == "manage_connections" || action == "edit_connection") { - handle_home_action(ActionManageConnections, object); + handle_home_action(HomeScreenAction::ActionManageConnections, object); } else if (action == "move_connection_to_top") { // We enter here for both: groups and connections. The object for groups must be a StringRef // with the name of the group. For connections it's the connection ref. // Similar for the other move_* actions. + db_mgmt_ConnectionRef val = getConnectionById(object.as()); grt::ListRef connections(_wb->get_root()->rdbmsMgmt()->storedConns()); - bec::move_list_ref_item(connections, object, MoveTop); + bec::move_list_ref_item(connections, val, MoveTop); refresh_home_connections(false); } else if (action == "move_connection_up") { + grt::ValueRef val = getConnectionById(object.as()); grt::ListRef connections(_wb->get_root()->rdbmsMgmt()->storedConns()); - bec::move_list_ref_item(connections, object, MoveUp); + bec::move_list_ref_item(connections, val, MoveUp); refresh_home_connections(false); } else if (action == "move_connection_down") { + db_mgmt_ConnectionRef val = getConnectionById(object.as()); grt::ListRef connections(_wb->get_root()->rdbmsMgmt()->storedConns()); - bec::move_list_ref_item(connections, object, MoveDown); + bec::move_list_ref_item(connections, val, MoveDown); refresh_home_connections(false); } else if (action == "move_connection_to_end") { + db_mgmt_ConnectionRef val = getConnectionById(object.as()); grt::ListRef connections(_wb->get_root()->rdbmsMgmt()->storedConns()); - bec::move_list_ref_item(connections, object, MoveBottom); + bec::move_list_ref_item(connections, val, MoveBottom); refresh_home_connections(false); } else if (action == "move_connection_to_group") @@ -574,23 +683,24 @@ void WBContextUI::handle_home_context_menu(const grt::ValueRef &object, const st // Create the available groups for the movement... std::vector groups; - get_groups_for_movement(connections, object, groups); + db_mgmt_ConnectionRef val = getConnectionById(object.as()); + get_groups_for_movement(connections, val, groups); SelectOptionDialog dialog(_("Move To Group"), _("Pick a group to move the selected connection " "to\nor type a name to move it to a new one."), groups); - dialog.set_validation_function(boost::bind(&validate_group_for_movement, connections, object, _1)); + dialog.set_validation_function(boost::bind(&validate_group_for_movement, connections, val, _1)); std::string result = dialog.run(); // At this point the movement is considered valid so we just do it. if( result != "") { - move_item_to_group(result, connections, object); + move_item_to_group(result, connections, val); refresh_home_connections(); } } else if (action == "delete_connection_group" || action == "internal_delete_connection_group") { - std::string group = object.toString(); + std::string group = object; int answer = mforms::ResultOk; @@ -603,11 +713,11 @@ void WBContextUI::handle_home_context_menu(const grt::ValueRef &object, const st if (answer == mforms::ResultOk) { - grt::GRT *grt = _wb->get_grt(); - grt::BaseListRef args(grt); - args->insert_unchecked(object); + grt::BaseListRef args(true); + db_mgmt_ConnectionRef val = object; + args->insert_unchecked(val); - grt::ValueRef result = grt->call_module_function("Workbench", "deleteConnectionGroup", args); + grt::ValueRef result = grt::GRT::get()->call_module_function("Workbench", "deleteConnectionGroup", args); // Internal deletion does not require the UI update if (action == "delete_connection_group") @@ -628,27 +738,28 @@ void WBContextUI::handle_home_context_menu(const grt::ValueRef &object, const st } else if (action == "open_model_from_list") { - handle_home_action(ActionOpenEERModelFromList, object); + handle_home_action(HomeScreenAction::ActionOpenEERModelFromList, object); } else if (action == "model_from_schema") { - handle_home_action(ActionNewModelFromDB, object); + handle_home_action(HomeScreenAction::ActionNewModelFromDB, object); } else if (action == "model_from_script") { - handle_home_action(ActionNewModelFromScript, object); + handle_home_action(HomeScreenAction::ActionNewModelFromScript, object); } else if (action == "show_model") { - std::string file = grt::StringRef::cast_from(object); + std::string file = object; mforms::Utilities::reveal_file(file); } else if (action == "remove_model") { - _wb->get_root()->options()->recentFiles()->remove(object); + grt::ValueRef val = object; + _wb->get_root()->options()->recentFiles()->remove(val); bool remove_auto_save = false; - std::string file = grt::StringRef::cast_from(object); + std::string file = object; if (file.size() > 5 && file.substr(file.size()-5) == ".mwbd") remove_auto_save = true; else @@ -678,7 +789,7 @@ void WBContextUI::handle_home_context_menu(const grt::ValueRef &object, const st } catch (std::exception &exc) { - log_error("Error removing model file %s: %s\n", file.c_str(), exc.what()); + logError("Error removing model file %s: %s\n", file.c_str(), exc.what()); } } refresh_home_documents(); @@ -703,122 +814,129 @@ void WBContextUI::handle_home_context_menu(const grt::ValueRef &object, const st bec::ArgumentPool argument_pool; _wb->update_plugin_arguments_pool(argument_pool); - if (db_mgmt_ConnectionRef::can_wrap(object)) + if (object.is()) { - argument_pool.add_entries_for_object("selectedConnection", db_mgmt_ConnectionRef::cast_from(object)); + std::string val = object; + if (base::hasSuffix(val, ".mwb")) + argument_pool.add_simple_value("selectedModelFile", grt::StringRef(val)); // assume a model file + else + argument_pool.add_simple_value("selectedGroupName", grt::StringRef(val)); // assume a connection group name get_command_ui()->activate_command(action, argument_pool); } - else - if (grt::StringRef::can_wrap(object)) + else if (object.is()) + { + grt::ValueRef val = object; + if (db_mgmt_ConnectionRef::can_wrap(val)) { - grt::StringRef arg(grt::StringRef::cast_from(object)); - if (has_suffix(arg, ".mwb")) - argument_pool.add_simple_value("selectedModelFile", arg); // assume a model file - else - argument_pool.add_simple_value("selectedGroupName", arg); // assume a connection group name + argument_pool.add_entries_for_object("selectedConnection", db_mgmt_ConnectionRef::cast_from(val)); get_command_ui()->activate_command(action, argument_pool); } - else // Any other command. + else get_command_ui()->activate_command(action, argument_pool); + } + else + get_command_ui()->activate_command(action, argument_pool); + } } //-------------------------------------------------------------------------------------------------- -void WBContextUI::start_plugin(const std::string& title, const std::string& command, bool force_external) +void WBContextUI::start_plugin(const std::string& title, const std::string& command, const bec::ArgumentPool &defaults, bool force_external) { try { std::string message_title= base::strfmt(_("Starting %s"), title.c_str()); GUILock lock(_wb, message_title, _("Please stand by while the plugin is started...")); - if (base::starts_with(command, "plugin:")) + if (base::hasPrefix(command, "plugin:")) { - _wb->execute_plugin(command.substr(7, command.length())); + _wb->execute_plugin(command.substr(7, command.length()), defaults); } else - if (base::starts_with(command, "browse:")) + if (base::hasPrefix(command, "browse:")) show_web_page(command.substr(7, command.length()), !force_external); else - if (base::starts_with(command, "http://")) + if (base::hasPrefix(command, "http://")) show_web_page(command, false); } catch (const std::exception &exc) { std::string message = base::strfmt(_("Could not open link or plugin. The error message is: %s"), exc.what()); - log_error("%s\n", message.c_str()); + logError("%s\n", message.c_str()); mforms::Utilities::show_error(_("Open Plugin Error"), message, _("Close")); } } //-------------------------------------------------------------------------------------------------- -void WBContextUI::handle_home_action(HomeScreenAction action, const grt::ValueRef &object) +void WBContextUI::handle_home_action(mforms::HomeScreenAction action, const base::any &anyObject) { switch (action) { - case ActionNone: + case HomeScreenAction::ActionNone: break; - case ActionShortcut: - { - app_StarterRef starter = app_StarterRef::cast_from(object); - start_plugin(starter->title(), starter->command()); - } - - break; - - case ActionRemoveShortcut: - { - app_StarterRef starter = app_StarterRef::cast_from(object); - _wb->get_root()->starters()->displayList()->remove(starter); - _wb->save_starters(); - refresh_home_starters(); - } - break; - - case ActionOpenConnectionFromList: + case HomeScreenAction::ActionOpenConnectionFromList: { if (_processing_action_open_connection) break; _processing_action_open_connection = true; + db_mgmt_ConnectionRef object; + if (!anyObject.isNull()) + object = getConnectionById(anyObject.as()); + if (object.is_valid()) { db_mgmt_ConnectionRef connection(db_mgmt_ConnectionRef::cast_from(object)); - _wb->show_status_text("Opening SQL Editor..."); - _wb->add_new_query_window(connection); + bool is_ng = connection.is_valid() && connection->driver()->name() == "MySQLX"; + if (is_ng) + { + _wb->show_status_text("Opening XShell..."); + bec::ArgumentPool argument_pool; + argument_pool.add_entries_for_object("connection", connection, db_mgmt_Connection::static_class_name()); + start_plugin("NG IDE", "plugin:com.mysql.wb.ng", argument_pool); + _wb->show_status_text("XSHell opened..."); + } + else + { + _wb->show_status_text("Opening SQL Editor..."); + _wb->add_new_query_window(connection); + } } _processing_action_open_connection = false; break; } - - case ActionFilesWithConnection: - { - if (_processing_action_open_connection) - break; - _processing_action_open_connection = true; - if (object.is_valid()) + case HomeScreenAction::ActionFilesWithConnection: + { + if (_processing_action_open_connection) + break; + + _processing_action_open_connection = true; + HomeScreenDropFilesInfo dInfo; + if (!anyObject.isNull()) + dInfo = anyObject; + + if (dInfo.files.size() != 0) + { + db_mgmt_ConnectionRef connection = getConnectionById(dInfo.connectionId); + _wb->show_status_text("Opening files in new SQL Editor ..."); + std::shared_ptr form = _wb->add_new_query_window(connection, false); + if (form) { - grt::DictRef dict = grt::DictRef::cast_from(object); - db_mgmt_ConnectionRef connection = db_mgmt_ConnectionRef::cast_from(dict["connection"]); - grt::StringListRef names = grt::StringListRef::cast_from(dict["files"]); - _wb->show_status_text("Opening files in new SQL Editor ..."); - boost::shared_ptr form = _wb->add_new_query_window(connection, false); - if (form) - { - for (size_t i = 0; i < names->count(); ++i) - form->open_file(names[i], true); - form->update_title(); - } + for (auto &it : dInfo.files) + form->open_file(it, true); + form->update_title(); } - - _processing_action_open_connection = false; - break; } - case ActionNewConnection: + _processing_action_open_connection = false; + break; + } + + case HomeScreenAction::ActionNewConnection: { NewConnectionWizard wizard(_wb, _wb->get_root()->rdbmsMgmt()); wizard.set_title("Setup New Connection"); @@ -827,9 +945,13 @@ void WBContextUI::handle_home_action(HomeScreenAction action, const grt::ValueRe break; } - case ActionManageConnections: + case HomeScreenAction::ActionManageConnections: { - ServerInstanceEditor editor(_wb->get_grt_manager(), _wb->get_root()->rdbmsMgmt()); + db_mgmt_ConnectionRef object; + if (!anyObject.isNull()) + object = getConnectionById(anyObject.as()); + + ServerInstanceEditor editor(_wb->get_root()->rdbmsMgmt()); _wb->show_status_text("Connection Manager Opened"); editor.run(db_mgmt_ConnectionRef::cast_from(object)); _wb->show_status_text(""); @@ -837,91 +959,44 @@ void WBContextUI::handle_home_action(HomeScreenAction action, const grt::ValueRe break; } - case ActionMoveConnection: + case HomeScreenAction::ActionMoveConnection: { + HomeScreenDropInfo dropInfo = anyObject; + grt::ListRef connections(_wb->get_root()->rdbmsMgmt()->storedConns()); - grt::DictRef dict = grt::DictRef::cast_from(object); - int to = (int)grt::IntegerRef::cast_from(dict["to"]); - if (db_mgmt_ConnectionRef::can_wrap(dict["object"])) + if (dropInfo.valueIsConnectionId) { - db_mgmt_ConnectionRef connection = db_mgmt_ConnectionRef::cast_from(dict["object"]); - move_list_ref_item(connections, connection, to); + db_mgmt_ConnectionRef connection = getConnectionById(dropInfo.value); + move_list_ref_item(connections, connection, dropInfo.to); refresh_home_connections(false); } else { - if (grt::StringRef::can_wrap(dict["object"])) - { - grt::StringRef group = grt::StringRef::cast_from(dict["object"]); - move_list_ref_item(connections, group, to); - refresh_home_connections(false); - } - + std::string group = dropInfo.value; + move_list_ref_item(connections, grt::StringRef(group), dropInfo.to); + refresh_home_connections(false); } break; } - case ActionMoveConnectionToGroup: + case HomeScreenAction::ActionMoveConnectionToGroup: { + HomeScreenDropInfo dropInfo = anyObject; grt::ListRef connections(_wb->get_root()->rdbmsMgmt()->storedConns()); - db_mgmt_ConnectionRef connection; - - grt::DictRef dict = grt::DictRef::cast_from(object); - std::string group = grt::StringRef::cast_from(dict["group"]); - connection = db_mgmt_ConnectionRef::cast_from(dict["object"]); - if (group != "" && connection.is_valid()) + db_mgmt_ConnectionRef connection = getConnectionById(dropInfo.value); + if (dropInfo.group != "" && connection.is_valid()) { - move_item_to_group(group, connections, connection); + move_item_to_group(dropInfo.group, connections, connection); refresh_home_connections(false); } break; } - - case ActionUpdateFabricConnections: - { - // Creates the fabric connections only if they have not been already created - // since the last connection refresh - GUILock lock(_wb, _("Connecting to MySQL Fabric Management Node"), _("The connections to the managed MySQL Servers will be updated in a moment.\n" - "\nPlease stand by...")); - _wb->show_status_text(_("Connecting to MySQL Fabric Management Node...")); - db_mgmt_ConnectionRef connection(db_mgmt_ConnectionRef::cast_from(object)); - grt::GRT *grt = connection->get_grt(); - grt::BaseListRef args(grt); - args->insert_unchecked(connection); - - std::string error; - - try - { - grt::ValueRef result = grt->call_module_function("WBFabric", "updateConnections", args); - error = grt::StringRef::extract_from(result); - } - catch (std::runtime_error &exc) - { - error = exc.what(); - } - - if (error == "Operation Cancelled") - _wb->show_status_text(_("Creation of connections to Managed MySQL Servers was cancelled.")); - else - { - if (error.length()) - { - log_warning("Error updating managed connections for %s: %s\n", connection->name().c_str(), error.c_str()); - mforms::Utilities::show_error(_("MySQL Fabric Connection Error"), error, "OK"); - _wb->show_status_text(_("Failed updating connections to Managed MySQL Servers...")); - } - else - _wb->show_status_text(_("Updated connections to Managed MySQL Servers...")); - } - break; - } - - case ActionSetupRemoteManagement: + case HomeScreenAction::ActionSetupRemoteManagement: { - NewServerInstanceWizard wizard(_wb, db_mgmt_ConnectionRef::cast_from(object)); + db_mgmt_ConnectionRef object = getConnectionById(anyObject.as()); + NewServerInstanceWizard wizard(_wb, object); _wb->show_status_text("Started Management Setup Wizard"); wizard.run_modal(); _wb->show_status_text(""); @@ -930,88 +1005,150 @@ void WBContextUI::handle_home_action(HomeScreenAction action, const grt::ValueRe break; } - case ActionEditSQLScript: + case HomeScreenAction::ActionEditSQLScript: { break; } - case ActionOpenEERModel: - { - // Note: wb->open_document has an own GUILock, so we must not set another one here. - std::string filename = _wb->show_file_dialog("open", _("Open Workbench Model"), "mwb"); - if (!filename.empty()) - _wb->open_document(filename); - else - _wb->show_status_text("Cancelled"); - break; - } + case HomeScreenAction::ActionOpenEERModel: + { + // Note: wb->open_document has an own GUILock, so we must not set another one here. + std::string filename = _wb->show_file_dialog("open", _("Open Workbench Model"), "mwb"); + if (!filename.empty()) + _wb->open_document(filename); + else + _wb->show_status_text("Cancelled"); + break; + } - case ActionOpenEERModelFromList: + case HomeScreenAction::ActionOpenEERModelFromList: { // Note: wb->open_document has an own GUILock, so we must not set another one here. - if (object.is_valid()) + if (!anyObject.isNull()) { - std::string path = *grt::StringRef::cast_from(object); + std::string path = anyObject; _wb->show_status_text(strfmt("Opening %s...", path.c_str())); _wb->open_document(path); } break; } - case ActionNewEERModel: + case HomeScreenAction::ActionNewEERModel: _wb->new_document(); break; - case ActionNewModelFromDB: + case HomeScreenAction::ActionNewModelFromDB: + { + _wb->new_document(); + if (_wb->get_document().is_valid()) { - _wb->new_document(); - if (_wb->get_document().is_valid()) - { - ArgumentPool args; + ArgumentPool args; - // delete the default schema - if (_wb->get_document()->physicalModels()[0]->catalog()->schemata().count() > 0) - _wb->get_document()->physicalModels()[0]->catalog()->schemata().remove(0); + // delete the default schema + if (_wb->get_document()->physicalModels()[0]->catalog()->schemata().count() > 0) + _wb->get_document()->physicalModels()[0]->catalog()->schemata().remove(0); - _wb->update_plugin_arguments_pool(args); - args.add_entries_for_object("activeCatalog", _wb->get_document()->physicalModels()[0]->catalog(), - "db.Catalog"); + _wb->update_plugin_arguments_pool(args); + args.add_entries_for_object("activeCatalog", _wb->get_document()->physicalModels()[0]->catalog(), + "db.Catalog"); - _wb->execute_plugin("db.plugin.database.rev_eng", args); + _wb->execute_plugin("db.plugin.database.rev_eng", args); - // if the model is still empty, just close it - if (_wb->get_document()->physicalModels()[0]->catalog()->schemata().count() == 0) - _wb->close_document(); - } - else - _wb->show_status_text("Error creating document"); - break; + // if the model is still empty, just close it + if (_wb->get_document()->physicalModels()[0]->catalog()->schemata().count() == 0) + _wb->close_document(); } + else + _wb->show_status_text("Error creating document"); + break; + } - case ActionNewModelFromScript: + case HomeScreenAction::ActionNewModelFromScript: + { + _wb->new_document(); + if (_wb->get_document().is_valid()) { - _wb->new_document(); - if (_wb->get_document().is_valid()) - { - ArgumentPool args; + ArgumentPool args; + + // delete the default schema + if (_wb->get_document()->physicalModels()[0]->catalog()->schemata().count() > 0) + _wb->get_document()->physicalModels()[0]->catalog()->schemata().remove(0); - // delete the default schema - if (_wb->get_document()->physicalModels()[0]->catalog()->schemata().count() > 0) - _wb->get_document()->physicalModels()[0]->catalog()->schemata().remove(0); + _wb->update_plugin_arguments_pool(args); + args.add_entries_for_object("activeCatalog", _wb->get_document()->physicalModels()[0]->catalog(), + "db.Catalog"); + _wb->execute_plugin("db.mysql.plugin.import.sql", args); + + // if the model is still empty, just close it + if (_wb->get_document()->physicalModels()[0]->catalog()->schemata().count() == 0) + _wb->close_document(); + } + else + _wb->show_status_text("Error creating document"); + break; + } + + case HomeScreenAction::ActionOpenXProject: + { + dataTypes::XProject project = anyObject; +#ifdef _WIN32 + std::string exeName = "MySQLWorkbench.X.exe"; +#elif __APPLE__ + std::string exeName = "MySQLWorkbench.X.app"; +#else + std::string exeName = mforms::App::get()->get_executable_path("workbench.x"); +#endif + logInfo("About to execute: %s --open %s\n", exeName.c_str(), project.connection.uuid.c_str()); + try + { + if (project.placeholder) + { - _wb->update_plugin_arguments_pool(args); - args.add_entries_for_object("activeCatalog", _wb->get_document()->physicalModels()[0]->catalog(), - "db.Catalog"); - _wb->execute_plugin("db.mysql.plugin.import.sql", args); + if (project.connection.language == dataTypes::EditorJavaScript) + base::launchApplication(exeName, { "--new", "js" }); + else if (project.connection.language == dataTypes::EditorPython) + base::launchApplication(exeName, { "--new", "python" }); + else + throw std::runtime_error("Unhandled session type"); - // if the model is still empty, just close it - if (_wb->get_document()->physicalModels()[0]->catalog()->schemata().count() == 0) - _wb->close_document(); } else - _wb->show_status_text("Error creating document"); - break; + base::launchApplication(exeName, { "--open", project.connection.uuid }); + } catch (std::runtime_error &e) + { + std::string message = "Unable to execute: " + exeName + "\nError: " + e.what(); + logError("%s\n", message.c_str()); + mforms::Utilities::show_warning(_("Launch Error"), message, _("Close")); } + + break; + } + + case mforms::HomeScreenAction::ActionNewJSXProject: + break; + + case mforms::HomeScreenAction::ActionNewPythonXProject: + break; + + case mforms::HomeScreenAction::ActionManageXProjects: + break; + + case mforms::HomeScreenAction::ActionOpenXTutorial: + mforms::Utilities::open_url("http://dev.mysql.com/doc/refman/5.7/en/mysql-shell-tutorial-javascript.html"); + break; + + case mforms::HomeScreenAction::ActionOpenXLearnMore: + mforms::Utilities::open_url("http://dev.mysql.com/doc/refman/5.7/en/document-store.html"); + break; + + case mforms::HomeScreenAction::ActionOpenXTraditional: + { + _home_screen->showSection(1); + break; + } + + default: + logError("Unknown Action.\n"); } } @@ -1026,18 +1163,17 @@ void WBContextUI::refresh_home_connections(bool clear_state) std::map auto_save_files = WBContextSQLIDE::auto_save_sessions(); - _home_screen->clear_connections(clear_state); + _connectionsSection->clear_connections(clear_state); // If there are no connections defined yet then create entries for all currently installed // local servers (only if this is the first run, after application start). if (_initializing_home_screen && (connections->count() == 0)) { - grt::GRT* grt = _wb->get_grt(); - grt::Module* module = grt->get_module("Workbench"); + grt::Module* module = grt::GRT::get()->get_module("Workbench"); if (module == NULL) throw std::logic_error("Internal error: can't find Workbench module."); - grt::StringListRef arguments(grt); + grt::StringListRef arguments(grt::Initialized); module->call_function("createInstancesFromLocalServers", arguments); } @@ -1065,17 +1201,26 @@ void WBContextUI::refresh_home_connections(bool clear_state) oldAuthList.push_back(*inst); } - // Any fabric managed connection referencing a - if (dict.has_key("fabric_managed") && invalid_connection_ids.count(dict.get_string("fabric_managed"))) - invalid_connections.push_back(*inst); - else { std::string host_entry; if ((*inst)->driver().is_valid() && (*inst)->driver()->name() == "MysqlNativeSSH") host_entry = dict.get_string("sshUserName") + "@" + dict.get_string("sshHost"); else { - host_entry = strfmt("%s:%i", dict.get_string("hostName").c_str(), (int)dict.get_int("port", 3306)); + + if ((*inst)->driver()->name() == "MySQLX") + { + std::string editor = ""; + if (dict.get_int("editorLanguage") == 0) + editor = "sql"; + else if (dict.get_int("editorLanguage") == 1) + editor = "js"; + else if (dict.get_int("editorLanguage") == 2) + editor = "py"; + host_entry = strfmt("%s:///%s:%i",editor.c_str(), dict.get_string("hostName").c_str(), (int)dict.get_int("port", 3306)); + } + else + host_entry = strfmt("%s:%i", dict.get_string("hostName").c_str(), (int)dict.get_int("port", 3306)); if ((*inst)->driver().is_valid() && (*inst)->driver()->name() == "MysqlNativeSocket") { // TODO: what about the default for sockets (only have a default for the pipe name)? @@ -1088,19 +1233,22 @@ void WBContextUI::refresh_home_connections(bool clear_state) if (auto_save_files.find((*inst)->id()) != auto_save_files.end()) title += " (auto saved)"; - _home_screen->add_connection(*inst, title, host_entry, + _connectionsSection->addConnection((*inst).id(), title, host_entry, dict.get_string("userName"), dict.get_string("schema")); } } } - _home_screen->oldAuthConnections(oldAuthList); + _xConnectionsSection->clear_connections(true); + _xConnectionsSection->loadProjects(ng::loadNgSessions()); - // Deletes the fabric managed connections + _oldAuthList = oldAuthList; + + // Deletes invalid connections for (std::vector::const_iterator iterator = invalid_connections.begin(); iterator != invalid_connections.end(); ++iterator) { - log_warning("Invalid connection detected %s, deleting it\n", (*iterator)->name().c_str()); + logWarning("Invalid connection detected %s, deleting it\n", (*iterator)->name().c_str()); remove_connection(*iterator); } @@ -1115,7 +1263,7 @@ void WBContextUI::refresh_home_documents() if (!_home_screen) return; - _home_screen->clear_documents(); + _documentsSection->clear_documents(); std::map auto_save_models(WBContextModel::auto_save_files()); @@ -1135,7 +1283,7 @@ void WBContextUI::refresh_home_documents() } if (!found) - _home_screen->add_document(iter->second, 0, wb::ModelFile::read_comment(iter->first.c_str()), 0); + _documentsSection->add_document(iter->second, 0, wb::ModelFile::read_comment(iter->first.c_str()), 0); } // Create list entries for each recently opened file. @@ -1163,11 +1311,11 @@ void WBContextUI::refresh_home_documents() "\\MySQL\\Samples and Examples 5.5"); examples_paths.push_back(mforms::Utilities::get_special_folder(mforms::WinProgramFiles) + "\\MySQL\\Samples and Examples 5.5"); - examples_paths.push_back(_wb->get_grt_manager()->get_basedir()+"/extras"); + examples_paths.push_back(bec::GRTManager::get()->get_basedir()+"/extras"); #elif defined(__APPLE__) - examples_paths.push_back(_wb->get_grt_manager()->get_basedir()+"/../SharedSupport"); + examples_paths.push_back(bec::GRTManager::get()->get_basedir()+"/../SharedSupport"); #else - examples_paths.push_back(_wb->get_grt_manager()->get_basedir()+"/extras"); + examples_paths.push_back(bec::GRTManager::get()->get_basedir()+"/extras"); #endif for (std::list::const_iterator path_iterator = examples_paths.begin(); @@ -1175,7 +1323,7 @@ void WBContextUI::refresh_home_documents() { if (g_file_test(path_iterator->c_str(), G_FILE_TEST_IS_DIR)) { - std::string pattern = make_path(*path_iterator, "*.mwb"); + std::string pattern = base::makePath(*path_iterator, "*.mwb"); std::list sample_model_files = base::scan_for_files_matching(pattern, true); for (std::list::const_iterator iterator = sample_model_files.begin(); iterator != sample_model_files.end(); iterator++) @@ -1196,29 +1344,11 @@ void WBContextUI::refresh_home_documents() struct stat stbuf; #endif if (base_stat((*f).c_str(), &stbuf) < 0) - _home_screen->add_document(*f, 0, "", 0); + _documentsSection->add_document(*f, 0, "", 0); else - _home_screen->add_document(*f, stbuf.st_mtime, wb::ModelFile::read_comment(*f), stbuf.st_size); + _documentsSection->add_document(*f, stbuf.st_mtime, wb::ModelFile::read_comment(*f), stbuf.st_size); } } //-------------------------------------------------------------------------------------------------- - -void WBContextUI::refresh_home_starters() -{ - if (!_home_screen) - return; - - _home_screen->clear_shortcuts(); - - grt::ListRef starters= _wb->get_root()->starters()->displayList(); - for (grt::ListRef::const_iterator iterator= starters.begin(); iterator != starters.end(); - iterator++) - { - _home_screen->add_shortcut(*iterator, (*iterator)->smallIcon()); - } - _home_screen->set_needs_repaint(); -} - -//-------------------------------------------------------------------------------------------------- diff --git a/backend/wbprivate/workbench/wb_db_schema.cpp b/backend/wbprivate/workbench/wb_db_schema.cpp index 446d149e7..d3fd49099 100644 --- a/backend/wbprivate/workbench/wb_db_schema.cpp +++ b/backend/wbprivate/workbench/wb_db_schema.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -50,7 +50,7 @@ bool InternalSchema::check_schema_exist() } catch (const sql::SQLException& exc) { - log_warning("Error verifying existence of wb schema '%s': %s", _schema_name.c_str(), exc.what()); + logWarning("Error verifying existence of wb schema '%s': %s", _schema_name.c_str(), exc.what()); ret_val = false; } @@ -86,7 +86,7 @@ bool InternalSchema::check_function_or_sp_exists(const std::string object_name, } catch (const sql::SQLException& exc) { - log_warning("Error verifying existence of %s '%s'.'%s' : %s", what.c_str(), _schema_name.c_str(), object_name.c_str(), exc.what()); + logWarning("Error verifying existence of %s '%s'.'%s' : %s", what.c_str(), _schema_name.c_str(), object_name.c_str(), exc.what()); ret_val = false; } @@ -122,7 +122,7 @@ bool InternalSchema::check_table_or_view_exists(const std::string object_name, b } catch (const sql::SQLException& exc) { - log_warning("Error verifying existence of %s '%s'.'%s' : %s", what.c_str(), _schema_name.c_str(), object_name.c_str(), exc.what()); + logWarning("Error verifying existence of %s '%s'.'%s' : %s", what.c_str(), _schema_name.c_str(), object_name.c_str(), exc.what()); ret_val = false; } @@ -159,7 +159,7 @@ std::string InternalSchema::execute_sql(const std::string &statement) catch (const sql::SQLException& exc) { ret_val = base::strfmt("MySQL Error : %s (code %d)", exc.what(), exc.getErrorCode()); - log_warning("Error executing sql :\n '%s'\n Error %d : %s", statement.c_str(), exc.getErrorCode(), exc.what()); + logWarning("Error executing sql :\n '%s'\n Error %d : %s", statement.c_str(), exc.getErrorCode(), exc.what()); } return ret_val; diff --git a/backend/wbprivate/workbench/wb_model_file.cpp b/backend/wbprivate/workbench/wb_model_file.cpp index 440a2129c..4545fa112 100644 --- a/backend/wbprivate/workbench/wb_model_file.cpp +++ b/backend/wbprivate/workbench/wb_model_file.cpp @@ -323,7 +323,7 @@ void ModelFile::open(const std::string &path) path.c_str(), base::fmttime(autosave_ts, DATETIME_FMT).c_str(), base::fmttime(file_ts, DATETIME_FMT).c_str()), _("Recover"), _("Continue"), "") == mforms::ResultOk) { - log_info("Recovering %s...", path.c_str()); + logInfo("Recovering %s...", path.c_str()); recover= true; _content_dir = auto_save_dir; @@ -355,7 +355,7 @@ void ModelFile::open(const std::string &path) } else // Cancel recovery { - log_info("Cleaning up leftover auto-save directory %s", auto_save_dir.c_str()); + logInfo("Cleaning up leftover auto-save directory %s", auto_save_dir.c_str()); rmdir_recursively(auto_save_dir.c_str()); } } @@ -924,7 +924,7 @@ void ModelFile::cleanup() void ModelFile::add_db_file(const std::string &content_dir) { - std::string db_tpl_file_path= bec::GRTManager::get().get_data_file_path("data/" DB_FILE); + std::string db_tpl_file_path= bec::GRTManager::get()->get_data_file_path("data/" DB_FILE); std::string db_file_dir_path= content_dir + "/" + DB_DIR; add_attachment_file(db_file_dir_path, db_tpl_file_path); } diff --git a/backend/wbprivate/workbench/wb_model_file.h b/backend/wbprivate/workbench/wb_model_file.h index 3e9eb3993..37ca90d70 100644 --- a/backend/wbprivate/workbench/wb_model_file.h +++ b/backend/wbprivate/workbench/wb_model_file.h @@ -28,7 +28,7 @@ #include "base/trackable.h" #ifndef _WIN32 -#include +#include #endif #define MAIN_DOCUMENT_NAME "document.mwb.xml" diff --git a/backend/wbprivate/workbench/wb_model_file_upgrade.cpp b/backend/wbprivate/workbench/wb_model_file_upgrade.cpp index f83926fe8..d273d7628 100644 --- a/backend/wbprivate/workbench/wb_model_file_upgrade.cpp +++ b/backend/wbprivate/workbench/wb_model_file_upgrade.cpp @@ -590,7 +590,7 @@ workbench_DocumentRef ModelFile::attempt_document_upgrade(const workbench_Docume { fk->index(found_index); - log_info("Document Upgrade: ForeignKey %s.%s was assigned the index %s by column matching\n", + logInfo("Document Upgrade: ForeignKey %s.%s was assigned the index %s by column matching\n", table->name().c_str(), fk->name().c_str(), found_index->name().c_str()); } @@ -601,7 +601,7 @@ workbench_DocumentRef ModelFile::attempt_document_upgrade(const workbench_Docume fk->index(new_index); table->indices().insert(new_index); - log_warning("ForeignKey %s.%s has no matching index, created one\n", + logWarning("ForeignKey %s.%s has no matching index, created one\n", table->name().c_str(), fk->name().c_str()); } } @@ -638,7 +638,7 @@ workbench_DocumentRef ModelFile::attempt_document_upgrade(const workbench_Docume if (idx_name.length() > 59) idx_name.resize(59); indexes[ii]->name(grt::get_name_suggestion_for_list_object(indexes,idx_name.append("_idx"),false)); - log_info("Document Upgrade: Index %s.%s was renamed to %s.%s to avoid name conflict with FK\n", + logInfo("Document Upgrade: Index %s.%s was renamed to %s.%s to avoid name conflict with FK\n", tables[i]->name().c_str(), fks[fi]->name().c_str(), tables[i]->name().c_str(), indexes[ii]->name().c_str()); continue; @@ -646,7 +646,7 @@ workbench_DocumentRef ModelFile::attempt_document_upgrade(const workbench_Docume } } if (!ask_confirmation) - bec::GRTManager::get().has_unsaved_changes(true); + bec::GRTManager::get()->has_unsaved_changes(true); } if (major <= 1 && (minor < 4 || (minor == 4 && revision < 4))) @@ -918,7 +918,7 @@ static int fix_duplicate_uuid_bug(xmlNodePtr node, std::string remapped = strfmt("%s%i", id.c_str(), (int)remapped_ids.size()); if (remapped_ids.find(id) != remapped_ids.end() || remapped_ids[id].find(sname) != remapped_ids[id].end()) - log_warning("Found more than 1 duplicate entry for same UUID, will be unable to correctly fix file (%s %s)\n", + logWarning("Found more than 1 duplicate entry for same UUID, will be unable to correctly fix file (%s %s)\n", sname.c_str(), id.c_str()); if (remapped_ids[id].size() == 0) { @@ -965,11 +965,11 @@ static void fix_duplicate_uuid_bug_references(xmlNodePtr node, if (XMLTraverser::node_prop(node, "type") == "list" && XMLTraverser::node_prop(node, "content-type") == "object" && !(sname = XMLTraverser::node_prop(node, "content-struct-name")).empty()) { - log_info("link %s is in list of %s\n", id.c_str(), sname.c_str()); + logInfo("link %s is in list of %s\n", id.c_str(), sname.c_str()); } else { - log_info("link %s has no struct-name\n", id.c_str()); + logInfo("link %s has no struct-name\n", id.c_str()); continue; } } @@ -1011,7 +1011,7 @@ static void fix_duplicate_uuid_bug_references(xmlNodePtr node, if (mc->name() == sname) { count++; - log_info("found match %i %s for %s:%s (%s -> %s)\n", count, opt->first.c_str(), sname.c_str(), target_key.c_str(), + logInfo("found match %i %s for %s:%s (%s -> %s)\n", count, opt->first.c_str(), sname.c_str(), target_key.c_str(), id.c_str(), opt->second.c_str()); xmlNodeSetContent(n, (xmlChar*)opt->second.c_str()); ok = true; @@ -1022,7 +1022,7 @@ static void fix_duplicate_uuid_bug_references(xmlNodePtr node, } if (!ok) - log_warning("WARNING: Could not resolve link for %s %s (%i) key='%s'. Report to the developers to get a fix.\n", + logWarning("WARNING: Could not resolve link for %s %s (%i) key='%s'. Report to the developers to get a fix.\n", id.c_str(), sname.c_str(), (int)structs.size(), XMLTraverser::node_prop(n, "key").c_str()); } diff --git a/backend/wbprivate/workbench/wb_overview.cpp b/backend/wbprivate/workbench/wb_overview.cpp index 5b34fa6d6..e8a1cbb6e 100644 --- a/backend/wbprivate/workbench/wb_overview.cpp +++ b/backend/wbprivate/workbench/wb_overview.cpp @@ -50,7 +50,7 @@ int OverviewBE::Node::get_popup_menu_items(WBContext *wb, bec::MenuItemList &ite bool OverviewBE::ObjectNode::activate(WBContext *wb) { - bec::GRTManager::get().open_object_editor(object, bec::NoFlags); + bec::GRTManager::get()->open_object_editor(object, bec::NoFlags); return true; } diff --git a/backend/wbprivate/workbench/wb_tunnel.cpp b/backend/wbprivate/workbench/wb_tunnel.cpp index f01e3bdbe..ad795adb7 100644 --- a/backend/wbprivate/workbench/wb_tunnel.cpp +++ b/backend/wbprivate/workbench/wb_tunnel.cpp @@ -136,7 +136,7 @@ TunnelManager::TunnelManager(wb::WBContext *wb) void TunnelManager::start() { - std::string progpath = base::makePath(bec::GRTManager::get().get_basedir(), "sshtunnel.py"); + std::string progpath = base::makePath(bec::GRTManager::get()->get_basedir(), "sshtunnel.py"); WillEnterPython lock; grt::PythonContext *py = grt::PythonContext::get(); @@ -232,25 +232,25 @@ void TunnelManager::wait_tunnel(int port) { WillEnterPython lock; - log_debug("Waiting on tunnel to connect...\n"); + logDebug("Waiting on tunnel to connect...\n"); PyObject *ret = PyObject_CallMethod(_tunnel, (char*) "wait_connection", (char*) "i", port); if (!ret) { PyErr_Print(); - log_error("TunnelManager.wait_connection had an uncaught python exception\n"); + logError("TunnelManager.wait_connection had an uncaught python exception\n"); throw std::runtime_error("Error calling TunnelManager.wait_connection"); } if (ret == Py_None) { - log_info("TunnelManager.wait_connection returned OK\n"); + logInfo("TunnelManager.wait_connection returned OK\n"); Py_XDECREF(ret); return; } std::string str = PyString_AsString(ret); Py_XDECREF(ret); - log_debug("TunnelManager.wait_connection() returned %s\n", str.c_str()); + logDebug("TunnelManager.wait_connection() returned %s\n", str.c_str()); if ( g_str_has_prefix(str.c_str(), "Bad authentication type") || g_str_has_prefix(str.c_str(), "Private key file is encrypted") || @@ -260,30 +260,30 @@ void TunnelManager::wait_tunnel(int port) if (g_str_has_prefix(str.c_str(), "Server key has been stored")) { - log_info("TunnelManager.wait_connection server key stored, retrying: %s\n", str.c_str()); + logInfo("TunnelManager.wait_connection server key stored, retrying: %s\n", str.c_str()); throw tunnel_auth_retry("Retry due to fingerprint missing, user accept new fingerprint"); } if (g_str_has_prefix(str.c_str(), "Host key for server ")) { - log_info("TunnelManager.wait_connection host key does not match, abandoning connection: %s\n", str.c_str()); + logInfo("TunnelManager.wait_connection host key does not match, abandoning connection: %s\n", str.c_str()); throw tunnel_auth_key_error(str); } if (g_str_has_prefix(str.c_str(), "User cancelled")) { - log_info("TunnelManager.wait_connection cancelled by the user: %s\n", str.c_str()); + logInfo("TunnelManager.wait_connection cancelled by the user: %s\n", str.c_str()); throw tunnel_auth_cancelled("Tunnel connection cancelled by the user"); } if (g_str_has_prefix(str.c_str(), "IO Error")) { - log_error("TunnelManager.wait_connection got IOError: %s\n", str.c_str()); + logError("TunnelManager.wait_connection got IOError: %s\n", str.c_str()); throw tunnel_auth_key_error(str); } if (g_str_has_prefix(str.c_str(), "Authentication error")) { - log_info("TunnelManager.wait_connection authentication error: %s\n", str.c_str()); + logInfo("TunnelManager.wait_connection authentication error: %s\n", str.c_str()); throw tunnel_auth_error(str); } @@ -301,7 +301,7 @@ bool TunnelManager::get_message_for(int port, std::string &type, std::string &me if (!ret) { PyErr_Print(); - log_error("TunnelManager.get_message had an uncaught python exception\n"); + logError("TunnelManager.get_message had an uncaught python exception\n"); throw std::runtime_error("Error calling TunnelManager.get_message"); } if (ret == Py_None) @@ -313,7 +313,7 @@ bool TunnelManager::get_message_for(int port, std::string &type, std::string &me if (!PyTuple_Check(ret) || PyTuple_GET_SIZE(ret) != 2) { Py_XDECREF(ret); - log_error("TunnelManager.get_message returned unexpected value\n"); + logError("TunnelManager.get_message returned unexpected value\n"); return false; } @@ -352,7 +352,7 @@ std::shared_ptr TunnelManager::create_tunnel(db_mgmt_Conn { if (!_tunnel) { - log_info("Starting tunnel\n"); + logInfo("Starting tunnel\n"); start(); } @@ -366,22 +366,22 @@ std::shared_ptr TunnelManager::create_tunnel(db_mgmt_Conn target += ":" + base::to_string(target_port); // before anything, check if a tunnel already exists for this server/user/target tuple - bec::GRTManager::get().replace_status_text("Looking for existing SSH tunnel to "+server+"..."); + bec::GRTManager::get()->replace_status_text("Looking for existing SSH tunnel to "+server+"..."); int tunnel_port; tunnel_port = lookup_tunnel(server.c_str(), username.c_str(), target.c_str()); if (tunnel_port > 0) { - bec::GRTManager::get().replace_status_text("Existing SSH tunnel found, connecting..."); - log_info("Existing SSH tunnel found, connecting\n"); - tunnel = boost::shared_ptr(new ::SSHTunnel(this, tunnel_port)); + bec::GRTManager::get()->replace_status_text("Existing SSH tunnel found, connecting..."); + logInfo("Existing SSH tunnel found, connecting\n"); + tunnel = std::shared_ptr(new ::SSHTunnel(this, tunnel_port)); } else { bool reset_password = false; retry: - bec::GRTManager::get().replace_status_text("Existing SSH tunnel not found, opening new one..."); - log_info("Existing SSH tunnel not found, opening new one\n"); + bec::GRTManager::get()->replace_status_text("Existing SSH tunnel not found, opening new one..."); + logInfo("Existing SSH tunnel not found, opening new one\n"); std::string service; if (keyfile.empty() && password.empty()) { @@ -397,7 +397,7 @@ std::shared_ptr TunnelManager::create_tunnel(db_mgmt_Conn } catch(std::exception &exc) { - log_warning("Exception caught on credentials_for_service: %s", exc.what()); + logWarning("Exception caught on credentials_for_service: %s", exc.what()); mforms::Utilities::show_error("Clear Password", base::strfmt("Could not clear password: %s", exc.what()), "OK"); @@ -430,28 +430,28 @@ std::shared_ptr TunnelManager::create_tunnel(db_mgmt_Conn throw std::runtime_error("SSH key passphrase input cancelled by user"); } - bec::GRTManager::get().replace_status_text("Opening SSH tunnel to "+server+"..."); - log_info("Opening SSH tunnel to %s\n", server.c_str()); + bec::GRTManager::get()->replace_status_text("Opening SSH tunnel to "+server+"..."); + logInfo("Opening SSH tunnel to %s\n", server.c_str()); try { tunnel_port = open_tunnel(server.c_str(), username.c_str(), password.c_str(), keyfile.c_str(), target.c_str()); - bec::GRTManager::get().replace_status_text("SSH tunnel opened, connecting..."); + bec::GRTManager::get()->replace_status_text("SSH tunnel opened, connecting..."); tunnel = std::shared_ptr(new ::SSHTunnel(this, tunnel_port)); if (tunnel) { tunnel->connect(connectionProperties); - set_keepalive(tunnel_port, bec::GRTManager::get().get_app_option_int("sshkeepalive", 0)); - log_info("SSH tunnel connect executed OK\n"); + set_keepalive(tunnel_port, bec::GRTManager::get()->get_app_option_int("sshkeepalive", 0)); + logInfo("SSH tunnel connect executed OK\n"); } } catch (tunnel_auth_error &exc) { - log_error("Authentication error opening SSH tunnel: %s\n", exc.what()); - bec::GRTManager::get().replace_status_text("Authentication error opening SSH tunnel"); + logError("Authentication error opening SSH tunnel: %s\n", exc.what()); + bec::GRTManager::get()->replace_status_text("Authentication error opening SSH tunnel"); if (mforms::Utilities::show_error("Could not connect the SSH Tunnel", exc.what(), _("Retry"), _("Cancel")) == mforms::ResultOk) { reset_password= true; @@ -461,7 +461,7 @@ std::shared_ptr TunnelManager::create_tunnel(db_mgmt_Conn } catch (std::exception &exc) { - log_warning("Could not clear password: %s\n", exc.what()); + logWarning("Could not clear password: %s\n", exc.what()); } password = ""; @@ -472,29 +472,29 @@ std::shared_ptr TunnelManager::create_tunnel(db_mgmt_Conn } catch (tunnel_auth_retry &exc) { - log_warning("Opening SSH tunnel: %s\n", exc.what()); + logWarning("Opening SSH tunnel: %s\n", exc.what()); goto retry; } catch (tunnel_auth_cancelled &exc) { - log_debug("Tunnel auth cancelled: %s\n", exc.what()); + logDebug("Tunnel auth cancelled: %s\n", exc.what()); throw grt::user_cancelled(exc.what()); } catch (tunnel_auth_key_error &exc) { mforms::Utilities::show_error("Tunnel Connection Error", exc.what(), _("OK")); - log_debug("Tunnel auth key error: %s\n", exc.what()); + logDebug("Tunnel auth key error: %s\n", exc.what()); throw grt::user_cancelled(exc.what()); } catch (std::exception &exc) { - log_error("Exception while opening SSH tunnel: %s\n", exc.what()); - bec::GRTManager::get().replace_status_text("Could not open SSH tunnel"); + logError("Exception while opening SSH tunnel: %s\n", exc.what()); + bec::GRTManager::get()->replace_status_text("Could not open SSH tunnel"); throw std::runtime_error(std::string("Cannot open SSH Tunnel: ").append(exc.what())); } } - bec::GRTManager::get().replace_status_text("Using SSH tunnel to "+server); + bec::GRTManager::get()->replace_status_text("Using SSH tunnel to "+server); } return tunnel; diff --git a/backend/wbprivate/workbench/wb_version.h b/backend/wbprivate/workbench/wb_version.h index 603486b04..483353c4f 100644 --- a/backend/wbprivate/workbench/wb_version.h +++ b/backend/wbprivate/workbench/wb_version.h @@ -1,7 +1,8 @@ -#define APP_MAJOR_NUMBER 6 -#define APP_MINOR_NUMBER 3 -#define APP_RELEASE_NUMBER 8 +#define APP_MAJOR_NUMBER 7 +#define APP_MINOR_NUMBER 0 +#define APP_RELEASE_NUMBER 0 + #define APP_BUILD_NUMBER 0 #define APP_RELEASE_TYPE "" diff --git a/backend/wbprivate/workbench/wmi.cpp b/backend/wbprivate/workbench/wmi.cpp index b042d357f..517b47279 100644 --- a/backend/wbprivate/workbench/wmi.cpp +++ b/backend/wbprivate/workbench/wmi.cpp @@ -97,7 +97,7 @@ std::string wmiResultToString(HRESULT wmiResult) if (FAILED(hres)) { - log_error("Converting result code to string failed with error: %d\n", hres); + logError("Converting result code to string failed with error: %d\n", hres); result = "Internal error: WMI error description retrieval failed."; } @@ -107,7 +107,7 @@ std::string wmiResultToString(HRESULT wmiResult) } else { - log_error("Could not instatiate a status code text converter. Error code: %d\n", hres); + logError("Could not instatiate a status code text converter. Error code: %d\n", hres); result = "Internal error: WMI status code text creation failed."; } @@ -159,13 +159,13 @@ std::string serviceResultToString(unsigned int result) WmiMonitor::WmiMonitor(IWbemServices* services, const std::string& parameter) : _services(services), _propertyHandle(0), _namePropertyHandle(0), _findTotal(false) { - log_debug("Creating new wmi monitor for parameter: %s\n", parameter.c_str()); + logDebug("Creating new wmi monitor for parameter: %s\n", parameter.c_str()); const std::vector args = base::split(parameter, "."); if (args.size() < 2) { - log_error("Invalid parameter format - cannot continue\n"); + logError("Invalid parameter format - cannot continue\n"); throw std::runtime_error(_("Wrong monitor format. Got '") + parameter + _("', expected ''")); } @@ -175,7 +175,7 @@ WmiMonitor::WmiMonitor(IWbemServices* services, const std::string& parameter) (void**) &_refresher); if (FAILED(hr)) { - log_error("Could not create a wbem refresher instance. Error: %d\n", hr); + logError("Could not create a wbem refresher instance. Error: %d\n", hr); throw std::runtime_error(_("WMI - Could not create monitor object.\n\n") + wmiResultToString(hr)); } @@ -183,7 +183,7 @@ WmiMonitor::WmiMonitor(IWbemServices* services, const std::string& parameter) hr = _refresher->QueryInterface(IID_IWbemConfigureRefresher, (void**) &config); if (FAILED(hr)) { - log_error("QueryInterface for wbem configure refresher failed with error: %d\n", hr); + logError("QueryInterface for wbem configure refresher failed with error: %d\n", hr); // _refersher is a smart pointer and is automatically freed. throw std::runtime_error(_("WMI - Could not create monitor object.\n\n") + wmiResultToString(hr)); @@ -200,7 +200,7 @@ WmiMonitor::WmiMonitor(IWbemServices* services, const std::string& parameter) if (FAILED(hr)) { std::string result = wmiResultToString(hr); - log_error("Could not register monitoring enumerator. Error: %s\n", result.c_str()); + logError("Could not register monitoring enumerator. Error: %s\n", result.c_str()); throw std::runtime_error(_("WMI - Could not register monitoring enumerator.\n")); } } @@ -209,7 +209,7 @@ WmiMonitor::WmiMonitor(IWbemServices* services, const std::string& parameter) WmiMonitor::~WmiMonitor() { - log_debug("Destroying monitor\n"); + logDebug("Destroying monitor\n"); CComPtr config; HRESULT hr = _refresher->QueryInterface(IID_IWbemConfigureRefresher, (void**) &config); @@ -218,7 +218,7 @@ WmiMonitor::~WmiMonitor() else { std::string result = wmiResultToString(hr); - log_error("Could not remove enumerator from wbem config refresher. Error: %s\n", result.c_str()); + logError("Could not remove enumerator from wbem config refresher. Error: %s\n", result.c_str()); } } @@ -226,7 +226,7 @@ WmiMonitor::~WmiMonitor() std::string WmiMonitor::readValue() { - log_debug("Reading next monitoring value\n"); + logDebug("Reading next monitoring value\n"); // Refresh the enumerator so we actually get values. _refresher->Refresh(0L); @@ -246,7 +246,7 @@ std::string WmiMonitor::readValue() if (FAILED(hr)) { std::string result = wmiResultToString(hr); - log_error("Cannot get value object from enumerator. Error: %s\n", result.c_str()); + logError("Cannot get value object from enumerator. Error: %s\n", result.c_str()); delete [] accessors; return "0"; @@ -264,7 +264,7 @@ std::string WmiMonitor::readValue() if (FAILED(hr)) { std::string result = wmiResultToString(hr); - log_error("Cannot get property handle from wbem accessor. Error: %s\n", result.c_str()); + logError("Cannot get property handle from wbem accessor. Error: %s\n", result.c_str()); } CIMTYPE namePropType; @@ -274,7 +274,7 @@ std::string WmiMonitor::readValue() if (FAILED(hr)) { std::string result = wmiResultToString(hr); - log_error("Cannot get name property handle from wbem accessor. Error: %s\n", result.c_str()); + logError("Cannot get name property handle from wbem accessor. Error: %s\n", result.c_str()); } if (_propertyHandle != 0) @@ -296,7 +296,7 @@ std::string WmiMonitor::readValue() if (FAILED(hr)) { std::string result = wmiResultToString(hr); - log_error("Cannot read DWORD value from wbem accessor. Error: %s\n", result.c_str()); + logError("Cannot read DWORD value from wbem accessor. Error: %s\n", result.c_str()); } break; @@ -312,7 +312,7 @@ std::string WmiMonitor::readValue() if (FAILED(hr)) { std::string result = wmiResultToString(hr); - log_error("Cannot read DWORD value from wbem accessor. Error: %s\n", result.c_str()); + logError("Cannot read DWORD value from wbem accessor. Error: %s\n", result.c_str()); } } @@ -337,9 +337,9 @@ static int _locator_refcount = 0; WmiServices::WmiServices(const std::string& server, const std::string& user, const std::string& password) { if (server.empty()) - log_debug("Creating WmiServices for local server (user: %s)\n", user.c_str()); + logDebug("Creating WmiServices for local server (user: %s)\n", user.c_str()); else - log_debug("Creating WmiServices for remote server: %s (user: %s)\n", server.c_str(), user.c_str()); + logDebug("Creating WmiServices for remote server: %s (user: %s)\n", server.c_str(), user.c_str()); allocate_locator(); @@ -391,14 +391,14 @@ WmiServices::WmiServices(const std::string& server, const std::string& user, con if (FAILED(hr)) { std::string result = wmiResultToString(hr); - log_error("Could not set proxy blanket for our wmi services. Error: %s\n", result.c_str()); + logError("Could not set proxy blanket for our wmi services. Error: %s\n", result.c_str()); throw std::runtime_error(_("WMI setting security blanket failed.\n")); } } else { std::string result = wmiResultToString(hr); - log_error("Could not connect to target machine. Error: %s\n", result.c_str()); + logError("Could not connect to target machine. Error: %s\n", result.c_str()); throw std::runtime_error(_("Could not connect to target machine.\n")); } } @@ -407,7 +407,7 @@ WmiServices::WmiServices(const std::string& server, const std::string& user, con WmiServices::~WmiServices() { - log_debug("Destroying services\n"); + logDebug("Destroying services\n"); deallocate_locator(); } @@ -415,7 +415,7 @@ WmiServices::~WmiServices() void WmiServices::allocate_locator() { - log_debug("Allocating wbem locator\n"); + logDebug("Allocating wbem locator\n"); base::MutexLock lock(_locator_mutex); if (_locator_refcount == 0) @@ -426,7 +426,7 @@ void WmiServices::allocate_locator() if (FAILED(hr)) { std::string result = wmiResultToString(hr); - log_error("Could not create wbem locator. Error: %s\n", result.c_str()); + logError("Could not create wbem locator. Error: %s\n", result.c_str()); throw std::runtime_error("Internal error: Instantiation of IWbemLocator failed.\n"); } } @@ -438,7 +438,7 @@ void WmiServices::allocate_locator() void WmiServices::deallocate_locator() { - log_debug("Deallocating wbem locator\n"); + logDebug("Deallocating wbem locator\n"); base::MutexLock lock(_locator_mutex); if (_locator_refcount > 0) @@ -467,7 +467,7 @@ void WmiServices::deallocate_locator() */ grt::DictListRef WmiServices::query(const std::string& query) { - log_debug3("Running wmi query: %s\n", query.c_str()); + logDebug3("Running wmi query: %s\n", query.c_str()); // Making this function explicitly thread-safe might be unnecessary as we don't have // any data which is allocated/deallocated concurrently. But since we know we will be called @@ -530,7 +530,7 @@ grt::DictListRef WmiServices::query(const std::string& query) char *name_ = _com_util::ConvertBSTRToString(name); std::string result = wmiResultToString(hr); - log_error("Couldn't get the value for %s. Error: %s\n", name_, result.c_str()); + logError("Couldn't get the value for %s. Error: %s\n", name_, result.c_str()); delete [] name_; } } @@ -542,7 +542,7 @@ grt::DictListRef WmiServices::query(const std::string& query) else { std::string result = wmiResultToString(hr); - log_error("Query execution failed. Error: %s\n", result.c_str()); + logError("Query execution failed. Error: %s\n", result.c_str()); throw std::runtime_error("WMI query execution failed"); } @@ -566,7 +566,7 @@ grt::DictListRef WmiServices::query(const std::string& query) */ std::string WmiServices::serviceControl(const std::string& service, const std::string& action) { - log_debug3("Running wmi service control query for service: %s (action: %s)\n", service.c_str(), action.c_str()); + logDebug3("Running wmi service control query for service: %s (action: %s)\n", service.c_str(), action.c_str()); base::MutexLock lock(_locator_mutex); @@ -577,7 +577,7 @@ std::string WmiServices::serviceControl(const std::string& service, const std::s if (FAILED(hr)) { std::string result = wmiResultToString(hr); - log_error("Query execution failed. Error: %s\n", result.c_str()); + logError("Query execution failed. Error: %s\n", result.c_str()); return "error, see log"; } @@ -586,7 +586,7 @@ std::string WmiServices::serviceControl(const std::string& service, const std::s if (FAILED(hr)) { std::string result = wmiResultToString(hr); - log_error("Could not get state value for the service. Error: %s\n", result.c_str()); + logError("Could not get state value for the service. Error: %s\n", result.c_str()); return "unknown"; } @@ -648,7 +648,7 @@ std::string WmiServices::serviceControl(const std::string& service, const std::s { char *serviceClassPath_ = _com_util::ConvertBSTRToString(serviceClassPath); std::string result = wmiResultToString(hr); - log_error("Could not get object for service class path: %s. Error: %s\n", serviceClassPath_, result.c_str()); + logError("Could not get object for service class path: %s. Error: %s\n", serviceClassPath_, result.c_str()); delete [] serviceClassPath_; } @@ -658,7 +658,7 @@ std::string WmiServices::serviceControl(const std::string& service, const std::s { char *methodName_ = _com_util::ConvertBSTRToString(methodName); std::string result = wmiResultToString(hr); - log_error("Could not get in/out class for method: %s. Error: %s\n", methodName_, result.c_str()); + logError("Could not get in/out class for method: %s. Error: %s\n", methodName_, result.c_str()); delete [] methodName_; } @@ -667,7 +667,7 @@ std::string WmiServices::serviceControl(const std::string& service, const std::s else { std::string result = wmiResultToString(hr); - log_error("Could not spawn in-class instance. Error: %s\n", result.c_str()); + logError("Could not spawn in-class instance. Error: %s\n", result.c_str()); } if (FAILED(hr)) @@ -675,7 +675,7 @@ std::string WmiServices::serviceControl(const std::string& service, const std::s char *serviceClassPath_ = _com_util::ConvertBSTRToString(serviceClassPath); char *methodName_ = _com_util::ConvertBSTRToString(methodName); std::string result = wmiResultToString(hr); - log_error("Could not execute method %d at path %s. Error: %s\n", methodName_, + logError("Could not execute method %d at path %s. Error: %s\n", methodName_, serviceClassPath_, result.c_str()); delete [] methodName_; delete [] serviceClassPath_; @@ -691,7 +691,7 @@ std::string WmiServices::serviceControl(const std::string& service, const std::s if (FAILED(hr)) { std::string result = wmiResultToString(hr); - log_error("Could not get the return value of the query. Error: %s\n", result.c_str()); + logError("Could not get the return value of the query. Error: %s\n", result.c_str()); return "error, see log"; } @@ -703,7 +703,7 @@ std::string WmiServices::serviceControl(const std::string& service, const std::s if (result != 0) { std::string text = serviceResultToString(result); - log_error("Variant conversion for return value failed. Error: %s\n", text.c_str()); + logError("Variant conversion for return value failed. Error: %s\n", text.c_str()); return "error, see log"; } @@ -723,7 +723,7 @@ std::string WmiServices::serviceControl(const std::string& service, const std::s if (FAILED(hr)) { std::string result = wmiResultToString(hr); - log_error("Could not get state value for the service. Error: %s\n", result.c_str()); + logError("Could not get state value for the service. Error: %s\n", result.c_str()); return "unknown"; } @@ -745,7 +745,7 @@ std::string WmiServices::serviceControl(const std::string& service, const std::s if (state != expectedState) { - log_error("Timeout waiting for the service to change status. Returning error to caller.\n"); + logError("Timeout waiting for the service to change status. Returning error to caller.\n"); return "error"; } @@ -766,7 +766,7 @@ std::string WmiServices::serviceControl(const std::string& service, const std::s */ std::string WmiServices::systemStat(const std::string& what) { - log_debug3("Running wmi system stat call (what: %s)\n", what.c_str()); + logDebug3("Running wmi system stat call (what: %s)\n", what.c_str()); base::MutexLock lock(_locator_mutex); @@ -801,14 +801,14 @@ std::string WmiServices::systemStat(const std::string& what) char *propertyName_ = _com_util::ConvertBSTRToString(propertyName); std::string result = wmiResultToString(hr); - log_error("Could not get the value for property %s. Error: %s\n", propertyName_, result.c_str()); + logError("Could not get the value for property %s. Error: %s\n", propertyName_, result.c_str()); delete [] propertyName_; } } else { std::string result = wmiResultToString(hr); - log_error("Could not run the system stat query. Error: %s\n", result.c_str()); + logError("Could not run the system stat query. Error: %s\n", result.c_str()); } diff --git a/backend/wbpublic/CMakeLists.txt b/backend/wbpublic/CMakeLists.txt index 25ba6b82d..6cf66324b 100644 --- a/backend/wbpublic/CMakeLists.txt +++ b/backend/wbpublic/CMakeLists.txt @@ -86,7 +86,6 @@ add_library(wbpublic grtsqlparser/mysql_parser_services.cpp sqlide/sqlide_generics.cpp sqlide/sql_editor_be.cpp - sqlide/sql_editor_be_autocomplete.cpp sqlide/var_grid_model_be.cpp sqlide/recordset_be.cpp sqlide/recordset_data_storage.cpp @@ -96,11 +95,8 @@ add_library(wbpublic sqlide/recordset_table_inserts_storage.cpp sqlide/recordset_text_storage.cpp sqlide/table_inserts_loader_be.cpp - sqlide/mysql_object_names_cache.cpp sqlide/sql_script_run_wizard.cpp sqlide/column_width_cache.cpp - sqlide/grammar-parser/ANTLRv3Lexer.c - sqlide/grammar-parser/ANTLRv3Parser.c wbcanvas/figure_common.cpp wbcanvas/badge_figure.cpp wbcanvas/connection_figure.cpp @@ -148,6 +144,9 @@ add_library(wbpublic objimpl/db.query/db_query_QueryBuffer.cpp objimpl/db.query/db_query_Editor.cpp objimpl/db.query/db_query_EditableResultset.cpp + objimpl/db.ng/db_ng_Sheet.cpp + objimpl/db.ng/db_ng_Ide.cpp + objimpl/db.ng/db_ng_Editor.cpp objimpl/db.migration/db_migration_Migration.cpp objimpl/ui/ui_db_ConnectPanel.cpp objimpl/ui/ui_ObjectEditor.cpp @@ -184,13 +183,13 @@ add_library(wbpublic # ) #endif() +target_link_libraries(wbpublic wbbase mdcanvas mforms cdbc grt ${VSQLITE_LIBRARIES} wbscintilla parsers ${CAIRO_LIBRARIES} ${GNOME_KEYRING_LIBRARIES} ${CTemplate_LIBRARIES} ${OPENGL_LIBRARIES} ${PCRE_LIBRARIES} ${GDAL_LIBRARIES}) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set_source_files_properties(sqlide/grammar-parser/ANTLRv3Lexer.c PROPERTIES COMPILE_FLAGS "-Wno-tautological-compare") endif() -target_link_libraries(wbpublic wbbase mdcanvas mforms cdbc grt ${VSQLITE_LIBRARIES} wbscintilla mysqlparser ${CAIRO_LIBRARIES} ${GNOME_KEYRING_LIBRARIES} ${CTemplate_LIBRARIES} ${OPENGL_LIBRARIES} ${PCRE_LIBRARIES} ${GDAL_LIBRARIES}) set_target_properties(wbpublic PROPERTIES VERSION ${WB_VERSION} diff --git a/backend/wbpublic/grt/common.cpp b/backend/wbpublic/grt/common.cpp index 9c14df809..fbfcc5837 100644 --- a/backend/wbpublic/grt/common.cpp +++ b/backend/wbpublic/grt/common.cpp @@ -188,7 +188,7 @@ namespace bec { if (std::find(names_list.begin(), names_list.end(), group_name) == names_list.end()) { item_name = group_name; - target_group = grt::ListRef(items.get_grt()); + target_group = grt::ListRef(true); groups[item_name] = target_group; } else diff --git a/backend/wbpublic/grt/common.h b/backend/wbpublic/grt/common.h index fe69d6729..24deac6cb 100644 --- a/backend/wbpublic/grt/common.h +++ b/backend/wbpublic/grt/common.h @@ -35,14 +35,6 @@ #include "wbpublic_public_interface.h" -#ifdef __GNUC__ -#define WB_UNUSED __attribute__((unused)) -#else -#define WB_UNUSED -#endif - - - namespace bec { enum MatchType diff --git a/backend/wbpublic/grt/editor_base.cpp b/backend/wbpublic/grt/editor_base.cpp index 821a562a2..eb0163148 100644 --- a/backend/wbpublic/grt/editor_base.cpp +++ b/backend/wbpublic/grt/editor_base.cpp @@ -162,10 +162,10 @@ void BaseEditor::on_object_changed() // calling ui_refresh from here will cause refresh to be called from the GRT thread // which must not happen. delaying it to be executing when idle will make it // get called on main thread - if (bec::GRTManager::get().in_main_thread()) + if (bec::GRTManager::get()->in_main_thread()) do_ui_refresh(); else - _ui_refresh_conn = bec::GRTManager::get().run_once_when_idle(boost::bind(&RefreshUI::do_ui_refresh, this)); + _ui_refresh_conn = bec::GRTManager::get()->run_once_when_idle(boost::bind(&RefreshUI::do_ui_refresh, this)); } else _ignored_object_changes_for_ui_refresh++; @@ -175,14 +175,14 @@ void BaseEditor::on_object_changed() void BaseEditor::undo_applied() { - _ui_refresh_conn = bec::GRTManager::get().run_once_when_idle(boost::bind(&RefreshUI::do_ui_refresh, this)); + _ui_refresh_conn = bec::GRTManager::get()->run_once_when_idle(boost::bind(&RefreshUI::do_ui_refresh, this)); } //-------------------------------------------------------------------------------------------------- void BaseEditor::run_from_grt(const boost::function &slot) { - bec::GRTManager::get().get_dispatcher()->execute_sync_function("editor action", + bec::GRTManager::get()->get_dispatcher()->execute_sync_function("editor action", boost::bind(boost::bind(&base::run_and_return_value, slot))); } diff --git a/backend/wbpublic/grt/grt_dispatcher.h b/backend/wbpublic/grt/grt_dispatcher.h index bba19243b..8ff6564d1 100644 --- a/backend/wbpublic/grt/grt_dispatcher.h +++ b/backend/wbpublic/grt/grt_dispatcher.h @@ -21,7 +21,7 @@ #include "base/threading.h" -#include "grtpp.h" +#include "grt.h" #include "grtpp_util.h" #include "grtpp_shell.h" @@ -127,7 +127,7 @@ namespace bec { inline bool is_finished() { return _finished; } - virtual grt::ValueRef execute(grt::GRT *grt)= 0; + virtual grt::ValueRef execute()= 0; void cancel(); inline bool is_cancelled() { return _cancelled; } @@ -201,26 +201,26 @@ namespace bec { typedef std::shared_ptr Ref; static Ref create_task(const std::string &name, const std::shared_ptr dispatcher, - const boost::function &function); + const boost::function &function); //XXX replace with direct slots? - StartedSignal *signal_started() { return &_started; } - FinishedSignal *signal_finished() { return &_finished; } - FailedSignal *signal_failed() { return &_failed; } + StartedSignal *signal_started() { return &_sigStarted; } + FinishedSignal *signal_finished() { return &_sigFinished; } + FailedSignal *signal_failed() { return &_sigFailed; } ProcessMessageSignal *signal_message() { return &_message; } protected: - boost::function _function; + boost::function _function; - StartedSignal _started; - FinishedSignal _finished; - FailedSignal _failed; + StartedSignal _sigStarted; + FinishedSignal _sigFinished; + FailedSignal _sigFailed; ProcessMessageSignal _message; - virtual grt::ValueRef execute(grt::GRT *grt); + virtual grt::ValueRef execute(); GRTTask(const std::string &name, const std::shared_ptr dispatcher, - const boost::function &function); + const boost::function &function); virtual void started_m(); virtual void finished_m(const grt::ValueRef &result); virtual void failed_m(const std::exception &error); @@ -252,7 +252,7 @@ namespace bec { GRTShellTask(const std::string &name, const std::shared_ptr dispatcher, const std::string &command); - virtual grt::ValueRef execute(grt::GRT *grt); + virtual grt::ValueRef execute(); virtual void finished_m(const grt::ValueRef &result); virtual bool process_message(const grt::Message &msg); @@ -287,16 +287,16 @@ namespace bec { volatile bool _shutdown_callback; bool _is_main_dispatcher; bool _shut_down; + bool _started; GAsyncQueue *_callback_queue; GThread *_thread; static gpointer worker_thread(gpointer data); - grt::GRT *_grt; GRTTaskBase::Ref _current_task; - GRTDispatcher(grt::GRT *grt, bool threaded, bool is_main_dispatcher); + GRTDispatcher(bool threaded, bool is_main_dispatcher); void prepare_task(const GRTTaskBase::Ref task); void execute_task(const GRTTaskBase::Ref task); @@ -310,22 +310,20 @@ namespace bec { bool message_callback(const grt::Message &msg, void *sender); public: - static Ref create_dispatcher(grt::GRT *grt, bool threaded, bool is_main_dispatcher); + static Ref create_dispatcher(bool threaded, bool is_main_dispatcher); virtual ~GRTDispatcher(); - grt::GRT *grt() { return _grt; }; - void execute_now(const GRTTaskBase::Ref task); void add_task(const GRTTaskBase::Ref task); grt::ValueRef add_task_and_wait(const GRTTaskBase::Ref task) THROW (grt::grt_runtime_error); grt::ValueRef execute_sync_function(const std::string &name, - const boost::function &function) THROW (grt::grt_runtime_error); + const boost::function &function) THROW (grt::grt_runtime_error); void execute_async_function(const std::string &name, - const boost::function &function) THROW (grt::grt_runtime_error); + const boost::function &function) THROW (grt::grt_runtime_error); void wait_task(const GRTTaskBase::Ref task); diff --git a/backend/wbpublic/grt/grt_manager.cpp b/backend/wbpublic/grt/grt_manager.cpp index bd6576303..870d5aa52 100644 --- a/backend/wbpublic/grt/grt_manager.cpp +++ b/backend/wbpublic/grt/grt_manager.cpp @@ -57,15 +57,14 @@ static void init_all() GRTManager::GRTManager(bool threaded) : _has_unsaved_changes(false), _threaded(threaded), _verbose(false) { - grt::GRT::get(); // This is empty call just to be sure that GRT will be constructed before GRTManager and will not be destroyed before it as of c++11. - // it will define the destruction sequence correctly. + _grt = grt::GRT::get(); // Ensure the grt singleton is created when we need it and stays as long as we are alive. _globals_tree_soft_lock_count= 0; _current_idle_signal = 0; init_all(); - grt::GRT::get()->set_verbose(_verbose); + _grt->set_verbose(_verbose); _terminated= false; _idle_blocked= false; @@ -73,19 +72,19 @@ GRTManager::GRTManager(bool threaded) _dispatcher = GRTDispatcher::create_dispatcher(_threaded, true); _shell = new ShellBE(_dispatcher); - _plugin_manager = grt::GRT::get()->get_native_module(); + _plugin_manager = _grt->get_native_module(); _messages_list = new MessageListStorage(this); } -GRTManager& GRTManager::get() +GRTManager::Ref GRTManager::get() { - static GRTManager instance(new GRTManager(true)); + static GRTManager::Ref instance(new GRTManager(true)); return instance; } void GRTManager::setVerbose(bool verbose) { _verbose = verbose; - grt::GRT::get()->set_verbose(_verbose); + _grt->set_verbose(_verbose); } bool GRTManager::try_soft_lock_globals_tree() @@ -387,6 +386,10 @@ void GRTManager::perform_idle_tasks() copy = _disp_map; } + // We need to call main general dispatcher as it's not on the dispatcher list. + if (_dispatcher) + _dispatcher->flush_pending_callbacks(); + for (DispatcherMap::iterator i= copy.begin(), i_end= copy.end(); i != i_end; ++i) i->first->flush_pending_callbacks(); } @@ -655,7 +658,7 @@ bool GRTManager::load_structs() _shell->writef(_("Looking for struct files in '%s'.\n"), paths[i]); try { - c= grt::GRT::get()->scan_metaclasses_in(paths[i]); + c= _grt->scan_metaclasses_in(paths[i]); count+= c; } catch (std::exception &exc) { @@ -665,7 +668,7 @@ bool GRTManager::load_structs() } } - grt::GRT::get()->end_loading_metaclasses(); + _grt->end_loading_metaclasses(); _shell->writef(_("Registered %i GRT classes.\n"), count); @@ -708,7 +711,7 @@ bool GRTManager::load_libraries() path= g_strdup_printf("%s%c%s", paths[i], G_DIR_SEPARATOR, fname); if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) { - ModuleLoader *loader= grt::GRT::get()->get_module_loader_for_file(fname); + ModuleLoader *loader= _grt->get_module_loader_for_file(fname); if (loader) { @@ -774,22 +777,22 @@ int GRTManager::do_scan_modules(const std::string &path, const std::listsend_output(strfmt(_("Looking for modules in '%s'.\n"), path.c_str())); + _grt->send_output(strfmt(_("Looking for modules in '%s'.\n"), path.c_str())); try { - c= grt::GRT::get()->scan_modules_in(path, _basedir, extensions.empty() ? _module_extensions : extensions, refresh); + c= _grt->scan_modules_in(path, _basedir, extensions.empty() ? _module_extensions : extensions, refresh); } catch (std::exception &exc) { - grt::GRT::get()->send_output(strfmt(_("Error scanning for modules: %s\n"), + _grt->send_output(strfmt(_("Error scanning for modules: %s\n"), exc.what())); return 0; } if (_verbose) - grt::GRT::get()->send_output(strfmt(_("%i modules found\n"), c)); + _grt->send_output(strfmt(_("%i modules found\n"), c)); return c; } @@ -807,10 +810,10 @@ void GRTManager::scan_modules_grt(const std::list &extensions, bool count+= c; } - grt::GRT::get()->end_loading_modules(); + _grt->end_loading_modules(); _shell->writef(_("Registered %i modules (from %i files).\n"), - grt::GRT::get()->get_modules().size(), count); + _grt->get_modules().size(), count); g_strfreev(paths); } @@ -982,12 +985,12 @@ bool GRTManager::check_plugin_runnable(const app_PluginRef &plugin, const bec::A { if (debug_args) { - grt::GRT::get()->send_output(base::strfmt("Debug: Plugin %s cannot execute because argument %s is not available\n", + _grt->send_output(base::strfmt("Debug: Plugin %s cannot execute because argument %s is not available\n", plugin->name().c_str(), searched_key.c_str())); - grt::GRT::get()->send_output("Debug: Available arguments:\n"); + _grt->send_output("Debug: Available arguments:\n"); - argpool.dump_keys(boost::bind([](const std::string &str) { - grt::GRT::get()->send_output(str); + argpool.dump_keys(boost::bind([this](const std::string &str) { + _grt->send_output(str); }, _1)); } return false; @@ -1013,7 +1016,7 @@ void GRTManager::open_object_editor(const GrtObjectRef &object, bec::GUIPluginFl _plugin_manager->open_gui_plugin(plugin, args, flags); else { - log_error("No suitable editor found for object of type '%s'.", + logError("No suitable editor found for object of type '%s'.", object.get_metaclass()->get_attribute("caption").c_str()); mforms::Utilities::show_error(_("Edit Object"), @@ -1024,7 +1027,7 @@ void GRTManager::open_object_editor(const GrtObjectRef &object, bec::GUIPluginFl } catch (grt::grt_runtime_error &exc) { - log_error("Exception in Open object editor: %s\n%s", exc.what(), exc.detail.c_str()); + logError("Exception in Open object editor: %s\n%s", exc.what(), exc.detail.c_str()); mforms::Utilities::show_error(_("Edit Object"), strfmt("%s\n%s", exc.what(), exc.detail.c_str()), @@ -1032,7 +1035,7 @@ void GRTManager::open_object_editor(const GrtObjectRef &object, bec::GUIPluginFl } catch (std::exception &exc) { - log_exception("Open object editor", exc); + logException("Open object editor", exc); mforms::Utilities::show_error(_("Edit Object"), strfmt("%s", exc.what()), "OK"); diff --git a/backend/wbpublic/grt/grt_manager.h b/backend/wbpublic/grt/grt_manager.h index 3c431e3ac..50eb05e0c 100644 --- a/backend/wbpublic/grt/grt_manager.h +++ b/backend/wbpublic/grt/grt_manager.h @@ -42,6 +42,8 @@ namespace bec { class WBPUBLICBACKEND_PUBLIC_FUNC GRTManager : public base::trackable { public: + typedef std::shared_ptr Ref; + struct Timer { boost::function slot; @@ -62,7 +64,7 @@ namespace bec { GRTManager& operator=(GRTManager&) = delete; public: - static GRTManager& get(); + static GRTManager::Ref get(); virtual ~GRTManager(); void setVerbose(bool verbose); @@ -259,6 +261,7 @@ namespace bec { private: bool _terminated; // true if application termination was requested by the BE or a plugin. + std::shared_ptr _grt; // Reference to static grt singleton to avoid static fiasco. grt::ValueRef setup_grt(); void shell_write(const std::string &text); diff --git a/backend/wbpublic/grt/grt_shell.cpp b/backend/wbpublic/grt/grt_shell.cpp index 44ff6180c..f11a1c3ac 100644 --- a/backend/wbpublic/grt/grt_shell.cpp +++ b/backend/wbpublic/grt/grt_shell.cpp @@ -119,7 +119,7 @@ void ShellBE::shell_finished_cb(ShellCommand result, const std::string &prompt, { if (result == ShellCommandExit) { - bec::GRTManager::get().terminate(); + bec::GRTManager::get()->terminate(); _current_statement.clear(); } else if (result == ShellCommandUnknown) @@ -322,7 +322,7 @@ void ShellBE::writef(const char *fmt, ...) // Cache the text if there is no output slot set yet (usually at app start). // Flush this queue when we have an output slot and are running in the main thread currently. - if (bec::GRTManager::get().is_threaded()) + if (bec::GRTManager::get()->is_threaded()) { { base::MutexLock lock(_text_queue_mutex); @@ -330,7 +330,7 @@ void ShellBE::writef(const char *fmt, ...) } // if we're in the main thread, flush the message queue - if (bec::GRTManager::get().in_main_thread() && _output_slot) + if (bec::GRTManager::get()->in_main_thread() && _output_slot) flush_shell_output(); } else diff --git a/backend/wbpublic/grt/grt_threaded_task.cpp b/backend/wbpublic/grt/grt_threaded_task.cpp index 531d3db12..66f64e6bc 100644 --- a/backend/wbpublic/grt/grt_threaded_task.cpp +++ b/backend/wbpublic/grt/grt_threaded_task.cpp @@ -92,8 +92,8 @@ const bec::GRTDispatcher::Ref & GrtThreadedTask::dispatcher() if (!_dispatcher) { - _dispatcher = bec::GRTDispatcher::create_dispatcher(bec::GRTManager::get().is_threaded(), false); - _dispatcher->set_main_thread_flush_and_wait(bec::GRTManager::get().get_dispatcher()->get_main_thread_flush_and_wait()); + _dispatcher = bec::GRTDispatcher::create_dispatcher(bec::GRTManager::get()->is_threaded(), false); + _dispatcher->set_main_thread_flush_and_wait(bec::GRTManager::get()->get_dispatcher()->get_main_thread_flush_and_wait()); _dispatcher->start(); } return _dispatcher; @@ -189,7 +189,7 @@ void GrtThreadedTask::process_finish(grt::ValueRef res) void GrtThreadedTask::send_msg(int msg_type, const std::string &msg, const std::string &detail) { - if (bec::GRTManager::get().in_main_thread()) + if (bec::GRTManager::get()->in_main_thread()) { if(_msg_cb) _msg_cb(msg_type, msg, detail); @@ -217,10 +217,10 @@ void GrtThreadedTask::send_msg(int msg_type, const std::string &msg, const std:: void GrtThreadedTask::send_progress(float percentage, const std::string &msg, const std::string &detail) { - if (bec::GRTManager::get().terminated()) + if (bec::GRTManager::get()->terminated()) return; - if (bec::GRTManager::get().in_main_thread()) + if (bec::GRTManager::get()->in_main_thread()) { if (_progress_cb) _progress_cb(percentage, msg); diff --git a/backend/wbpublic/grt/plugin_manager.cpp b/backend/wbpublic/grt/plugin_manager.cpp index bc8d22cd0..d02622a98 100644 --- a/backend/wbpublic/grt/plugin_manager.cpp +++ b/backend/wbpublic/grt/plugin_manager.cpp @@ -58,9 +58,8 @@ static std::string get_args_hash(const grt::BaseListRef &list) PluginManagerImpl::PluginManagerImpl(grt::CPPModuleLoader *loader) : superclass(loader) { - _grtm= GRTManager::get_instance_for(loader->get_grt()); - InterfaceImplBase::Register(loader->get_grt()); + InterfaceImplBase::Register(); } @@ -168,7 +167,7 @@ grt::StringListRef PluginManagerImpl::get_disabled_plugin_names() base::pop_path_back(disabled_path); base::pop_path_back(disabled_path); disabled_path.append("/options/disabledPlugins"); - return grt::StringListRef::cast_from(_grtm->get_grt()->get(disabled_path)); + return grt::StringListRef::cast_from(grt::GRT::get()->get(disabled_path)); } /** @@ -184,7 +183,6 @@ grt::StringListRef PluginManagerImpl::get_disabled_plugin_names() void PluginManagerImpl::rescan_plugins() { grt::ListRef plugin_list= get_plugin_list(); - grt::GRT *grt= _grtm->get_grt(); std::set disabled_plugins; // make a set of disabled plugin names @@ -220,7 +218,7 @@ void PluginManagerImpl::rescan_plugins() } // get list of modules that implement the plugin interface - std::vector plugin_modules= grt->find_modules_matching("PluginInterface", ""); + std::vector plugin_modules= grt::GRT::get()->find_modules_matching("PluginInterface", ""); _plugin_source_module.clear(); @@ -235,13 +233,13 @@ void PluginManagerImpl::rescan_plugins() plist= grt::ListRef::cast_from(result); if (!plist.is_valid() || plist.count() == 0) { - grt->send_warning("Module "+(*pm)->name()+" implements PluginInterface but does not export any plugins", ""); + grt::GRT::get()->send_warning("Module "+(*pm)->name()+" implements PluginInterface but does not export any plugins", ""); continue; } } catch (std::exception &exc) { - grt->send_error("Module "+(*pm)->name()+" had an error while executing getPluginInfo: "+exc.what(), + grt::GRT::get()->send_error("Module "+(*pm)->name()+" had an error while executing getPluginInfo: "+exc.what(), "Location: "+(*pm)->path()); continue; } @@ -253,7 +251,7 @@ void PluginManagerImpl::rescan_plugins() if (_plugin_source_module.find(plugin->name()) != _plugin_source_module.end()) { - grt->send_warning("Duplicate plugin name "+*plugin->name(), + grt::GRT::get()->send_warning("Duplicate plugin name "+*plugin->name(), base::strfmt("There is more than one plugin with the name %s (in %s and %s).", plugin->name().c_str(), (*pm)->name().c_str(), _plugin_source_module[plugin->name()].c_str())); // must reset internal references in the object or we get a leak because of the cycles @@ -274,8 +272,8 @@ void PluginManagerImpl::rescan_plugins() if (disabled_plugins.find(*plugin->name()) != disabled_plugins.end()) { - if (grt->verbose()) - grt->send_info("Plugin "+*plugin->name()+" is disabled, skipping...", ""); + if (grt::GRT::get()->verbose()) + grt::GRT::get()->send_info("Plugin "+*plugin->name()+" is disabled, skipping...", ""); plugin->reset_references(); continue; } @@ -376,7 +374,7 @@ void PluginManagerImpl::register_plugins(grt::ListRef plugins) */ grt::ListRef PluginManagerImpl::get_plugin_groups() { - return grt::ListRef::cast_from(_grtm->get_grt()->get(_group_registry_path)); + return grt::ListRef::cast_from(grt::GRT::get()->get(_group_registry_path)); } @@ -396,10 +394,10 @@ grt::ListRef PluginManagerImpl::get_plugin_groups() grt::ListRef PluginManagerImpl::get_plugin_list(const std::string &group) { if (group.empty()) - return grt::ListRef::cast_from(_grtm->get_grt()->get(_registry_path)); + return grt::ListRef::cast_from(grt::GRT::get()->get(_registry_path)); else { - grt::ListRef rlist(_grtm->get_grt()), list; + grt::ListRef rlist(true), list; std::string left, right; // groups are expected to be either in group/subgroup format or group (which will be interpreted as group/*) @@ -415,7 +413,7 @@ grt::ListRef PluginManagerImpl::get_plugin_list(const std::string &g right= "*"; } - list= grt::ListRef::cast_from(_grtm->get_grt()->get(_registry_path)); + list= grt::ListRef::cast_from(grt::GRT::get()->get(_registry_path)); for (size_t c= list.count(), i= 0; i < c; i++) { @@ -753,10 +751,10 @@ std::string PluginManagerImpl::open_gui_plugin(const app_PluginRef &plugin, cons if (!plugin.is_valid()) throw std::invalid_argument("Attempt to open an invalid plugin"); - GRTDispatcher::Ref dispatcher = _grtm->get_dispatcher(); + GRTDispatcher::Ref dispatcher = bec::GRTManager::get()->get_dispatcher(); if (*plugin->pluginType() == GUI_PLUGIN_TYPE) { - if (_grtm->in_main_thread()) + if (bec::GRTManager::get()->in_main_thread()) return open_gui_plugin_main(plugin, args, flags); else { @@ -767,7 +765,7 @@ std::string PluginManagerImpl::open_gui_plugin(const app_PluginRef &plugin, cons dispatcher->call_from_main_thread(cb, false, false); - grt::Module *module= _grtm->get_grt()->get_module(_plugin_source_module[plugin->name()]); + grt::Module *module= grt::GRT::get()->get_module(_plugin_source_module[plugin->name()]); // Build the handle name ourselves. return make_open_plugin_id(module, plugin->moduleFunctionName(), args); @@ -775,7 +773,7 @@ std::string PluginManagerImpl::open_gui_plugin(const app_PluginRef &plugin, cons } else if (*plugin->pluginType() == STANDALONE_GUI_PLUGIN_TYPE) { - if (_grtm->in_main_thread()) + if (bec::GRTManager::get()->in_main_thread()) open_standalone_plugin_main(plugin, args); else { @@ -788,13 +786,13 @@ std::string PluginManagerImpl::open_gui_plugin(const app_PluginRef &plugin, cons } else if (*plugin->pluginType() == INTERNAL_PLUGIN_TYPE) { - if (_grtm->in_main_thread()) - open_normal_plugin_grt(_grtm->get_grt(), plugin, args); + if (bec::GRTManager::get()->in_main_thread()) + open_normal_plugin_grt(plugin, args); else { // Request the plugin to be executed and opened by the frontend in the main thread. DispatcherCallback::Ref cb = DispatcherCallback::create_callback( - boost::bind(&PluginManagerImpl::open_normal_plugin_grt, this, _grtm->get_grt(), plugin, args) + boost::bind(&PluginManagerImpl::open_normal_plugin_grt, this, plugin, args) ); dispatcher->call_from_main_thread(cb, false, false); @@ -805,13 +803,13 @@ std::string PluginManagerImpl::open_gui_plugin(const app_PluginRef &plugin, cons // Opening a normal plugin is usually done in the context of the grt thread and we want to // continue that way. But if we are currently in the main thread switch here to the grt thread // for opening the plugin. - if (_grtm->in_main_thread()) + if (bec::GRTManager::get()->in_main_thread()) { - _grtm->get_dispatcher()->execute_sync_function("Open normal plugin", - boost::bind(&PluginManagerImpl::open_normal_plugin_grt, this, _1, plugin, args)); + bec::GRTManager::get()->get_dispatcher()->execute_sync_function("Open normal plugin", + boost::bind(&PluginManagerImpl::open_normal_plugin_grt, this, plugin, args)); } else - open_normal_plugin_grt(_grtm->get_grt(), plugin, args); + open_normal_plugin_grt(plugin, args); } return ""; } @@ -844,7 +842,7 @@ std::string PluginManagerImpl::open_plugin(const app_PluginRef &plugin, const gr grt::ValueRef PluginManagerImpl::execute_plugin_function(const app_PluginRef &plugin, const grt::BaseListRef &args) { - grt::Module *module= _grtm->get_grt()->get_module(plugin->moduleName()); + grt::Module *module= grt::GRT::get()->get_module(plugin->moduleName()); if (!module) throw grt::grt_runtime_error("Cannot execute plugin "+*plugin->name(), "Called module "+*plugin->moduleName()+" not found"); @@ -852,10 +850,10 @@ grt::ValueRef PluginManagerImpl::execute_plugin_function(const app_PluginRef &pl return module->call_function(*plugin->moduleFunctionName(), args); } -grt::ValueRef PluginManagerImpl::open_normal_plugin_grt(grt::GRT *grt, const app_PluginRef &plugin, +grt::ValueRef PluginManagerImpl::open_normal_plugin_grt(const app_PluginRef &plugin, const grt::BaseListRef &args) { - grt::Module *module= _grtm->get_grt()->get_module(plugin->moduleName()); + grt::Module *module= grt::GRT::get()->get_module(plugin->moduleName()); if (!module) throw grt::grt_runtime_error("Cannot execute plugin "+*plugin->name(), "Called module "+*plugin->moduleName()+" not found"); @@ -866,7 +864,7 @@ grt::ValueRef PluginManagerImpl::open_normal_plugin_grt(grt::GRT *grt, const app void PluginManagerImpl::open_standalone_plugin_main(const app_PluginRef &plugin, const grt::BaseListRef &args) { - grt::Module *module= _grtm->get_grt()->get_module(plugin->moduleName()); + grt::Module *module= grt::GRT::get()->get_module(plugin->moduleName()); if (!module) throw grt::grt_runtime_error("Cannot execute plugin "+*plugin->name(), "Called module "+*plugin->moduleName()+" not found"); @@ -881,7 +879,7 @@ std::string PluginManagerImpl::open_gui_plugin_main(const app_PluginRef &plugin, GUIPluginFlags flags) { NativeHandle handle; - grt::Module *module= _grtm->get_grt()->get_module(_plugin_source_module[plugin->name()]); + grt::Module *module= grt::GRT::get()->get_module(_plugin_source_module[plugin->name()]); std::string open_plugin_id= make_open_plugin_id(module, plugin->moduleFunctionName(), args); if (_open_gui_plugins.find(open_plugin_id) != _open_gui_plugins.end()) @@ -891,11 +889,10 @@ std::string PluginManagerImpl::open_gui_plugin_main(const app_PluginRef &plugin, } else { - grt::Module *module= _grtm->get_grt()->get_module(_plugin_source_module[plugin->name()]); + grt::Module *module= grt::GRT::get()->get_module(_plugin_source_module[plugin->name()]); // open the editor and get a handle for the GUI object to pass to the frontend - NativeHandle handle= _open_gui_plugin_slot(_grtm, - module, + NativeHandle handle= _open_gui_plugin_slot(module, *plugin->moduleName(), *plugin->moduleFunctionName(), args, @@ -923,11 +920,11 @@ std::string PluginManagerImpl::open_gui_plugin_main(const app_PluginRef &plugin, */ int PluginManagerImpl::show_plugin(const std::string &handle) { - if (_grtm->in_main_thread()) + if (bec::GRTManager::get()->in_main_thread()) return show_gui_plugin_main(handle); else { - GRTDispatcher::Ref dispatcher = _grtm->get_dispatcher(); + GRTDispatcher::Ref dispatcher = bec::GRTManager::get()->get_dispatcher(); // Request the plugin to be executed and opened by the frontend in the main thread. DispatcherCallback::Ref cb = DispatcherCallback::create_callback( @@ -966,11 +963,11 @@ int PluginManagerImpl::show_gui_plugin_main(const std::string &handle) */ int PluginManagerImpl::close_plugin(const std::string &handle) { - if (_grtm->in_main_thread()) + if (bec::GRTManager::get()->in_main_thread()) return close_gui_plugin_main(handle); else { - GRTDispatcher::Ref dispatcher = _grtm->get_dispatcher(); + GRTDispatcher::Ref dispatcher = bec::GRTManager::get()->get_dispatcher(); // Request the plugin to be executed and opened by the frontend in the main thread. DispatcherCallback::Ref cb = DispatcherCallback::create_callback( @@ -1159,13 +1156,12 @@ void ArgumentPool::add_entries_for_object(const std::string &name, { if (object.is_valid()) { - grt::GRT *grt= object.get_grt(); std::string prefix= "app.PluginObjectInput:"+name+":"; std::string class_name= object.class_name(); bool done= false; for (;;) { - grt::MetaClass *mc= grt->get_metaclass(class_name); + grt::MetaClass *mc= grt::GRT::get()->get_metaclass(class_name); (*this)[prefix+mc->name()]= object; class_name = mc->parent() ? mc->parent()->name() : ""; @@ -1218,8 +1214,7 @@ void ArgumentPool::add_file_input(const app_PluginFileInputRef &pdef, grt::BaseListRef ArgumentPool::build_argument_list(const app_PluginRef &plugin) { // build the argument list - grt::BaseListRef fargs(plugin->get_grt()); - + grt::BaseListRef fargs(true); const size_t c= plugin->inputValues().count(); for (size_t i= 0; i < c; i++) { diff --git a/backend/wbpublic/grt/spatial_handler.cpp b/backend/wbpublic/grt/spatial_handler.cpp index 7307a2813..c76ec0da2 100644 --- a/backend/wbpublic/grt/spatial_handler.cpp +++ b/backend/wbpublic/grt/spatial_handler.cpp @@ -28,12 +28,12 @@ DEFAULT_LOG_DOMAIN("spatial"); #ifdef _WIN32 static void __stdcall ogr_error_handler(CPLErr eErrClass, int err_no, const char *msg) { - log_error("gdal error: %d, %s\n", err_no, msg); + logError("gdal error: %d, %s\n", err_no, msg); } #else static void ogr_error_handler(CPLErr eErrClass, int err_no, const char *msg) { - log_error("gdal error: %d, %s\n", err_no, msg); + logError("gdal error: %d, %s\n", err_no, msg); } #endif @@ -93,7 +93,7 @@ std::string spatial::fetchAuthorityCode(const std::string &wkt) { if (wkt.empty()) { - log_error("Unable to fetch AuthorityCode, WKT was empty."); + logError("Unable to fetch AuthorityCode, WKT was empty."); return ""; } OGRSpatialReference srs; @@ -101,14 +101,14 @@ std::string spatial::fetchAuthorityCode(const std::string &wkt) OGRErr err = srs.importFromWkt(&_wkt); if (err != OGRERR_NONE) { - log_error("ImportWKT Error: %s", stringFromErrorCode(err).c_str()); + logError("ImportWKT Error: %s", stringFromErrorCode(err).c_str()); return ""; } err = srs.AutoIdentifyEPSG(); if (err != OGRERR_NONE) { - log_error("AutoIdentifyEPSG Error: %s", stringFromErrorCode(err).c_str()); + logError("AutoIdentifyEPSG Error: %s", stringFromErrorCode(err).c_str()); return ""; } return srs.GetAuthorityCode("GEOGCS"); @@ -558,7 +558,7 @@ std::string spatial::Importer::as_wkt() OGRErr err; if ((err = _geometry->exportToWkt(&data)) != OGRERR_NONE) { - log_error("Error exporting data to WKT (%i)\n", err); + logError("Error exporting data to WKT (%i)\n", err); } else { @@ -577,7 +577,7 @@ std::string spatial::Importer::as_kml() { if (!(data = _geometry->exportToKML())) { - log_error("Error exporting data to KML\n"); + logError("Error exporting data to KML\n"); } else { @@ -596,7 +596,7 @@ std::string spatial::Importer::as_json() { if (!(data = _geometry->exportToJson())) { - log_error("Error exporting data to JSON\n"); + logError("Error exporting data to JSON\n"); } else { @@ -615,7 +615,7 @@ std::string spatial::Importer::as_gml() { if (!(data = _geometry->exportToGML())) { - log_error("Error exporting data to GML\n"); + logError("Error exporting data to GML\n"); } else { @@ -712,7 +712,7 @@ void spatial::Converter::change_projection(ProjectionView view, OGRSpatialRefere { char * proj4; _target_srs->exportToProj4(&proj4); - log_error("Unable to perform requested reprojection from WGS84, to %s\n", proj4); + logError("Unable to perform requested reprojection from WGS84, to %s\n", proj4); CPLFree(proj4); } @@ -720,7 +720,7 @@ void spatial::Converter::change_projection(ProjectionView view, OGRSpatialRefere { char * proj4; _target_srs->exportToProj4(&proj4); - log_error("Unable to perform requested reprojection from WGS84, to %s\n", proj4); + logError("Unable to perform requested reprojection from WGS84, to %s\n", proj4); CPLFree(proj4); } @@ -732,7 +732,7 @@ void spatial::Converter::change_projection(ProjectionView view, OGRSpatialRefere _adf_projection[4] = 0; _adf_projection[5] = -(maxLon - minLon) / (double)_view.height; if (!GDALInvGeoTransform(_adf_projection, _inv_projection)) - log_error("Unable to invert equation\n"); + logError("Unable to invert equation\n"); } void spatial::Converter::to_projected(int x, int y, double &lat, double &lon) @@ -802,7 +802,7 @@ void spatial::Converter::transform_points(std::deque &shapes_con } if (!for_removal.empty()) - log_debug("%i points that could not be converted were skipped\n", (int)for_removal.size()); + logDebug("%i points that could not be converted were skipped\n", (int)for_removal.size()); std::deque::reverse_iterator rit; for (rit = for_removal.rbegin(); rit != for_removal.rend() && !_interrupt; rit++) @@ -823,7 +823,7 @@ void spatial::Converter::transform_envelope(spatial::Envelope &env) if (!env.is_init()) { - log_error("Can't transform empty envelope.\n"); + logError("Can't transform empty envelope.\n"); return; } @@ -841,7 +841,7 @@ void spatial::Converter::transform_envelope(spatial::Envelope &env) } else { - log_error("Unable to transform envelope: %f, %f, %f, %f.\n", env.top_left.x, env.top_left.y, env.bottom_right.x, env.bottom_right.y); + logError("Unable to transform envelope: %f, %f, %f, %f.\n", env.top_left.x, env.top_left.y, env.bottom_right.x, env.bottom_right.y); } @@ -931,7 +931,7 @@ void Feature::repaint(mdc::CairoCtx &cr, float scale, const base::Rect &clip_are { if ((*it).points.empty()) { - log_error("%s is empty", shape_description(it->type).c_str()); + logError("%s is empty", shape_description(it->type).c_str()); continue; } @@ -971,7 +971,7 @@ void Feature::repaint(mdc::CairoCtx &cr, float scale, const base::Rect &clip_are break; default: - log_debug("Unknown type %i\n", it->type); + logDebug("Unknown type %i\n", it->type); break; } } diff --git a/backend/wbpublic/grt/validation_manager.cpp b/backend/wbpublic/grt/validation_manager.cpp index c3c32fb75..8aaacda02 100644 --- a/backend/wbpublic/grt/validation_manager.cpp +++ b/backend/wbpublic/grt/validation_manager.cpp @@ -160,7 +160,7 @@ void bec::ValidationMessagesBE::validation_message(const grt::Validator::Tag& ta } default: { - log_warning("Unhandled type in validation_message"); + logWarning("Unhandled type in validation_message"); } } @@ -191,7 +191,7 @@ void bec::ValidationManager::register_validator(const std::string& type, grt::Va void bec::ValidationManager::scan() { - const std::vector plugins = bec::GRTManager::get().get_plugin_manager()->get_plugins_for_group(""); + const std::vector plugins = bec::GRTManager::get()->get_plugin_manager()->get_plugins_for_group(""); for (size_t i = 0; i < plugins.size(); ++i) { @@ -203,7 +203,7 @@ void bec::ValidationManager::scan() { // Handle plugin directly //1. Fetch slot - log_debug2("ValidationManager: %s", plugins[i]->caption().c_str()); + logDebug2("ValidationManager: %s", plugins[i]->caption().c_str()); } else { diff --git a/backend/wbpublic/grtdb/db_object_filter.cpp b/backend/wbpublic/grtdb/db_object_filter.cpp index af2170ba1..41be31c04 100644 --- a/backend/wbpublic/grtdb/db_object_filter.cpp +++ b/backend/wbpublic/grtdb/db_object_filter.cpp @@ -49,7 +49,7 @@ void DBObjectFilterBE::set_object_type_name(const std::string &type_name) // load stored filter sets grt::DictRef opt= grt::DictRef::cast_from(grt::GRT::get()->get("/wb/options/options")); _stored_filter_sets_filepath - .append(bec::GRTManager::get().get_user_datadir()) + .append(bec::GRTManager::get()->get_user_datadir()) .append("/stored_filter_sets.") .append(_full_type_name) .append(".xml"); diff --git a/backend/wbpublic/grtdb/db_object_helpers.cpp b/backend/wbpublic/grtdb/db_object_helpers.cpp index 83b648481..74ee1c789 100644 --- a/backend/wbpublic/grtdb/db_object_helpers.cpp +++ b/backend/wbpublic/grtdb/db_object_helpers.cpp @@ -381,13 +381,13 @@ void TableHelper::reorder_foreign_key_for_index(const db_ForeignKeyRef &fk, cons if (fk->columns().count() != fk->referencedColumns().count()) { - log_error("Internal consistency error: number of items in fk->columns and fk->referencedColumns() for %s.%s.%s do not match\n", + logError("Internal consistency error: number of items in fk->columns and fk->referencedColumns() for %s.%s.%s do not match\n", fk->owner()->owner()->name().c_str(), fk->owner()->name().c_str(), fk->name().c_str()); return; } if (column_count > index->columns().count()) { - log_error("Internal consistency error: number of items in index for FK is less than columns in FK %s.%s.%s\n", + logError("Internal consistency error: number of items in index for FK is less than columns in FK %s.%s.%s\n", fk->owner()->owner()->name().c_str(), fk->owner()->name().c_str(), fk->name().c_str()); return; } @@ -1254,69 +1254,69 @@ static bool parse_type(const std::string &type, // like charsets etc.). That doesn't affect the main task here, however. Additionally stuff // is simply ignored for now (but it must be a valid definition). MySQLRecognizer recognizer(bec::version_to_int(targetVersion), "", std::set()); - recognizer.parse(type.c_str(), type.size(), true, PuDataType); + recognizer.parse(type.c_str(), type.size(), true, MySQLParseUnit::PuDataType); if (!recognizer.error_info().empty()) return false; MySQLRecognizerTreeWalker walker = recognizer.tree_walker(); // A type name can consist of up to 3 parts (e.g. "national char varying"). - std::string type_name = walker.token_text(); + std::string type_name = walker.tokenText(); - switch (walker.token_type()) + switch (walker.tokenType()) { case DOUBLE_SYMBOL: walker.next(); - if (walker.token_type() == PRECISION_SYMBOL) + if (walker.tokenType() == PRECISION_SYMBOL) walker.next(); // Simply ignore syntactic sugar. break; case NATIONAL_SYMBOL: walker.next(); - type_name += " " + walker.token_text(); + type_name += " " + walker.tokenText(); walker.next(); - if (walker.token_type() == VARYING_SYMBOL) + if (walker.tokenType() == VARYING_SYMBOL) { - type_name += " " + walker.token_text(); + type_name += " " + walker.tokenText(); walker.next(); } break; case NCHAR_SYMBOL: walker.next(); - if (walker.token_type() == VARCHAR_SYMBOL || walker.token_type() == VARYING_SYMBOL) + if (walker.tokenType() == VARCHAR_SYMBOL || walker.tokenType() == VARYING_SYMBOL) { - type_name += " " + walker.token_text(); + type_name += " " + walker.tokenText(); walker.next(); } break; case CHAR_SYMBOL: walker.next(); - if (walker.token_type() == VARYING_SYMBOL) + if (walker.tokenType() == VARYING_SYMBOL) { - type_name += " " + walker.token_text(); + type_name += " " + walker.tokenText(); walker.next(); } break; case LONG_SYMBOL: walker.next(); - switch (walker.token_type()) + switch (walker.tokenType()) { case CHAR_SYMBOL: // LONG CHAR VARYING - if (walker.look_ahead(true) == VARYING_SYMBOL) // Otherwise we may get e.g. LONG CHAR SET... + if (walker.lookAhead(true) == VARYING_SYMBOL) // Otherwise we may get e.g. LONG CHAR SET... { - type_name += " " + walker.token_text(); + type_name += " " + walker.tokenText(); walker.next(); - type_name += " " + walker.token_text(); + type_name += " " + walker.tokenText(); walker.next(); } break; case VARBINARY_SYMBOL: case VARCHAR_SYMBOL: - type_name += " " + walker.token_text(); + type_name += " " + walker.tokenText(); walker.next(); } break; @@ -1341,9 +1341,9 @@ static bool parse_type(const std::string &type, if (simpleType->characterMaximumLength() != bec::EMPTY_TYPE_MAXIMUM_LENGTH || simpleType->characterOctetLength() != bec::EMPTY_TYPE_OCTET_LENGTH) { - if (walker.token_type() != INT_NUMBER) + if (walker.tokenType() != INT_NUMBER) return false; - length = base::atoi(walker.token_text().c_str()); + length = base::atoi(walker.tokenText().c_str()); return true; } @@ -1354,9 +1354,9 @@ static bool parse_type(const std::string &type, { if (!explicitParams.empty()) explicitParams += ", "; - explicitParams += walker.token_text(true); + explicitParams += walker.tokenText(true); walker.next(); - walker.skip_if(COMMA_SYMBOL); // We normalize the whitespace around the commas. + walker.skipIf(COMMA_SYMBOL); // We normalize the whitespace around the commas. } while (!walker.is(CLOSE_PAR_SYMBOL)); explicitParams = "(" + explicitParams + ")"; @@ -1364,12 +1364,12 @@ static bool parse_type(const std::string &type, } // Finally all cases with either precision, scale or both. - precision = base::atoi(walker.token_text().c_str()); + precision = base::atoi(walker.tokenText().c_str()); walker.next(); - if (walker.token_type() != COMMA_SYMBOL) + if (walker.tokenType() != COMMA_SYMBOL) return true; walker.next(); - scale = base::atoi(walker.token_text().c_str()); + scale = base::atoi(walker.tokenText().c_str()); return true; } @@ -1468,7 +1468,7 @@ std::string bec::get_default_collation_for_charset(const db_SchemaRef &schema, c } } else - log_warning("While checking diff, catalog ref was found to be invalid\n"); + logWarning("While checking diff, catalog ref was found to be invalid\n"); return ""; @@ -1479,7 +1479,7 @@ std::string bec::get_default_collation_for_charset(const db_TableRef &table, con if (table->owner().is_valid()) return bec::get_default_collation_for_charset(db_SchemaRef::cast_from(table->owner()), character_set); else - log_warning("While checking diff, table ref was found to be invalid\n"); + logWarning("While checking diff, table ref was found to be invalid\n"); return ""; } diff --git a/backend/wbpublic/grtdb/db_object_master_filter.cpp b/backend/wbpublic/grtdb/db_object_master_filter.cpp index 353296a7d..7de5909b7 100644 --- a/backend/wbpublic/grtdb/db_object_master_filter.cpp +++ b/backend/wbpublic/grtdb/db_object_master_filter.cpp @@ -28,7 +28,7 @@ DBObjectMasterFilterBE::DBObjectMasterFilterBE() // load stored filter sets grt::DictRef opt= grt::DictRef::cast_from(grt::GRT::get()->get("/wb/options/options")); _stored_master_filter_sets_filepath - .append(bec::GRTManager::get().get_user_datadir()) + .append(bec::GRTManager::get()->get_user_datadir()) .append("/stored_master_filter_sets.xml"); if (g_file_test(_stored_master_filter_sets_filepath.c_str(), G_FILE_TEST_EXISTS)) _stored_master_filter_sets= grt::DictRef::cast_from( diff --git a/backend/wbpublic/grtdb/editor_dbobject.h b/backend/wbpublic/grtdb/editor_dbobject.h index f65bb7bba..471eaef19 100644 --- a/backend/wbpublic/grtdb/editor_dbobject.h +++ b/backend/wbpublic/grtdb/editor_dbobject.h @@ -85,8 +85,8 @@ namespace bec { boost::function on_expand_live_table_stub; protected: - parser::ParserContext::Ref _parser_context; - parser::ParserContext::Ref _autocompletion_context; // Temporary. + parser::MySQLParserContext::Ref _parser_context; + parser::MySQLParserContext::Ref _autocompletion_context; // Temporary. parser::MySQLParserServices::Ref _parser_services; DBObjectEditorBE(const db_DatabaseObjectRef &object); diff --git a/backend/wbpublic/grtdb/editor_routinegroup.cpp b/backend/wbpublic/grtdb/editor_routinegroup.cpp index d4cdee1f7..305d2ae09 100644 --- a/backend/wbpublic/grtdb/editor_routinegroup.cpp +++ b/backend/wbpublic/grtdb/editor_routinegroup.cpp @@ -180,7 +180,7 @@ std::string RoutineGroupEditorBE::get_title() void RoutineGroupEditorBE::open_editor_for_routine_at_index(size_t index) { if (index < get_routine_group()->routines().count()) - bec::GRTManager::get().open_object_editor(get_routine_group()->routines()[index]); + bec::GRTManager::get()->open_object_editor(get_routine_group()->routines()[index]); } //-------------------------------------------------------------------------------------------------- diff --git a/backend/wbpublic/grtdb/editor_table.cpp b/backend/wbpublic/grtdb/editor_table.cpp index 58ab654f7..6a9afe1a2 100644 --- a/backend/wbpublic/grtdb/editor_table.cpp +++ b/backend/wbpublic/grtdb/editor_table.cpp @@ -466,7 +466,7 @@ bool TableColumnsListBE::set_column_type_from_string(db_ColumnRef &col, const st } } else - log_warning("%s is not a valid column type", type.c_str()); + logWarning("%s is not a valid column type", type.c_str()); return flag; } @@ -581,10 +581,10 @@ bool TableColumnsListBE::set_field(const NodeId &node, ColumnId column, const st { _owner->get_table()->addPrimaryKeyColumn(col); - set_column_type_from_string(col, grt::StringRef::cast_from(bec::GRTManager::get().get_app_option("DefaultPkColumnType"))); + set_column_type_from_string(col, grt::StringRef::cast_from(bec::GRTManager::get()->get_app_option("DefaultPkColumnType"))); } else - set_column_type_from_string(col, grt::StringRef::cast_from(bec::GRTManager::get().get_app_option("DefaultColumnType"))); + set_column_type_from_string(col, grt::StringRef::cast_from(bec::GRTManager::get()->get_app_option("DefaultColumnType"))); } else { @@ -919,12 +919,12 @@ bool TableColumnsListBE::get_field_grt(const NodeId &node, ColumnId column, grt: { if (node[0] == 0) { - value= grt::StringRef(base::replaceVariable(bec::GRTManager::get().get_app_option_string("PkColumnNameTemplate"), + value= grt::StringRef(base::replaceVariable(bec::GRTManager::get()->get_app_option_string("PkColumnNameTemplate"), "%table%", _owner->get_name().c_str())); } else { - std::string templ= base::replaceVariable(bec::GRTManager::get().get_app_option_string("ColumnNameTemplate"), + std::string templ= base::replaceVariable(bec::GRTManager::get()->get_app_option_string("ColumnNameTemplate"), "%table%", _owner->get_name().c_str()); value= grt::StringRef(grt::get_name_suggestion_for_list_object(_owner->get_table()->columns(), templ, false)); @@ -933,9 +933,9 @@ bool TableColumnsListBE::get_field_grt(const NodeId &node, ColumnId column, grt: else if (column == Type && _editing_placeholder_row == node[0]) { if (node[0] == 0) - value= grt::StringRef::cast_from(bec::GRTManager::get().get_app_option("DefaultPkColumnType")); + value= grt::StringRef::cast_from(bec::GRTManager::get()->get_app_option("DefaultPkColumnType")); else - value= grt::StringRef::cast_from(bec::GRTManager::get().get_app_option("DefaultColumnType")); + value= grt::StringRef::cast_from(bec::GRTManager::get()->get_app_option("DefaultColumnType")); } else @@ -1154,7 +1154,7 @@ MenuItemList TableColumnsListBE::get_popup_items_for_nodes(const std::vectorget_clipboard(); if (clip->is_data()) { std::list data = clip->get_data(); @@ -1218,7 +1218,7 @@ bool TableColumnsListBE::activate_popup_item_for_nodes(const std::string &name, } else if (name == "copyColumnToolStripMenuItem") { - bec::Clipboard *clip = bec::GRTManager::get().get_clipboard(); + bec::Clipboard *clip = bec::GRTManager::get()->get_clipboard(); clip->clear(); for (std::vector::const_iterator iter= nodes.begin(); iter != nodes.end(); ++iter) @@ -1233,7 +1233,7 @@ bool TableColumnsListBE::activate_popup_item_for_nodes(const std::string &name, } else if (name == "cutColumnToolStripMenuItem") { - bec::Clipboard *clip = bec::GRTManager::get().get_clipboard(); + bec::Clipboard *clip = bec::GRTManager::get()->get_clipboard(); clip->clear(); for (std::vector::const_iterator iter= nodes.begin(); iter != nodes.end(); ++iter) @@ -1251,7 +1251,7 @@ bool TableColumnsListBE::activate_popup_item_for_nodes(const std::string &name, } else if (name == "pasteColumnToolStripMenuItem") { - bec::Clipboard *clip = bec::GRTManager::get().get_clipboard(); + bec::Clipboard *clip = bec::GRTManager::get()->get_clipboard(); if (clip->is_data()) { AutoUndoEdit undo(_owner); @@ -2725,7 +2725,7 @@ bool FKConstraintListBE::set_field(const NodeId &node, ColumnId column, const st { std::string schema_name = schema.is_valid() ? *schema->name() : parts[0]; - log_info("Creating stub schema and table %s.%s for foreign key\n", schema_name.c_str(), table.c_str()); + logInfo("Creating stub schema and table %s.%s for foreign key\n", schema_name.c_str(), table.c_str()); dbtable = _owner->create_stub_table(schema_name, table); if (!dbtable.is_valid()) return false; @@ -2786,7 +2786,7 @@ bool FKConstraintListBE::get_field_grt(const NodeId &node, ColumnId column, grt: value= fk->name(); else if (_editing_placeholder_row == node[0]) { - std::string temp = base::replaceString(bec::GRTManager::get().get_app_option_string("FKNameTemplate"), + std::string temp = base::replaceString(bec::GRTManager::get()->get_app_option_string("FKNameTemplate"), "%stable%", _owner->get_name().c_str()); value = grt::StringRef(get_name_suggestion_for_list_object(_owner->get_table()->foreignKeys(), base::replaceString(temp, "%dtable%", ""), true)); @@ -3054,9 +3054,9 @@ NodeId TableEditorBE::add_fk(const std::string &name) fk= TableHelper::create_empty_foreign_key(get_table(), name); - fk->updateRule(StringRef::cast_from(bec::GRTManager::get().get_app_option + fk->updateRule(StringRef::cast_from(bec::GRTManager::get()->get_app_option ("db.ForeignKey:updateRule"))); - fk->deleteRule(StringRef::cast_from(bec::GRTManager::get().get_app_option("db.ForeignKey:deleteRule"))); + fk->deleteRule(StringRef::cast_from(bec::GRTManager::get()->get_app_option("db.ForeignKey:deleteRule"))); update_change_date(); @@ -3460,9 +3460,9 @@ void TableEditorBE::show_export_wizard(mforms::Form *owner) { if (_inserts_model && _inserts_model->count() > 0) { - grt::ValueRef option(bec::GRTManager::get().get_app_option("TableEditor:LastExportDirectory")); + grt::ValueRef option(bec::GRTManager::get()->get_app_option("TableEditor:LastExportDirectory")); std::string path = option.is_valid() ? grt::StringRef::cast_from(option) : ""; - option = bec::GRTManager::get().get_app_option("TableEditor:LastExportExtension"); + option = bec::GRTManager::get()->get_app_option("TableEditor:LastExportExtension"); std::string extension = option.is_valid() ? grt::StringRef::cast_from(option) : ""; InsertsExportForm exporter(owner, _inserts_model, extension); exporter.set_title(strfmt(_("Export Inserts for %s"), get_name().c_str())); @@ -3473,16 +3473,16 @@ void TableEditorBE::show_export_wizard(mforms::Form *owner) } path = exporter.run(); if (path.empty()) - bec::GRTManager::get().replace_status_text(_("Export inserts canceled")); + bec::GRTManager::get()->replace_status_text(_("Export inserts canceled")); else { - bec::GRTManager::get().replace_status_text(strfmt(_("Exported inserts to %s"), path.c_str())); - bec::GRTManager::get().set_app_option("TableEditor:LastExportDirectory", grt::StringRef(exporter.get_directory())); + bec::GRTManager::get()->replace_status_text(strfmt(_("Exported inserts to %s"), path.c_str())); + bec::GRTManager::get()->set_app_option("TableEditor:LastExportDirectory", grt::StringRef(exporter.get_directory())); extension = base::extension(path); if (!extension.empty() && extension[0] == '.') extension = extension.substr(1); if (!extension.empty()) - bec::GRTManager::get().set_app_option("TableEditor:LastExportExtension", grt::StringRef(extension)); + bec::GRTManager::get()->set_app_option("TableEditor:LastExportExtension", grt::StringRef(extension)); } } else @@ -3517,7 +3517,7 @@ void TableEditorBE::show_import_wizard() } } else - log_error("Can't find module SQLIDEUtils for record importer"); + logError("Can't find module SQLIDEUtils for record importer"); } } diff --git a/backend/wbpublic/grtsqlparser/mysql_parser_services.cpp b/backend/wbpublic/grtsqlparser/mysql_parser_services.cpp index d344f63c2..b8edea280 100644 --- a/backend/wbpublic/grtsqlparser/mysql_parser_services.cpp +++ b/backend/wbpublic/grtsqlparser/mysql_parser_services.cpp @@ -192,9 +192,9 @@ MySQLParserContext::Ref MySQLParserServices::createParserContext(GrtCharacterSet //-------------------------------------------------------------------------------------------------- -MySQLParserServices::Ref MySQLParserServices::get(grt::GRT *grt) +MySQLParserServices::Ref MySQLParserServices::get() { - MySQLParserServices::Ref module = dynamic_cast(grt->get_module("MySQLParserServices")); + MySQLParserServices::Ref module = dynamic_cast(grt::GRT::get()->get_module("MySQLParserServices")); if (!module) throw std::runtime_error("Can't get MySQLParserServices module."); return module; diff --git a/backend/wbpublic/grtsqlparser/mysql_parser_services.h b/backend/wbpublic/grtsqlparser/mysql_parser_services.h index 8d93dc483..47fea3747 100644 --- a/backend/wbpublic/grtsqlparser/mysql_parser_services.h +++ b/backend/wbpublic/grtsqlparser/mysql_parser_services.h @@ -81,7 +81,7 @@ class WBPUBLICBACKEND_PUBLIC_FUNC MySQLParserServices public: typedef MySQLParserServices *Ref; // We only have a singleton, so define Ref only to keep the pattern. - static MySQLParserServices::Ref get(grt::GRT *grt); + static MySQLParserServices::Ref get(); static MySQLParserContext::Ref createParserContext(GrtCharacterSetsRef charsets, GrtVersionRef version, bool case_sensitive); @@ -109,7 +109,7 @@ class WBPUBLICBACKEND_PUBLIC_FUNC MySQLParserServices virtual size_t determineStatementRanges(const char *sql, size_t length, const std::string &initial_delimiter, std::vector > &ranges, const std::string &line_break = "\n") = 0; - virtual grt::DictRef parseStatement(parser::MySQLParserContext::Ref context, grt::GRT *grt, const std::string &sql) = 0; + virtual grt::DictRef parseStatement(parser::MySQLParserContext::Ref context, const std::string &sql) = 0; // Query manipulation services. virtual std::string replaceTokenSequenceWithText(parser::MySQLParserContext::Ref context, diff --git a/backend/wbpublic/grtsqlparser/sql_parser_base.cpp b/backend/wbpublic/grtsqlparser/sql_parser_base.cpp index c08a32085..9af009c2b 100644 --- a/backend/wbpublic/grtsqlparser/sql_parser_base.cpp +++ b/backend/wbpublic/grtsqlparser/sql_parser_base.cpp @@ -96,14 +96,14 @@ void Sql_parser_base::add_log_message(const std::string &text, int entry_type) // syntax checks and the like. Simple SQL errors shouldn't go into the log file. if (_messages_enabled) { - bool send_to_frontend = (!bec::GRTManager::get().in_main_thread()); + bool send_to_frontend = (!bec::GRTManager::get()->in_main_thread()); // TODO: The entry types needs a review. It should be streamlined to the logger levels. switch (entry_type) { case 0: { - log_debug2("%s", (text + "\n").c_str()); + logDebug2("%s", (text + "\n").c_str()); if (send_to_frontend) grt::GRT::get()->send_info(text); @@ -112,7 +112,7 @@ void Sql_parser_base::add_log_message(const std::string &text, int entry_type) case 1: { ++_warn_count; - log_debug("%s", (text + "\n").c_str()); + logDebug("%s", (text + "\n").c_str()); if (send_to_frontend) grt::GRT::get()->send_warning(text); @@ -120,14 +120,14 @@ void Sql_parser_base::add_log_message(const std::string &text, int entry_type) } case 2: { - log_debug("%s", (text + "\n").c_str()); + logDebug("%s", (text + "\n").c_str()); if (send_to_frontend) grt::GRT::get()->send_error(text); break; } default: - log_debug3("%s", (text + "\n").c_str()); + logDebug3("%s", (text + "\n").c_str()); break; } } diff --git a/backend/wbpublic/grtsqlparser/sql_specifics.h b/backend/wbpublic/grtsqlparser/sql_specifics.h index ed74b6e9d..ed61a37d5 100644 --- a/backend/wbpublic/grtsqlparser/sql_specifics.h +++ b/backend/wbpublic/grtsqlparser/sql_specifics.h @@ -21,7 +21,8 @@ #include "wbpublic_public_interface.h" #include "sqlide/sqlide_generics.h" -#include "grtpp.h" +#include "grt.h" +#include #include #include #include @@ -38,10 +39,7 @@ class WBPUBLICBACKEND_PUBLIC_FUNC Sql_specifics typedef std::shared_ptr Ref; virtual ~Sql_specifics() {} protected: - Sql_specifics(grt::GRT *grt); - -protected: - grt::GRT *_grt; + Sql_specifics(); public: virtual std::string limit_select_query(const std::string &sql, int *row_count, int *offset); diff --git a/backend/wbpublic/grtui/binary_data_editor.cpp b/backend/wbpublic/grtui/binary_data_editor.cpp index f41e6ab16..7da133b86 100644 --- a/backend/wbpublic/grtui/binary_data_editor.cpp +++ b/backend/wbpublic/grtui/binary_data_editor.cpp @@ -1,5 +1,5 @@ -/* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. +/* + * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -38,6 +38,7 @@ DEFAULT_LOG_DOMAIN("BlobViewer"); #include "mforms/code_editor.h" #include "mforms/find_panel.h" #include "mforms/filechooser.h" +#include "mforms/label.h" BinaryDataViewer::BinaryDataViewer(BinaryDataEditor *owner) : mforms::Box(false), _owner(owner) @@ -358,21 +359,60 @@ class TextDataViewer : public BinaryDataViewer class JsonDataViewer : public BinaryDataViewer { public: - JsonDataViewer(BinaryDataEditor *owner, JsonParser::JsonValue &value) - : BinaryDataViewer(owner) + JsonDataViewer(BinaryDataEditor *owner, JsonParser::JsonValue &value, const std::string &encoding) + : BinaryDataViewer(owner), _encoding(encoding) { set_spacing(8); _jsonView.setJson(value); add(&_jsonView, true, true); - //scoped_connect(_jsonView.textViewTextChanged(), boost::bind(&JsonDataViewer::edited, this)); + scoped_connect(_jsonView.editorDataChanged(), boost::bind(&JsonDataViewer::edited, this, _1)); } virtual void data_changed() { + if (!_owner->data()) + { + _jsonView.clear(); + return; + } + GError *error = NULL; + gsize bread = 0, bwritten = 0; + char *converted = g_convert(_owner->data(), static_cast(_owner->length()), "UTF-8", _encoding.c_str(), &bread, &bwritten, &error); + if (!converted || _owner->length() != bread) + { + _jsonView.clear(); + return; + } + std::string dataToTest = converted; + size_t pos = dataToTest.find_first_not_of(SPACES); + if (pos != std::string::npos && dataToTest.at(pos) != '{' && dataToTest.at(pos) != '[') + { + _jsonView.clear(); + return; + } + + JsonParser::JsonValue value; + try + { + JsonParser::JsonReader::read(converted, value); + if (_jsonView.text() != converted) + _jsonView.setJson(value); + } + catch (JsonParser::ParserException &) + { + _jsonView.setText(converted); + } } private: - mforms::JsonTabView _jsonView; + + void edited(const std::string &text) + { + _owner->assign_data(text.data(), text.length()); + } + + mforms::JsonTabView _jsonView; + std::string _encoding; }; //-------------------------------------------------------------------------------- @@ -407,7 +447,8 @@ class GeomTextDataViewer : public BinaryDataViewer { set_spacing(8); add(&_selector, false, true); - add_end(&_text, true, true); + add(&_text, true, true); + add_end(&_srid, false, false); _text.set_read_only(read_only && false); //TODO: data editing (need to figure out a way to send WKT data to the server when saving) @@ -440,25 +481,27 @@ class GeomTextDataViewer : public BinaryDataViewer break; } _text.set_value(text); + _srid.set_text("SRID: " + base::to_string(importer.getSrid())); } private: mforms::TextBox _text; mforms::Selector _selector; + mforms::Label _srid; std::string _encoding; }; //-------------------------------------------------------------------------------- -BinaryDataEditor::BinaryDataEditor(bec::GRTManager *grtm, const char *data, size_t length, bool read_only) -: mforms::Form(0), _grtm(grtm), _box(false), _hbox(true), _read_only(read_only) +BinaryDataEditor::BinaryDataEditor(const char *data, size_t length, bool read_only) +: mforms::Form(0), _box(false), _hbox(true), _read_only(read_only) { set_name("blob_editor"); _data = 0; _length = 0; - grt::IntegerRef tab = grt::IntegerRef::cast_from(_grtm->get_app_option("BlobViewer:DefaultTab")); + grt::IntegerRef tab = grt::IntegerRef::cast_from(bec::GRTManager::get()->get_app_option("BlobViewer:DefaultTab")); setup(); assign_data(data, length); @@ -473,7 +516,7 @@ BinaryDataEditor::BinaryDataEditor(bec::GRTManager *grtm, const char *data, size activeTab = (int)*tab; if (tab.is_valid() && *tab >= _tab_view.page_count()) { - grt::DictRef dict(grt::DictRef::cast_from(_grtm->get_app_option(""))); + grt::DictRef dict(grt::DictRef::cast_from(bec::GRTManager::get()->get_app_option(""))); if (dict.is_valid()) dict.gset("BlobViewer:DefaultTab", 0); activeTab = 0; @@ -483,14 +526,15 @@ BinaryDataEditor::BinaryDataEditor(bec::GRTManager *grtm, const char *data, size tab_changed(); } -BinaryDataEditor::BinaryDataEditor(bec::GRTManager *grtm, const char *data, size_t length, const std::string &text_encoding, const std::string &datatype, bool read_only) -: mforms::Form(mforms::Form::main_form()), _grtm(grtm), _type(datatype), _box(false), _hbox(true), _read_only(read_only) +BinaryDataEditor::BinaryDataEditor(const char *data, size_t length, const std::string &text_encoding, const std::string &datatype, bool read_only) +: mforms::Form(mforms::Form::main_form()), _type(datatype), _box(false), _hbox(true), _read_only(read_only) { set_name("blob_editor"); _data = 0; _length = 0; + _updating = false; - grt::IntegerRef tab = grt::IntegerRef::cast_from(_grtm->get_app_option("BlobViewer:DefaultTab")); + grt::IntegerRef tab = grt::IntegerRef::cast_from(bec::GRTManager::get()->get_app_option("BlobViewer:DefaultTab")); setup(); add_viewer(new HexDataViewer(this, read_only), "Binary"); @@ -512,7 +556,7 @@ BinaryDataEditor::BinaryDataEditor(bec::GRTManager *grtm, const char *data, size activeTab = (int)*tab; if (tab.is_valid() && *tab >= _tab_view.page_count()) { - grt::DictRef dict(grt::DictRef::cast_from(_grtm->get_app_option(""))); + grt::DictRef dict(grt::DictRef::cast_from(bec::GRTManager::get()->get_app_option(""))); if (dict.is_valid()) dict.gset("BlobViewer:DefaultTab", 0); activeTab = 0; @@ -560,7 +604,7 @@ void BinaryDataEditor::setup() scoped_connect(_import.signal_clicked(),boost::bind(&BinaryDataEditor::import_value, this)); scoped_connect(_export.signal_clicked(),boost::bind(&BinaryDataEditor::export_value, this)); - set_size(640, 500); + set_size(800, 500); // Golden ratio. center(); } @@ -571,6 +615,9 @@ void BinaryDataEditor::notify_edit() void BinaryDataEditor::assign_data(const char *data, size_t length, bool steal_pointer) { + if (_updating) + return; + if (data != _data) { g_free(_data); @@ -580,7 +627,7 @@ void BinaryDataEditor::assign_data(const char *data, size_t length, bool steal_p _data = (char*)g_memdup(data, (guint)length); for (size_t i = 0; i < _viewers.size(); i++) - _viewers[i].second = true; + _pendingUpdates.insert(_viewers[i]); } _length = length; @@ -591,23 +638,25 @@ void BinaryDataEditor::tab_changed() { int i = _tab_view.get_active_tab(); if (i < 0) - i= 0; + i = 0; - grt::DictRef dict(grt::DictRef::cast_from(_grtm->get_app_option(""))); + grt::DictRef dict(grt::DictRef::cast_from(bec::GRTManager::get()->get_app_option(""))); if (dict.is_valid()) dict.gset("BlobViewer:DefaultTab", i); if (i >= _tab_view.page_count()) { - grt::DictRef dict(grt::DictRef::cast_from(_grtm->get_app_option(""))); + grt::DictRef dict(grt::DictRef::cast_from(bec::GRTManager::get()->get_app_option(""))); if (dict.is_valid()) dict.gset("BlobViewer:DefaultTab", 0); i = 0; } try { - if (_viewers[i].second && _data) - _viewers[i].first->data_changed(); - _viewers[i].second = false; + _updating = true; + if (_pendingUpdates.count(_viewers[i]) > 0 && _data != NULL) + _viewers[i]->data_changed(); + _pendingUpdates.erase(_viewers[i]); + _updating = false; } catch (std::exception &exc) { @@ -617,7 +666,8 @@ void BinaryDataEditor::tab_changed() void BinaryDataEditor::add_viewer(BinaryDataViewer *viewer, const std::string &title) { - _viewers.push_back(std::make_pair(viewer, true)); + _viewers.push_back(viewer); + _pendingUpdates.insert(viewer); _tab_view.add_page(mforms::manage(viewer), title); } @@ -635,8 +685,8 @@ void BinaryDataEditor::add_json_viewer(bool read_only, const std::string& text_e return; } std::string dataToTest = converted; - size_t pos = dataToTest.find_first_not_of(" \t\r\n"); - if (pos != std::string::npos && dataToTest.at(pos) != '{') + size_t pos = dataToTest.find_first_not_of(SPACES); + if (pos != std::string::npos && dataToTest.at(pos) != '{' && dataToTest.at(pos) != '[') return; bool isJson = true; @@ -650,7 +700,10 @@ void BinaryDataEditor::add_json_viewer(bool read_only, const std::string& text_e isJson = false; } if (isJson) - add_viewer(new JsonDataViewer(this, value), title.c_str()); + { + add_viewer(new JsonDataViewer(this, value, text_encoding), title.c_str()); + _type = "JSON"; + } } void BinaryDataEditor::save() @@ -688,8 +741,8 @@ void BinaryDataEditor::import_value() void BinaryDataEditor::export_value() { mforms::FileChooser chooser(mforms::SaveFile); - chooser.set_title("Export Field Data"); + chooser.set_extensions("Text files (*.txt)|*.txt|All Files (*.*)|*.*", "txt"); if (chooser.run_modal()) { std::string path = chooser.get_path(); diff --git a/backend/wbpublic/grtui/connection_page.h b/backend/wbpublic/grtui/connection_page.h index 9122c9935..a38bbbb5a 100644 --- a/backend/wbpublic/grtui/connection_page.h +++ b/backend/wbpublic/grtui/connection_page.h @@ -35,7 +35,7 @@ class ConnectionPage : public grtui::WizardPage if (!_selection_save_name.empty()) { - std::string name = bec::GRTManager::get().get_app_option_string(_selection_save_name); + std::string name = bec::GRTManager::get()->get_app_option_string(_selection_save_name); if (!name.empty()) _connect.set_active_stored_conn(name); } @@ -49,7 +49,7 @@ class ConnectionPage : public grtui::WizardPage { db_mgmt_ConnectionRef conn(_connect.get_connection()); if (conn.is_valid() && conn->name() != "") - bec::GRTManager::get().set_app_option(_selection_save_name, conn->name()); + bec::GRTManager::get()->set_app_option(_selection_save_name, conn->name()); } return WizardPage::advance(); diff --git a/backend/wbpublic/grtui/db_conn_be.cpp b/backend/wbpublic/grtui/db_conn_be.cpp index c3b5d19bf..191a06677 100644 --- a/backend/wbpublic/grtui/db_conn_be.cpp +++ b/backend/wbpublic/grtui/db_conn_be.cpp @@ -233,12 +233,12 @@ std::vector > DbDriverParam::get_enum_option } } else - log_warning("Error calling enum value lookup method %s.%s for DriverParameter %s", + logWarning("Error calling enum value lookup method %s.%s for DriverParameter %s", _inner->lookupValueModule().c_str(), _inner->lookupValueMethod().c_str(), _inner->name().c_str()); } else - log_warning("Error searching module for enum value lookup method %s.%s for DriverParameter %s", + logWarning("Error searching module for enum value lookup method %s.%s for DriverParameter %s", _inner->lookupValueModule().c_str(), _inner->lookupValueMethod().c_str(), _inner->name().c_str()); } diff --git a/backend/wbpublic/grtui/geom_draw_box.cpp b/backend/wbpublic/grtui/geom_draw_box.cpp index 4b004beea..c28bcc7b5 100644 --- a/backend/wbpublic/grtui/geom_draw_box.cpp +++ b/backend/wbpublic/grtui/geom_draw_box.cpp @@ -97,7 +97,7 @@ void GeomDrawBox::draw_geometry(cairo_t *cr, OGRGeometry *geom, double scale, do } break; default: - log_warning("Can't paint geometry type %s\n", geom->getGeometryName()); + logWarning("Can't paint geometry type %s\n", geom->getGeometryName()); break; } } diff --git a/backend/wbpublic/grtui/grtdb_connect_panel.cpp b/backend/wbpublic/grtui/grtdb_connect_panel.cpp index 0dbdf807c..42d0a4516 100644 --- a/backend/wbpublic/grtui/grtdb_connect_panel.cpp +++ b/backend/wbpublic/grtui/grtdb_connect_panel.cpp @@ -22,7 +22,6 @@ #include "mforms/fs_object_selector.h" #include "grtdb/db_helpers.h" -#include "grt/common.h" #include "base/string_utilities.h" #include "base/log.h" #include "base/file_utilities.h" @@ -65,6 +64,7 @@ _params_panel(mforms::TransparentPanel), _params_table(0), _ssl_panel(mforms::TransparentPanel), _ssl_table(0), _advanced_panel(mforms::TransparentPanel), _advanced_table(0), _options_panel(mforms::TransparentPanel), _options_table(0), +_create_group(false), _show_connection_combo((flags & DbConnectPanelShowConnectionCombo) != 0), _show_manage_connections((flags & DbConnectPanelShowManageConnections) != 0), _dont_set_default_connection((flags & DbConnectPanelDontSetDefaultConnection) != 0), @@ -107,10 +107,13 @@ _last_active_tab(-1) _desc3.set_text(_("Method to use to connect to the RDBMS")); _desc3.set_style(mforms::SmallHelpTextStyle); + + _stored_connection_sel.set_name("Connection List"); if (_show_connection_combo) scoped_connect(_stored_connection_sel.signal_changed(),boost::bind(&DbConnectPanel::change_active_stored_conn, this)); scoped_connect(_rdbms_sel.signal_changed(),boost::bind(&DbConnectPanel::change_active_rdbms, this)); scoped_connect(_driver_sel.signal_changed(),boost::bind(&DbConnectPanel::change_active_driver, this)); + scoped_connect(_name_entry.signal_changed(), boost::bind(&DbConnectPanel::change_connection_name, this)); _table.set_name("connect_panel:table"); _table.set_row_count(flags & DbConnectPanelShowRDBMSCombo ? 4 : 2); @@ -123,7 +126,7 @@ _last_active_tab(-1) if (flags & DbConnectPanelShowRDBMSCombo) { _table.add(&_label2, 0, 1, row, row+1, mforms::HFillFlag); - _table.add(&_rdbms_sel, 1, 2, row, row+1, mforms::HExpandFlag | mforms::HFillFlag); + _table.add(&_rdbms_sel, 1, 2, row, row+1, mforms::HExpandFlag | mforms::HFillFlag | mforms::VFillFlag); _table.add(&_desc2, 2, 3, row, row+1, mforms::HFillFlag); row++; _table.add(mforms::manage(new mforms::Label()), 0, 1, row, row+1, mforms::HFillFlag); @@ -135,20 +138,21 @@ _last_active_tab(-1) if (_show_connection_combo) { _table.add(&_label1, 0, 1, row, row+1, mforms::HFillFlag); - _table.add(&_stored_connection_sel, 1, 2, row, row+1, mforms::HExpandFlag | mforms::HFillFlag); + _table.add(&_stored_connection_sel, 1, 2, row, row+1, mforms::HExpandFlag | mforms::HFillFlag | mforms::VFillFlag); _table.add(&_desc1, 2, 3, row, row+1, mforms::HFillFlag); } else { _table.add(&_label1, 0, 1, row, row+1, mforms::HFillFlag); - _table.add(&_name_entry, 1, 2, row, row+1, mforms::HExpandFlag | mforms::HFillFlag); + _table.add(&_name_entry, 1, 2, row, row+1, mforms::HExpandFlag | mforms::HFillFlag | mforms::VFillFlag); _table.add(&_desc1, 2, 3, row, row+1, mforms::HFillFlag); } row++; } - + + _label3.set_size(-1, 30); _table.add(&_label3, 0, 1, row, row+1, mforms::HFillFlag); - _table.add(&_driver_sel, 1, 2, row, row+1, mforms::HExpandFlag | mforms::HFillFlag); + _table.add(&_driver_sel, 1, 2, row, row+1, mforms::HExpandFlag | mforms::HFillFlag | mforms::VFillFlag); _table.add(&_desc3, 2, 3, row, row+1, mforms::HFillFlag); _tab.set_name("connect_panel:tab"); @@ -160,11 +164,11 @@ _last_active_tab(-1) set_name("connect_panel"); add(&_content, true, true); - _content.add(&_table, false, false); + _content.add(&_table, false, true); _content.add(&_tab, true, true); _warning.set_style(mforms::SmallHelpTextStyle); _warning.set_front_color("#FF0000"); - _content.add(&_warning, false, false); + _content.add(&_warning, false, true); } @@ -175,6 +179,40 @@ DbConnectPanel::~DbConnectPanel() } +void DbConnectPanel::connection_user_input(std::string &text_entry, bool &create_group, bool new_entry /*= true*/) +{ + std::size_t pos = text_entry.find_first_of("/"); + if (pos == std::string::npos) + return; + create_group = false; + std::string group = text_entry.substr(0, pos); + std::string message = (new_entry) ? "Do you want to create connection inside the group" : "Do you want to split the name and move the connection to the group"; + int ret = mforms::Utilities::show_message("Place Connection in a Group.", + base::strfmt("You have used a forward slash in your connection name, which is used to separate a group from the real connection name.\n" + "%s '%s'? If you select 'No' all forward slashes in the name will be replaced by underscores.", + message.c_str(), group.c_str()), _("Yes"), _("No")); + if (ret == mforms::ResultOk) + { + create_group = true; + return; + } + while (pos != std::string::npos) + { + text_entry[pos] = '_'; + pos = text_entry.find_first_of("/", pos + 1); + } +} + +void DbConnectPanel::change_connection_name() +{ + if (_create_group) + return; + std::string text = _name_entry.get_string_value(); + connection_user_input(text, _create_group); + _name_entry.set_value(text); +} + + void DbConnectPanel::set_skip_schema_name(bool flag) { _skip_schema_name= flag; @@ -204,13 +242,13 @@ void DbConnectPanel::init(DbConnection *conn, const db_mgmt_ConnectionRef &defau _anonymous_connection= default_conn; else { - _anonymous_connection = db_mgmt_ConnectionRef(_connection->get_grt()); + _anonymous_connection = db_mgmt_ConnectionRef(grt::Initialized); _anonymous_connection->owner(_connection->get_db_mgmt()); } if (!_allowed_rdbms.is_valid()) { - _allowed_rdbms = grt::ListRef(_connection->get_grt()); + _allowed_rdbms = grt::ListRef(true); _allowed_rdbms.ginsert(_connection->get_db_mgmt()->rdbms()[0]); } @@ -264,7 +302,7 @@ db_mgmt_ConnectionRef DbConnectPanel::get_connection(bool initInvalid) { if (!_connection->get_connection().is_valid() && initInvalid) { - db_mgmt_ConnectionRef connection(get_be()->get_grt()); + db_mgmt_ConnectionRef connection(grt::Initialized); connection->owner(get_be()->get_db_mgmt()); connection->driver(selected_driver()); set_connection(connection); @@ -461,7 +499,7 @@ void DbConnectPanel::change_active_rdbms() _updating = false; } else - log_warning("DbConnectPanel: no active rdbms\n"); + logWarning("DbConnectPanel: no active rdbms\n"); } } @@ -644,7 +682,7 @@ bool DbConnectPanel::test_connection() db_mgmt_ConnectionRef connectionProperties = get_be()->get_connection(); if (!connectionProperties.is_valid()) { - db_mgmt_ConnectionRef connection(get_be()->get_grt()); + db_mgmt_ConnectionRef connection(grt::Initialized); connection->owner(get_be()->get_db_mgmt()); connection->driver(selected_driver()); set_connection(connection); @@ -657,20 +695,6 @@ bool DbConnectPanel::test_connection() message.append("Port: " + grt::IntegerRef(connectionProperties->parameterValues().get_int("port")).toString() + "\n"); message.append("User: " + connectionProperties->parameterValues().get_string("userName") + "\n"); - if ( connectionProperties->driver()->name() == "MySQLFabric") - { - grt::GRT *grt = connectionProperties->get_grt(); - grt::BaseListRef args(grt); - args->insert_unchecked(connectionProperties); - grt::ValueRef result= grt->call_module_function("WBFabric", "testConnection", args); - std::string error = grt::StringRef::extract_from(result); - if (!error.empty()) - { - failed = true; - message = error; - } - } - else { sql::ConnectionWrapper _dbc_conn= dbc_drv_man->getConnection(connectionProperties); @@ -686,7 +710,7 @@ bool DbConnectPanel::test_connection() } if (!bec::is_supported_mysql_version(version)) { - log_error("Unsupported server version: %s %s\n", _dbc_conn->getMetaData()->getDatabaseProductName().c_str(), + logError("Unsupported server version: %s %s\n", _dbc_conn->getMetaData()->getDatabaseProductName().c_str(), version.c_str()); if (mforms::Utilities::show_warning("Connection Warning", base::strfmt("Incompatible/nonstandard server version or connection protocol detected (%s).\n\n" @@ -760,13 +784,11 @@ void DbConnectPanel::set_active_stored_conn(db_mgmt_ConnectionRef connection) _warning.set_text(""); if (!connection.is_valid()) connection = _anonymous_connection; - else if (connection->parameterValues().has_key("fabric_managed")) - _warning.set_text(_("This is a fabric managed connection")); db_mgmt_DriverRef driver = connection->driver(); if (!driver.is_valid()) { - log_error("Connection %s has no driver set\n", connection->name().c_str()); + logError("Connection %s has no driver set\n", connection->name().c_str()); return; } @@ -846,18 +868,17 @@ void DbConnectPanel::change_active_stored_conn() void DbConnectPanel::launch_ssl_wizard() { mforms::Form *parent = get_parent_form(); - grt::BaseListRef args(get_be()->get_grt()); - args.ginsert(mforms_to_grt(get_be()->get_grt(), parent, "Form")); + grt::BaseListRef args(true); + args.ginsert(mforms_to_grt(parent, "Form")); args.ginsert(get_connection(true)); args.ginsert(grt::StringRef(get_connection(true)->id())); - get_be()->get_grt()->call_module_function("PyWbUtils", "generateCertificates", args); - + grt::GRT::get()->call_module_function("PyWbUtils", "generateCertificates", args); _connection->update(); } void DbConnectPanel::open_ssl_wizard_directory() { - std::string path = base::join_path(mforms::App::get()->get_user_data_folder().c_str(), "certificates", get_connection()->id().c_str(), ""); + std::string path = base::joinPath(mforms::App::get()->get_user_data_folder().c_str(), "certificates", get_connection()->id().c_str(), ""); if (base::is_directory(path)) Utilities::open_url(path); @@ -869,7 +890,7 @@ void DbConnectPanel::open_ssl_wizard_directory() db_mgmt_ConnectionRef DbConnectPanel::open_editor() { - grt::ListRef rdbms_list(_connection->get_grt()); + grt::ListRef rdbms_list(true); rdbms_list.ginsert(selected_rdbms()); DbConnectionEditor editor(_connection->get_db_mgmt()); @@ -940,25 +961,25 @@ void DbConnectPanel::begin_layout() void DbConnectPanel::end_layout() { - if (_param_rows.size()) + if (!_param_rows.empty()) { _params_panel.add(_params_table); _tab.add_page(&_params_panel, _("Parameters")); } - if (_ssl_rows.size()) + if (!_ssl_rows.empty()) { _ssl_panel.add(_ssl_table); _tab.add_page(&_ssl_panel, _("SSL")); } - if (_advanced_rows.size()) + if (!_advanced_rows.empty()) { _advanced_panel.add(_advanced_table); _tab.add_page(&_advanced_panel, _("Advanced")); } - if (_options_rows.size()) + if (!_options_rows.empty()) { _options_panel.add(_options_table); _tab.add_page(&_options_panel, _("Options")); @@ -982,13 +1003,13 @@ void DbConnectPanel::set_keychain_password(DbDriverParam *param, bool clear) } else { - log_error("Invalid storage key format for option %s\n", param->object().id().c_str()); + logError("Invalid storage key format for option %s\n", param->object().id().c_str()); return; } for (grt::DictRef::const_iterator iter = paramValues.begin(); iter != paramValues.end(); ++iter) { - storage_key = bec::replace_string(storage_key, "%" + iter->first + "%", iter->second.toString()); - username = bec::replace_string(username, "%" + iter->first + "%", iter->second.toString()); + storage_key = base::replaceString(storage_key, "%"+iter->first+"%", iter->second.toString()); + username = base::replaceString(username, "%"+iter->first+"%", iter->second.toString()); } if (username.empty()) @@ -1078,7 +1099,7 @@ void DbConnectPanel::create_control(::DbDriverParam *driver_param, const ::Contr _views.push_back(box); mforms::TableItemFlags flags; - flags = mforms::HExpandFlag | mforms::HFillFlag; + flags = mforms::HExpandFlag | mforms::HFillFlag | mforms::VFillFlag; if (driver_param->get_type() == DbDriverParam::ptText) flags = flags | mforms::VExpandFlag|mforms::VFillFlag; table->add(mforms::manage(box), 1, 2, bounds.top, bounds.top + 1, flags); @@ -1194,7 +1215,7 @@ void DbConnectPanel::create_control(::DbDriverParam *driver_param, const ::Contr // value { - grt::StringRef value= driver_param->get_value_repr(); + grt::StringRef value = driver_param->getValue(); if (value.is_valid()) ctrl->set_value(*value); } @@ -1262,7 +1283,7 @@ void DbConnectPanel::create_control(::DbDriverParam *driver_param, const ::Contr } catch (std::exception &e) { - log_error("Error calling get_enum_options() for param %s: %s", + logError("Error calling get_enum_options() for param %s: %s", driver_param->get_control_name().c_str(), e.what()); mforms::Utilities::show_error("Connection Setup", @@ -1290,7 +1311,7 @@ void DbConnectPanel::create_control(::DbDriverParam *driver_param, const ::Contr break; } default: - log_warning("Unknown param type for %s\n", driver_param->get_control_name().c_str()); + logWarning("Unknown param type for %s\n", driver_param->get_control_name().c_str()); break; } } diff --git a/backend/wbpublic/grtui/grtdb_connection_editor.cpp b/backend/wbpublic/grtui/grtdb_connection_editor.cpp index 5bf77e234..5e41c0902 100644 --- a/backend/wbpublic/grtui/grtdb_connection_editor.cpp +++ b/backend/wbpublic/grtui/grtdb_connection_editor.cpp @@ -30,22 +30,6 @@ DEFAULT_LOG_DOMAIN(DOMAIN_WB_CONTEXT_UI) //------------------------------------------------------------------------------ -/* -grtui::DbConnectionEditor::DbConnectionEditor(const db_mgmt_ManagementRef &mgmt, const grt::ListRef &allowed_rdbms) - : mforms::Form(0) - , _mgmt(mgmt) - , _connection_list(mgmt->otherStoredConns()) - , _panel(false) - , _top_vbox(false) - , _top_hbox(true) - , _conn_list_buttons_hbox(true) - , _stored_connection_list(mforms::TreeDefault|mforms::TreeFlatList) - , _bottom_hbox(true) -{ - _panel.init(_mgmt, allowed_rdbms); - - init(); -}*/ // for MySQL only connection editors grtui::DbConnectionEditor::DbConnectionEditor(const db_mgmt_ManagementRef &mgmt) @@ -310,7 +294,7 @@ void grtui::DbConnectionEditor::del_stored_conn() } catch (std::exception &exc) { - log_warning("Exception caught when clearning the password: %s", exc.what()); + logWarning("Exception caught when clearning the password: %s", exc.what()); mforms::Utilities::show_error("Clear Password", base::strfmt("Could not clear password: %s", exc.what()), "OK"); diff --git a/backend/wbpublic/grtui/wizard_progress_page.cpp b/backend/wbpublic/grtui/wizard_progress_page.cpp index 5797a49ae..25ee5a54c 100644 --- a/backend/wbpublic/grtui/wizard_progress_page.cpp +++ b/backend/wbpublic/grtui/wizard_progress_page.cpp @@ -78,7 +78,7 @@ void WizardProgressPage::TaskRow::set_state(WizardProgressPage::TaskState state) std::string path= bec::IconManager::get_instance()->get_icon_path(file); if (path.empty()) - log_warning("Could not find icon %s", file.c_str()); + logWarning("Could not find icon %s", file.c_str()); icon.set_image(path); } @@ -268,7 +268,7 @@ void WizardProgressPage::perform_tasks() { bool failed= false; - if (!bec::GRTManager::get().in_main_thread()) + if (!bec::GRTManager::get()->in_main_thread()) throw std::logic_error("Method must be called from main thread"); while (_current_task < (int)_tasks.size()) @@ -276,7 +276,7 @@ void WizardProgressPage::perform_tasks() TaskRow *task= _tasks[_current_task]; _form->flush_events(); - bec::GRTManager::get().perform_idle_tasks(); + bec::GRTManager::get()->perform_idle_tasks(); // check if we're being called because an async task finished if (task->async_running) @@ -369,9 +369,9 @@ void WizardProgressPage::perform_tasks() void WizardProgressPage::set_status_text(const std::string &text, bool is_error) { - if (!bec::GRTManager::get().in_main_thread()) + if (!bec::GRTManager::get()->in_main_thread()) { - bec::GRTManager::get().run_once_when_idle(this, boost::bind(&WizardProgressPage::set_status_text, this, text, is_error)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&WizardProgressPage::set_status_text, this, text, is_error)); return; } @@ -385,9 +385,9 @@ void WizardProgressPage::set_status_text(const std::string &text, bool is_error) void WizardProgressPage::update_progress(float pct, const std::string &caption) { - if (!bec::GRTManager::get().in_main_thread()) + if (!bec::GRTManager::get()->in_main_thread()) { - bec::GRTManager::get().run_once_when_idle(this, boost::bind(&WizardProgressPage::update_progress, this, pct, caption)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&WizardProgressPage::update_progress, this, pct, caption)); return; } @@ -460,7 +460,7 @@ void WizardProgressPage::extra_clicked() void WizardProgressPage::execute_grt_task(const boost::function &slot, bool sync) { - bec::GRTTask::Ref task= bec::GRTTask::create_task("wizard task", bec::GRTManager::get().get_dispatcher(), slot); + bec::GRTTask::Ref task= bec::GRTTask::create_task("wizard task", bec::GRTManager::get()->get_dispatcher(), slot); //We hold an extra ptr for the task so it's not released too early _task_list.insert(std::make_pair(task.get(), task)); @@ -471,9 +471,9 @@ void WizardProgressPage::execute_grt_task(const boost::functionsignal_finished(),boost::bind(&WizardProgressPage::process_grt_task_finish, this, _1, task.get())); if (sync) - bec::GRTManager::get().get_dispatcher()->add_task_and_wait(task); + bec::GRTManager::get()->get_dispatcher()->add_task_and_wait(task); else - bec::GRTManager::get().get_dispatcher()->add_task(task); + bec::GRTManager::get()->get_dispatcher()->add_task(task); } //-------------------------------------------------------------------------------------------------- @@ -550,7 +550,7 @@ void WizardProgressPage::process_grt_task_fail(const std::exception &error, bec: void WizardProgressPage::process_grt_task_finish(const grt::ValueRef &result, bec::GRTTask* task) { - bec::GRTManager::get().perform_idle_tasks(); + bec::GRTManager::get()->perform_idle_tasks(); if (_got_error_messages || _got_warning_messages) { diff --git a/backend/wbpublic/objimpl/db.ng/db_ng_Editor.cpp b/backend/wbpublic/objimpl/db.ng/db_ng_Editor.cpp new file mode 100644 index 000000000..cb0fc28f4 --- /dev/null +++ b/backend/wbpublic/objimpl/db.ng/db_ng_Editor.cpp @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; version 2 of the +* License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA +*/ + +#include +#include "db_ng_Editor.h" +#include + +db_ng_Editor::ImplData::ImplData() +{ + +} + +void db_ng_Editor::init() +{ +// if (!_data) _data= new db_ng_Editor::ImplData(); +} + +db_ng_Editor::~db_ng_Editor() +{ + //this is deleted by it's owner + // delete _data; +} + + +void db_ng_Editor::set_data(ImplData *data) +{ + _data = data; +} + +db_mgmt_ConnectionRef db_ng_Editor::connection() const +{ + if (_data) + return _data->getConnection(); + return db_mgmt_ConnectionRef(); +} + +grt::StringRef db_ng_Editor::script() const +{ + return grt::StringRef(); +} diff --git a/backend/wbpublic/objimpl/db.ng/db_ng_Editor.h b/backend/wbpublic/objimpl/db.ng/db_ng_Editor.h new file mode 100644 index 000000000..48e11dd4a --- /dev/null +++ b/backend/wbpublic/objimpl/db.ng/db_ng_Editor.h @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; version 2 of the +* License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA +*/ +#pragma once + +#include "grts/structs.db.ng.h" +#include "grtpp_util.h" +#include "wbpublic_public_interface.h" + +class WBPUBLICBACKEND_PUBLIC_FUNC db_ng_Editor::ImplData +{ +public: + ImplData(); + virtual ~ImplData() {}; + virtual db_mgmt_ConnectionRef getConnection() const = 0; +}; diff --git a/backend/wbpublic/objimpl/db.ng/db_ng_Ide.cpp b/backend/wbpublic/objimpl/db.ng/db_ng_Ide.cpp new file mode 100644 index 000000000..41e9f8b42 --- /dev/null +++ b/backend/wbpublic/objimpl/db.ng/db_ng_Ide.cpp @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; version 2 of the +* License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA +*/ + +#include +#include "db_ng_Ide.h" +#include + +db_ng_Ide::ImplData::ImplData() +{ +}; + + +void db_ng_Ide::init() +{ +// if (!_data) _data= new db_ng_Ide::ImplData(); +} + +db_ng_Ide::~db_ng_Ide() +{ + delete _data; +} + +void db_ng_Ide::set_data(ImplData *data) +{ + _data = data; +} + +db_ng_SheetRef db_ng_Ide::activeNgSheet() const +{ + if (_data) + return _data->activeNgSheet(); + + return db_ng_SheetRef(); +} + + + diff --git a/backend/wbpublic/objimpl/db.ng/db_ng_Ide.h b/backend/wbpublic/objimpl/db.ng/db_ng_Ide.h new file mode 100644 index 000000000..61c8060f3 --- /dev/null +++ b/backend/wbpublic/objimpl/db.ng/db_ng_Ide.h @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; version 2 of the +* License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA +*/ + +#pragma once + +#include "grts/structs.db.ng.h" +#include "wbpublic_public_interface.h" +#include "grtpp_util.h" + +class WBPUBLICBACKEND_PUBLIC_FUNC db_ng_Ide::ImplData +{ +public: + ImplData(); + virtual ~ImplData() {}; + virtual db_ng_SheetRef activeNgSheet() const = 0; +}; diff --git a/backend/wbpublic/objimpl/db.ng/db_ng_Sheet.cpp b/backend/wbpublic/objimpl/db.ng/db_ng_Sheet.cpp new file mode 100644 index 000000000..d5a45e38a --- /dev/null +++ b/backend/wbpublic/objimpl/db.ng/db_ng_Sheet.cpp @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; version 2 of the +* License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA +*/ + +#include +#include "db_ng_Sheet.h" +#include + + +db_ng_Sheet::ImplData::ImplData() +{ +}; + + +void db_ng_Sheet::init() +{ +// if (!_data) _data= new db_ng_Sheet::ImplData(); +} + +db_ng_Sheet::~db_ng_Sheet() +{ + delete _data; +} + + +void db_ng_Sheet::set_data(ImplData *data) +{ + _data = data; +} + +db_ng_EditorRef db_ng_Sheet::editor() const +{ + if(_data) + _data->editor(); + return db_ng_EditorRef(); +} + +db_mgmt_ConnectionRef db_ng_Sheet::connection() const +{ + if (_data) + return _data->getConnection(); + return db_mgmt_ConnectionRef(); +} + +void db_ng_Sheet::execute(ssize_t currentStatementOnly) +{ + if (_data) + _data->execute(currentStatementOnly); +} diff --git a/backend/wbpublic/objimpl/db.ng/db_ng_Sheet.h b/backend/wbpublic/objimpl/db.ng/db_ng_Sheet.h new file mode 100644 index 000000000..d62d31476 --- /dev/null +++ b/backend/wbpublic/objimpl/db.ng/db_ng_Sheet.h @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; version 2 of the +* License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA +*/ + +#pragma once + +#include "grts/structs.db.ng.h" +#include "grtpp_util.h" +#include "wbpublic_public_interface.h" + +class WBPUBLICBACKEND_PUBLIC_FUNC db_ng_Sheet::ImplData +{ +public: + ImplData(); + virtual ~ImplData() {}; + virtual db_ng_EditorRef editor() const = 0; + virtual void execute(ssize_t currentStatementOnly) = 0; + virtual db_mgmt_ConnectionRef getConnection() const = 0; +}; diff --git a/backend/wbpublic/objimpl/db.query/db_query_Resultset.cpp b/backend/wbpublic/objimpl/db.query/db_query_Resultset.cpp index 64d130aa8..25851f094 100644 --- a/backend/wbpublic/objimpl/db.query/db_query_Resultset.cpp +++ b/backend/wbpublic/objimpl/db.query/db_query_Resultset.cpp @@ -437,7 +437,7 @@ class WBPUBLICBACKEND_PUBLIC_FUNC CPPResultsetResultset : public db_query_Result if (column >= 0 && column < (ssize_t)column_by_name.size()) { #ifdef ENVIRONMENT_64 - return grt::IntegerRef(recordset->getInt64((uint32_t)column + 1)); + return grt::IntegerRef((size_t)recordset->getInt64((uint32_t)column + 1)); #else return grt::IntegerRef(recordset->getInt((uint32_t)column + 1)); #endif @@ -451,7 +451,7 @@ class WBPUBLICBACKEND_PUBLIC_FUNC CPPResultsetResultset : public db_query_Result if (column_by_name.find(column) != column_by_name.end()) { #ifdef ENVIRONMENT_64 - return grt::IntegerRef(recordset->getInt64((uint32_t)column_by_name[column])); + return grt::IntegerRef((size_t)recordset->getInt64((uint32_t)column_by_name[column])); #else return grt::IntegerRef(recordset->getInt((uint32_t)column_by_name[column])); #endif diff --git a/backend/wbpublic/objimpl/db/db_Column.cpp b/backend/wbpublic/objimpl/db/db_Column.cpp index d1b97559a..84646557d 100644 --- a/backend/wbpublic/objimpl/db/db_Column.cpp +++ b/backend/wbpublic/objimpl/db/db_Column.cpp @@ -66,31 +66,31 @@ class auto_array_ptr grt::StringRef db_Column::formattedRawType() const { - if (this->userType().is_valid()) + if (userType().is_valid()) { std::string arguments; // if no simple or structured datatype is set, // simply take the parameters - if (this->length() != bec::EMPTY_COLUMN_LENGTH) + if (length() != bec::EMPTY_COLUMN_LENGTH) { - arguments= strfmt("(%i)", (int)this->length()); + arguments= strfmt("(%i)", (int)length()); } - else if (this->precision() != bec::EMPTY_COLUMN_PRECISION) + else if (precision() != bec::EMPTY_COLUMN_PRECISION) { std::string tmp; - if (this->scale() != bec::EMPTY_COLUMN_SCALE) - tmp= strfmt("(%i,%i)", (int)this->precision(), (int)this->scale()); + if (scale() != bec::EMPTY_COLUMN_SCALE) + tmp= strfmt("(%i,%i)", (int)precision(), (int)scale()); else - tmp= strfmt("(%i)", (int)this->precision()); + tmp= strfmt("(%i)", (int)precision()); arguments= tmp; } - else if (this->datatypeExplicitParams().is_valid() && *this->datatypeExplicitParams() != "") + else if (datatypeExplicitParams().is_valid() && *datatypeExplicitParams() != "") { - arguments= *this->datatypeExplicitParams(); + arguments= *datatypeExplicitParams(); } - return std::string(this->userType()->name()).append(arguments); + return std::string(userType()->name()).append(arguments); } else return formattedType(); @@ -111,10 +111,10 @@ grt::StringRef db_Column::formattedType() const if (simpleType->numericPrecision() != bec::EMPTY_TYPE_PRECISION) { std::string tmp; - if (this->precision() != bec::EMPTY_COLUMN_PRECISION && this->scale() != bec::EMPTY_COLUMN_SCALE && (ptype == 3 || ptype == 4 || ptype == 5 || ptype == 6)) - tmp= strfmt("(%i,%i)", (int)this->precision(), (int)this->scale()); - else if (this->precision() != bec::EMPTY_COLUMN_PRECISION && (ptype == 1 || ptype == 2 || ptype == 4 || ptype == 6)) - tmp= strfmt("(%i)", (int)this->precision()); + if (precision() != bec::EMPTY_COLUMN_PRECISION && scale() != bec::EMPTY_COLUMN_SCALE && (ptype == 3 || ptype == 4 || ptype == 5 || ptype == 6)) + tmp= strfmt("(%i,%i)", (int)precision(), (int)scale()); + else if (precision() != bec::EMPTY_COLUMN_PRECISION && (ptype == 1 || ptype == 2 || ptype == 4 || ptype == 6)) + tmp= strfmt("(%i)", (int)precision()); caption.append(tmp); } else @@ -122,18 +122,18 @@ grt::StringRef db_Column::formattedType() const if (*simpleType->characterMaximumLength() != bec::EMPTY_TYPE_MAXIMUM_LENGTH || *simpleType->characterOctetLength() != bec::EMPTY_TYPE_OCTET_LENGTH) { - if (this->length() != bec::EMPTY_COLUMN_LENGTH && (ptype == 1 || ptype == 2 || ptype == 4 || ptype == 6)) + if (length() != bec::EMPTY_COLUMN_LENGTH && (ptype == 1 || ptype == 2 || ptype == 4 || ptype == 6)) { - caption.append(strfmt("(%i)", (int)this->length())); + caption.append(strfmt("(%i)", (int)length())); } } - else if (*simpleType->dateTimePrecision() != 0) + else if (*simpleType->dateTimePrecision() > 0 && length() > 0) { // timestamp, time, datetime, year - caption.append(strfmt("(%i)", (int)this->length())); + caption.append(strfmt("(%i)", (int)length())); } - else if (this->datatypeExplicitParams().is_valid() && *this->datatypeExplicitParams() != "") - caption.append(*this->datatypeExplicitParams()); + else if (datatypeExplicitParams().is_valid() && *datatypeExplicitParams() != "") + caption.append(*datatypeExplicitParams()); } } else if (structuredType.is_valid()) @@ -143,27 +143,27 @@ grt::StringRef db_Column::formattedType() const { std::string arguments; - if (this->userType().is_valid()) - caption= this->userType()->sqlDefinition(); + if (userType().is_valid()) + caption= userType()->sqlDefinition(); // if no simple or structured datatype is set, // simply take the parameters - if (this->length() != bec::EMPTY_COLUMN_LENGTH) + if (length() != bec::EMPTY_COLUMN_LENGTH) { - arguments= strfmt("(%i)", (int)this->length()); + arguments= strfmt("(%i)", (int)length()); } - else if (this->precision() != bec::EMPTY_COLUMN_PRECISION) + else if (precision() != bec::EMPTY_COLUMN_PRECISION) { std::string tmp; - if (this->scale() != bec::EMPTY_COLUMN_SCALE) - tmp= strfmt("(%i,%i)", (int)this->precision(), (int)this->scale()); + if (scale() != bec::EMPTY_COLUMN_SCALE) + tmp= strfmt("(%i,%i)", (int)precision(), (int)scale()); else - tmp= strfmt("(%i)", (int)this->precision()); + tmp= strfmt("(%i)", (int)precision()); arguments= tmp; } - else if (this->datatypeExplicitParams().is_valid() && *this->datatypeExplicitParams() != "") + else if (datatypeExplicitParams().is_valid() && *datatypeExplicitParams() != "") { - arguments= *this->datatypeExplicitParams(); + arguments= *datatypeExplicitParams(); } if (!arguments.empty()) @@ -199,7 +199,7 @@ grt::IntegerRef db_Column::setParseType(const std::string &type, const grt::List { grt::ListRef user_types; grt::ListRef default_type_list; - GrtVersionRef targetVersion(get_grt()); + GrtVersionRef targetVersion(grt::Initialized); if (owner().is_valid() && owner()->owner().is_valid() && owner()->owner()->owner().is_valid()) { db_CatalogRef catalog= db_CatalogRef::cast_from(owner()->owner()->owner()); @@ -219,7 +219,7 @@ grt::IntegerRef db_Column::setParseType(const std::string &type, const grt::List int scale= bec::EMPTY_COLUMN_SCALE; int length= bec::EMPTY_COLUMN_LENGTH; std::string datatypeExplicitParams; - grt::AutoUndo undo(get_grt(), !is_global()); + grt::AutoUndo undo(!is_global()); // if the available release number is negative, that's meant to signify "any release number", if (!bec::parse_type_definition(type, targetVersion, typeList, user_types, default_type_list, diff --git a/backend/wbpublic/objimpl/wrapper/parser_ContextReference.cpp b/backend/wbpublic/objimpl/wrapper/parser_ContextReference.cpp index 46537e634..6b6b02511 100644 --- a/backend/wbpublic/objimpl/wrapper/parser_ContextReference.cpp +++ b/backend/wbpublic/objimpl/wrapper/parser_ContextReference.cpp @@ -1,21 +1,21 @@ /* -* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; version 2 of the -* License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -* 02110-1301 USA -*/ + * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2 of the + * License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ #include "grts/structs.wrapper.h" @@ -28,8 +28,8 @@ using namespace parser; class parser_ContextReference::ImplData { public: - parser::ParserContext::Ref _ref; - ImplData(const ParserContext::Ref &ref) + parser::MySQLParserContext::Ref _ref; + ImplData(const MySQLParserContext::Ref &ref) { _ref = ref; } @@ -68,16 +68,16 @@ void parser_ContextReference::set_data(ImplData *data) //-------------------------------------------------------------------------------------------------- -ParserContext::Ref parser_context_from_grt(parser_ContextReferenceRef object) +MySQLParserContext::Ref parser_context_from_grt(parser_ContextReferenceRef object) { if (!object.is_valid() || !*object->valid()) - return ParserContext::Ref(); + return MySQLParserContext::Ref(); return object->get_data()->_ref; } //-------------------------------------------------------------------------------------------------- -parser_ContextReferenceRef parser_context_to_grt(const ParserContext::Ref &context) +parser_ContextReferenceRef parser_context_to_grt(const MySQLParserContext::Ref &context) { if (context != NULL) { diff --git a/backend/wbpublic/objimpl/wrapper/parser_ContextReference_impl.h b/backend/wbpublic/objimpl/wrapper/parser_ContextReference_impl.h index 9bbca0825..299b6b396 100644 --- a/backend/wbpublic/objimpl/wrapper/parser_ContextReference_impl.h +++ b/backend/wbpublic/objimpl/wrapper/parser_ContextReference_impl.h @@ -20,5 +20,5 @@ #include "grts/structs.wrapper.h" #include "grtsqlparser/mysql_parser_services.h" -GRT_STRUCTS_WRAPPER_PUBLIC parser::ParserContext::Ref parser_context_from_grt(parser_ContextReferenceRef object); -GRT_STRUCTS_WRAPPER_PUBLIC parser_ContextReferenceRef parser_context_to_grt(const parser::ParserContext::Ref &context); +GRT_STRUCTS_WRAPPER_PUBLIC parser::MySQLParserContext::Ref parser_context_from_grt(parser_ContextReferenceRef object); +GRT_STRUCTS_WRAPPER_PUBLIC parser_ContextReferenceRef parser_context_to_grt(const parser::MySQLParserContext::Ref &context); diff --git a/backend/wbpublic/sqlide/column_width_cache.cpp b/backend/wbpublic/sqlide/column_width_cache.cpp index d3d6fea3d..4cd234c28 100644 --- a/backend/wbpublic/sqlide/column_width_cache.cpp +++ b/backend/wbpublic/sqlide/column_width_cache.cpp @@ -44,7 +44,7 @@ ColumnWidthCache::ColumnWidthCache(const std::string &connection_id, const std:: sqlite::execute(*_sqconn, "PRAGMA temp_store=MEMORY", true); sqlite::execute(*_sqconn, "PRAGMA synchronous=NORMAL", true); - log_debug2("Using column width cache file %s\n", (base::makePath(cache_dir, connection_id)+".column_widths").c_str()); + logDebug2("Using column width cache file %s\n", (base::makePath(cache_dir, connection_id)+".column_widths").c_str()); // check if the DB is already initialized sqlite::query q(*_sqconn, "select name from sqlite_master where type='table'"); @@ -62,7 +62,7 @@ ColumnWidthCache::ColumnWidthCache(const std::string &connection_id, const std:: } if (found == 0) { - log_debug3("Initializing cache\n"); + logDebug3("Initializing cache\n"); init_db(); } } @@ -77,14 +77,14 @@ void ColumnWidthCache::init_db() { std::string code = "create table widths (column_id varchar(100) primary key, width int)"; - log_info("Initializing column width cache for %s\n", _connection_id.c_str()); + logInfo("Initializing column width cache for %s\n", _connection_id.c_str()); try { sqlite::execute(*_sqconn, code, true); } catch (std::exception &exc) { - log_error("Error creating cache %s: %s\n", code.c_str(), exc.what()); + logError("Error creating cache %s: %s\n", code.c_str(), exc.what()); } } @@ -100,7 +100,7 @@ void ColumnWidthCache::save_column_width(const std::string &column_id, int width } catch (std::exception &exc) { - log_error("Error storing column width to cache %s: %s\n", column_id.c_str(), exc.what()); + logError("Error storing column width to cache %s: %s\n", column_id.c_str(), exc.what()); } } @@ -121,7 +121,7 @@ void ColumnWidthCache::save_columns_width(const std::map &colu } catch (std::exception &exc) { - log_error("Error storing column width to cache %s: %s\n", it->first.c_str(), exc.what()); + logError("Error storing column width to cache %s: %s\n", it->first.c_str(), exc.what()); } } @@ -140,7 +140,7 @@ int ColumnWidthCache::get_column_width(const std::string &column_id) } catch (std::exception &exc) { - log_error("Error storing column width to cache %s: %s\n", column_id.c_str(), exc.what()); + logError("Error storing column width to cache %s: %s\n", column_id.c_str(), exc.what()); } return -1; } @@ -156,6 +156,6 @@ void ColumnWidthCache::delete_column_width(const std::string &column_id) } catch (std::exception &exc) { - log_debug("Error deleting column width to cache %s: %s\n", column_id.c_str(), exc.what()); + logDebug("Error deleting column width to cache %s: %s\n", column_id.c_str(), exc.what()); } } diff --git a/backend/wbpublic/sqlide/recordset_be.cpp b/backend/wbpublic/sqlide/recordset_be.cpp index ae7a3c788..b14863d6d 100644 --- a/backend/wbpublic/sqlide/recordset_be.cpp +++ b/backend/wbpublic/sqlide/recordset_be.cpp @@ -276,10 +276,10 @@ void Recordset::rollback() void Recordset::data_edited() { - if (bec::GRTManager::get().in_main_thread()) + if (bec::GRTManager::get()->in_main_thread()) data_edited_signal(); else - log_error("data_edited called from thread\n"); + logError("data_edited called from thread\n"); } @@ -1668,10 +1668,6 @@ class DataEditorSelector2 : public boost::static_visitor } }; -void Recordset::binary_editor_closed() -{ -} - void Recordset::open_field_data_editor(RowId row, ColumnId column, const std::string &logical_type) { base::RecMutexLock data_mutex(_data_mutex); @@ -1708,9 +1704,8 @@ void Recordset::open_field_data_editor(RowId row, ColumnId column, const std::st if (!data_editor) return; data_editor->set_title(base::strfmt("Edit Data for %s (%s)", _column_names[column].c_str(), logical_type.c_str())); + data_editor->set_release_on_close(true); data_editor->signal_saved.connect(boost::bind(&Recordset::set_field_value,this, row, column, data_editor)); - scoped_connect(data_editor->signal_closed(), boost::bind(&Recordset::binary_editor_closed, this)); - data_editor->show(true); } CATCH_AND_DISPATCH_EXCEPTION(false, "Open field editor") diff --git a/backend/wbpublic/sqlide/recordset_be.h b/backend/wbpublic/sqlide/recordset_be.h index c08df5cc9..0a248f7ef 100644 --- a/backend/wbpublic/sqlide/recordset_be.h +++ b/backend/wbpublic/sqlide/recordset_be.h @@ -17,8 +17,7 @@ * 02110-1301 USA */ -#ifndef _RECORDSET_BE_H_ -#define _RECORDSET_BE_H_ +#pragma once #include "wbpublic_public_interface.h" #include "sqlide/sqlide_generics.h" @@ -54,11 +53,11 @@ class WBPUBLICBACKEND_PUBLIC_FUNC Recordset : public VarGridModel public: typedef std::shared_ptr Ref; typedef std::weak_ptr Ptr; - static Ref create(bec::GRTManager *grtm); + static Ref create(); static Ref create(GrtThreadedTask::Ref parent_task); virtual ~Recordset(); protected: - Recordset(bec::GRTManager *grtm); + Recordset(); Recordset(GrtThreadedTask::Ref parent_task); public: @@ -139,7 +138,7 @@ class WBPUBLICBACKEND_PUBLIC_FUNC Recordset : public VarGridModel void rollback_and_gather_messages(std::string &messages); void apply_changes_(); - grt::StringRef do_apply_changes(grt::GRT *grt, Ptr self_ptr, Recordset_data_storage_Ptr data_storage_ptr, bool skip_commit); + grt::StringRef do_apply_changes(Ptr self_ptr, Recordset_data_storage_Ptr data_storage_ptr, bool skip_commit); bool has_pending_changes(); void pending_changes(int &upd_count, int &ins_count, int &del_count) const; void rollback(); @@ -268,4 +267,3 @@ class WBPUBLICBACKEND_PUBLIC_FUNC Recordset : public VarGridModel void set_field_raw_data(RowId row, ColumnId column, const char *data, size_t data_length, bool isJson = false); }; -#endif /* _RECORDSET_BE_H_ */ diff --git a/backend/wbpublic/sqlide/recordset_cdbc_storage.h b/backend/wbpublic/sqlide/recordset_cdbc_storage.h index 506cf0003..0b638e478 100644 --- a/backend/wbpublic/sqlide/recordset_cdbc_storage.h +++ b/backend/wbpublic/sqlide/recordset_cdbc_storage.h @@ -39,10 +39,10 @@ class WBPUBLICBACKEND_PUBLIC_FUNC Recordset_cdbc_storage : public Recordset_sql_ }; typedef std::shared_ptr Ref; - static Ref create(bec::GRTManager *grtm) { return Ref(new Recordset_cdbc_storage(grtm)); } + static Ref create() { return Ref(new Recordset_cdbc_storage()); } virtual ~Recordset_cdbc_storage(); protected: - Recordset_cdbc_storage(bec::GRTManager *grtm); + Recordset_cdbc_storage(); protected: virtual void do_unserialize(Recordset *recordset, sqlite::connection *data_swap_db); diff --git a/backend/wbpublic/sqlide/recordset_data_storage.h b/backend/wbpublic/sqlide/recordset_data_storage.h index 0e715100e..aa82c0070 100644 --- a/backend/wbpublic/sqlide/recordset_data_storage.h +++ b/backend/wbpublic/sqlide/recordset_data_storage.h @@ -17,10 +17,7 @@ * 02110-1301 USA */ - -#ifndef _RECORDSET_DATA_STORAGE_BE_H_ -#define _RECORDSET_DATA_STORAGE_BE_H_ - +#pragma once #include "wbpublic_public_interface.h" #include "sqlide/recordset_be.h" @@ -108,6 +105,3 @@ class WBPUBLICBACKEND_PUBLIC_FUNC Recordset_data_storage int _limit_rows_offset; bool _limit_rows_applicable; }; - - -#endif /* _RECORDSET_DATA_STORAGE_BE_H_ */ diff --git a/backend/wbpublic/sqlide/recordset_sql_storage.h b/backend/wbpublic/sqlide/recordset_sql_storage.h index 76ca09304..57ccc38a5 100644 --- a/backend/wbpublic/sqlide/recordset_sql_storage.h +++ b/backend/wbpublic/sqlide/recordset_sql_storage.h @@ -49,10 +49,10 @@ class WBPUBLICBACKEND_PUBLIC_FUNC Recordset_sql_storage : public Recordset_data_ { public: typedef std::shared_ptr Ref; - static Ref create(bec::GRTManager *grtm) { return Ref(new Recordset_sql_storage(grtm)); } + static Ref create() { return Ref(new Recordset_sql_storage()); } virtual ~Recordset_sql_storage(); protected: - Recordset_sql_storage(bec::GRTManager *grtm); + Recordset_sql_storage(); protected: virtual void fetch_blob_value(Recordset *recordset, sqlite::connection *data_swap_db, RowId rowid, ColumnId column, sqlite::variant_t &blob_value); diff --git a/backend/wbpublic/sqlide/recordset_sqlite_storage.h b/backend/wbpublic/sqlide/recordset_sqlite_storage.h index 726c7c8e9..67a63067e 100644 --- a/backend/wbpublic/sqlide/recordset_sqlite_storage.h +++ b/backend/wbpublic/sqlide/recordset_sqlite_storage.h @@ -36,10 +36,10 @@ class WBPUBLICBACKEND_PUBLIC_FUNC Recordset_sqlite_storage : public Recordset_sq { public: typedef std::shared_ptr Ref; - static Ref create(bec::GRTManager *grtm) { return Ref(new Recordset_sqlite_storage(grtm)); } + static Ref create() { return Ref(new Recordset_sqlite_storage()); } virtual ~Recordset_sqlite_storage(); protected: - Recordset_sqlite_storage(bec::GRTManager *grtm); + Recordset_sqlite_storage(); protected: virtual void do_serialize(const Recordset *recordset, sqlite::connection *data_swap_db); diff --git a/backend/wbpublic/sqlide/recordset_table_inserts_storage.cpp b/backend/wbpublic/sqlide/recordset_table_inserts_storage.cpp index 534c72f1e..d488245dc 100644 --- a/backend/wbpublic/sqlide/recordset_table_inserts_storage.cpp +++ b/backend/wbpublic/sqlide/recordset_table_inserts_storage.cpp @@ -272,7 +272,7 @@ void Recordset_table_inserts_storage::generate_sql_script(const Recordset *recor void Recordset_table_inserts_storage::do_apply_changes(const Recordset *recordset, sqlite::connection *data_swap_db, bool skip_commit) { Recordset_sqlite_storage::do_apply_changes(recordset, data_swap_db, skip_commit); - bec::GRTManager::get().has_unsaved_changes(true); + bec::GRTManager::get()->has_unsaved_changes(true); } diff --git a/backend/wbpublic/sqlide/recordset_table_inserts_storage.h b/backend/wbpublic/sqlide/recordset_table_inserts_storage.h index da3f5ff42..1a4e92ad2 100644 --- a/backend/wbpublic/sqlide/recordset_table_inserts_storage.h +++ b/backend/wbpublic/sqlide/recordset_table_inserts_storage.h @@ -32,11 +32,11 @@ class WBPUBLICBACKEND_PUBLIC_FUNC Recordset_table_inserts_storage : public Recor { public: typedef std::shared_ptr Ref; - static Ref create(bec::GRTManager *grtm) { return create_with_path(grtm,grtm->get_db_file_path()); } - static Ref create_with_path(bec::GRTManager *grtm, const std::string& path) { return Ref(new Recordset_table_inserts_storage(grtm,path)); } + static Ref create() { return create_with_path(bec::GRTManager::get()->get_db_file_path()); } + static Ref create_with_path(const std::string& path) { return Ref(new Recordset_table_inserts_storage(path)); } virtual ~Recordset_table_inserts_storage(); protected: - Recordset_table_inserts_storage(bec::GRTManager *grtm,const std::string& path); + Recordset_table_inserts_storage(const std::string& path); protected: virtual void do_apply_changes(const Recordset *recordset, sqlite::connection *data_swap_db, bool skip_commit); diff --git a/backend/wbpublic/sqlide/recordset_text_storage.cpp b/backend/wbpublic/sqlide/recordset_text_storage.cpp index f2f1666f4..5aa56bd28 100644 --- a/backend/wbpublic/sqlide/recordset_text_storage.cpp +++ b/backend/wbpublic/sqlide/recordset_text_storage.cpp @@ -90,11 +90,11 @@ static void scan_templates() { if (_templates.empty()) { - std::string template_dir = base::makePath(bec::GRTManager::get().get_basedir(), "modules/data/sqlide"); + std::string template_dir = base::makePath(bec::GRTManager::get()->get_basedir(), "modules/data/sqlide"); std::list files = base::scan_for_files_matching(template_dir+"/*.tpli"); process_templates(files); - template_dir = base::makePath(bec::GRTManager::get().get_user_datadir(), "recordset_export_templates"); + template_dir = base::makePath(bec::GRTManager::get()->get_user_datadir(), "recordset_export_templates"); files = base::scan_for_files_matching(template_dir+"/*.tpli"); process_templates(files); } diff --git a/backend/wbpublic/sqlide/recordset_text_storage.h b/backend/wbpublic/sqlide/recordset_text_storage.h index ba8147c88..a6d5b0218 100644 --- a/backend/wbpublic/sqlide/recordset_text_storage.h +++ b/backend/wbpublic/sqlide/recordset_text_storage.h @@ -40,14 +40,14 @@ class WBPUBLICBACKEND_PUBLIC_FUNC Recordset_text_storage : public Recordset_data bool pre_quote_strings; std::string quote; }; - static std::vector storage_types(bec::GRTManager *grtm); + static std::vector storage_types(); public: typedef std::shared_ptr Ref; - static Ref create(bec::GRTManager *grtm) { return Ref(new Recordset_text_storage(grtm)); } + static Ref create() { return Ref(new Recordset_text_storage()); } virtual ~Recordset_text_storage(); protected: - Recordset_text_storage(bec::GRTManager *grtm); + Recordset_text_storage(); protected: virtual void do_apply_changes(const Recordset *recordset, sqlite::connection *data_swap_db, bool skip_commit); diff --git a/backend/wbpublic/sqlide/sql_editor_be.cpp b/backend/wbpublic/sqlide/sql_editor_be.cpp index 5869c5b55..fbfc461cf 100644 --- a/backend/wbpublic/sqlide/sql_editor_be.cpp +++ b/backend/wbpublic/sqlide/sql_editor_be.cpp @@ -40,10 +40,10 @@ #include "mforms/menu.h" #include "mforms/filechooser.h" -#include "autocomplete_object_name_cache.h" - #include "grts/structs.db.mysql.h" +#include "mysql-scanner.h" +#include "code-completion/mysql-code-completion.h" #include "sql_editor_be.h" DEFAULT_LOG_DOMAIN("MySQL editor"); @@ -71,15 +71,15 @@ class MySQLEditor::Private int _last_typed_char; - ParserContext::Ref _parser_context; - ParserContext::Ref _autocompletion_context; + MySQLParserContext::Ref _parser_context; + MySQLParserContext::Ref _autocompletion_context; MySQLParserServices::Ref _services; double _last_sql_check_progress_msg_timestamp; double _sql_check_progress_msg_throttle; base::RecMutex _sql_checker_mutex; - MySQLQueryType _parse_unit; // The type of query we want to limit our parsing to. + MySQLParseUnit _parse_unit; // The type of query we want to limit our parsing to. // We use 2 timers here for delayed work. One is a grt timer to run a task in the main thread after a certain delay. // The other one is to run the actual work task in a background thread. @@ -88,7 +88,6 @@ class MySQLEditor::Private std::pair _text_info; // Only valid during a parse run. - base::RecMutex _sql_errors_mutex; std::vector _recognition_errors; // List of errors from the last sql check run. std::set _error_marker_lines; @@ -108,12 +107,12 @@ class MySQLEditor::Private boost::signals2::signal _text_change_signal; // autocomplete_context will go after auto completion refactoring. - Private(ParserContext::Ref syntaxcheck_context, ParserContext::Ref autocomplete_context) + Private(MySQLParserContext::Ref syntaxcheck_context, MySQLParserContext::Ref autocomplete_context) : _grtobj(grt::Initialized), _last_sql_check_progress_msg_timestamp(0.0), _stop_processing(false) { _owns_toolbar = false; - _parse_unit = QtUnknown; + _parse_unit = MySQLParseUnit::PuGeneric; _is_refresh_enabled = true; _sql_check_progress_msg_throttle = 500; @@ -146,29 +145,29 @@ class MySQLEditor::Private // as a single statement. This will then show syntax errors for any invalid additional input. if (_splitting_required) { - log_debug3("Start splitting\n"); + logDebug3("Start splitting\n"); _splitting_required = false; base::RecMutexLock lock(_sql_statement_borders_mutex); _statement_ranges.clear(); - if (_parse_unit == QtUnknown) + if (_parse_unit == MySQLParseUnit::PuGeneric) { double start = timestamp(); - _services->determineStatementRanges(_text_info.first, _text_info.second, ";", _statement_ranges); - log_debug3("Splitting ended after %f ticks\n", timestamp() - start); + determineStatementRanges(_text_info.first, _text_info.second, ";", _statement_ranges); + logDebug3("Splitting ended after %f ticks\n", timestamp() - start); } else - _statement_ranges.push_back(std::make_pair(0, _text_info.second)); + _statement_ranges.push_back({ 0, _text_info.second }); } } //------------------------------------------------------------------------------------------------ /** - * One or more markers on that line where changed. We have to stay in sync with our statement markers list - * to make the optimized add/remove algorithm working. - */ + * One or more markers on that line where changed. We have to stay in sync with our statement markers list + * to make the optimized add/remove algorithm working. + */ void marker_changed(const mforms::LineMarkupChangeset &changeset, bool deleted) { if (_updating_statement_markers || changeset.size() == 0) @@ -212,7 +211,7 @@ class MySQLEditor::Private //-------------------------------------------------------------------------------------------------- -MySQLEditor::Ref MySQLEditor::create(ParserContext::Ref syntax_check_context, ParserContext::Ref autocopmlete_context, +MySQLEditor::Ref MySQLEditor::create(MySQLParserContext::Ref syntax_check_context, MySQLParserContext::Ref autocopmlete_context, db_query_QueryBufferRef grtobj) { Ref sql_editor = MySQLEditor::Ref(new MySQLEditor(syntax_check_context, autocopmlete_context)); @@ -229,13 +228,13 @@ MySQLEditor::Ref MySQLEditor::create(ParserContext::Ref syntax_check_context, Pa //-------------------------------------------------------------------------------------------------- -MySQLEditor::MySQLEditor(ParserContext::Ref syntax_check_context, ParserContext::Ref autocopmlete_context) +MySQLEditor::MySQLEditor(MySQLParserContext::Ref syntax_check_context, MySQLParserContext::Ref autocopmlete_context) { d = new Private(syntax_check_context, autocopmlete_context); _code_editor = new mforms::CodeEditor(this); - _code_editor->set_font(bec::GRTManager::get().get_app_option_string("workbench.general.Editor:Font")); + _code_editor->set_font(bec::GRTManager::get()->get_app_option_string("workbench.general.Editor:Font")); _code_editor->set_features(mforms::FeatureUsePopup, false); _code_editor->set_features(mforms::FeatureConvertEolOnPaste | mforms::FeatureAutoIndent, true); _code_editor->set_name("Code Editor"); @@ -244,9 +243,9 @@ MySQLEditor::MySQLEditor(ParserContext::Ref syntax_check_context, ParserContext: _editor_config = NULL; create_editor_config_for_version(version); - _code_editor->send_editor(SCI_SETTABWIDTH, bec::GRTManager::get().get_app_option_int("Editor:TabWidth", 4), 0); - _code_editor->send_editor(SCI_SETINDENT, bec::GRTManager::get().get_app_option_int("Editor:IndentWidth", 4), 0); - _code_editor->send_editor(SCI_SETUSETABS, !bec::GRTManager::get().get_app_option_int("Editor:TabIndentSpaces", 0), 0); + _code_editor->send_editor(SCI_SETTABWIDTH, bec::GRTManager::get()->get_app_option_int("Editor:TabWidth", 4), 0); + _code_editor->send_editor(SCI_SETINDENT, bec::GRTManager::get()->get_app_option_int("Editor:IndentWidth", 4), 0); + _code_editor->send_editor(SCI_SETUSETABS, !bec::GRTManager::get()->get_app_option_int("Editor:TabIndentSpaces", 0), 0); scoped_connect(_code_editor->signal_changed(), boost::bind(&MySQLEditor::text_changed, this, _1, _2, _3, _4)); scoped_connect(_code_editor->signal_char_added(), boost::bind(&MySQLEditor::char_added, this, _1)); @@ -273,8 +272,7 @@ MySQLEditor::~MySQLEditor() // We lock all mutexes for a moment here to ensure no background thread is still holding them. base::RecMutexLock lock1(d->_sql_checker_mutex); - base::RecMutexLock lock2(d->_sql_errors_mutex); - base::RecMutexLock lock3(d->_sql_statement_borders_mutex); + base::RecMutexLock lock2(d->_sql_statement_borders_mutex); } if (d->_editor_text_submenu != NULL) @@ -636,7 +634,7 @@ std::pair MySQLEditor::cursor_pos_row_column(bool loca line -= _code_editor->line_from_position(min); } - return std::make_pair(offset, line); + return { offset, line }; } //---------------------------------------------------------------------------------------------------------------------- @@ -697,20 +695,20 @@ void MySQLEditor::restrict_content_to(ContentType type) switch (type) { case ContentTypeTrigger: - d->_parse_unit = QtCreateTrigger; + d->_parse_unit = MySQLParseUnit::PuCreateTrigger; break; case ContentTypeView: - d->_parse_unit = QtCreateView; + d->_parse_unit = MySQLParseUnit::PuCreateView; break; case ContentTypeRoutine: - d->_parse_unit = QtCreateRoutine; + d->_parse_unit = MySQLParseUnit::PuCreateRoutine; break; case ContentTypeEvent: - d->_parse_unit = QtCreateEvent; + d->_parse_unit = MySQLParseUnit::PuCreateEvent; break; default: - d->_parse_unit = QtUnknown; + d->_parse_unit = MySQLParseUnit::PuGeneric; break; } } @@ -732,14 +730,14 @@ void MySQLEditor::text_changed(int position, int length, int lines_changed, bool // Update auto completion list if a char was removed, but not added. // When adding a char the caret is not yet updated leading to strange behavior. // So we use a different notification for adding chars. - std::string text = get_written_part(position); + std::string text = getWrittenPart(position); update_auto_completion(text); } d->_splitting_required = true; d->_text_info = _code_editor->get_text_ptr(); if (d->_is_sql_check_enabled) - d->_current_delay_timer = bec::GRTManager::get().run_every(boost::bind(&MySQLEditor::start_sql_processing, this), 0.001); + d->_current_delay_timer = bec::GRTManager::get()->run_every(boost::bind(&MySQLEditor::start_sql_processing, this), 0.001); else d->_text_change_signal(); // If there is no timer set up then trigger change signals directly. } @@ -752,22 +750,13 @@ void MySQLEditor::char_added(int char_code) d->_last_typed_char = char_code; // UTF32 encoded char. else { - std::string text = get_written_part(_code_editor->get_caret_pos()); + std::string text = getWrittenPart(_code_editor->get_caret_pos()); update_auto_completion(text); } } //-------------------------------------------------------------------------------------------------- -void MySQLEditor::cancel_auto_completion() -{ - // Make sure a pending timed autocompletion won't kick in after we cancel it. - d->_last_typed_char = 0; - _code_editor->auto_completion_cancel(); -} - -//-------------------------------------------------------------------------------------------------- - void MySQLEditor::dwell_event(bool started, size_t position, int x, int y) { if (started) @@ -804,7 +793,7 @@ bool MySQLEditor::start_sql_processing() d->_current_delay_timer = NULL; // The timer will be deleted by the grt manager. { - RecMutexLock sql_errors_mutex(d->_sql_errors_mutex); + RecMutexLock sql_errors_mutex(d->_sql_checker_mutex); d->_recognition_errors.clear(); } @@ -826,7 +815,7 @@ bool MySQLEditor::do_statement_split_and_check(int id) d->split_statements_if_required(); // Start tasks that depend on the statement ranges (markers + auto completion). - bec::GRTManager::get().run_once_when_idle(this, boost::bind(&MySQLEditor::splitting_done, this)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&MySQLEditor::splitting_done, this)); if (d->_stop_processing) return false; @@ -849,7 +838,7 @@ bool MySQLEditor::do_statement_split_and_check(int id) } } - bec::GRTManager::get().run_once_when_idle(this, boost::bind(&MySQLEditor::update_error_markers, this)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&MySQLEditor::update_error_markers, this)); return false; } @@ -1016,7 +1005,7 @@ void MySQLEditor::setup_editor_menu() argpool.add_entries_for_object("activeQueryBuffer", grtobj()); argpool.add_entries_for_object("", grtobj()); - bec::MenuItemList plugin_items= bec::GRTManager::get().get_plugin_context_menu_items(groups, argpool); + bec::MenuItemList plugin_items= bec::GRTManager::get()->get_plugin_context_menu_items(groups, argpool); if (!plugin_items.empty()) { @@ -1032,7 +1021,7 @@ void MySQLEditor::setup_editor_menu() groups.clear(); groups.push_back("Filter"); - plugin_items = bec::GRTManager::get().get_plugin_context_menu_items(groups, argpool); + plugin_items = bec::GRTManager::get()->get_plugin_context_menu_items(groups, argpool); if (!plugin_items.empty()) { d->_editor_context_menu->add_separator(); @@ -1087,7 +1076,7 @@ void MySQLEditor::activate_context_menu_item(const std::string &name) std::vector parts= base::split(name, ":", 1); if (parts.size() == 2 && parts[0] == "plugin") { - app_PluginRef plugin(bec::GRTManager::get().get_plugin_manager()->get_plugin(parts[1])); + app_PluginRef plugin(bec::GRTManager::get()->get_plugin_manager()->get_plugin(parts[1])); if (!plugin.is_valid()) throw std::runtime_error("Invalid plugin "+name); @@ -1112,7 +1101,7 @@ void MySQLEditor::activate_context_menu_item(const std::string &name) grt::BaseListRef fargs(argpool.build_argument_list(plugin)); - grt::ValueRef result= bec::GRTManager::get().get_plugin_manager()->execute_plugin_function(plugin, fargs); + grt::ValueRef result= bec::GRTManager::get()->get_plugin_manager()->execute_plugin_function(plugin, fargs); if (is_filter) { @@ -1127,7 +1116,7 @@ void MySQLEditor::activate_context_menu_item(const std::string &name) } } else { - log_warning("Unhandled context menu item %s", name.c_str()); + logWarning("Unhandled context menu item %s", name.c_str()); } } } @@ -1179,7 +1168,7 @@ void MySQLEditor::set_sql_check_enabled(bool flag) { ThreadedTimer::get()->remove_task(d->_current_work_timer_id); // Does nothing if the id is -1. if (d->_current_delay_timer == NULL) - d->_current_delay_timer = bec::GRTManager::get().run_every(boost::bind(&MySQLEditor::start_sql_processing, this), 0.01); + d->_current_delay_timer = bec::GRTManager::get()->run_every(boost::bind(&MySQLEditor::start_sql_processing, this), 0.01); } else stop_processing(); @@ -1188,16 +1177,246 @@ void MySQLEditor::set_sql_check_enabled(bool flag) //-------------------------------------------------------------------------------------------------- +void MySQLEditor::setup_auto_completion() +{ + _code_editor->auto_completion_max_size(80, 15); + + static std::vector> ccImages = { + { AC_KEYWORD_IMAGE, "ac_keyword.png" }, { AC_SCHEMA_IMAGE, "ac_schema.png" }, + { AC_TABLE_IMAGE, "ac_table.png" }, { AC_ROUTINE_IMAGE, "ac_routine.png" }, + { AC_FUNCTION_IMAGE, "ac_function.png" }, { AC_VIEW_IMAGE, "ac_view.png" }, + { AC_COLUMN_IMAGE, "ac_column.png" }, { AC_OPERATOR_IMAGE, "ac_operator.png" }, + { AC_ENGINE_IMAGE, "ac_engine.png" }, { AC_TRIGGER_IMAGE, "ac_trigger.png" }, + { AC_LOGFILE_GROUP_IMAGE, "ac_logfilegroup.png" }, { AC_USER_VAR_IMAGE, "ac_uservar.png" }, + { AC_SYSTEM_VAR_IMAGE, "ac_sysvar.png" }, { AC_TABLESPACE_IMAGE, "ac_tablespace.png" }, + { AC_EVENT_IMAGE, "ac_event.png" }, { AC_INDEX_IMAGE, "ac_index.png" }, + { AC_USER_IMAGE, "ac_user.png" }, { AC_CHARSET_IMAGE, "ac_charset.png" }, + { AC_COLLATION_IMAGE, "ac_collation.png" } + }; + + _code_editor->auto_completion_register_images(ccImages); + _code_editor->auto_completion_stops("\t,.*;) "); // Will close ac even if we are in an identifier. + _code_editor->auto_completion_fillups(""); + + std::string grammarPath = base::makePath(bec::GRTManager::get()->get_basedir(), "data/MySQL.g"); + initializeMySQLCodeCompletionIfNeeded(grammarPath); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Returns the text in the editor starting at the given position backwards until the line start. + * If there's a back tick or double quote char then text until this quote char is returned. If there's + * no quoting char but a space or dot char then everything up to (but not including) this is returned. + */ +std::string MySQLEditor::getWrittenPart(size_t position) +{ + ssize_t line = _code_editor->line_from_position(position); + ssize_t start, stop; + _code_editor->get_range_of_line(line, start, stop); + std::string text = _code_editor->get_text_in_range(start, position); + if (text.empty()) + return ""; + + const char *head = text.c_str(); + const char *run = head; + + while (*run != '\0') + { + if (*run == '\'' || *run == '"' || *run == '`') + { + // Entering a quoted text. + head = run + 1; + char quote_char = *run; + while (true) + { + run = g_utf8_next_char(run); + if (*run == quote_char || *run == '\0') + break; + + // If there's an escape char skip it and the next char too (if we didn't reach the end). + if (*run == '\\') + { + run++; + if (*run != '\0') + run = g_utf8_next_char(run); + } + } + if (*run == '\0') // Unfinished quoted text. Return everything. + return head; + head = run + 1; // Skip over this quoted text and start over. + } + run++; + } + + // If we come here then we are outside any quoted text. Scan back for anything we consider + // to be a word stopper (for now anything below '0', char code wise). + while (head < run--) + { + if (*run < '0') + return run + 1; + } + return head; +} + +//-------------------------------------------------------------------------------------------------- + +void MySQLEditor::show_auto_completion(bool auto_choose_single, parser::MySQLParserContext::Ref parser_context) +{ + if (!code_completion_enabled()) + return; + + _code_editor->auto_completion_options(true, auto_choose_single, false, true, false); + + // Get the statement and its absolute position. + size_t caretPosition = _code_editor->get_caret_pos(); + size_t caretLine = _code_editor->line_from_position(caretPosition); + + ssize_t lineStart, lineEnd; + _code_editor->get_range_of_line(caretLine, lineStart, lineEnd); + size_t caretOffset = caretPosition - lineStart; // This is a byte offset. + + size_t min, max; + std::string statement; + bool fixedCaretPos = false; + if (get_current_statement_range(min, max, true)) + { + // If the caret is in the whitespaces before the query we would get a wrong line number + // (because the statement splitter doesn't include these whitespaces in the determined ranges). + // We set the caret pos to the first position in the query, which has the same effect for + // code completion (we don't generate error line numbers). + uint32_t codeStartLine = (uint32_t)_code_editor->line_from_position(min); + if (codeStartLine > caretLine) + { + caretLine = 0; + caretOffset = 0; + fixedCaretPos = true; + } + else + caretLine -= codeStartLine; + + statement = _code_editor->get_text_in_range(min, max); + } + else + { + // No query, means we have nothing typed yet in the current query (at least nothing valuable). + caretLine = 0; + caretOffset = 0; + fixedCaretPos = true; + } + + // Convert current caret position into a position of the single statement. + // The byte-based offset in the line must be converted to a character offset. + if (!fixedCaretPos) + { + std::string line_text = _code_editor->get_text_in_range(lineStart, lineEnd); + caretOffset = g_utf8_pointer_to_offset(line_text.c_str(), line_text.c_str() + caretOffset); + } + + std::string writtenPart = getWrittenPart(caretPosition); + _auto_completion_entries = getCodeCompletionList(caretLine, caretOffset, writtenPart, _current_schema, + make_keywords_uppercase(), parser_context->createScanner(statement), _editor_config->get_keywords()["Functions"], + _auto_completion_cache); + update_auto_completion(writtenPart); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Updates the auto completion list by filtering the determined entries by the text the user + * already typed. If auto completion is not yet active it becomes active here. + * Returns the list sent to the editor for unit tests to validate them. + */ +std::vector> MySQLEditor::update_auto_completion(const std::string &typed_part) +{ + logDebug2("Updating auto completion popup in editor\n"); + + // Remove all entries that don't start with the typed text before showing the list. + if (!typed_part.empty()) + { + gchar *prefix = g_utf8_casefold(typed_part.c_str(), -1); + + std::vector> filteredEntries; + for (auto &entry : _auto_completion_entries) + { + gchar *folded = g_utf8_casefold(entry.second.c_str(), -1); + if (g_str_has_prefix(folded, prefix)) + filteredEntries.push_back(entry); + g_free(folded); + } + + switch (filteredEntries.size()) + { + case 0: + logDebug2("Nothing to autocomplete - hiding popup if it was active\n"); + _code_editor->auto_completion_cancel(); + break; + case 1: + // See if that single entry matches the typed part. If so we don't need to show ac either. + if (base::same_string(filteredEntries[0].second, prefix, false)) // Exact (but case insensitive) match, not just string parts. + { + logDebug2("The only match is the same as the written input - hiding popup if it was active\n"); + _code_editor->auto_completion_cancel(); + break; + } + // Fall through. + default: + logDebug2("Showing auto completion popup\n"); + _code_editor->auto_completion_show(typed_part.size(), filteredEntries); + break; + } + + g_free(prefix); + + return filteredEntries; + } + else + { + if (!_auto_completion_entries.empty()) + { + logDebug2("Showing auto completion popup\n"); + _code_editor->auto_completion_show(0, _auto_completion_entries); + } + else + { + logDebug2("Nothing to autocomplete - hiding popup if it was active\n"); + _code_editor->auto_completion_cancel(); + } + } + + return _auto_completion_entries; +} + +//-------------------------------------------------------------------------------------------------- + +void MySQLEditor::cancel_auto_completion() +{ + // Make sure a pending timed autocompletion won't kick in after we cancel it. + d->_last_typed_char = 0; + _code_editor->auto_completion_cancel(); +} + +//-------------------------------------------------------------------------------------------------- + +void MySQLEditor::set_auto_completion_cache(MySQLObjectNamesCache *cache) +{ + logDebug2("Auto completion cache set to: %p\n", cache); + + _auto_completion_cache = cache; +} + +//-------------------------------------------------------------------------------------------------- + bool MySQLEditor::code_completion_enabled() { - return bec::GRTManager::get().get_app_option_int("DbSqlEditor:CodeCompletionEnabled") == 1; + return bec::GRTManager::get()->get_app_option_int("DbSqlEditor:CodeCompletionEnabled") == 1; } //-------------------------------------------------------------------------------------------------- bool MySQLEditor::auto_start_code_completion() { - return (bec::GRTManager::get().get_app_option_int("DbSqlEditor:AutoStartCodeCompletion") == 1) && + return (bec::GRTManager::get()->get_app_option_int("DbSqlEditor:AutoStartCodeCompletion") == 1) && (d->_autocompletion_context != NULL); } @@ -1205,7 +1424,7 @@ bool MySQLEditor::auto_start_code_completion() bool MySQLEditor::make_keywords_uppercase() { - return bec::GRTManager::get().get_app_option_int("DbSqlEditor:CodeCompletionUpperCaseKeywords") == 1; + return bec::GRTManager::get()->get_app_option_int("DbSqlEditor:CodeCompletionUpperCaseKeywords") == 1; } //-------------------------------------------------------------------------------------------------- @@ -1283,7 +1502,7 @@ void MySQLEditor::stop_processing() if (d->_current_delay_timer != NULL) { - bec::GRTManager::get().cancel_timer(d->_current_delay_timer); + bec::GRTManager::get()->cancel_timer(d->_current_delay_timer); d->_current_delay_timer = NULL; } diff --git a/backend/wbpublic/sqlide/sql_editor_be.h b/backend/wbpublic/sqlide/sql_editor_be.h index ff7ae48ec..85e40864f 100644 --- a/backend/wbpublic/sqlide/sql_editor_be.h +++ b/backend/wbpublic/sqlide/sql_editor_be.h @@ -51,33 +51,11 @@ namespace mforms { class DropDelegate; }; -class AutoCompleteCache; +class MySQLObjectNamesCache; class MySQLRecognizer; -// Identifiers for images used in auto completion lists. -// In the header file for unit tests. -#define AC_KEYWORD_IMAGE 1 -#define AC_SCHEMA_IMAGE 2 -#define AC_TABLE_IMAGE 3 -#define AC_ROUTINE_IMAGE 4 // For SQL stored procedures + functions. -#define AC_FUNCTION_IMAGE 5 // For MySQL library (runtime) functions and UDFs. -#define AC_VIEW_IMAGE 6 -#define AC_COLUMN_IMAGE 7 -#define AC_OPERATOR_IMAGE 8 -#define AC_ENGINE_IMAGE 9 -#define AC_TRIGGER_IMAGE 10 -#define AC_LOGFILE_GROUP_IMAGE 11 -#define AC_USER_VAR_IMAGE 12 -#define AC_SYSTEM_VAR_IMAGE 13 -#define AC_TABLESPACE_IMAGE 14 -#define AC_EVENT_IMAGE 15 -#define AC_INDEX_IMAGE 16 -#define AC_USER_IMAGE 17 -#define AC_CHARSET_IMAGE 18 -#define AC_COLLATION_IMAGE 19 - /** - * The central MySQL editor class. + * The legacy MySQL editor class. */ class WBPUBLICBACKEND_PUBLIC_FUNC MySQLEditor : public base::trackable @@ -95,8 +73,8 @@ class WBPUBLICBACKEND_PUBLIC_FUNC MySQLEditor : public base::trackable typedef std::shared_ptr Ref; typedef std::weak_ptr Ptr; - static Ref create(parser::ParserContext::Ref syntax_check_context, - parser::ParserContext::Ref autocopmlete_context, + static Ref create(parser::MySQLParserContext::Ref syntax_check_context, + parser::MySQLParserContext::Ref autocopmlete_context, db_query_QueryBufferRef grtobj = db_query_QueryBufferRef()); virtual ~MySQLEditor(); @@ -140,10 +118,10 @@ class WBPUBLICBACKEND_PUBLIC_FUNC MySQLEditor : public base::trackable bool is_sql_check_enabled() const; void set_sql_check_enabled(bool val); - void show_auto_completion(bool auto_choose_single, parser::ParserContext::Ref parser_context); - std::vector > update_auto_completion(const std::string &typed_part); + void show_auto_completion(bool auto_choose_single, parser::MySQLParserContext::Ref parser_context); + std::vector> update_auto_completion(const std::string &typed_part); void cancel_auto_completion(); - void set_auto_completion_cache(AutoCompleteCache *cache); + void set_auto_completion_cache(MySQLObjectNamesCache *cache); std::string selected_text(); void set_selected_text(const std::string &new_text); @@ -169,19 +147,19 @@ class WBPUBLICBACKEND_PUBLIC_FUNC MySQLEditor : public base::trackable void set_continue_on_error(bool value); protected: - MySQLEditor(parser::ParserContext::Ref syntax_check_context, - parser::ParserContext::Ref autocopmlete_context); + MySQLEditor(parser::MySQLParserContext::Ref syntax_check_context, + parser::MySQLParserContext::Ref autocopmlete_context); private: class Private; - Private *d; // d-pointer idiom. + Private *d; void set_grtobj(db_query_QueryBufferRef grtobj); void setup_auto_completion(); void* run_code_completion(); - std::string get_written_part(size_t position); + std::string getWrittenPart(size_t position); void text_changed(int position, int length, int lines_changed, bool added); void char_added(int char_code); @@ -206,12 +184,10 @@ class WBPUBLICBACKEND_PUBLIC_FUNC MySQLEditor : public base::trackable bool auto_start_code_completion(); bool make_keywords_uppercase(); - // These members are shared with sql_editor_autocomplete.cpp, so they cannot go into the private class. - // Entries determined the last time we started auto completion. The actually shown list // is derived from these entries filtered by the current input. std::vector > _auto_completion_entries; - AutoCompleteCache *_auto_completion_cache; + MySQLObjectNamesCache *_auto_completion_cache; mforms::CodeEditor* _code_editor; mforms::CodeEditorConfig *_editor_config; diff --git a/backend/wbpublic/sqlide/sql_script_run_wizard.cpp b/backend/wbpublic/sqlide/sql_script_run_wizard.cpp index efd72fb4e..f78af9264 100644 --- a/backend/wbpublic/sqlide/sql_script_run_wizard.cpp +++ b/backend/wbpublic/sqlide/sql_script_run_wizard.cpp @@ -249,19 +249,19 @@ int SqlScriptApplyPage::on_exec_stat(long success_count, long err_count) grt::ValueRef SqlScriptApplyPage::do_execute_sql_script(const std::string &sql_script) { - bec::GRTManager::get().run_once_when_idle(this, boost::bind(&SqlScriptApplyPage::add_log_text, this, "Executing:\n"+sql_script+"\n")); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&SqlScriptApplyPage::add_log_text, this, "Executing:\n"+sql_script+"\n")); apply_sql_script(sql_script); if (_err_count) { values().gset("has_errors", 1); - bec::GRTManager::get().run_once_when_idle(this, boost::bind(&SqlScriptApplyPage::add_log_text, this, _log)); + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&SqlScriptApplyPage::add_log_text, this, _log)); throw std::runtime_error(_("There was an error while applying the SQL script to the database.")); } else { - bec::GRTManager::get().run_once_when_idle(this, boost::bind(&SqlScriptApplyPage::add_log_text, + bec::GRTManager::get()->run_once_when_idle(this, boost::bind(&SqlScriptApplyPage::add_log_text, this, _("SQL script was successfully applied to the database."))); } diff --git a/backend/wbpublic/sqlide/unit-tests/mysql_objects_name_cache_test.cpp b/backend/wbpublic/sqlide/unit-tests/mysql_objects_name_cache_test.cpp new file mode 100644 index 000000000..f69882c58 --- /dev/null +++ b/backend/wbpublic/sqlide/unit-tests/mysql_objects_name_cache_test.cpp @@ -0,0 +1,340 @@ +/* + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2 of the + * License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include "connection_helpers.h" +#include "test_fixture.h" +#include "base/file_utilities.h" +#include "sqlide/wb_sql_editor_form.h" +#include "code-completion/mysql_object_names_cache.h" + +using namespace grt; +using namespace wb; +namespace ph = std::placeholders; + +BEGIN_TEST_DATA_CLASS(autocompletion_cache_test) +public: + base::RecMutex _connection_mutex; + sql::Dbc_connection_handler::Ref _conn; + MySQLObjectNamesCache *_cache; + +TEST_DATA_CONSTRUCTOR(autocompletion_cache_test) + : _conn(new sql::Dbc_connection_handler()), _cache(0) +{ + // We want to print this out only once, not for every test, so we put it here + // as this is the first test that runs usually. +#ifdef _WIN32 + TCHAR path[MAX_PATH]; + GetCurrentDirectory(MAX_PATH, path); + printf("\nTests running in: %s\n\n", base::wstring_to_string(path).c_str()); +#endif + + grt::GRT::get()->scan_metaclasses_in("../../res/grt/"); + grt::GRT::get()->end_loading_metaclasses(); + + // Because tests are executed in alphabetic order this is the first one. + // Hence we set up the sakila db in server here. + setup_sakila_db(); +} + +TEST_DATA_DESTRUCTOR(autocompletion_cache_test) +{ + // cleanup_sakila_db(); + _cache->shutdown(); + delete _cache; +} + +std::vector> runSQL(const std::string &query) +{ + std::vector> result; + + //RecMutexLock lock(ensure_valid_aux_connection()); + { + std::auto_ptr statement(_conn->ref->createStatement()); + std::auto_ptr rs(statement->executeQuery(query)); + if (rs.get()) + { + unsigned columnCount = rs->getMetaData()->getColumnCount(); + if (columnCount > 0) + { + while (rs->next()) + { + if (columnCount > 1) + result.push_back({ rs->getString(1), rs->getString(2) }); + else + result.push_back({ rs->getString(1), "" }); + } + } + } + } + + return result; +} + +END_TEST_DATA_CLASS; + +TEST_MODULE(autocompletion_cache_test, "autocompletion object name cache"); + +TEST_FUNCTION(2) +{ + db_mgmt_ConnectionRef connectionProperties(grt::Initialized); + + setup_env(connectionProperties); + + sql::DriverManager *dm= sql::DriverManager::getDriverManager(); + + _conn->ref = dm->getConnection(connectionProperties); +} + +TEST_FUNCTION(3) +{ + _cache = new MySQLObjectNamesCache(std::bind(&Test_object_base::runSQL, this, ph::_1), + std::function()); + + // Right after creation the schema list is empty. Retrieval has just been set up. + std::vector list = _cache->getMatchingSchemaNames("sakila"); + ensure("Schema list is not empty", list.empty()); + + // After creation a first data retrieval starts automatically in the background. + // Wait a moment to have that finished. + g_usleep(2000000); + + // Retrieve db objects in the sakila schema. So they are available when we ask for them + // in the following tests. + _cache->loadSchemaObjectsIfNeeded("sakila"); + g_usleep(2000000); +} + +static void ensure_list_equals(const char *what, const std::vector &list, const char **comp) +{ + std::vector::const_iterator i; + int j = 0; + try + { + for (i = list.begin(); i != list.end() && comp[j] != NULL; ++i, ++j) + { + ensure_equals(what, *i, comp[j]); + } + ensure(what, comp[j] == NULL); + ensure(what, i == list.end()); + } + catch (...) + { + // TODO: this should be part of the TUT message, otherwise we might not see it. + g_message("Result list:"); + for (i = list.begin(); i != list.end(); ++i) + g_message(" %s", i->c_str()); + g_message("Expected list:"); + for (j = 0; comp[j]; j++) + g_message(" %s", comp[j]); + throw; + } +} + + +TEST_FUNCTION(10) +{ + std::vector list = _cache->getMatchingSchemaNames(""); + int found = 0; + + // This time the schema list should contain sakila and mysql. + for (std::vector::const_iterator i = list.begin(); i != list.end(); ++i) + { + if (*i == "sakila" || *i == "mysql") + found++; + } + ensure_equals("known schema name matches", found, 2); + + // match just sakila + list = _cache->getMatchingSchemaNames("sakila"); + found = 0; + for (std::vector::const_iterator i = list.begin(); i != list.end(); ++i) + { + if (*i == "sakila" || *i == "mysql") + found++; + } + ensure_equals("known schema name matches (sakila)", found, 1); +} + +TEST_FUNCTION(12) +{ + static const char *sakila_ac[] = { + "actor", + "actor_info", + NULL + }; + static const char *sakila_actor_[] = { + "actor_info", + NULL + }; + + _cache->loadSchemaObjectsIfNeeded("sakila"); + + // Wait for the refresh to settle. The functions to check if a fetch is done + // are really unreliable and should be revised. + g_usleep(1000000); + + std::vector list = _cache->getMatchingTableNames("sakila", "ac"); + std::vector list2 = _cache->getMatchingViewNames("sakila", "ac"); + std::copy(list2.begin(), list2.end(), std::back_inserter(list)); + ensure_list_equals("tables sakila.ac*", list, sakila_ac); + + list = _cache->getMatchingTableNames("sakila", "actor_"); + list2 = _cache->getMatchingViewNames("sakila", "ac"); + std::copy(list2.begin(), list2.end(), std::back_inserter(list)); + ensure_list_equals("tables sakila.actor_*", list, sakila_actor_); +} + +TEST_FUNCTION(14) +{ + static const char *sakila_inv[] = { + "inventory_held_by_customer", + "inventory_in_stock", + NULL + }; + + std::vector list = _cache->getMatchingFunctionNames("sakila", "inv"); + ensure_list_equals("functions sakila.inv*", list, sakila_inv); +} + +TEST_FUNCTION(16) +{ + static const char *sakila_fi[] = { + "film_in_stock", + "film_not_in_stock", + NULL + }; + + std::vector list = _cache->getMatchingProcedureNames("sakila", "fi"); + ensure_list_equals("procedures sakila.fi*", list, sakila_fi); +} + + +TEST_FUNCTION(18) +{ + // columns + static const char *sakila_a[] = { + "actor_id", + NULL + }; + + std::vector list = _cache->getMatchingColumnNames("sakila", "actor", "a"); + ensure_list_equals("columns sakila.actor.a*", list, sakila_a); +} + +// Everything again reusing cache +TEST_FUNCTION(19) +{ + _cache->shutdown(); + delete _cache; + _cache = new MySQLObjectNamesCache(std::bind(&Test_object_base::runSQL, this, ph::_1), + std::function()); + + g_usleep(2000000); + + _cache->loadSchemaObjectsIfNeeded("sakila"); + g_usleep(2000000); +} + + +TEST_FUNCTION(20) +{ + std::vector list; + + list = _cache->getMatchingSchemaNames(""); + int found = 0; + + // This time the schema list should contain sakila and mysql. + for (std::vector::const_iterator i = list.begin(); i != list.end(); ++i) + { + if (*i == "sakila" || *i == "mysql") + found++; + } + ensure_equals("known schema name matches", found, 2); + + // match just sakila + list = _cache->getMatchingSchemaNames("sakila"); + found = 0; + for (std::vector::const_iterator i = list.begin(); i != list.end(); ++i) + { + if (*i == "sakila" || *i == "mysql") + found++; + } + ensure_equals("known schema name matches (sakila*)", found, 1); +} + +TEST_FUNCTION(22) +{ + static const char *sakila_ac[] = { + "actor", + "actor_info", + NULL + }; + static const char *sakila_actor_[] = { + "actor_info", + NULL + }; + + std::vector list = _cache->getMatchingTableNames("sakila", "ac"); + std::vector list2 = _cache->getMatchingViewNames("sakila", "ac"); + std::copy(list2.begin(), list2.end(), std::back_inserter(list)); + ensure_list_equals("tables sakila.ac*", list, sakila_ac); + + list = _cache->getMatchingTableNames("sakila", "actor_"); + list2 = _cache->getMatchingViewNames("sakila", "actor_"); + std::copy(list2.begin(), list2.end(), std::back_inserter(list)); + ensure_list_equals("tables sakila.actor_*", list, sakila_actor_); +} + +TEST_FUNCTION(24) +{ + static const char *sakila_inv[] = { + "inventory_held_by_customer", + "inventory_in_stock", + NULL + }; + + std::vector list = _cache->getMatchingFunctionNames("sakila", "inv"); + ensure_list_equals("functions sakila.inv*", list, sakila_inv); +} + +TEST_FUNCTION(26) +{ + static const char *sakila_fi[] = { + "film_in_stock", + "film_not_in_stock", + NULL + }; + + std::vector list = _cache->getMatchingProcedureNames("sakila", "fi"); + ensure_list_equals("procedures sakila.fi*", list, sakila_fi); +} + + +TEST_FUNCTION(28) +{ + static const char *sakila_a[] = { + "actor_id", + NULL + }; + + std::vector list = _cache->getMatchingColumnNames("sakila", "actor", "a"); + ensure_list_equals("columns sakila.actor.a*", list, sakila_a); +} + +END_TESTS diff --git a/backend/wbpublic/sqlide/unit-tests/sql_editor.cpp b/backend/wbpublic/sqlide/unit-tests/sql_editor.cpp index ab96f244f..17c534d86 100644 --- a/backend/wbpublic/sqlide/unit-tests/sql_editor.cpp +++ b/backend/wbpublic/sqlide/unit-tests/sql_editor.cpp @@ -55,7 +55,7 @@ TEST_FUNCTION(1) GrtVersionRef version = bec::parse_version("5.6.10"); version->name("MySQL Community Server (GPL)"); parser::MySQLParserServices::Ref services = parser::MySQLParserServices::get(); - parser::ParserContext::Ref parser = services->createParserContext(rdbms->characterSets(), version, 1); + parser::MySQLParserContext::Ref parser = services->createParserContext(rdbms->characterSets(), version, 1); ensure("failed to retrieve RDBMS list", rdbms_list.is_valid()); for (int n= 0, count= rdbms_list.count(); n < count; ++n) { diff --git a/backend/wbpublic/sqlide/var_grid_model_be.cpp b/backend/wbpublic/sqlide/var_grid_model_be.cpp index 498f237b5..f839ad478 100644 --- a/backend/wbpublic/sqlide/var_grid_model_be.cpp +++ b/backend/wbpublic/sqlide/var_grid_model_be.cpp @@ -103,7 +103,7 @@ void VarGridModel::reset() _data_swap_db.reset(); if (_data_swap_db_path.empty()) { - _data_swap_db_path= GRTManager::get().get_unique_tmp_subdir(); + _data_swap_db_path= GRTManager::get()->get_unique_tmp_subdir(); _data_swap_db_path.resize(_data_swap_db_path.size()-1); // remove trailing path separator _data_swap_db_path+= ".db"; @@ -141,7 +141,7 @@ int VarGridModel::floating_point_visible_scale() std::shared_ptr VarGridModel::data_swap_db() const { - if (GRTManager::get().in_main_thread()) + if (GRTManager::get()->in_main_thread()) return (_data_swap_db) ? _data_swap_db : _data_swap_db= create_data_swap_db_connection(); else return create_data_swap_db_connection(); @@ -164,10 +164,10 @@ std::shared_ptr VarGridModel::create_data_swap_db_connection int VarGridModel::refresh_ui() { - if (GRTManager::get().in_main_thread()) + if (GRTManager::get()->in_main_thread()) refresh_ui_signal(); else - _refresh_connection = GRTManager::get().run_once_when_idle(this, boost::bind(&VarGridModel::refresh_ui, this)); + _refresh_connection = GRTManager::get()->run_once_when_idle(this, boost::bind(&VarGridModel::refresh_ui, this)); return 0; } diff --git a/backend/wbpublic/wbcanvas/base_bridge.cpp b/backend/wbpublic/wbcanvas/base_bridge.cpp index b2f95a1ce..f471fe036 100644 --- a/backend/wbpublic/wbcanvas/base_bridge.cpp +++ b/backend/wbpublic/wbcanvas/base_bridge.cpp @@ -20,20 +20,14 @@ #include "base_bridge.h" #include "grt/grt_manager.h" -/** - * @file base_bridge.cpp - * @brief - */ - - bool BridgeBase::is_main_thread() { - return bec::GRTManager::get().in_main_thread(); + return bec::GRTManager::get()->in_main_thread(); } void BridgeBase::run_later(const boost::function &slot) { - bec::GRTManager::get().run_once_when_idle(this, slot); + bec::GRTManager::get()->run_once_when_idle(this, slot); } diff --git a/backend/wbpublic/wbpublic.be.vcxproj b/backend/wbpublic/wbpublic.be.vcxproj index b87af1acd..98a5268b9 100644 --- a/backend/wbpublic/wbpublic.be.vcxproj +++ b/backend/wbpublic/wbpublic.be.vcxproj @@ -128,7 +128,7 @@ Level3 Disabled true - WBPUBLICBACKEND_EXPORTS;GRT_STRUCTS_EXPORT;GRT_STRUCTS_DB_EXPORT;GRT_STRUCTS_DB_MIGRATION_EXPORT;GRT_STRUCTS_DB_MGMT_EXPORT;GRT_STRUCTS_DB_QUERY_EXPORT;GRT_STRUCTS_MODEL_EXPORT;GRT_STRUCTS_META_EXPORT;GRT_STRUCTS_WORKBENCH_MODEL_EXPORT;GRT_STRUCTS_WORKBENCH_PHYSICAL_EXPORT;GRT_STRUCTS_WORKBENCH_LOGICAL_EXPORT;GRT_STRUCTS_UI_EXPORT;SCI_NAMESPACE;GRT_STRUCTS_WRAPPER_EXPORT;CPL_DISABLE_DLL;BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE;%(PreprocessorDefinitions) + WBPUBLICBACKEND_EXPORTS;GRT_STRUCTS_EXPORT;GRT_STRUCTS_DB_EXPORT;GRT_STRUCTS_DB_MIGRATION_EXPORT;GRT_STRUCTS_DB_MGMT_EXPORT;GRT_STRUCTS_DB_QUERY_EXPORT;GRT_STRUCTS_MODEL_EXPORT;GRT_STRUCTS_META_EXPORT;GRT_STRUCTS_WORKBENCH_MODEL_EXPORT;GRT_STRUCTS_WORKBENCH_PHYSICAL_EXPORT;GRT_STRUCTS_WORKBENCH_LOGICAL_EXPORT;GRT_STRUCTS_UI_EXPORT;GRT_STRUCTS_DB_NG_EXPORT;SCI_NAMESPACE;GRT_STRUCTS_WRAPPER_EXPORT;CPL_DISABLE_DLL;BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE;%(PreprocessorDefinitions) true false Use @@ -147,7 +147,7 @@ Level3 Disabled true - WBPUBLICBACKEND_EXPORTS;GRT_STRUCTS_EXPORT;GRT_STRUCTS_DB_EXPORT;GRT_STRUCTS_DB_MIGRATION_EXPORT;GRT_STRUCTS_DB_MGMT_EXPORT;GRT_STRUCTS_DB_QUERY_EXPORT;GRT_STRUCTS_MODEL_EXPORT;GRT_STRUCTS_META_EXPORT;GRT_STRUCTS_WORKBENCH_MODEL_EXPORT;GRT_STRUCTS_WORKBENCH_PHYSICAL_EXPORT;GRT_STRUCTS_WORKBENCH_LOGICAL_EXPORT;GRT_STRUCTS_UI_EXPORT;SCI_NAMESPACE;GRT_STRUCTS_WRAPPER_EXPORT;CPL_DISABLE_DLL;BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE;%(PreprocessorDefinitions) + WBPUBLICBACKEND_EXPORTS;GRT_STRUCTS_EXPORT;GRT_STRUCTS_DB_EXPORT;GRT_STRUCTS_DB_MIGRATION_EXPORT;GRT_STRUCTS_DB_MGMT_EXPORT;GRT_STRUCTS_DB_QUERY_EXPORT;GRT_STRUCTS_MODEL_EXPORT;GRT_STRUCTS_META_EXPORT;GRT_STRUCTS_WORKBENCH_MODEL_EXPORT;GRT_STRUCTS_WORKBENCH_PHYSICAL_EXPORT;GRT_STRUCTS_WORKBENCH_LOGICAL_EXPORT;GRT_STRUCTS_UI_EXPORT;GRT_STRUCTS_DB_NG_EXPORT;SCI_NAMESPACE;GRT_STRUCTS_WRAPPER_EXPORT;CPL_DISABLE_DLL;BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE;%(PreprocessorDefinitions) true false Use @@ -172,7 +172,7 @@ true true true - WBPUBLICBACKEND_EXPORTS;GRT_STRUCTS_EXPORT;GRT_STRUCTS_DB_EXPORT;GRT_STRUCTS_DB_MIGRATION_EXPORT;GRT_STRUCTS_DB_MGMT_EXPORT;GRT_STRUCTS_DB_QUERY_EXPORT;GRT_STRUCTS_MODEL_EXPORT;GRT_STRUCTS_META_EXPORT;GRT_STRUCTS_WORKBENCH_MODEL_EXPORT;GRT_STRUCTS_WORKBENCH_PHYSICAL_EXPORT;GRT_STRUCTS_WORKBENCH_LOGICAL_EXPORT;GRT_STRUCTS_UI_EXPORT;SCI_NAMESPACE;GRT_STRUCTS_WRAPPER_EXPORT;CPL_DISABLE_DLL;BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE;%(PreprocessorDefinitions) + WBPUBLICBACKEND_EXPORTS;GRT_STRUCTS_EXPORT;GRT_STRUCTS_DB_EXPORT;GRT_STRUCTS_DB_MIGRATION_EXPORT;GRT_STRUCTS_DB_MGMT_EXPORT;GRT_STRUCTS_DB_QUERY_EXPORT;GRT_STRUCTS_MODEL_EXPORT;GRT_STRUCTS_META_EXPORT;GRT_STRUCTS_WORKBENCH_MODEL_EXPORT;GRT_STRUCTS_WORKBENCH_PHYSICAL_EXPORT;GRT_STRUCTS_WORKBENCH_LOGICAL_EXPORT;GRT_STRUCTS_UI_EXPORT;GRT_STRUCTS_DB_NG_EXPORT;SCI_NAMESPACE;GRT_STRUCTS_WRAPPER_EXPORT;CPL_DISABLE_DLL;BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE;%(PreprocessorDefinitions) true Use stdafx.h @@ -192,7 +192,7 @@ true true true - WBPUBLICBACKEND_EXPORTS;GRT_STRUCTS_EXPORT;GRT_STRUCTS_DB_EXPORT;GRT_STRUCTS_DB_MIGRATION_EXPORT;GRT_STRUCTS_DB_MGMT_EXPORT;GRT_STRUCTS_DB_QUERY_EXPORT;GRT_STRUCTS_MODEL_EXPORT;GRT_STRUCTS_META_EXPORT;GRT_STRUCTS_WORKBENCH_MODEL_EXPORT;GRT_STRUCTS_WORKBENCH_PHYSICAL_EXPORT;GRT_STRUCTS_WORKBENCH_LOGICAL_EXPORT;GRT_STRUCTS_UI_EXPORT;SCI_NAMESPACE;GRT_STRUCTS_WRAPPER_EXPORT;CPL_DISABLE_DLL;BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE;%(PreprocessorDefinitions) + WBPUBLICBACKEND_EXPORTS;GRT_STRUCTS_EXPORT;GRT_STRUCTS_DB_EXPORT;GRT_STRUCTS_DB_MIGRATION_EXPORT;GRT_STRUCTS_DB_MGMT_EXPORT;GRT_STRUCTS_DB_QUERY_EXPORT;GRT_STRUCTS_MODEL_EXPORT;GRT_STRUCTS_META_EXPORT;GRT_STRUCTS_WORKBENCH_MODEL_EXPORT;GRT_STRUCTS_WORKBENCH_PHYSICAL_EXPORT;GRT_STRUCTS_WORKBENCH_LOGICAL_EXPORT;GRT_STRUCTS_UI_EXPORT;GRT_STRUCTS_DB_NG_EXPORT;SCI_NAMESPACE;GRT_STRUCTS_WRAPPER_EXPORT;CPL_DISABLE_DLL;BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE;%(PreprocessorDefinitions) true Use stdafx.h @@ -212,7 +212,7 @@ true true true - WBPUBLICBACKEND_EXPORTS;GRT_STRUCTS_EXPORT;GRT_STRUCTS_DB_EXPORT;GRT_STRUCTS_DB_MIGRATION_EXPORT;GRT_STRUCTS_DB_MGMT_EXPORT;GRT_STRUCTS_DB_QUERY_EXPORT;GRT_STRUCTS_MODEL_EXPORT;GRT_STRUCTS_META_EXPORT;GRT_STRUCTS_WORKBENCH_MODEL_EXPORT;GRT_STRUCTS_WORKBENCH_PHYSICAL_EXPORT;GRT_STRUCTS_WORKBENCH_LOGICAL_EXPORT;GRT_STRUCTS_UI_EXPORT;SCI_NAMESPACE;GRT_STRUCTS_WRAPPER_EXPORT;CPL_DISABLE_DLL;BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE;%(PreprocessorDefinitions) + WBPUBLICBACKEND_EXPORTS;GRT_STRUCTS_EXPORT;GRT_STRUCTS_DB_EXPORT;GRT_STRUCTS_DB_MIGRATION_EXPORT;GRT_STRUCTS_DB_MGMT_EXPORT;GRT_STRUCTS_DB_QUERY_EXPORT;GRT_STRUCTS_MODEL_EXPORT;GRT_STRUCTS_META_EXPORT;GRT_STRUCTS_WORKBENCH_MODEL_EXPORT;GRT_STRUCTS_WORKBENCH_PHYSICAL_EXPORT;GRT_STRUCTS_WORKBENCH_LOGICAL_EXPORT;GRT_STRUCTS_UI_EXPORT;GRT_STRUCTS_DB_NG_EXPORT;SCI_NAMESPACE;GRT_STRUCTS_WRAPPER_EXPORT;CPL_DISABLE_DLL;BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE;%(PreprocessorDefinitions) true Use stdafx.h @@ -232,7 +232,7 @@ true true true - WBPUBLICBACKEND_EXPORTS;GRT_STRUCTS_EXPORT;GRT_STRUCTS_DB_EXPORT;GRT_STRUCTS_DB_MIGRATION_EXPORT;GRT_STRUCTS_DB_MGMT_EXPORT;GRT_STRUCTS_DB_QUERY_EXPORT;GRT_STRUCTS_MODEL_EXPORT;GRT_STRUCTS_META_EXPORT;GRT_STRUCTS_WORKBENCH_MODEL_EXPORT;GRT_STRUCTS_WORKBENCH_PHYSICAL_EXPORT;GRT_STRUCTS_WORKBENCH_LOGICAL_EXPORT;GRT_STRUCTS_UI_EXPORT;SCI_NAMESPACE;GRT_STRUCTS_WRAPPER_EXPORT;CPL_DISABLE_DLL;BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE;%(PreprocessorDefinitions) + WBPUBLICBACKEND_EXPORTS;GRT_STRUCTS_EXPORT;GRT_STRUCTS_DB_EXPORT;GRT_STRUCTS_DB_MIGRATION_EXPORT;GRT_STRUCTS_DB_MGMT_EXPORT;GRT_STRUCTS_DB_QUERY_EXPORT;GRT_STRUCTS_MODEL_EXPORT;GRT_STRUCTS_META_EXPORT;GRT_STRUCTS_WORKBENCH_MODEL_EXPORT;GRT_STRUCTS_WORKBENCH_PHYSICAL_EXPORT;GRT_STRUCTS_WORKBENCH_LOGICAL_EXPORT;GRT_STRUCTS_UI_EXPORT;GRT_STRUCTS_DB_NG_EXPORT;SCI_NAMESPACE;GRT_STRUCTS_WRAPPER_EXPORT;CPL_DISABLE_DLL;BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE;%(PreprocessorDefinitions) true Use stdafx.h @@ -313,6 +313,9 @@ + + + @@ -348,24 +351,7 @@ - - - CompileAsCpp - CompileAsCpp - CompileAsCpp - CompileAsCpp - CompileAsCpp - CompileAsCpp - - - CompileAsCpp - CompileAsCpp - CompileAsCpp - CompileAsCpp - CompileAsCpp - CompileAsCpp - @@ -375,7 +361,6 @@ - @@ -422,6 +407,7 @@ + @@ -458,6 +444,7 @@ + @@ -512,6 +499,9 @@ + + + @@ -520,10 +510,7 @@ - - - diff --git a/backend/wbpublic/wbpublic.be.vcxproj.filters b/backend/wbpublic/wbpublic.be.vcxproj.filters index 24caa8f35..cef917c6a 100644 --- a/backend/wbpublic/wbpublic.be.vcxproj.filters +++ b/backend/wbpublic/wbpublic.be.vcxproj.filters @@ -44,8 +44,11 @@ {a8aae8af-d1d2-4571-91c8-3b27a2947f4b} - - {13e5081a-ffb1-4d4d-ac60-3f8ae3ca0387} + + {e3157aa3-6318-44b3-9110-47224057c79e} + + + {1252ad35-b208-4eba-b39f-69836165f44d} @@ -341,9 +344,6 @@ grtui Header Files - - sqlide Header Files - sqlide Header Files @@ -488,11 +488,20 @@ grtui Header Files - - grammar parser + + grtsqlparser Header Files - - grammar parser + + db_ng Header Files + + + db_ng Header Files + + + db_ng Header Files + + + Generated Header Files @@ -782,9 +791,6 @@ grtui Source Files - - sqlide Source Files - sqlide Source Files @@ -809,9 +815,6 @@ sqlide Source Files - - sqlide Source Files - sqlide Source Files @@ -929,11 +932,14 @@ grtui Source Files - - grammar parser + + db_ng Source Files + + + db_ng Source Files - - grammar parser + + db_ng Source Files - + \ No newline at end of file diff --git a/backend/windows/sqlide.wr/src/SQLEditorFormWrapper.h b/backend/windows/sqlide.wr/src/SQLEditorFormWrapper.h index 026869b7a..84c78733e 100644 --- a/backend/windows/sqlide.wr/src/SQLEditorFormWrapper.h +++ b/backend/windows/sqlide.wr/src/SQLEditorFormWrapper.h @@ -18,10 +18,12 @@ */ #pragma once - +#pragma unmanaged +#include "sqlide/wb_sql_editor_tree_controller.h" #include "sqlide/wb_sql_editor_form.h" #include "sqlide/wb_sql_editor_panel.h" +#pragma managed #include "db_sql_editor_history_wr.h" #include "Overview.h" @@ -51,7 +53,7 @@ public ref class SqlEditorFormWrapper : public MySQL::Base::UIForm MySQL::Grt::ActionList ^action_list; - GrtManager ^ grt_manager() { return gcnew GrtManager(&bec::GRTManager::get()); } + GrtManager ^ grt_manager() { return gcnew GrtManager(); } void new_sql_script_file() { (*_ref)->new_sql_script_file(); } diff --git a/backend/windows/sqlide.wr/src/recordset_wr.cpp b/backend/windows/sqlide.wr/src/recordset_wr.cpp index 1d7888342..76f0d4ec0 100644 --- a/backend/windows/sqlide.wr/src/recordset_wr.cpp +++ b/backend/windows/sqlide.wr/src/recordset_wr.cpp @@ -24,7 +24,7 @@ using namespace System::Collections::Generic; #include "GrtTemplates.h" #include "DelegateWrapper.h" #include "IconManager.h" -#include "Grt.h" +#include "GrtWrapper.h" #include "ModelWrappers.h" #include "var_grid_model_wr.h" #include "ActionList.h" diff --git a/backend/windows/wbprivate.wr/src/WbCallbacks.cpp b/backend/windows/wbprivate.wr/src/WbCallbacks.cpp index fd05ae86e..be828b8ea 100644 --- a/backend/windows/wbprivate.wr/src/WbCallbacks.cpp +++ b/backend/windows/wbprivate.wr/src/WbCallbacks.cpp @@ -307,7 +307,7 @@ uintptr_t WbFrontendCallbacks::open_editor_wrapper(grt::Module *module, const std::string& str2, const std::string& str3, const grt::BaseListRef &grt_list, bec::GUIPluginFlags flags) { - return (uintptr_t)open_editor_delegate(gcnew GrtManager(&bec::GRTManager::get()), gcnew GrtModule(module), + return (uintptr_t)open_editor_delegate(gcnew GrtManager(), gcnew GrtModule(module), CppStringToNative(str2), CppStringToNative(str3), gcnew GrtValue(grt_list), (GUIPluginFlags)flags).ToPointer(); } diff --git a/backend/windows/wbpublic.wr/src/DelegateWrapper.h b/backend/windows/wbpublic.wr/src/DelegateWrapper.h index 911f1c236..e9392f137 100644 --- a/backend/windows/wbpublic.wr/src/DelegateWrapper.h +++ b/backend/windows/wbpublic.wr/src/DelegateWrapper.h @@ -22,7 +22,7 @@ #include -#include "sqlide/recordset_be.h" +#include "sqlide/recordset_data_storage.h" using namespace System; using namespace System::Runtime::InteropServices; diff --git a/backend/windows/wbpublic.wr/src/GrtManager.h b/backend/windows/wbpublic.wr/src/GrtManager.h index 345584d30..5ed79c03a 100644 --- a/backend/windows/wbpublic.wr/src/GrtManager.h +++ b/backend/windows/wbpublic.wr/src/GrtManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -51,10 +51,6 @@ namespace MySQL { : managed_shell(nullptr), managed_grt(nullptr) {} - GrtManager(::bec::GRTManager *grt_manager) - : managed_grt(nullptr) - {} - explicit GrtManager() : managed_grt(nullptr) {} @@ -69,23 +65,23 @@ namespace MySQL { String^ get_app_option_string(String^ option_name) { - return CppStringToNative(::bec::GRTManager::get().get_app_option_string(NativeToCppString(option_name))); + return CppStringToNative(::bec::GRTManager::get()->get_app_option_string(NativeToCppString(option_name))); } Font^ get_font_option(String^ option_name) { - String^ font_string = CppStringToNative(::bec::GRTManager::get().get_app_option_string(NativeToCppString(option_name))); + String^ font_string = CppStringToNative(::bec::GRTManager::get()->get_app_option_string(NativeToCppString(option_name))); return MySQL::Utilities::ControlUtilities::GetFont(font_string); } void set_module_extensions(List^ extensions) { - ::bec::GRTManager::get().set_module_extensions(NativeToCppStringList2(extensions)); + ::bec::GRTManager::get()->set_module_extensions(NativeToCppStringList2(extensions)); } void set_search_paths(String^ module_sp, String^ struct_sp, String^ libs_sp) { - ::bec::GRTManager::get().set_search_paths( + ::bec::GRTManager::get()->set_search_paths( NativeToCppString(module_sp), NativeToCppString(struct_sp), NativeToCppString(libs_sp)); @@ -100,35 +96,35 @@ namespace MySQL { void initialize() { - ::bec::GRTManager::get().initialize(true); + ::bec::GRTManager::get()->initialize(true); } void perform_idle_tasks() { - ::bec::GRTManager::get().perform_idle_tasks(); + ::bec::GRTManager::get()->perform_idle_tasks(); } void rescan_modules() { - ::bec::GRTManager::get().rescan_modules(); + ::bec::GRTManager::get()->rescan_modules(); } // shell GrtShell^ get_shell() { if(managed_shell == nullptr) - managed_shell = gcnew GrtShell(::bec::GRTManager::get().get_shell()); + managed_shell = gcnew GrtShell(::bec::GRTManager::get()->get_shell()); return managed_shell; } - void terminate() { bec::GRTManager::get().terminate(); }; - bool terminated() { return ::bec::GRTManager::get().terminated(); }; - void resetTermination() { ::bec::GRTManager::get().reset_termination(); }; + void terminate() { bec::GRTManager::get()->terminate(); }; + bool terminated() { return ::bec::GRTManager::get()->terminated(); }; + void resetTermination() { ::bec::GRTManager::get()->reset_termination(); }; - bool try_soft_lock_globals_tree() { return ::bec::GRTManager::get().try_soft_lock_globals_tree(); }; - void soft_lock_globals_tree() { ::bec::GRTManager::get().soft_lock_globals_tree(); }; - void soft_unlock_globals_tree() { ::bec::GRTManager::get().soft_unlock_globals_tree(); }; - bool is_globals_tree_locked() { return ::bec::GRTManager::get().is_globals_tree_locked(); }; + bool try_soft_lock_globals_tree() { return ::bec::GRTManager::get()->try_soft_lock_globals_tree(); }; + void soft_lock_globals_tree() { ::bec::GRTManager::get()->soft_lock_globals_tree(); }; + void soft_unlock_globals_tree() { ::bec::GRTManager::get()->soft_unlock_globals_tree(); }; + bool is_globals_tree_locked() { return ::bec::GRTManager::get()->is_globals_tree_locked(); }; }; diff --git a/build/debian.in/changelog b/build/debian.in/changelog index a79552d60..72dea1633 100644 --- a/build/debian.in/changelog +++ b/build/debian.in/changelog @@ -1,32 +1,9 @@ -mysql-workbench-@edition@ (6.3.8-1@distrov@) @distro@; urgency=low +mysql-workbench-@edition@ (7.0.0-1@distrov@) @distro@; urgency=low * New release - -- Mike Lischke (mike.lischke@oracle.com) Di, 14 Jun 2016 11:14:47 +0200 + -- Marcin Szalowicz Fri, 20 Mar 2015 12:00:00 +0100 -mysql-workbench-@edition@ (6.3.7-1@distrov@) @distro@; urgency=low - - * New release - - -- Milosz Bodzek Mon, 09 May 2016 14:54:36 +0200 - -mysql-workbench-@edition@ (6.3.6-1@distrov@) @distro@; urgency=low - - * New release - - -- Marcin SzaÅ‚owicz Thu, 19 November 2015 12:00:00 +0100 - -mysql-workbench-@edition@ (6.3.5-1@distrov@) @distro@; urgency=low - - * New release - - -- Mike Lischke Wed, 17 June 2015 12:00:00 +0100 - -mysql-workbench-@edition@ (6.3.4-1@distrov@) @distro@; urgency=low - - * New release - - -- Mike Lischke Wed, 13 May 2015 12:00:00 +0100 mysql-workbench-@edition@ (6.3.3-1@distrov@) @distro@; urgency=low diff --git a/build/debian.in/control b/build/debian.in/control index cafa1886b..78efafc46 100644 --- a/build/debian.in/control +++ b/build/debian.in/control @@ -2,7 +2,7 @@ Source: mysql-workbench-@edition@ Section: utils Priority: extra Maintainer: MySQL Workbench team -Build-Depends: debhelper (>= 5), libzip-dev, libgtkmm-2.4-dev, libxml2-dev, libgl1-mesa-dev, libpcre3-dev, python-dev (>= 2.5), libgnome-keyring-dev, libsqlite3-dev, libboost-dev, xdg-utils, libctemplate-dev, cmake, libtinyxml-dev, swig (>= 1.3), libproj-dev, cmake, build-essential, autoconf, autogen +Build-Depends: debhelper (>= 5), libzip-dev, libgtkmm-3.0-dev, libxml2-dev, libgl1-mesa-dev, libpcre3-dev, python-dev (>= 2.6), libgnome-keyring-dev, libsqlite3-dev, libboost-dev, xdg-utils, libctemplate-dev, cmake, libtinyxml-dev, swig (>= 1.3), libproj-dev, cmake, build-essential, autoconf, autogen Standards-Version: 3.7.2 Homepage: http://dev.mysql.com/workbench/ diff --git a/build/debian.in/rules b/build/debian.in/rules index 6d3f515ab..a45a40f4d 100755 --- a/build/debian.in/rules +++ b/build/debian.in/rules @@ -1,6 +1,6 @@ #!/usr/bin/make -f -# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,31 +28,50 @@ INSTALL_PREFIX=/usr +ifndef LINUXRES_HOME LINUXRES_HOME=$(HOME)/linux-res +endif + LINUXRES_BINARIES=$(LINUXRES_HOME)/builds -ODBC_HOME=$(LINUXRES_BINARIES)/odbc/usr/local +ifndef ANTLR_JAR_PATH +ANTLR_JAR_PATH=$(LINUXRES_HOME)/bin/antlr-3.4-complete.jar +endif + +ifndef BOOST_ROOT +BOOST_ROOT=$(LINUXRES_HOME) +endif -SQLITE_HOME=$(LINUXRES_BINARIES)/sqlite -PYSQLITE2_HOME=$(LINUXRES_BINARIES)/pysqlite2 +ODBC_HOME=$(LINUXRES_BINARIES)/odbc PYODBC_HOME=$(LINUXRES_BINARIES)/pyodbc -CTEMPLATE_HOME=$(LINUXRES_BINARIES)/ctemplate/usr/local +CTEMPLATE_HOME=$(LINUXRES_BINARIES)/ctemplate @ifdef community -CPPCONN_HOME=$(LINUXRES_BINARIES)/cppconn-gpl/usr/local -GDAL_HOME=$(LINUXRES_BINARIES)/gdal-gpl/usr/local -VSQLITE_HOME=$(LINUXRES_BINARIES)/vsqlite-gpl/usr/local +SQLITE_HOME=$(LINUXRES_BINARIES)/sqlite-gpl +PYSQLITE2_HOME=$(LINUXRES_BINARIES)/pysqlite2-gpl +CPPCONN_HOME=$(LINUXRES_BINARIES)/cppconn-gpl +GDAL_HOME=$(LINUXRES_BINARIES)/gdal-gpl +VSQLITE_HOME=$(LINUXRES_BINARIES)/vsqlite-gpl +NGSHELL_HOME=$(LINUXRES_BINARIES)/ngshell-gpl +ifndef MYSQL_HOME MYSQL_HOME=$(HOME)/mysql-server/ +endif @else -CPPCONN_HOME=$(LINUXRES_BINARIES)/cppconn-com/usr/local -GDAL_HOME=$(LINUXRES_BINARIES)/gdal-com/usr/local -VSQLITE_HOME=$(LINUXRES_BINARIES)/vsqlite-com/usr/local +SQLITE_HOME=$(LINUXRES_BINARIES)/sqlite-com +PYSQLITE2_HOME=$(LINUXRES_BINARIES)/pysqlite2-com +CPPCONN_HOME=$(LINUXRES_BINARIES)/cppconn-com +GDAL_HOME=$(LINUXRES_BINARIES)/gdal-com +VSQLITE_HOME=$(LINUXRES_BINARIES)/vsqlite-com +NGSHELL_HOME=$(LINUXRES_BINARIES)/ngshell-com +ifndef MYSQL_HOME MYSQL_HOME=$(HOME)/mysql-server-advanced/ +endif @endif WBDIRNAME=mysql-workbench-@edition@ WBLIBPATH=$(INSTALL_PREFIX)/lib/mysql-workbench +WBLIBXPATH=$(INSTALL_PREFIX)/lib/workbench.x WBDATADIRPATH=$(INSTALL_PREFIX)/share/mysql-workbench WBDOCPATH=$(INSTALL_PREFIX)/share/doc/mysql-workbench-@edition@ @@ -60,23 +79,28 @@ configure: configure-stamp configure-stamp: dh_testdir # Add here commands to configure the package. -@ifversion >= 1604 CXXFLAGS="-std=c++11 $(CXXFLAGS)" \ -@endif - cmake . -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX) -DCMAKE_BUILD_TYPE=Release \ - -DMySQL_CONFIG_PATH=$(MYSQL_HOME)/bin/mysql_config -DUSE_BUNDLED_MYSQLDUMP=1 \ - -DMYSQLCPPCONN_LIBRARY="-L$(CPPCONN_HOME)/lib -lmysqlcppconn" \ - -DMYSQLCPPCONN_INCLUDE_DIR=$(CPPCONN_HOME)/include \ - -DGDAL_INCLUDE_DIR=$(GDAL_HOME)/include -DGDAL_LIBRARY=$(GDAL_HOME)/lib/libgdal.so \ - -DCTemplate_INCLUDE_DIR=${CTEMPLATE_HOME}/include \ - -DCTemplate_LIBRARIES="-L${CTEMPLATE_HOME}/lib -lctemplate"\ -@ifdef community - -DIODBC_CONFIG_PATH=$(ODBC_HOME)/bin/iodbc-config -@else - -DIODBC_CONFIG_PATH=$(ODBC_HOME)/bin/iodbc-config \ - -DVSQLITE_INCLUDE_DIR=$(VSQLITE_HOME)/include \ - -DVSQLITE_LIBRARIES="-L$(VSQLITE_HOME)/lib -lvsqlitepp" -@endif + ANTLR_JAR_PATH=$(ANTLR_JAR_PATH) \ + BOOST_ROOT=$(BOOST_ROOT) \ + cmake . \ + -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX) \ + -DCMAKE_BUILD_TYPE=Release \ + -DMySQL_CONFIG_PATH=$(MYSQL_HOME)/bin/mysql_config \ + -DUSE_BUNDLED_MYSQLDUMP=1 \ + -DMYSQLCLIENT_STATIC_LINKING:BOOL=TRUE \ + -DMYSQLCPPCONN_LIBRARY="-L$(CPPCONN_HOME)/lib -lmysqlcppconn" \ + -DMYSQLCPPCONN_INCLUDE_DIR=$(CPPCONN_HOME)/include \ + -DMYSQLNG_LIBRARIES=$(NGSHELL_HOME)/lib \ + -DMYSQLNG_INCLUDE_DIR=$(NGSHELL_HOME)/include/mysqlsh \ + -DGDAL_INCLUDE_DIR=$(GDAL_HOME)/include \ + -DGDAL_LIBRARY=$(GDAL_HOME)/lib/libgdal.so \ + -DIODBC_CONFIG_PATH=$(ODBC_HOME)/bin/iodbc-config \ + -DIODBC_INCLUDE_PATH=$(ODBC_HOME)/include \ + -DIODBC_LIBRARIES_PATH=$(ODBC_HOME)/lib \ + -DVSQLITE_INCLUDE_DIR=$(VSQLITE_HOME)/include \ + -DVSQLITE_LIBRARIES="-L$(VSQLITE_HOME)/lib -lvsqlitepp" \ + -DCTemplate_INCLUDE_DIR=${CTEMPLATE_HOME}/include \ + -DCTemplate_LIBRARIES="-L${CTEMPLATE_HOME}/lib -lctemplate" touch configure-stamp @@ -112,36 +136,32 @@ install: build # Add here commands to install the package into debian/mysql-workbench. DESTDIR=debian/$(WBDIRNAME) $(MAKE) install - # Bundle pyodbc and iodbc - cp -a $(ODBC_HOME)/bin/iodbcadm-gtk $(CURDIR)/debian/$(WBDIRNAME)/$(WBLIBPATH) - cp -a $(ODBC_HOME)/lib/libiodbc*.so.* $(CURDIR)/debian/$(WBDIRNAME)/$(WBLIBPATH) - cp -a $(PYODBC_HOME)/pyodbc.so $(CURDIR)/debian/$(WBDIRNAME)/$(WBLIBPATH) - # Bundle other unpackaged libs - cp -a $(VSQLITE_HOME)/lib/libvsqlitepp.* $(CURDIR)/debian/$(WBDIRNAME)/$(WBLIBPATH) - cp -a $(CPPCONN_HOME)/lib/libmysqlcppconn.* $(CURDIR)/debian/$(WBDIRNAME)/$(WBLIBPATH) - cp -a $(GDAL_HOME)/lib/libgdal* $(CURDIR)/debian/$(WBDIRNAME)/$(WBLIBPATH) - cp -a $(CTEMPLATE_HOME)/lib/libctemplate* $(CURDIR)/debian/$(WBDIRNAME)/$(WBLIBPATH) -@ifdef commercial - # Bundle libs only needed for SE edition - cp -a $(SQLITE_HOME)/libsqlite3.so $(CURDIR)/debian/$(WBDIRNAME)/$(WBLIBPATH) - cp -a $(PYSQLITE2_HOME) $(CURDIR)/debian/$(WBDIRNAME)/$(WBLIBPATH)/modules/ -@endif + # Bundle libaries + cp -a $(ODBC_HOME)/bin/iodbcadm-gtk $(CURDIR)/debian/$(WBDIRNAME)$(WBLIBPATH) + cp -a $(ODBC_HOME)/lib/libiodbc*.so.* $(CURDIR)/debian/$(WBDIRNAME)$(WBLIBPATH) + cp -a $(PYODBC_HOME)/pyodbc.so $(CURDIR)/debian/$(WBDIRNAME)$(WBLIBPATH) + cp -a $(VSQLITE_HOME)/lib/libvsqlitepp.* $(CURDIR)/debian/$(WBDIRNAME)$(WBLIBPATH) + cp -a $(CPPCONN_HOME)/lib/libmysqlcppconn.* $(CURDIR)/debian/$(WBDIRNAME)$(WBLIBPATH) + cp -a $(GDAL_HOME)/lib/libgdal* $(CURDIR)/debian/$(WBDIRNAME)$(WBLIBPATH) + cp -a $(CTEMPLATE_HOME)/lib/libctemplate* $(CURDIR)/debian/$(WBDIRNAME)$(WBLIBPATH) + cp -a $(SQLITE_HOME)/lib/libsqlite3.so* $(CURDIR)/debian/$(WBDIRNAME)$(WBLIBPATH) + cp -a $(PYSQLITE2_HOME) $(CURDIR)/debian/$(WBDIRNAME)$(WBLIBPATH)/modules/ @ifdef paramiko #bundle paramiko based on the param - cp -a $(LINUXRES_HOME)/python/paramiko $(CURDIR)/debian/$(WBDIRNAME)/$(WBLIBPATH)/modules/ - cp -a $(LINUXRES_HOME)/python/ecdsa $(CURDIR)/debian/$(WBDIRNAME)/$(WBLIBPATH)/modules/ + cp -a $(LINUXRES_HOME)/python/paramiko $(CURDIR)/debian/$(WBDIRNAME)$(WBLIBPATH)/modules/ + cp -a $(LINUXRES_HOME)/python/ecdsa $(CURDIR)/debian/$(WBDIRNAME)$(WBLIBPATH)/modules/ @endif # Bundle client programs and lib - cp -a $(MYSQL_HOME)/lib/libmysqlclient.so.* $(CURDIR)/debian/$(WBDIRNAME)/$(WBLIBPATH) - cp -a $(MYSQL_HOME)/bin/mysql $(CURDIR)/debian/$(WBDIRNAME)/$(WBLIBPATH) - cp -a $(MYSQL_HOME)/bin/mysqldump $(CURDIR)/debian/$(WBDIRNAME)/$(WBLIBPATH) +# cp -a $(MYSQL_HOME)/lib/libmysqlclient.so.* $(CURDIR)/debian/$(WBDIRNAME)$(WBLIBPATH) + cp -a $(MYSQL_HOME)/bin/mysql $(CURDIR)/debian/$(WBDIRNAME)$(WBLIBPATH) + cp -a $(MYSQL_HOME)/bin/mysqldump $(CURDIR)/debian/$(WBDIRNAME)$(WBLIBPATH) # Remove these files: # - The file /etc/ld.so.conf.d/mysql-workbench.conf is a non.conformance in debian based distros # - The .la metadata files are not necessary - rm $(CURDIR)/debian/$(WBDIRNAME)/$(WBLIBPATH)/*.la + rm -f $(CURDIR)/debian/$(WBDIRNAME)$(WBLIBPATH)/*.la rm -rf $(CURDIR)/debian/$(WBDIRNAME)/etc # Build architecture-independent files here. @@ -175,7 +195,9 @@ binary-arch: build install # dh_perl # dh_makeshlibs dh_installdeb - dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info -l$(CURDIR)/debian/$(WBDIRNAME)/$(WBLIBPATH) + dh_shlibdeps \ + --dpkg-shlibdeps-params=--ignore-missing-info \ + -l$(CURDIR)/debian/$(WBDIRNAME)$(WBLIBPATH):$(CURDIR)/debian/$(WBDIRNAME)$(WBLIBXPATH) dh_gencontrol dh_md5sums dh_builddeb diff --git a/build/gen_deb_sources.py b/build/gen_deb_sources.py index 34e16b844..89320243a 100644 --- a/build/gen_deb_sources.py +++ b/build/gen_deb_sources.py @@ -4,7 +4,11 @@ # from the input debian.in directory contents -output_distros = [("xenial", "ubu1604", ""), ("wily", "ubu1510", ""), ("vivid", "ubu1504", ""), ("utopic", "ubu1410", 'paramiko'), ("trusty", "ubu1404",'paramiko'), ("precise", "ubu1204", 'paramiko')] +output_distros = [ + ("xenial" ,"ubuntu16.04" ,"1604" ,""), + ("trusty" ,"ubuntu14.04" ,"1404" ,"paramiko"), + ("jessie" ,"debian8" ,"8" ,""), +] editions = ["community", "commercial"] @@ -87,13 +91,13 @@ def generate_distro(source_dir, vars): print target_dir, "generated" -for distro, distro_version, bundle in output_distros: +for distro, distro_version, version, bundle in output_distros: for edition in editions: vars = {} vars['distro'] = distro vars['distrov'] = distro_version vars['edition'] = edition vars['bundle'] = bundle - vars['version'] = distro_version.replace('ubu', '') + vars['version'] = version generate_distro("debian.in", vars) diff --git a/build/make_dmg.sh b/build/make_dmg.sh index 51ff59043..f7fa96229 100755 --- a/build/make_dmg.sh +++ b/build/make_dmg.sh @@ -1,6 +1,7 @@ #!/bin/sh app="MySQLWorkbench.app" +appx="MySQLWorkbench.X.app" srcdir="DerivedData/MySQLWorkbench/Build/Products/Release" edition=$1 ver=$2 @@ -25,7 +26,7 @@ echo "Packaging $finaldmg" echo "Attaching template $templatedmg" hdiutil attach "$templatedmg" -noautoopen -mountpoint template -echo "Copying app" +echo "Copying apps" rm -fr "template/$app" ditto "$srcdir/$app" "template/$app" if [ $? -ne 0 ]; then @@ -34,6 +35,14 @@ if [ $? -ne 0 ]; then exit 1 fi +rm -fr "template/$appx" +ditto "$srcdir/$appx" "template/$appx" +if [ $? -ne 0 ]; then + hdiutil detach template -force -quiet + echo "Could not copy X.app to template dmg" + exit 1 +fi + echo "Copying background image" cp build/mac/background.tiff template/ chflags hidden template/background.tiff diff --git a/build/msi/resources/MySQLWorkbench.X.ico b/build/msi/resources/MySQLWorkbench.X.ico new file mode 100644 index 0000000000000000000000000000000000000000..367abffc3e84391f22484eef8912f102e8f63a0d GIT binary patch literal 44189 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̤om~ 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 IEIjD{0O4aeqyPW_ literal 0 HcmV?d00001 diff --git a/build/msi/source/mysql_workbench.xml b/build/msi/source/mysql_workbench.xml index 6e9128e44..13791d1c1 100644 --- a/build/msi/source/mysql_workbench.xml +++ b/build/msi/source/mysql_workbench.xml @@ -142,6 +142,7 @@ + diff --git a/build/msi/source/mysql_workbench_fragment.xml b/build/msi/source/mysql_workbench_fragment.xml index c5c3b058c..513713f7a 100644 --- a/build/msi/source/mysql_workbench_fragment.xml +++ b/build/msi/source/mysql_workbench_fragment.xml @@ -1,10 +1,13 @@ + + + @@ -22,6 +25,7 @@ --> + %s - [STARTED] %s\n", format_time(0).data(), message.data()); + logDebug("---> %s - [STARTED] %s\n", format_time(0).data(), message.data()); } //------------------------------------------------------------------------------------- void StopWatch::lap(const std::string& message) @@ -71,7 +71,7 @@ void StopWatch::lap(const std::string& message) clock_t diff = _end - _lap_start; - log_debug("---> %s - [LAP] %s\n", format_time(diff).data(), message.data()); + logDebug("---> %s - [LAP] %s\n", format_time(diff).data(), message.data()); _lap_start = _end; } @@ -85,7 +85,7 @@ void StopWatch::stop(const std::string& message) clock_t diff = _end - _start; - log_debug("---> %s - [COMPLETED] %s\n", format_time(diff).data(), message.data()); + logDebug("---> %s - [COMPLETED] %s\n", format_time(diff).data(), message.data()); } } @@ -116,11 +116,11 @@ void TimeAccumulator::dump(const std::string& message) { std::map::const_iterator index, end = _accumulators.end(); - log_debug("Dumping data for : %s\n", message.data()); + logDebug("Dumping data for : %s\n", message.data()); for(index = _accumulators.begin(); index != end; index++) { - log_debug("--->Time on accumulator %s : %lf\n", index->first.data(), index->second / CLOCKS_PER_SEC); + logDebug("--->Time on accumulator %s : %lf\n", index->first.data(), index->second / CLOCKS_PER_SEC); } } //------------------------------------------------------------------------------------- diff --git a/library/base/session_wrapper.cpp b/library/base/session_wrapper.cpp new file mode 100644 index 000000000..e3dcf6c53 --- /dev/null +++ b/library/base/session_wrapper.cpp @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2 of the + * License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include "base/session_wrapper.h" + +#include "shellcore/types.h" +#include "shellcore/shell_registry.h" +#include "utils/utils_file.h" +#include "modules/mysqlxtest_utils.h" +#include "base/string_utilities.h" + +dataTypes::ProjectHolder ng::loadNgSessions() +{ + shcore::Server_registry sr(shcore::get_default_config_path()); + + try { + sr.load(); + } catch (...) + { + translate_crud_exception("ShellRegistry.load"); + } + + dataTypes::ProjectHolder holder; + for (std::map::const_iterator it = sr.begin(); it != sr.end(); ++it) + { + const shcore::Connection_options& cs = it->second; + + dataTypes::ProjectHolder entry; + entry.name = cs.get_name(); + entry.project.name = cs.get_name(); + entry.project.connection.hostName = cs.get_server(); + entry.project.connection.userName = cs.get_user(); + entry.project.connection.port = base::atoi(cs.get_port()); + entry.project.connection.uuid = cs.get_uuid(); + + holder.children.push_back(entry); + } + +// dataTypes::ProjectHolder holder; +// for (auto item : *(shcore::StoredSessions::get_instance()->connections())) +// { +// dataTypes::ProjectHolder entry; +// shcore::Value::Map_type_ref connection = item.second.as_map(); +// entry.name = item.first; +// entry.project.name = item.first; +// entry.project.connection.hostName = (*connection)["host"].as_string(); +// entry.project.connection.userName = (*connection)["dbUser"].as_string(); +// entry.project.connection.port = (*connection)["port"].as_int(); +// (*connection). +// holder.children.push_back(entry); +// } + + return holder; +} + +bool ng::storeNgSession(const dataTypes::XProject &project) +{ + return shcore::StoredSessions::get_instance()->add_connection(project.name, project.connection.uri(false)); +} + +bool ng::deleteNgSession(const dataTypes::XProject &project) +{ + return shcore::StoredSessions::get_instance()->remove_connection(project.name); +} + +dataTypes::XProject ng::getSessionByUUID(const std::string &uuid) +{ + shcore::Server_registry sr(shcore::get_default_config_path()); + + try { + sr.load(); + } catch (...) + { + translate_crud_exception("ShellRegistry.load"); + } + + dataTypes::XProject project; + for (std::map::const_iterator it = sr.begin(); it != sr.end(); ++it) + { + const shcore::Connection_options& cs = it->second; + if (cs.get_uuid() == uuid) + { + project.name = cs.get_name(); + project.connection.hostName = cs.get_server(); + project.connection.userName = cs.get_user(); + project.connection.port = base::atoi(cs.get_port()); + project.connection.uuid = cs.get_uuid(); + break; + } + } + return project; +} diff --git a/library/base/stdafx.h b/library/base/stdafx.h index 088fc6138..f73829724 100644 --- a/library/base/stdafx.h +++ b/library/base/stdafx.h @@ -29,6 +29,7 @@ #define NOMINMAX #include +#include #include #include @@ -45,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -65,6 +67,5 @@ #include #include - #include -#include \ No newline at end of file +#include diff --git a/library/base/string_utilities.cpp b/library/base/string_utilities.cpp index 69742207d..7fc6141d6 100644 --- a/library/base/string_utilities.cpp +++ b/library/base/string_utilities.cpp @@ -391,7 +391,7 @@ std::string sanitize_file_name(const std::string &s) for (std::string::const_iterator c = s.begin(); c != s.end(); ++c) { // utf-8 has the high-bit = 1, so we just copy those verbatim - if (isalnum(*c) || (unsigned char)*c >= 128 || (ispunct(*c) && !is_invalid_filesystem_char(*c))) + if ((unsigned char)*c >= 128 || isalnum(*c) || (ispunct(*c) && !is_invalid_filesystem_char(*c))) out.push_back(*c); else out.push_back('_'); @@ -1620,7 +1620,25 @@ std::string unquote_identifier(const std::string& identifier) } //-------------------------------------------------------------------------------------------------- - + +/** + * @brief Remove outer quotes from any text. + * + * @param text Text to unquote + * @return Return unqoted text. + */ +std::string unquote(const std::string &text) +{ + if (text.size() < 2) + return text; + + if ((text[0] == '"' || text[0] == '`' || text[0] == '\'') && text[0] == text[text.size() - 1]) + return text.substr(1, text.size() - 2); + return text; +} + +//-------------------------------------------------------------------------------------------------- + std::string quote_identifier(const std::string& identifier, const char quote_char) { return quote_char + identifier + quote_char; diff --git a/library/base/threaded_timer.cpp b/library/base/threaded_timer.cpp index e31e88a8b..01faff01d 100644 --- a/library/base/threaded_timer.cpp +++ b/library/base/threaded_timer.cpp @@ -153,7 +153,7 @@ ThreadedTimer::~ThreadedTimer() { // Free the thread pool but wait until tasks, which are currently executing have finished. // Pending tasks are discarded. - log_debug2("Threaded timer shutdown...\n"); + logDebug2("Threaded timer shutdown...\n"); // Don't lock the mutex or we might deadlock here if the mutex is currently held by the work loop. _terminate = true; @@ -163,7 +163,7 @@ ThreadedTimer::~ThreadedTimer() g_thread_pool_free(_pool, TRUE, TRUE); - log_debug2("Threaded timer shutdown done\n"); + logDebug2("Threaded timer shutdown done\n"); } //-------------------------------------------------------------------------------------------------- @@ -202,7 +202,7 @@ gpointer ThreadedTimer::pool_function(gpointer data, gpointer user_data) base::MutexLock lock(timer->_timer_lock); task->stop= true; task->scheduled= false; - log_warning("Threaded timer: exception in pool function: %s\n", e.what()); + logWarning("Threaded timer: exception in pool function: %s\n", e.what()); } catch (...) { @@ -211,7 +211,7 @@ gpointer ThreadedTimer::pool_function(gpointer data, gpointer user_data) base::MutexLock(timer->_timer_lock); task->stop= true; task->scheduled= false; - log_warning("Threaded timer: unknown exception in pool function\n"); + logWarning("Threaded timer: unknown exception in pool function\n"); } return NULL; diff --git a/library/base/threading.cpp b/library/base/threading.cpp index 93ed323ef..1921e5218 100644 --- a/library/base/threading.cpp +++ b/library/base/threading.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -19,8 +19,120 @@ #include "base/threading.h" +#if !defined(__APPLE__) && !defined(_WIN32) +#include +#include +#endif + +#include +#include "base/string_utilities.h" + using namespace base; +#ifdef _WIN32 + +void base::launchTool(const std::string &name, const std::vector ¶ms) +{ + std::stringstream ss; + std::copy(params.begin(), params.end(), std::ostream_iterator(ss, " ")); + std::wstring wexe = base::string_to_wstring(name); + std::wstring wparam = base::string_to_wstring(ss.str()); + SHELLEXECUTEINFO shellExeInfo; + memset(&shellExeInfo, 0, sizeof(shellExeInfo)); + shellExeInfo.cbSize = sizeof(shellExeInfo); + shellExeInfo.fMask = NULL; + shellExeInfo.lpVerb = L"runas"; + shellExeInfo.lpFile = wexe.c_str(); + shellExeInfo.lpParameters = wparam.c_str(); + shellExeInfo.nShow = SW_SHOWMAXIMIZED; + SetLastError(ERROR_SUCCESS); + if (ShellExecuteEx(&shellExeInfo) == FALSE) + { + LPVOID msgBuf = NULL; + DWORD lastErr = GetLastError(); + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, lastErr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR)&msgBuf, 0, NULL); + std::wstring msg = (LPCTSTR)msgBuf; + LocalFree(msgBuf); + SetLastError(ERROR_SUCCESS); + throw std::runtime_error(base::wstring_to_string(msg)); + } +} + +void base::launchApplication(const std::string &path, const std::vector ¶ms) +{ + launchTool(path, params); +} + +#elif __APPLE__ + +void base::launchTool(const std::string &name, const std::vector ¶ms) +{ + NSString *path = [NSString stringWithUTF8String: name.c_str()]; + + NSMutableArray *args = [NSMutableArray new]; + for (size_t i = 0; i < params.size(); ++i) + [args addObject: [NSString stringWithUTF8String: params[i].c_str()]]; + + NSTask *task = [NSTask launchedTaskWithLaunchPath: path arguments: args]; + if (task == nil) + throw std::runtime_error("Running the tool failed."); +} + +void base::launchApplication(const std::string &name, const std::vector ¶ms) +{ + NSString *appName = [NSString stringWithUTF8String: name.c_str()]; + + NSMutableArray *args = [NSMutableArray new]; + for (size_t i = 0; i < params.size(); ++i) + [args addObject: [NSString stringWithUTF8String: params[i].c_str()]]; + + NSError *error = nil; + NSString *root = [NSBundle.mainBundle.bundlePath stringByDeletingLastPathComponent]; + NSURL *url = [NSURL fileURLWithPath: [root stringByAppendingPathComponent: appName]]; + + NSRunningApplication *application = [NSWorkspace.sharedWorkspace launchApplicationAtURL: url + options: NSWorkspaceLaunchAndHide + configuration: @{ NSWorkspaceLaunchConfigurationArguments: args } + error: &error]; + if (error != nil) + throw std::runtime_error([error.localizedDescription stringByAppendingString: url.absoluteString].UTF8String); + [application activateWithOptions: NSApplicationActivateAllWindows]; +} + +#else +#include +#include +#include + + +void base::launchTool(const std::string &name, const std::vector ¶ms) +{ + auto tmpParams = params; + tmpParams.insert(tmpParams.begin(), name); + + auto envp = Glib::ArrayHandler::array_to_vector(g_get_environ(), Glib::OWNERSHIP_NONE); + envp.erase(std::remove_if(envp.begin(), envp.end(), [](const std::string &str){ + return str.find("LD_PRELOAD") != std::string::npos; + }), + envp.end()); + Glib::Pid pid; + try { + Glib::spawn_async(Glib::get_current_dir(), tmpParams, envp, Glib::SPAWN_DEFAULT, sigc::slot(), &pid); + } catch (Glib::SpawnError &serr) + { + throw std::runtime_error(serr.what()); + } +} + +void base::launchApplication(const std::string &name, const std::vector ¶ms) +{ + launchTool(name, params); +} + +#endif + #if GLIB_CHECK_VERSION(2,32,0) void base::threading_init() { diff --git a/library/base/unit-tests/string_utilities_test.cpp b/library/base/unit-tests/string_utilities_test.cpp index 5d8eea45d..32f84f464 100644 --- a/library/base/unit-tests/string_utilities_test.cpp +++ b/library/base/unit-tests/string_utilities_test.cpp @@ -794,47 +794,47 @@ TEST_FUNCTION(40) std::string test_string_unicode = "\xC3\x89\xC3\x89\xC3\x89\xC3\x89\xC3\x89\xC3\x89\xC3\x89\xC3\x89...Now that is a unicode string...\xE3\x8A\xA8"; // Base tests - ensure_equals("TEST 40.1: Starts with (success test)", base::starts_with(test_string, "This"), true); - ensure_equals("TEST 40.2: Starts with (exists somwehere in the middle)", base::starts_with(test_string, "is"), false); - ensure_equals("TEST 40.3: Starts with (exists in the end)", base::starts_with(test_string, "test."), false); - ensure_equals("TEST 40.4: Starts with (search text don't exist)", base::starts_with(test_string, "blablabla"), false); - ensure_equals("TEST 40.5: Starts with (search an empty string)", base::starts_with(test_string, ""), true); - ensure_equals("TEST 40.6: Starts with (starting on the second character)", base::starts_with(test_string, "his"), false); - ensure_equals("TEST 40.7: Starts with (whole string)", base::starts_with(test_string, test_string), true); - ensure_equals("TEST 40.8: Starts with (more then the original string)", base::starts_with(test_string, test_string + " Second part..."), false); - ensure_equals("TEST 40.9: Starts with (empty source)", base::starts_with("", "blablabla"), false); - ensure_equals("TEST 40.10: Starts with (empty source, empty search)", base::starts_with("", ""), true); - - ensure_equals("TEST 40.11: Ends with (success test)", base::ends_with(test_string, "test."), true); - ensure_equals("TEST 40.12: Ends with (exists somwehere in the middle)", base::ends_with(test_string, "to "), false); - ensure_equals("TEST 40.13: Ends with (exists at the beginning)", base::ends_with(test_string, "This"), false); - ensure_equals("TEST 40.14: Ends with (search text don't exist)", base::ends_with(test_string, "blablabla"), false); - ensure_equals("TEST 40.15: Ends with (search an empty string)", base::ends_with(test_string, ""), true); - ensure_equals("TEST 40.16: Ends with (starting on the second last character)", base::ends_with(test_string, "test"), false); - ensure_equals("TEST 40.17: Ends with (whole string)", base::ends_with(test_string, test_string), true); - ensure_equals("TEST 40.18: Ends with (more then the original string)", base::ends_with(test_string, test_string + " Second part..."), false); - ensure_equals("TEST 40.19: Ends with (empty source)", base::ends_with("", "blablabla"), false); - ensure_equals("TEST 40.20: Ends with (empty source, empty search)", base::ends_with("", ""), true); + ensure_equals("TEST 40.1: Starts with (success test)", base::hasPrefix(test_string, "This"), true); + ensure_equals("TEST 40.2: Starts with (exists somwehere in the middle)", base::hasPrefix(test_string, "is"), false); + ensure_equals("TEST 40.3: Starts with (exists in the end)", base::hasPrefix(test_string, "test."), false); + ensure_equals("TEST 40.4: Starts with (search text don't exist)", base::hasPrefix(test_string, "blablabla"), false); + ensure_equals("TEST 40.5: Starts with (search an empty string)", base::hasPrefix(test_string, ""), true); + ensure_equals("TEST 40.6: Starts with (starting on the second character)", base::hasPrefix(test_string, "his"), false); + ensure_equals("TEST 40.7: Starts with (whole string)", base::hasPrefix(test_string, test_string), true); + ensure_equals("TEST 40.8: Starts with (more then the original string)", base::hasPrefix(test_string, test_string + " Second part..."), false); + ensure_equals("TEST 40.9: Starts with (empty source)", base::hasPrefix("", "blablabla"), false); + ensure_equals("TEST 40.10: Starts with (empty source, empty search)", base::hasPrefix("", ""), true); + + ensure_equals("TEST 40.11: Ends with (success test)", base::hasSuffix(test_string, "test."), true); + ensure_equals("TEST 40.12: Ends with (exists somwehere in the middle)", base::hasSuffix(test_string, "to "), false); + ensure_equals("TEST 40.13: Ends with (exists at the beginning)", base::hasSuffix(test_string, "This"), false); + ensure_equals("TEST 40.14: Ends with (search text don't exist)", base::hasSuffix(test_string, "blablabla"), false); + ensure_equals("TEST 40.15: Ends with (search an empty string)", base::hasSuffix(test_string, ""), true); + ensure_equals("TEST 40.16: Ends with (starting on the second last character)", base::hasSuffix(test_string, "test"), false); + ensure_equals("TEST 40.17: Ends with (whole string)", base::hasSuffix(test_string, test_string), true); + ensure_equals("TEST 40.18: Ends with (more then the original string)", base::hasSuffix(test_string, test_string + " Second part..."), false); + ensure_equals("TEST 40.19: Ends with (empty source)", base::hasSuffix("", "blablabla"), false); + ensure_equals("TEST 40.20: Ends with (empty source, empty search)", base::hasSuffix("", ""), true); // Unicode tests - ensure_equals("TEST 40.21: [Unicode]Starts with (success test)", base::starts_with(test_string_unicode, "\xC3\x89\xC3\x89"), true); - ensure_equals("TEST 40.22: [Unicode]Starts with (exists somwehere in the middle)", base::starts_with(test_string_unicode, "is"), false); - ensure_equals("TEST 40.23: [Unicode]Starts with (exists in the end)", base::starts_with(test_string_unicode, "\xE3\x8A\xA8"), false); - ensure_equals("TEST 40.24: [Unicode]Starts with (search text don't exist)", base::starts_with(test_string_unicode, "blablabla"), false); - ensure_equals("TEST 40.25: [Unicode]Starts with (search an empty string)", base::starts_with(test_string_unicode, ""), true); - ensure_equals("TEST 40.26: [Unicode]Starts with (starting on the second character)", base::starts_with(test_string_unicode, "\x89\xC3\x89\xC3"), false); - ensure_equals("TEST 40.27: [Unicode]Starts with (whole string)", base::starts_with(test_string_unicode, test_string_unicode), true); - ensure_equals("TEST 40.28: [Unicode]Starts with (more then the original string)", base::starts_with(test_string_unicode, test_string_unicode + ". Second part..."), false); - - ensure_equals("TEST 40.29: [Unicode]Ends with (success test)", base::ends_with(test_string_unicode, ".\xE3\x8A\xA8"), true); - ensure_equals("TEST 40.30: [Unicode]Ends with (exists somwehere in the middle)", base::ends_with(test_string_unicode, "to "), false); - ensure_equals("TEST 40.31: [Unicode]Ends with (exists at the beginning)", base::ends_with(test_string_unicode, "\xC3\x89\xC3\x89"), false); - ensure_equals("TEST 40.32: [Unicode]Ends with (search text don't exist)", base::ends_with(test_string_unicode, "blablabla"), false); - ensure_equals("TEST 40.33: [Unicode]Ends with (search an empty string)", base::ends_with(test_string_unicode, ""), true); - ensure_equals("TEST 40.34: [Unicode]Ends with (starting on the second last character)", base::ends_with(test_string_unicode, ".\xE3\x8A"), false); - ensure_equals("TEST 40.35: [Unicode]Ends with (whole string)", base::ends_with(test_string_unicode, test_string_unicode), true); - ensure_equals("TEST 40.36: [Unicode]Ends with (more then the original string)", base::ends_with(test_string_unicode, test_string_unicode + ". Second part..."), false); + ensure_equals("TEST 40.21: [Unicode]Starts with (success test)", base::hasPrefix(test_string_unicode, "\xC3\x89\xC3\x89"), true); + ensure_equals("TEST 40.22: [Unicode]Starts with (exists somwehere in the middle)", base::hasPrefix(test_string_unicode, "is"), false); + ensure_equals("TEST 40.23: [Unicode]Starts with (exists in the end)", base::hasPrefix(test_string_unicode, "\xE3\x8A\xA8"), false); + ensure_equals("TEST 40.24: [Unicode]Starts with (search text don't exist)", base::hasPrefix(test_string_unicode, "blablabla"), false); + ensure_equals("TEST 40.25: [Unicode]Starts with (search an empty string)", base::hasPrefix(test_string_unicode, ""), true); + ensure_equals("TEST 40.26: [Unicode]Starts with (starting on the second character)", base::hasPrefix(test_string_unicode, "\x89\xC3\x89\xC3"), false); + ensure_equals("TEST 40.27: [Unicode]Starts with (whole string)", base::hasPrefix(test_string_unicode, test_string_unicode), true); + ensure_equals("TEST 40.28: [Unicode]Starts with (more then the original string)", base::hasPrefix(test_string_unicode, test_string_unicode + ". Second part..."), false); + + ensure_equals("TEST 40.29: [Unicode]Ends with (success test)", base::hasSuffix(test_string_unicode, ".\xE3\x8A\xA8"), true); + ensure_equals("TEST 40.30: [Unicode]Ends with (exists somwehere in the middle)", base::hasSuffix(test_string_unicode, "to "), false); + ensure_equals("TEST 40.31: [Unicode]Ends with (exists at the beginning)", base::hasSuffix(test_string_unicode, "\xC3\x89\xC3\x89"), false); + ensure_equals("TEST 40.32: [Unicode]Ends with (search text don't exist)", base::hasSuffix(test_string_unicode, "blablabla"), false); + ensure_equals("TEST 40.33: [Unicode]Ends with (search an empty string)", base::hasSuffix(test_string_unicode, ""), true); + ensure_equals("TEST 40.34: [Unicode]Ends with (starting on the second last character)", base::hasSuffix(test_string_unicode, ".\xE3\x8A"), false); + ensure_equals("TEST 40.35: [Unicode]Ends with (whole string)", base::hasSuffix(test_string_unicode, test_string_unicode), true); + ensure_equals("TEST 40.36: [Unicode]Ends with (more then the original string)", base::hasSuffix(test_string_unicode, test_string_unicode + ". Second part..."), false); } TEST_FUNCTION(41) diff --git a/library/base/util_functions.cpp b/library/base/util_functions.cpp index df5acbc6b..aa5839922 100644 --- a/library/base/util_functions.cpp +++ b/library/base/util_functions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -19,7 +19,6 @@ #include #include -#include #include #include #include @@ -325,7 +324,7 @@ std::string get_local_os_name() if (!product_name.empty()) { - result = (base::starts_with(product_name, "Microsoft") ? "" : "Microsoft ") + product_name; + result = (base::hasPrefix(product_name, "Microsoft") ? "" : "Microsoft ") + product_name; if (!csd_version.empty()) result += " " + csd_version; } @@ -632,7 +631,7 @@ std::string get_local_os_name() } else { - log_error("Error executing lsb_release -%c: %s\n", param, error->message); + logError("Error executing lsb_release -%c: %s\n", param, error->message); return std::string("unknown"); } @@ -651,7 +650,7 @@ std::string get_local_os_name() } catch(const std::ios_base::failure& e) { - log_error("Error reading /etc/redhat-release: %s\n", e.what()); + logError("Error reading /etc/redhat-release: %s\n", e.what()); return std::string("unknown"); } }; @@ -687,12 +686,12 @@ static int _get_hardware_info(hardware_info &info) if (!fgets(line, sizeof(line), proc)) break; - if (base::starts_with(line,"model name")) + if (base::hasPrefix(line,"model name")) { info._cpu_count++; info._cpu = base::trim(base::split(line, ":")[1], " \n"); } - else if (base::starts_with(line,"cpu MHz")) + else if (base::hasPrefix(line,"cpu MHz")) { info._clock = base::trim( base::split(line, ":")[1], " \n"); } @@ -869,56 +868,6 @@ char *strcasestr_len(const char *haystack, int haystack_len, const char *needle) //---------------------------------------------------------------------------------------------------------------------- -#define O_VECTOR_COUNT 64 // max # of ()*2+2 - -char * get_value_from_text_ex_opt(const char *txt, int txt_length, - const char *regexpr, - unsigned int substring_nr, - int options_for_exec) -{ - pcre *pcre_exp; - const char *error_str; - int erroffset; - int o_vector[O_VECTOR_COUNT]; - int rc; - const char *ret_val; - char *value= NULL; - - if(txt && *txt) - { - pcre_exp= pcre_compile(regexpr, PCRE_CASELESS, &error_str, &erroffset, NULL); - if (pcre_exp) - { - if ((rc= pcre_exec(pcre_exp, NULL, txt, txt_length, 0, - options_for_exec, o_vector, O_VECTOR_COUNT) ) > 0) - { - if (o_vector[substring_nr * 2] != -1) - { - pcre_get_substring(txt, o_vector, rc, substring_nr, &ret_val); - - value= g_strdup(ret_val); - - pcre_free_substring((char*)ret_val); - } - } - - pcre_free(pcre_exp); - } - } - - return value; -} - -//---------------------------------------------------------------------------------------------------------------------- - -char * get_value_from_text_ex(const char *txt, int txt_length, - const char *regexpr, unsigned int substring_nr) -{ - return get_value_from_text_ex_opt(txt,txt_length,regexpr,substring_nr,0); -} - -//---------------------------------------------------------------------------------------------------------------------- - const char *strfindword(const char *str, const char *word) { const char* result = NULL; diff --git a/library/cdbc/src/driver_manager.cpp b/library/cdbc/src/driver_manager.cpp index 3c2701ec2..8eae72366 100644 --- a/library/cdbc/src/driver_manager.cpp +++ b/library/cdbc/src/driver_manager.cpp @@ -126,6 +126,28 @@ void Authentication::invalidate() } } +std::string Authentication::uri(bool withPassword) +{ + std::vector v; + grt::DictRef parameter_values = connectionProperties()->parameterValues(); + + v.push_back(parameter_values.get_string("hostName")); + v.push_back(std::to_string(connectionProperties()->parameterValues().get_int("port"))); + v.push_back(parameter_values.get_string("userName")); + if (parameter_values.get_string("password").empty() ) + { + if (is_valid() && withPassword) + v.push_back(_password); + } + + std::string uri; + if (v.size() == 4) //if there's no pw, we will ask for it later + uri = v[2] + ":" + v[3] + "@" + v[0] + ":" + v[1]; + else + uri = v[2] + "@" + v[0] + ":" + v[1]; + return uri; +} + //----------------- DriverManager ------------------------------------------------------------------ DriverManager *DriverManager::getDriverManager() diff --git a/library/cdbc/src/driver_manager.h b/library/cdbc/src/driver_manager.h index b44694af7..37e76c44a 100644 --- a/library/cdbc/src/driver_manager.h +++ b/library/cdbc/src/driver_manager.h @@ -91,6 +91,7 @@ class CPPDBC_PUBLIC_FUNC Authentication const char* password() const { return _password; } void invalidate(); bool is_valid() const { return _password != NULL; } + std::string uri(bool withPassword = false); }; typedef std::set AuthenticationSet; diff --git a/library/forms/CMakeLists.txt b/library/forms/CMakeLists.txt index 41bc7bafc..6c89d4f70 100644 --- a/library/forms/CMakeLists.txt +++ b/library/forms/CMakeLists.txt @@ -117,7 +117,7 @@ add_library(mforms home_screen_x_connections.cpp home_screen_documents.cpp home_screen_helpers.cpp - + ProjectForm.cpp ) if (KEYRING_DEFINITION) diff --git a/library/forms/ProjectForm.cpp b/library/forms/ProjectForm.cpp new file mode 100644 index 000000000..1e151b8cc --- /dev/null +++ b/library/forms/ProjectForm.cpp @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2 of the + * License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include "mforms/ProjectForm.h" +#include "base/string_utilities.h" +#include + + +namespace Workbench +{ +namespace X +{ + +ProjectForm::ProjectForm() : mforms::Form(mforms::Form::main_form()), _box(false), _bbox(true) +{ + set_title("Project Manager"); + set_name("project_manager"); + set_content(&_box); + + _box.set_padding(20); + _box.set_spacing(20); + _cancel.set_text("Cancel"); + _save.set_text("Save"); + + mforms::Utilities::add_end_ok_cancel_buttons(&_bbox, &_save, &_cancel); + _box.add_end(&_bbox, false, true); + setupUi(); + + _save.signal_clicked()->connect([=](){ onSave(); }); +} + +ProjectForm::~ProjectForm() +{ +} + +static mforms::Label *new_label(const std::string &text, bool right_align=false, bool help=false) +{ + mforms::Label *label= mforms::manage(new mforms::Label()); + label->set_text(text); + if (right_align) + label->set_text_align(mforms::MiddleRight); + if (help) + { + label->set_style(mforms::SmallHelpTextStyle); + label->set_wrap_text(true); + label->set_size(50, -1); + } + + return label; +} + +void ProjectForm::setupUi() +{ + + mforms::Table *table= mforms::manage(new mforms::Table()); + + table->set_padding(8); + table->set_row_spacing(12); + table->set_column_spacing(8); + + table->set_row_count(3); + table->set_column_count(4); + + table->add(new_label(_("Project name:"), false), 0, 1, 0, 1, mforms::HFillFlag); + table->add(&_projectName, 1, 4, 0, 1, mforms::HFillFlag|mforms::HExpandFlag); + _projectName.set_placeholder_text("Name of the project"); + + table->add(new_label(_("Host:"), false), 0, 1, 1, 2, mforms::HFillFlag); + table->add(&_host, 1, 2, 1, 2, mforms::HFillFlag|mforms::HExpandFlag); + _host.set_placeholder_text("127.0.0.1"); + + table->add(new_label(_("Port:"), false), 2, 3, 1, 2, mforms::HFillFlag); + table->add(&_port, 3, 4, 1, 2, mforms::NoFillExpandFlag); + _port.set_placeholder_text("33060"); + _port.set_size(60, -1); + + + table->add(new_label(_("Username:"), false), 0, 1, 2, 3, mforms::HFillFlag); + table->add(&_userName, 1, 4, 2, 3, mforms::HFillFlag|mforms::HExpandFlag); + + _box.add(table, true, true); + + set_size(500, 200); +} + +void ProjectForm::show() +{ + run_modal(nullptr, &_cancel); +} + +void ProjectForm::onSave() +{ + dataTypes::XProject tmpProject; + tmpProject.name = _projectName.get_string_value(); + tmpProject.connection.userName = _userName.get_string_value(); + tmpProject.connection.hostName = _host.get_string_value(); + + std::string errMessage = "Please correct the following errors before continue:\n"; + std::locale loc("C"); + bool wasError = false; + if (tmpProject.name.empty()) + { + errMessage += " Project name cannot be empty\n"; + wasError = true; + } + + if (std::find_if(tmpProject.name.begin(), tmpProject.name.end(), [=](char c) { + return !std::isalnum(c, loc); + }) != tmpProject.name.end()) + { + errMessage += " Project name can contain only alphanumeric characters without space\n"; + wasError = true; + } + + try { + if (!_port.get_string_value().empty()) + tmpProject.connection.port = base::atoi(_port.get_string_value()); + } catch (std::bad_cast&) + { + errMessage += " Port number must be a number\n"; + wasError = true; + } + + if (tmpProject.connection.hostName.empty()) + { + errMessage += " HostName cannot be empty"; + wasError = true; + } + + if (!tmpProject.isValid() || wasError) + { + mforms::Utilities::show_error(_("Validation error"), errMessage, _("Ok")); + return; + } + + if (tmpProject.isValid()) + { + _project = tmpProject; + this->close(); + } +} + +} /* namespace X */ +} /* namespace Workbench */ diff --git a/library/forms/app.cpp b/library/forms/app.cpp index f097e03a9..d2c593d2e 100644 --- a/library/forms/app.cpp +++ b/library/forms/app.cpp @@ -29,7 +29,7 @@ using namespace base; static App *singleton= 0; App::App(DockingPointDelegate *delegate, bool delete_on_destroy) -: DockingPoint(delegate, delete_on_destroy) +: DockingPoint(delegate, delete_on_destroy), _app_impl(nullptr) { } diff --git a/library/forms/cocoa/EmbedableFindPane.xib b/library/forms/cocoa/EmbedableFindPane.xib index 92e659d4f..4ad81fc74 100644 --- a/library/forms/cocoa/EmbedableFindPane.xib +++ b/library/forms/cocoa/EmbedableFindPane.xib @@ -1,16 +1,15 @@ - + - + + - - @@ -18,13 +17,14 @@ - + + @@ -34,6 +34,7 @@ + @@ -48,6 +49,7 @@