├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── vMysqlMonitoring.xcodeproj └── project.pbxproj └── vMysqlMonitoring ├── AboutController.swift ├── AboutController.xib ├── AppDelegate.swift ├── Assets.xcassets ├── About.imageset │ ├── Contents.json │ ├── icon_128x128.png │ └── icon_128x128@2x.png ├── Alipay.imageset │ ├── Contents.json │ ├── icon_256x256.png │ └── icon_256x256@2x.png ├── AppIcon.appiconset │ ├── Contents.json │ ├── icon_128x128.png │ ├── icon_128x128@2x.png │ ├── icon_16x16.png │ ├── icon_16x16@2x.png │ ├── icon_256x256.png │ ├── icon_256x256@2x.png │ ├── icon_32x32.png │ ├── icon_32x32@2x.png │ ├── icon_512x512.png │ └── icon_512x512@2x.png └── Contents.json ├── Base.lproj └── Main.storyboard ├── DBManager.h ├── DBManager.m ├── Info.plist ├── PreferenceData.swift ├── ViewController.swift ├── libmariadb.3.dylib └── vMysqlMonitoring-Bridging-Header.h /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/xcode,swift,objective-c 3 | # Edit at https://www.gitignore.io/?templates=xcode,swift,objective-c 4 | 5 | ### Objective-C ### 6 | # Xcode 7 | # 8 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 9 | 10 | ## Build generated 11 | build/ 12 | DerivedData/ 13 | 14 | ## Various settings 15 | *.pbxuser 16 | !default.pbxuser 17 | *.mode1v3 18 | !default.mode1v3 19 | *.mode2v3 20 | !default.mode2v3 21 | *.perspectivev3 22 | !default.perspectivev3 23 | xcuserdata/ 24 | 25 | ## Other 26 | *.moved-aside 27 | *.xccheckout 28 | *.xcscmblueprint 29 | 30 | ## Obj-C/Swift specific 31 | *.hmap 32 | *.ipa 33 | *.dSYM.zip 34 | *.dSYM 35 | 36 | # CocoaPods 37 | # 38 | # We recommend against adding the Pods directory to your .gitignore. However 39 | # you should judge for yourself, the pros and cons are mentioned at: 40 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 41 | # 42 | # Pods/ 43 | # 44 | # Add this line if you want to avoid checking in source code from the Xcode workspace 45 | # *.xcworkspace 46 | 47 | # Carthage 48 | # 49 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 50 | # Carthage/Checkouts 51 | 52 | Carthage/Build 53 | 54 | # fastlane 55 | # 56 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 57 | # screenshots whenever they are needed. 58 | # For more information about the recommended setup visit: 59 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 60 | 61 | fastlane/report.xml 62 | fastlane/Preview.html 63 | fastlane/screenshots/**/*.png 64 | fastlane/test_output 65 | 66 | # Code Injection 67 | # 68 | # After new code Injection tools there's a generated folder /iOSInjectionProject 69 | # https://github.com/johnno1962/injectionforxcode 70 | 71 | iOSInjectionProject/ 72 | 73 | ### Objective-C Patch ### 74 | 75 | ### Swift ### 76 | # Xcode 77 | # 78 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 79 | 80 | ## Build generated 81 | 82 | ## Various settings 83 | 84 | ## Other 85 | 86 | ## Obj-C/Swift specific 87 | 88 | ## Playgrounds 89 | timeline.xctimeline 90 | playground.xcworkspace 91 | 92 | # Swift Package Manager 93 | # 94 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 95 | # Packages/ 96 | # Package.pins 97 | # Package.resolved 98 | .build/ 99 | 100 | # CocoaPods 101 | # 102 | # We recommend against adding the Pods directory to your .gitignore. However 103 | # you should judge for yourself, the pros and cons are mentioned at: 104 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 105 | # 106 | # Pods/ 107 | # 108 | # Add this line if you want to avoid checking in source code from the Xcode workspace 109 | # *.xcworkspace 110 | 111 | # Carthage 112 | # 113 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 114 | # Carthage/Checkouts 115 | 116 | 117 | # fastlane 118 | # 119 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 120 | # screenshots whenever they are needed. 121 | # For more information about the recommended setup visit: 122 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 123 | 124 | 125 | # Code Injection 126 | # 127 | # After new code Injection tools there's a generated folder /iOSInjectionProject 128 | # https://github.com/johnno1962/injectionforxcode 129 | 130 | 131 | ### Xcode ### 132 | # Xcode 133 | # 134 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 135 | 136 | ## User settings 137 | 138 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 139 | 140 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 141 | 142 | ### Xcode Patch ### 143 | *.xcodeproj/* 144 | !*.xcodeproj/project.pbxproj 145 | !*.xcodeproj/xcshareddata/ 146 | !*.xcworkspace/contents.xcworkspacedata 147 | /*.gcno 148 | **/xcshareddata/WorkspaceSettings.xcsettings 149 | 150 | # End of https://www.gitignore.io/api/xcode,swift,objective-c 151 | 152 | .DS_Store 153 | Index -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright © 2017 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vMysqlMonitoring 2 | 3 | ## OSX 10.12 (swift) 4 | 5 | ### Version 6 | 7 | **1.1.1 Beta** 8 | 9 | ~~**1.1 Beta**~~ 10 | 11 | ~~**1.0 Beta**~~ 12 | 13 | ### 功能 14 | 15 | - 实时修改数据库连接配置,并缓存到数据目录 16 | - 程序启动,自动清空 general_log 内容 17 | - 点击标题实现排序 18 | - 实时筛选SQL语句 19 | - 双击行复制SQL语句到剪贴板 20 | 21 | ### Usage 22 | 23 | - 首先确保成功连接数据库 24 | - CMD+D setTimeNow 设置 时间断点 25 | - 访问你的网站(执行语句) 26 | - CMD+R GetQuery 获取Sql语句 27 | - CMD+F 快速设置filter筛选框焦点 28 | - OpenLog 清空并开启Log日志 29 | - 双击行复制SQL语句到剪贴板 30 | 31 | ### TODO & DONE 32 | 33 | - [x] ~~表格自动换行并自适应列表行高~~ 34 | - [x] 增加表格 SQL 字段的宽度,横向滚动 35 | - [x] 新增完整 SQL 语句预览功能(实际上就是丢到另一个文本框 emmmm ) 36 | - [ ] 暂未发现还有啥要修改的地方 emmmmmm 37 | 38 | ## Author 39 | 40 | **Virink** 41 | 42 | Blog : [https://www.virzz.com](https://www.virzz.com) 43 | 44 | ## ChangeLog 45 | 46 | - 2018-02-17 重构程序,移除Pods,使用OC+libmysqlclient 47 | + 重写了下连接mysql的模块、通过OC调用系统libmysqlclient(😂😂😂😂😂)优化了下查询语句 48 | - 2017-12-12 重构程序,使用Pods 49 | - 2019-01-26 不知道写啥了,反正就是更新了,任性 50 | 51 | ## License 52 | 53 | [LICENSE](LICENSE) 54 | 55 | ### [The MIT License (MIT) ](https://mit-license.org) 56 | 57 | Copyright © 2017 58 | 59 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 60 | 61 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 62 | 63 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 64 | 65 | ### Notice 66 | 67 | I am so sorry about that I am not familiar with how layers of copyright notices interplay, if I did do something wrong, please tell me! -------------------------------------------------------------------------------- /vMysqlMonitoring.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9020D133203984DE004ECFF9 /* libmariadb.3.dylib in Resources */ = {isa = PBXBuildFile; fileRef = 9020D132203980F2004ECFF9 /* libmariadb.3.dylib */; }; 11 | 9020D13420398507004ECFF9 /* libmariadb.3.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = 9020D132203980F2004ECFF9 /* libmariadb.3.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 12 | 9034B8541E6F0FE2008E71D4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9034B8531E6F0FE2008E71D4 /* AppDelegate.swift */; }; 13 | 9034B8561E6F0FE2008E71D4 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9034B8551E6F0FE2008E71D4 /* ViewController.swift */; }; 14 | 9034B8581E6F0FE2008E71D4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9034B8571E6F0FE2008E71D4 /* Assets.xcassets */; }; 15 | 9034B85B1E6F0FE2008E71D4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9034B8591E6F0FE2008E71D4 /* Main.storyboard */; }; 16 | 9034B8811E6F20F4008E71D4 /* PreferenceData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9034B8801E6F20F4008E71D4 /* PreferenceData.swift */; }; 17 | 90AE539C1FDF3215008868AE /* AboutController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90AE539A1FDF3215008868AE /* AboutController.swift */; }; 18 | 90AE539D1FDF3215008868AE /* AboutController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 90AE539B1FDF3215008868AE /* AboutController.xib */; }; 19 | 90F553E720380BBA009A5086 /* DBManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 90F553E620380BBA009A5086 /* DBManager.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 9034B8621E6F0FE2008E71D4 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 9034B8481E6F0FE1008E71D4 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 9034B84F1E6F0FE1008E71D4; 28 | remoteInfo = vMysqlMonitoring; 29 | }; 30 | 9034B86D1E6F0FE2008E71D4 /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 9034B8481E6F0FE1008E71D4 /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 9034B84F1E6F0FE1008E71D4; 35 | remoteInfo = vMysqlMonitoring; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXCopyFilesBuildPhase section */ 40 | 9020D12A20397835004ECFF9 /* Embed Libraries */ = { 41 | isa = PBXCopyFilesBuildPhase; 42 | buildActionMask = 12; 43 | dstPath = ""; 44 | dstSubfolderSpec = 10; 45 | files = ( 46 | 9020D13420398507004ECFF9 /* libmariadb.3.dylib in Embed Libraries */, 47 | ); 48 | name = "Embed Libraries"; 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | /* End PBXCopyFilesBuildPhase section */ 52 | 53 | /* Begin PBXFileReference section */ 54 | 900197601FFA7A090000AC44 /* DBManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DBManager.h; sourceTree = ""; }; 55 | 9020D132203980F2004ECFF9 /* libmariadb.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libmariadb.3.dylib; path = vMysqlMonitoring/libmariadb.3.dylib; sourceTree = ""; }; 56 | 9034B8501E6F0FE1008E71D4 /* vMysqlMonitoring.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = vMysqlMonitoring.app; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | 9034B8531E6F0FE2008E71D4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 58 | 9034B8551E6F0FE2008E71D4 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 59 | 9034B8571E6F0FE2008E71D4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 60 | 9034B85A1E6F0FE2008E71D4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 61 | 9034B85C1E6F0FE2008E71D4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 62 | 9034B8611E6F0FE2008E71D4 /* vMysqlMonitoringTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = vMysqlMonitoringTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 63 | 9034B86C1E6F0FE2008E71D4 /* vMysqlMonitoringUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = vMysqlMonitoringUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 64 | 9034B8801E6F20F4008E71D4 /* PreferenceData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferenceData.swift; sourceTree = ""; }; 65 | 90AE539A1FDF3215008868AE /* AboutController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutController.swift; sourceTree = ""; }; 66 | 90AE539B1FDF3215008868AE /* AboutController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AboutController.xib; sourceTree = ""; }; 67 | 90F553E520380B0E009A5086 /* vMysqlMonitoring-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "vMysqlMonitoring-Bridging-Header.h"; sourceTree = ""; }; 68 | 90F553E620380BBA009A5086 /* DBManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DBManager.m; sourceTree = ""; }; 69 | /* End PBXFileReference section */ 70 | 71 | /* Begin PBXFrameworksBuildPhase section */ 72 | 9034B84D1E6F0FE1008E71D4 /* Frameworks */ = { 73 | isa = PBXFrameworksBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | ); 77 | runOnlyForDeploymentPostprocessing = 0; 78 | }; 79 | 9034B85E1E6F0FE2008E71D4 /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | ); 84 | runOnlyForDeploymentPostprocessing = 0; 85 | }; 86 | 9034B8691E6F0FE2008E71D4 /* Frameworks */ = { 87 | isa = PBXFrameworksBuildPhase; 88 | buildActionMask = 2147483647; 89 | files = ( 90 | ); 91 | runOnlyForDeploymentPostprocessing = 0; 92 | }; 93 | /* End PBXFrameworksBuildPhase section */ 94 | 95 | /* Begin PBXGroup section */ 96 | 9034B8471E6F0FE1008E71D4 = { 97 | isa = PBXGroup; 98 | children = ( 99 | 9034B8521E6F0FE1008E71D4 /* vMysqlMonitoring */, 100 | 9034B8511E6F0FE1008E71D4 /* Products */, 101 | F827BE258C8121CA57DEFD22 /* Frameworks */, 102 | ); 103 | sourceTree = ""; 104 | }; 105 | 9034B8511E6F0FE1008E71D4 /* Products */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 9034B8501E6F0FE1008E71D4 /* vMysqlMonitoring.app */, 109 | 9034B8611E6F0FE2008E71D4 /* vMysqlMonitoringTests.xctest */, 110 | 9034B86C1E6F0FE2008E71D4 /* vMysqlMonitoringUITests.xctest */, 111 | ); 112 | name = Products; 113 | sourceTree = ""; 114 | }; 115 | 9034B8521E6F0FE1008E71D4 /* vMysqlMonitoring */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | 9040C3BF1FDF725300A745D5 /* About */, 119 | 9034B8531E6F0FE2008E71D4 /* AppDelegate.swift */, 120 | 9034B8801E6F20F4008E71D4 /* PreferenceData.swift */, 121 | 9034B8551E6F0FE2008E71D4 /* ViewController.swift */, 122 | 9034B8571E6F0FE2008E71D4 /* Assets.xcassets */, 123 | 9034B8591E6F0FE2008E71D4 /* Main.storyboard */, 124 | 9034B85C1E6F0FE2008E71D4 /* Info.plist */, 125 | 900197601FFA7A090000AC44 /* DBManager.h */, 126 | 90F553E620380BBA009A5086 /* DBManager.m */, 127 | 90F553E520380B0E009A5086 /* vMysqlMonitoring-Bridging-Header.h */, 128 | ); 129 | path = vMysqlMonitoring; 130 | sourceTree = ""; 131 | }; 132 | 9040C3BF1FDF725300A745D5 /* About */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 90AE539A1FDF3215008868AE /* AboutController.swift */, 136 | 90AE539B1FDF3215008868AE /* AboutController.xib */, 137 | ); 138 | name = About; 139 | sourceTree = ""; 140 | }; 141 | F827BE258C8121CA57DEFD22 /* Frameworks */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 9020D132203980F2004ECFF9 /* libmariadb.3.dylib */, 145 | ); 146 | name = Frameworks; 147 | sourceTree = ""; 148 | }; 149 | /* End PBXGroup section */ 150 | 151 | /* Begin PBXNativeTarget section */ 152 | 9034B84F1E6F0FE1008E71D4 /* vMysqlMonitoring */ = { 153 | isa = PBXNativeTarget; 154 | buildConfigurationList = 9034B8751E6F0FE2008E71D4 /* Build configuration list for PBXNativeTarget "vMysqlMonitoring" */; 155 | buildPhases = ( 156 | 9034B84C1E6F0FE1008E71D4 /* Sources */, 157 | 9034B84D1E6F0FE1008E71D4 /* Frameworks */, 158 | 9034B84E1E6F0FE1008E71D4 /* Resources */, 159 | 9020D12A20397835004ECFF9 /* Embed Libraries */, 160 | 9020D12E20397E63004ECFF9 /* ShellScript */, 161 | ); 162 | buildRules = ( 163 | ); 164 | dependencies = ( 165 | ); 166 | name = vMysqlMonitoring; 167 | productName = vMysqlMonitoring; 168 | productReference = 9034B8501E6F0FE1008E71D4 /* vMysqlMonitoring.app */; 169 | productType = "com.apple.product-type.application"; 170 | }; 171 | 9034B8601E6F0FE2008E71D4 /* vMysqlMonitoringTests */ = { 172 | isa = PBXNativeTarget; 173 | buildConfigurationList = 9034B8781E6F0FE2008E71D4 /* Build configuration list for PBXNativeTarget "vMysqlMonitoringTests" */; 174 | buildPhases = ( 175 | 9034B85D1E6F0FE2008E71D4 /* Sources */, 176 | 9034B85E1E6F0FE2008E71D4 /* Frameworks */, 177 | 9034B85F1E6F0FE2008E71D4 /* Resources */, 178 | ); 179 | buildRules = ( 180 | ); 181 | dependencies = ( 182 | 9034B8631E6F0FE2008E71D4 /* PBXTargetDependency */, 183 | ); 184 | name = vMysqlMonitoringTests; 185 | productName = vMysqlMonitoringTests; 186 | productReference = 9034B8611E6F0FE2008E71D4 /* vMysqlMonitoringTests.xctest */; 187 | productType = "com.apple.product-type.bundle.unit-test"; 188 | }; 189 | 9034B86B1E6F0FE2008E71D4 /* vMysqlMonitoringUITests */ = { 190 | isa = PBXNativeTarget; 191 | buildConfigurationList = 9034B87B1E6F0FE2008E71D4 /* Build configuration list for PBXNativeTarget "vMysqlMonitoringUITests" */; 192 | buildPhases = ( 193 | 9034B8681E6F0FE2008E71D4 /* Sources */, 194 | 9034B8691E6F0FE2008E71D4 /* Frameworks */, 195 | 9034B86A1E6F0FE2008E71D4 /* Resources */, 196 | ); 197 | buildRules = ( 198 | ); 199 | dependencies = ( 200 | 9034B86E1E6F0FE2008E71D4 /* PBXTargetDependency */, 201 | ); 202 | name = vMysqlMonitoringUITests; 203 | productName = vMysqlMonitoringUITests; 204 | productReference = 9034B86C1E6F0FE2008E71D4 /* vMysqlMonitoringUITests.xctest */; 205 | productType = "com.apple.product-type.bundle.ui-testing"; 206 | }; 207 | /* End PBXNativeTarget section */ 208 | 209 | /* Begin PBXProject section */ 210 | 9034B8481E6F0FE1008E71D4 /* Project object */ = { 211 | isa = PBXProject; 212 | attributes = { 213 | LastSwiftUpdateCheck = 0820; 214 | LastUpgradeCheck = 1000; 215 | ORGANIZATIONNAME = Virink; 216 | TargetAttributes = { 217 | 9034B84F1E6F0FE1008E71D4 = { 218 | CreatedOnToolsVersion = 8.2.1; 219 | DevelopmentTeam = A67UG8ZSE2; 220 | LastSwiftMigration = 0900; 221 | ProvisioningStyle = Automatic; 222 | }; 223 | 9034B8601E6F0FE2008E71D4 = { 224 | CreatedOnToolsVersion = 8.2.1; 225 | LastSwiftMigration = 0900; 226 | ProvisioningStyle = Automatic; 227 | TestTargetID = 9034B84F1E6F0FE1008E71D4; 228 | }; 229 | 9034B86B1E6F0FE2008E71D4 = { 230 | CreatedOnToolsVersion = 8.2.1; 231 | LastSwiftMigration = 0900; 232 | ProvisioningStyle = Automatic; 233 | TestTargetID = 9034B84F1E6F0FE1008E71D4; 234 | }; 235 | }; 236 | }; 237 | buildConfigurationList = 9034B84B1E6F0FE1008E71D4 /* Build configuration list for PBXProject "vMysqlMonitoring" */; 238 | compatibilityVersion = "Xcode 3.2"; 239 | developmentRegion = English; 240 | hasScannedForEncodings = 0; 241 | knownRegions = ( 242 | en, 243 | Base, 244 | ); 245 | mainGroup = 9034B8471E6F0FE1008E71D4; 246 | productRefGroup = 9034B8511E6F0FE1008E71D4 /* Products */; 247 | projectDirPath = ""; 248 | projectRoot = ""; 249 | targets = ( 250 | 9034B84F1E6F0FE1008E71D4 /* vMysqlMonitoring */, 251 | 9034B8601E6F0FE2008E71D4 /* vMysqlMonitoringTests */, 252 | 9034B86B1E6F0FE2008E71D4 /* vMysqlMonitoringUITests */, 253 | ); 254 | }; 255 | /* End PBXProject section */ 256 | 257 | /* Begin PBXResourcesBuildPhase section */ 258 | 9034B84E1E6F0FE1008E71D4 /* Resources */ = { 259 | isa = PBXResourcesBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | 9020D133203984DE004ECFF9 /* libmariadb.3.dylib in Resources */, 263 | 9034B8581E6F0FE2008E71D4 /* Assets.xcassets in Resources */, 264 | 90AE539D1FDF3215008868AE /* AboutController.xib in Resources */, 265 | 9034B85B1E6F0FE2008E71D4 /* Main.storyboard in Resources */, 266 | ); 267 | runOnlyForDeploymentPostprocessing = 0; 268 | }; 269 | 9034B85F1E6F0FE2008E71D4 /* Resources */ = { 270 | isa = PBXResourcesBuildPhase; 271 | buildActionMask = 2147483647; 272 | files = ( 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | }; 276 | 9034B86A1E6F0FE2008E71D4 /* Resources */ = { 277 | isa = PBXResourcesBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | }; 283 | /* End PBXResourcesBuildPhase section */ 284 | 285 | /* Begin PBXShellScriptBuildPhase section */ 286 | 9020D12E20397E63004ECFF9 /* ShellScript */ = { 287 | isa = PBXShellScriptBuildPhase; 288 | buildActionMask = 2147483647; 289 | files = ( 290 | ); 291 | inputPaths = ( 292 | ); 293 | outputPaths = ( 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | shellPath = /bin/sh; 297 | shellScript = "#!/bin/bash\n\n# 每次构建的时候build号自增\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nbuildNumber=$(($buildNumber +1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n\n# 修改依赖路径\ninstall_name_tool -change /usr/local/opt/mariadb/lib/libmariadb.3.dylib @executable_path/../Frameworks/libmariadb.3.dylib \"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME\""; 298 | }; 299 | /* End PBXShellScriptBuildPhase section */ 300 | 301 | /* Begin PBXSourcesBuildPhase section */ 302 | 9034B84C1E6F0FE1008E71D4 /* Sources */ = { 303 | isa = PBXSourcesBuildPhase; 304 | buildActionMask = 2147483647; 305 | files = ( 306 | 90F553E720380BBA009A5086 /* DBManager.m in Sources */, 307 | 9034B8811E6F20F4008E71D4 /* PreferenceData.swift in Sources */, 308 | 9034B8561E6F0FE2008E71D4 /* ViewController.swift in Sources */, 309 | 9034B8541E6F0FE2008E71D4 /* AppDelegate.swift in Sources */, 310 | 90AE539C1FDF3215008868AE /* AboutController.swift in Sources */, 311 | ); 312 | runOnlyForDeploymentPostprocessing = 0; 313 | }; 314 | 9034B85D1E6F0FE2008E71D4 /* Sources */ = { 315 | isa = PBXSourcesBuildPhase; 316 | buildActionMask = 2147483647; 317 | files = ( 318 | ); 319 | runOnlyForDeploymentPostprocessing = 0; 320 | }; 321 | 9034B8681E6F0FE2008E71D4 /* Sources */ = { 322 | isa = PBXSourcesBuildPhase; 323 | buildActionMask = 2147483647; 324 | files = ( 325 | ); 326 | runOnlyForDeploymentPostprocessing = 0; 327 | }; 328 | /* End PBXSourcesBuildPhase section */ 329 | 330 | /* Begin PBXTargetDependency section */ 331 | 9034B8631E6F0FE2008E71D4 /* PBXTargetDependency */ = { 332 | isa = PBXTargetDependency; 333 | target = 9034B84F1E6F0FE1008E71D4 /* vMysqlMonitoring */; 334 | targetProxy = 9034B8621E6F0FE2008E71D4 /* PBXContainerItemProxy */; 335 | }; 336 | 9034B86E1E6F0FE2008E71D4 /* PBXTargetDependency */ = { 337 | isa = PBXTargetDependency; 338 | target = 9034B84F1E6F0FE1008E71D4 /* vMysqlMonitoring */; 339 | targetProxy = 9034B86D1E6F0FE2008E71D4 /* PBXContainerItemProxy */; 340 | }; 341 | /* End PBXTargetDependency section */ 342 | 343 | /* Begin PBXVariantGroup section */ 344 | 9034B8591E6F0FE2008E71D4 /* Main.storyboard */ = { 345 | isa = PBXVariantGroup; 346 | children = ( 347 | 9034B85A1E6F0FE2008E71D4 /* Base */, 348 | ); 349 | name = Main.storyboard; 350 | sourceTree = ""; 351 | }; 352 | /* End PBXVariantGroup section */ 353 | 354 | /* Begin XCBuildConfiguration section */ 355 | 9034B8731E6F0FE2008E71D4 /* Debug */ = { 356 | isa = XCBuildConfiguration; 357 | buildSettings = { 358 | ALWAYS_SEARCH_USER_PATHS = NO; 359 | CLANG_ANALYZER_NONNULL = YES; 360 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 361 | CLANG_CXX_LIBRARY = "libc++"; 362 | CLANG_ENABLE_MODULES = YES; 363 | CLANG_ENABLE_OBJC_ARC = YES; 364 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 365 | CLANG_WARN_BOOL_CONVERSION = YES; 366 | CLANG_WARN_COMMA = YES; 367 | CLANG_WARN_CONSTANT_CONVERSION = YES; 368 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 369 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 370 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 371 | CLANG_WARN_EMPTY_BODY = YES; 372 | CLANG_WARN_ENUM_CONVERSION = YES; 373 | CLANG_WARN_INFINITE_RECURSION = YES; 374 | CLANG_WARN_INT_CONVERSION = YES; 375 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 376 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 377 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 378 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 379 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 380 | CLANG_WARN_STRICT_PROTOTYPES = YES; 381 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 382 | CLANG_WARN_UNREACHABLE_CODE = YES; 383 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 384 | CODE_SIGN_IDENTITY = "-"; 385 | COPY_PHASE_STRIP = NO; 386 | DEBUG_INFORMATION_FORMAT = dwarf; 387 | ENABLE_STRICT_OBJC_MSGSEND = YES; 388 | ENABLE_TESTABILITY = YES; 389 | GCC_C_LANGUAGE_STANDARD = gnu99; 390 | GCC_DYNAMIC_NO_PIC = NO; 391 | GCC_NO_COMMON_BLOCKS = YES; 392 | GCC_OPTIMIZATION_LEVEL = 0; 393 | GCC_PREPROCESSOR_DEFINITIONS = ( 394 | "DEBUG=1", 395 | "$(inherited)", 396 | ); 397 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 398 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 399 | GCC_WARN_UNDECLARED_SELECTOR = YES; 400 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 401 | GCC_WARN_UNUSED_FUNCTION = YES; 402 | GCC_WARN_UNUSED_VARIABLE = YES; 403 | MACOSX_DEPLOYMENT_TARGET = 10.12; 404 | MTL_ENABLE_DEBUG_INFO = YES; 405 | ONLY_ACTIVE_ARCH = YES; 406 | SDKROOT = macosx; 407 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 408 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 409 | }; 410 | name = Debug; 411 | }; 412 | 9034B8741E6F0FE2008E71D4 /* Release */ = { 413 | isa = XCBuildConfiguration; 414 | buildSettings = { 415 | ALWAYS_SEARCH_USER_PATHS = NO; 416 | CLANG_ANALYZER_NONNULL = YES; 417 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 418 | CLANG_CXX_LIBRARY = "libc++"; 419 | CLANG_ENABLE_MODULES = YES; 420 | CLANG_ENABLE_OBJC_ARC = YES; 421 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 422 | CLANG_WARN_BOOL_CONVERSION = YES; 423 | CLANG_WARN_COMMA = YES; 424 | CLANG_WARN_CONSTANT_CONVERSION = YES; 425 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 426 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 427 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 428 | CLANG_WARN_EMPTY_BODY = YES; 429 | CLANG_WARN_ENUM_CONVERSION = YES; 430 | CLANG_WARN_INFINITE_RECURSION = YES; 431 | CLANG_WARN_INT_CONVERSION = YES; 432 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 433 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 434 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 435 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 436 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 437 | CLANG_WARN_STRICT_PROTOTYPES = YES; 438 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 439 | CLANG_WARN_UNREACHABLE_CODE = YES; 440 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 441 | CODE_SIGN_IDENTITY = "-"; 442 | COPY_PHASE_STRIP = NO; 443 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 444 | ENABLE_NS_ASSERTIONS = NO; 445 | ENABLE_STRICT_OBJC_MSGSEND = YES; 446 | GCC_C_LANGUAGE_STANDARD = gnu99; 447 | GCC_NO_COMMON_BLOCKS = YES; 448 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 449 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 450 | GCC_WARN_UNDECLARED_SELECTOR = YES; 451 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 452 | GCC_WARN_UNUSED_FUNCTION = YES; 453 | GCC_WARN_UNUSED_VARIABLE = YES; 454 | MACOSX_DEPLOYMENT_TARGET = 10.12; 455 | MTL_ENABLE_DEBUG_INFO = NO; 456 | SDKROOT = macosx; 457 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 458 | }; 459 | name = Release; 460 | }; 461 | 9034B8761E6F0FE2008E71D4 /* Debug */ = { 462 | isa = XCBuildConfiguration; 463 | buildSettings = { 464 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 465 | CLANG_ENABLE_MODULES = YES; 466 | CODE_SIGN_IDENTITY = "Mac Developer"; 467 | COMBINE_HIDPI_IMAGES = YES; 468 | DEAD_CODE_STRIPPING = YES; 469 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 470 | DEPLOYMENT_POSTPROCESSING = YES; 471 | DEVELOPMENT_TEAM = A67UG8ZSE2; 472 | FRAMEWORK_SEARCH_PATHS = "@executable_path/../Frameworks"; 473 | GCC_ENABLE_CPP_EXCEPTIONS = NO; 474 | GCC_ENABLE_OBJC_EXCEPTIONS = NO; 475 | INFOPLIST_FILE = vMysqlMonitoring/Info.plist; 476 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 477 | LIBRARY_SEARCH_PATHS = ( 478 | "$(inherited)", 479 | "$(PROJECT_DIR)/vMysqlMonitoring", 480 | ); 481 | OTHER_LDFLAGS = ( 482 | "-L/usr/local/lib", 483 | "-lmysqlclient", 484 | ); 485 | OTHER_SWIFT_FLAGS = "-DDEBUG"; 486 | PRODUCT_BUNDLE_IDENTIFIER = com.virzz.tools.vMysqlMonitoring; 487 | PRODUCT_NAME = "$(TARGET_NAME)"; 488 | SWIFT_OBJC_BRIDGING_HEADER = "vMysqlMonitoring/vMysqlMonitoring-Bridging-Header.h"; 489 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 490 | SWIFT_VERSION = 3.0; 491 | USER_HEADER_SEARCH_PATHS = /usr/local/include/mysql; 492 | }; 493 | name = Debug; 494 | }; 495 | 9034B8771E6F0FE2008E71D4 /* Release */ = { 496 | isa = XCBuildConfiguration; 497 | buildSettings = { 498 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 499 | CLANG_ENABLE_MODULES = YES; 500 | CODE_SIGN_IDENTITY = "Mac Developer"; 501 | COMBINE_HIDPI_IMAGES = YES; 502 | DEAD_CODE_STRIPPING = YES; 503 | DEBUG_INFORMATION_FORMAT = dwarf; 504 | DEPLOYMENT_POSTPROCESSING = YES; 505 | DEVELOPMENT_TEAM = A67UG8ZSE2; 506 | FRAMEWORK_SEARCH_PATHS = "@executable_path/../Frameworks"; 507 | GCC_ENABLE_CPP_EXCEPTIONS = NO; 508 | GCC_ENABLE_OBJC_EXCEPTIONS = NO; 509 | INFOPLIST_FILE = vMysqlMonitoring/Info.plist; 510 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 511 | LIBRARY_SEARCH_PATHS = ( 512 | "$(inherited)", 513 | "$(PROJECT_DIR)/vMysqlMonitoring", 514 | ); 515 | ONLY_ACTIVE_ARCH = YES; 516 | OTHER_LDFLAGS = ( 517 | "-L/usr/local/lib", 518 | "-lmysqlclient", 519 | ); 520 | PRODUCT_BUNDLE_IDENTIFIER = com.virzz.tools.vMysqlMonitoring; 521 | PRODUCT_NAME = "$(TARGET_NAME)"; 522 | SWIFT_OBJC_BRIDGING_HEADER = "vMysqlMonitoring/vMysqlMonitoring-Bridging-Header.h"; 523 | SWIFT_VERSION = 3.0; 524 | USER_HEADER_SEARCH_PATHS = /usr/local/include/mysql; 525 | }; 526 | name = Release; 527 | }; 528 | 9034B8791E6F0FE2008E71D4 /* Debug */ = { 529 | isa = XCBuildConfiguration; 530 | buildSettings = { 531 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 532 | BUNDLE_LOADER = "$(TEST_HOST)"; 533 | COMBINE_HIDPI_IMAGES = YES; 534 | INFOPLIST_FILE = vMysqlMonitoringTests/Info.plist; 535 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 536 | PRODUCT_BUNDLE_IDENTIFIER = com.virzz.macos.vMysqlMonitoringTests; 537 | PRODUCT_NAME = "$(TARGET_NAME)"; 538 | SWIFT_VERSION = 3.0; 539 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/vMysqlMonitoring.app/Contents/MacOS/vMysqlMonitoring"; 540 | }; 541 | name = Debug; 542 | }; 543 | 9034B87A1E6F0FE2008E71D4 /* Release */ = { 544 | isa = XCBuildConfiguration; 545 | buildSettings = { 546 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 547 | BUNDLE_LOADER = "$(TEST_HOST)"; 548 | COMBINE_HIDPI_IMAGES = YES; 549 | INFOPLIST_FILE = vMysqlMonitoringTests/Info.plist; 550 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 551 | PRODUCT_BUNDLE_IDENTIFIER = com.virzz.macos.vMysqlMonitoringTests; 552 | PRODUCT_NAME = "$(TARGET_NAME)"; 553 | SWIFT_VERSION = 3.0; 554 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/vMysqlMonitoring.app/Contents/MacOS/vMysqlMonitoring"; 555 | }; 556 | name = Release; 557 | }; 558 | 9034B87C1E6F0FE2008E71D4 /* Debug */ = { 559 | isa = XCBuildConfiguration; 560 | buildSettings = { 561 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 562 | COMBINE_HIDPI_IMAGES = YES; 563 | INFOPLIST_FILE = vMysqlMonitoringUITests/Info.plist; 564 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 565 | PRODUCT_BUNDLE_IDENTIFIER = com.virzz.macos.vMysqlMonitoringUITests; 566 | PRODUCT_NAME = "$(TARGET_NAME)"; 567 | SWIFT_VERSION = 3.0; 568 | TEST_TARGET_NAME = vMysqlMonitoring; 569 | }; 570 | name = Debug; 571 | }; 572 | 9034B87D1E6F0FE2008E71D4 /* Release */ = { 573 | isa = XCBuildConfiguration; 574 | buildSettings = { 575 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 576 | COMBINE_HIDPI_IMAGES = YES; 577 | INFOPLIST_FILE = vMysqlMonitoringUITests/Info.plist; 578 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 579 | PRODUCT_BUNDLE_IDENTIFIER = com.virzz.macos.vMysqlMonitoringUITests; 580 | PRODUCT_NAME = "$(TARGET_NAME)"; 581 | SWIFT_VERSION = 3.0; 582 | TEST_TARGET_NAME = vMysqlMonitoring; 583 | }; 584 | name = Release; 585 | }; 586 | /* End XCBuildConfiguration section */ 587 | 588 | /* Begin XCConfigurationList section */ 589 | 9034B84B1E6F0FE1008E71D4 /* Build configuration list for PBXProject "vMysqlMonitoring" */ = { 590 | isa = XCConfigurationList; 591 | buildConfigurations = ( 592 | 9034B8731E6F0FE2008E71D4 /* Debug */, 593 | 9034B8741E6F0FE2008E71D4 /* Release */, 594 | ); 595 | defaultConfigurationIsVisible = 0; 596 | defaultConfigurationName = Release; 597 | }; 598 | 9034B8751E6F0FE2008E71D4 /* Build configuration list for PBXNativeTarget "vMysqlMonitoring" */ = { 599 | isa = XCConfigurationList; 600 | buildConfigurations = ( 601 | 9034B8761E6F0FE2008E71D4 /* Debug */, 602 | 9034B8771E6F0FE2008E71D4 /* Release */, 603 | ); 604 | defaultConfigurationIsVisible = 0; 605 | defaultConfigurationName = Release; 606 | }; 607 | 9034B8781E6F0FE2008E71D4 /* Build configuration list for PBXNativeTarget "vMysqlMonitoringTests" */ = { 608 | isa = XCConfigurationList; 609 | buildConfigurations = ( 610 | 9034B8791E6F0FE2008E71D4 /* Debug */, 611 | 9034B87A1E6F0FE2008E71D4 /* Release */, 612 | ); 613 | defaultConfigurationIsVisible = 0; 614 | defaultConfigurationName = Release; 615 | }; 616 | 9034B87B1E6F0FE2008E71D4 /* Build configuration list for PBXNativeTarget "vMysqlMonitoringUITests" */ = { 617 | isa = XCConfigurationList; 618 | buildConfigurations = ( 619 | 9034B87C1E6F0FE2008E71D4 /* Debug */, 620 | 9034B87D1E6F0FE2008E71D4 /* Release */, 621 | ); 622 | defaultConfigurationIsVisible = 0; 623 | defaultConfigurationName = Release; 624 | }; 625 | /* End XCConfigurationList section */ 626 | }; 627 | rootObject = 9034B8481E6F0FE1008E71D4 /* Project object */; 628 | } 629 | -------------------------------------------------------------------------------- /vMysqlMonitoring/AboutController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AboutController.swift 3 | // vMysqlMonitoring 4 | // 5 | // Created by Virink on 2017-12-12. 6 | // Copyright © 2017 Virink. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class AboutController: NSViewController { 12 | 13 | @IBOutlet weak var version: NSTextField! 14 | 15 | var le:Any? 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | // Do view setup here. 20 | 21 | self.version.stringValue = __VERSION__ 22 | } 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /vMysqlMonitoring/AboutController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /vMysqlMonitoring/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // vMysqlMonitoring 4 | // 5 | // Created by Virink on 2017/3/7. 6 | // Copyright © 2017年 Virink. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | func VLog(msg: T, 12 | fileName: String = #file, 13 | methodName: String = #function, 14 | lineNumber: Int = #line){ 15 | #if DEBUG 16 | print("[\((fileName as NSString).pathComponents.last!):\(lineNumber)] [\(methodName)]:\n\(msg)\n-------------------------------------------\n") 17 | #endif 18 | } 19 | 20 | @NSApplicationMain 21 | class AppDelegate: NSObject, NSApplicationDelegate { 22 | 23 | func applicationDidFinishLaunching(_ aNotification: Notification) { 24 | // Insert code here to initialize your application 25 | 26 | } 27 | 28 | func applicationWillTerminate(_ aNotification: Notification) { 29 | // Insert code here to tear down your application 30 | } 31 | 32 | } 33 | 34 | -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/About.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "filename" : "icon_128x128.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "filename" : "icon_128x128@2x.png", 11 | "scale" : "2x" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/About.imageset/icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/virink/vMysqlMonitoring/7271a79e957fac0b2a051f01b1840679262f08e7/vMysqlMonitoring/Assets.xcassets/About.imageset/icon_128x128.png -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/About.imageset/icon_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/virink/vMysqlMonitoring/7271a79e957fac0b2a051f01b1840679262f08e7/vMysqlMonitoring/Assets.xcassets/About.imageset/icon_128x128@2x.png -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/Alipay.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "filename" : "icon_256x256.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "filename" : "icon_256x256@2x.png", 11 | "scale" : "2x" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/Alipay.imageset/icon_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/virink/vMysqlMonitoring/7271a79e957fac0b2a051f01b1840679262f08e7/vMysqlMonitoring/Assets.xcassets/Alipay.imageset/icon_256x256.png -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/Alipay.imageset/icon_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/virink/vMysqlMonitoring/7271a79e957fac0b2a051f01b1840679262f08e7/vMysqlMonitoring/Assets.xcassets/Alipay.imageset/icon_256x256@2x.png -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "icon_16x16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "icon_16x16@2x.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "icon_32x32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "icon_32x32@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "icon_128x128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "icon_128x128@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "icon_256x256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "icon_256x256@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "icon_512x512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "icon_512x512@2x.png", 61 | "scale" : "2x" 62 | } 63 | ] 64 | } -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/virink/vMysqlMonitoring/7271a79e957fac0b2a051f01b1840679262f08e7/vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_128x128.png -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/virink/vMysqlMonitoring/7271a79e957fac0b2a051f01b1840679262f08e7/vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/virink/vMysqlMonitoring/7271a79e957fac0b2a051f01b1840679262f08e7/vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_16x16.png -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/virink/vMysqlMonitoring/7271a79e957fac0b2a051f01b1840679262f08e7/vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/virink/vMysqlMonitoring/7271a79e957fac0b2a051f01b1840679262f08e7/vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_256x256.png -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/virink/vMysqlMonitoring/7271a79e957fac0b2a051f01b1840679262f08e7/vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/virink/vMysqlMonitoring/7271a79e957fac0b2a051f01b1840679262f08e7/vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_32x32.png -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/virink/vMysqlMonitoring/7271a79e957fac0b2a051f01b1840679262f08e7/vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/virink/vMysqlMonitoring/7271a79e957fac0b2a051f01b1840679262f08e7/vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_512x512.png -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/virink/vMysqlMonitoring/7271a79e957fac0b2a051f01b1840679262f08e7/vMysqlMonitoring/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png -------------------------------------------------------------------------------- /vMysqlMonitoring/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /vMysqlMonitoring/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | host 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | port 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | user 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | pass 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | -------------------------------------------------------------------------------- /vMysqlMonitoring/DBManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // Mysql.h 3 | // vMysqlMonitoring 4 | // 5 | // Created by Virink on 2018-01-01. 6 | // Copyright © 2018 Virink. All rights reserved. 7 | // 8 | 9 | #ifndef Mysql_h 10 | #define Mysql_h 11 | 12 | #import 13 | 14 | #ifdef DEBUG 15 | # define VLog(FORMAT, ...) fprintf(stderr,"[%s:%d]%s\n%s\n-------------------------------------------------------\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __FUNCTION__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]); 16 | #else 17 | # define VLog(FORMAT, ...) nil 18 | #endif 19 | 20 | @class MysqlLog; 21 | 22 | @interface DBManager : NSObject 23 | 24 | + (DBManager *)sharedManager; 25 | 26 | - (BOOL)connect:(NSString *)host connectUser:(NSString *)user connectPassword:(NSString *)pass connectName:(NSString *)name connectPort:(unsigned int)port; 27 | - (BOOL)disconnect; 28 | - (NSMutableArray *)getAllSqls; 29 | - (BOOL)getTime; 30 | - (BOOL)clearLog; 31 | 32 | @end 33 | 34 | #endif /* Mysql_h */ 35 | -------------------------------------------------------------------------------- /vMysqlMonitoring/DBManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // DBManager.m 3 | // vMysqlMonitoring 4 | // 5 | // Created by Virink on 2018-17-02. 6 | // Copyright © 2018 Virink. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "DBManager.h" 12 | #import "mysql.h" 13 | 14 | @interface DBManager() { 15 | MYSQL *_myconnect; 16 | NSString *_time; 17 | } 18 | @end 19 | 20 | @implementation DBManager 21 | 22 | +(DBManager *)sharedManager 23 | { 24 | static DBManager *sharedSingleton = nil; 25 | static dispatch_once_t onceToken; 26 | dispatch_once(&onceToken,^(void) { 27 | sharedSingleton = [[self alloc] init]; 28 | }); 29 | return sharedSingleton; 30 | } 31 | 32 | //- (instancetype)init:(NSString*)host user:(NSString*)user pass:(NSString*)pass name:(NSString*)name port:(unsigned int)port { 33 | - (instancetype)init { 34 | if (self = [super init]) { 35 | _time = @""; 36 | } 37 | return self; 38 | } 39 | 40 | - (BOOL)connect:(NSString *)host connectUser:(NSString *)user connectPassword:(NSString *)pass connectName:(NSString *)name connectPort:(unsigned int)port 41 | { 42 | _myconnect = mysql_init(_myconnect); 43 | _myconnect = mysql_real_connect(_myconnect,[host UTF8String],[user UTF8String],[pass UTF8String],[name UTF8String],port,NULL,CLIENT_MULTI_STATEMENTS); 44 | if (_myconnect != NULL) { 45 | mysql_set_character_set(_myconnect, "utf8"); 46 | VLog(@"连接成功"); 47 | return true; 48 | } else { 49 | VLog(@"连接失败 %s", mysql_error(_myconnect)); 50 | return false; 51 | } 52 | } 53 | 54 | - (BOOL)disconnect 55 | { 56 | mysql_close(_myconnect); 57 | VLog(@"Close From Mysql"); 58 | return true; 59 | } 60 | 61 | - (NSMutableArray *)getAllSqls { 62 | NSMutableArray *false_data = [[NSMutableArray alloc] initWithObjects:[[NSMutableArray alloc] init], nil]; 63 | if (_myconnect == NULL ) { 64 | VLog(@"getAllSqls : 连接数据库失败 %s", mysql_error(_myconnect)); 65 | return false_data; 66 | } 67 | if ( [_time isEqual: @""]) { 68 | VLog(@"getAllSqls : 没设置时间节点 %s", mysql_error(_myconnect)); 69 | return false_data; 70 | } 71 | NSString *sql = [NSString stringWithFormat:@"SELECT event_time,argument FROM mysql.general_log WHERE (command_type = 'Query' OR command_type = 'Execute') AND unix_timestamp(event_time) > %@ AND argument NOT LIKE '%%general_log%%' AND argument NOT LIKE '%%select event_time,argument from%%' AND argument NOT LIKE '%%SHOW%%' AND argument NOT LIKE '%%SELECT STATE%%' AND argument NOT LIKE '%%SET NAMES%%' AND argument NOT LIKE '%%SET PROFILING%%' AND argument NOT LIKE '%%stime_virink%%' AND argument NOT LIKE '%%SELECT QUERY_ID%%' order by event_time desc;",_time]; 72 | int status = mysql_query(_myconnect, [sql UTF8String]); 73 | if (status != 0) { 74 | VLog(@"查询数据失败 %s", mysql_error(_myconnect)); 75 | return false_data; 76 | } 77 | MYSQL_RES *result = mysql_store_result(_myconnect); 78 | long long rows =result->row_count; 79 | NSMutableArray *resultArray = [NSMutableArray arrayWithCapacity:rows]; 80 | unsigned int fieldCount = mysql_field_count(_myconnect); 81 | MYSQL_ROW row; 82 | for (int j = 0; j < rows; j++) { 83 | NSMutableArray *rowArray = [[NSMutableArray alloc] init]; 84 | if((row = mysql_fetch_row(result))){ 85 | for(int i = 0; i < fieldCount; i++){ 86 | [rowArray addObject:[[NSString alloc] initWithUTF8String:row[i]]]; 87 | } 88 | } 89 | [resultArray addObject:rowArray]; 90 | } 91 | mysql_free_result(result); 92 | do { 93 | mysql_free_result(mysql_store_result( _myconnect )); 94 | }while( !mysql_next_result( _myconnect ) ); 95 | row = NULL; 96 | return resultArray; 97 | } 98 | 99 | - (BOOL)getTime { 100 | if (_myconnect == NULL) { 101 | VLog(@"getTime : 连接数据库失败 %s", mysql_error(_myconnect)); 102 | _time = @""; 103 | return false; 104 | } 105 | NSString *sql = @"select unix_timestamp() as 'stime_virink' from dual;"; 106 | int status = mysql_query(_myconnect, [sql UTF8String]); 107 | if (status != 0) { 108 | VLog(@"获取时间失败 %s", mysql_error(_myconnect)); 109 | _time = @""; 110 | return false; 111 | } 112 | MYSQL_RES *result = mysql_store_result(_myconnect); 113 | MYSQL_ROW col = mysql_fetch_row(result); 114 | mysql_free_result(result); 115 | do { 116 | mysql_free_result(mysql_store_result( _myconnect )); 117 | }while( !mysql_next_result( _myconnect ) ); 118 | _time = [NSString stringWithUTF8String:col[0]]; 119 | return true; 120 | } 121 | 122 | - (BOOL)clearLog { 123 | if (_myconnect == NULL) { 124 | VLog(@"clearLog : 连接数据库失败 %s", mysql_error(_myconnect)); 125 | return false; 126 | } 127 | NSString *sql = @"set global general_log=off;truncate table general_log;SET GLOBAL log_output='table';set global general_log=on;"; 128 | mysql_set_server_option(_myconnect,MYSQL_OPTION_MULTI_STATEMENTS_ON); 129 | int status = mysql_query(_myconnect, [sql UTF8String]); 130 | mysql_set_server_option(_myconnect,MYSQL_OPTION_MULTI_STATEMENTS_OFF); 131 | do { 132 | mysql_free_result(mysql_store_result( _myconnect )); 133 | }while( !mysql_next_result( _myconnect ) ); 134 | if (status == 0) { 135 | VLog(@"重置日志成功"); 136 | return true; 137 | } else { 138 | VLog(@"重置日志失败 %s", mysql_error(_myconnect)); 139 | return false; 140 | } 141 | } 142 | @end 143 | -------------------------------------------------------------------------------- /vMysqlMonitoring/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | zh_CN 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.1.1 Beta 21 | CFBundleVersion 22 | 47 23 | LSApplicationCategoryType 24 | public.app-category.utilities 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2017年 Virink. All rights reserved. 29 | NSMainStoryboardFile 30 | Main 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /vMysqlMonitoring/PreferenceData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PreferenceData.swift 3 | // vMysqlMonitoring 4 | // 5 | // Created by Virink on 2017/3/8. 6 | // Copyright © 2017年 Virink. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | let DATA_DIRECTORY = "\(NSHomeDirectory())/Library/Application Support/\(Bundle.main.bundleIdentifier!)" 12 | let DATA_PATH = "\(DATA_DIRECTORY)/Preference.dat" 13 | 14 | class PreferenceData:NSObject { 15 | 16 | static let sharedInstance = PreferenceData() 17 | static let default_data = "127.0.0.1:3306:root::mysql" 18 | 19 | var host:String! = nil 20 | var port:Int! = nil 21 | var user:String! = nil 22 | var pass:String! = nil 23 | var name:String! = nil 24 | 25 | override init() 26 | { 27 | if !FileManager.default.fileExists(atPath: DATA_DIRECTORY, isDirectory: nil) { 28 | do{ 29 | try FileManager.default.createDirectory(atPath: DATA_DIRECTORY, withIntermediateDirectories: true, attributes: nil) 30 | } 31 | catch { 32 | } 33 | } 34 | if !FileManager.default.fileExists(atPath: DATA_PATH) { 35 | do{ 36 | try PreferenceData.default_data.write(toFile: DATA_PATH, atomically: false, encoding: String.Encoding.utf8) 37 | } 38 | catch { 39 | } 40 | } 41 | super.init() 42 | read() 43 | } 44 | 45 | func read(){ 46 | let conf = try! NSString(contentsOfFile: DATA_PATH, encoding: String.Encoding.utf8.rawValue) as String 47 | let data = conf.components(separatedBy: ":") 48 | if (data.count != 5){ 49 | VLog(msg: "mysql config error") 50 | try! PreferenceData.default_data.write(toFile: DATA_PATH, atomically: false, encoding: String.Encoding.utf8) 51 | read() 52 | } else{ 53 | self.host = data[0] 54 | self.port = (data[1] as NSString).integerValue 55 | self.user = data[2] 56 | self.pass = data[3] 57 | self.name = data[4] 58 | VLog(msg: "mysql config : \(data)") 59 | } 60 | } 61 | 62 | func save() 63 | { 64 | let data:String 65 | data = self.host+":\(String(self.port)):"+self.user+":"+self.pass+":"+self.name 66 | try! data.write(toFile: DATA_PATH, atomically: false, encoding: String.Encoding.utf8) 67 | VLog(msg:"save mysql config : \(data)") 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /vMysqlMonitoring/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // vMysqlMonitoring 4 | // 5 | // Created by Virink on 2017/3/7. 6 | // Copyright © 2017年 Virink. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | let __VERSION__ = "Ver 1.1.1 Beta" 12 | 13 | class ViewController: NSViewController { 14 | 15 | @IBOutlet weak var TableView: NSTableView! 16 | @IBOutlet weak var mainMenu: NSMenu! 17 | @IBOutlet weak var filterTextField: NSTextField! 18 | @IBOutlet weak var previewTextField: NSTextField! 19 | 20 | @IBOutlet weak var dbHost: NSTextField! 21 | @IBOutlet weak var dbPort: NSTextField! 22 | @IBOutlet weak var dbUser: NSTextField! 23 | @IBOutlet weak var dbPass: NSTextField! 24 | 25 | // the data for the table 26 | dynamic var listData = [NSDictionary]() 27 | dynamic var original_filter = [NSDictionary]() 28 | 29 | dynamic var aboutWin: NSWindow! = nil 30 | dynamic var sessionCode : NSApplication.ModalSession? = nil 31 | 32 | // DBManager 33 | var dbc = PreferenceData.sharedInstance 34 | var filter:String = "" 35 | var db:DBManager = DBManager.shared() 36 | 37 | override func viewDidLoad() { 38 | super.viewDidLoad() 39 | 40 | NotificationCenter.default.addObserver(self, selector:#selector(self.closeAbout(_:)), name: NSNotification.Name.NSWindowWillClose, object: nil) 41 | 42 | NSApp.mainMenu = mainMenu 43 | // self.view.window?.makeFirstResponder(self) 44 | 45 | self.connectDB() 46 | } 47 | 48 | override var representedObject: Any? { 49 | didSet { 50 | self.aboutWin.isReleasedWhenClosed = true 51 | self.aboutWin.close() 52 | NotificationCenter.default.removeObserver(self) 53 | } 54 | } 55 | 56 | @IBAction func openAbout(_ sender: Any){ 57 | if self.sessionCode == nil { 58 | if (self.aboutWin == nil) { 59 | let frame = CGRect(x: 0, y: 0, width: 400, height: 500) 60 | let style : NSWindow.StyleMask = [NSWindow.StyleMask.titled,NSWindow.StyleMask.closable] 61 | self.aboutWin = NSWindow(contentRect:frame, styleMask:style, backing:.buffered, defer:false) 62 | self.aboutWin.title = "About vMysqlMonitoring" 63 | self.aboutWin.contentViewController = AboutController() 64 | self.aboutWin.isReleasedWhenClosed = false 65 | } 66 | self.sessionCode = NSApplication.shared().beginModalSession(for: self.aboutWin) 67 | self.aboutWin.center() 68 | } 69 | } 70 | 71 | func closeAbout(_ sender: Any){ 72 | VLog(msg:"\(sender)") 73 | if let sessionCode = self.sessionCode { 74 | NSApplication.shared().endModalSession(sessionCode) 75 | self.sessionCode = nil 76 | VLog(msg:"closeAbout") 77 | } 78 | if let win = (sender as AnyObject).object { 79 | if win as! NSObject == self.view.window! { 80 | VLog(msg:"close App") 81 | NSApp.terminate(self) 82 | } 83 | } 84 | } 85 | 86 | @IBAction func setOpenLog(_ sender: Any) { 87 | self.db.clearLog() 88 | } 89 | 90 | @IBAction func setTimeNow(_ sender: Any) { 91 | self.db.getTime() 92 | } 93 | 94 | @IBAction func GetQuerySQL(_ sender: Any) { 95 | var originalData = [NSDictionary]() 96 | self.listData.removeAll() 97 | self.original_filter.removeAll() 98 | let rows = self.db.getAllSqls() as NSMutableArray 99 | if (rows.count > 0 && (rows[0] as! NSMutableArray).count > 0){ 100 | for row in rows { 101 | VLog(msg: row) 102 | let _r = row as! NSMutableArray 103 | let t:Array = (_r[0] as! String).components(separatedBy: ".") 104 | originalData.append(["vtime":t[0],"vsql":_r[1]]) 105 | } 106 | self.original_filter = originalData 107 | self.listData = originalData 108 | self.TableView.reloadData() 109 | } 110 | } 111 | 112 | @IBAction func Filter(_ sender: Any) { 113 | self.view.window?.makeFirstResponder(self.filterTextField) 114 | } 115 | 116 | @IBAction func showInPreview(_ sender:Any){ 117 | let row = self.TableView.selectedRow 118 | if row<0 { 119 | return 120 | } 121 | let msg = self.listData[row].value(forKey: "vsql") 122 | self.previewTextField.stringValue = msg as! String 123 | } 124 | 125 | @IBAction func copyTableData(_ sender: Any){ 126 | let row = self.TableView.selectedRow 127 | if row<0 { 128 | return 129 | } 130 | let msg = self.listData[row].value(forKey: "vsql") 131 | let pb = NSPasteboard.general() 132 | pb.clearContents() 133 | pb.writeObjects([msg as! NSString]) 134 | VLog(msg:"\(self.listData[row].value(forKey: "vsql") as! String)") 135 | // 弹出用户通知 user notification 136 | let notification = NSUserNotification() 137 | notification.title = "Set \"\(String(describing: msg))\" to Pasteboard Success!" 138 | NSUserNotificationCenter.default.deliver(notification) 139 | } 140 | 141 | func connectDB() { 142 | if (self.db.connect(dbc.host,connectUser: dbc.user,connectPassword: dbc.pass,connectName: dbc.name,connectPort: UInt32(dbc.port))){ 143 | self.db.getTime() 144 | } 145 | } 146 | 147 | var p_host:String{ 148 | get{ return PreferenceData.sharedInstance.host } 149 | set{ PreferenceData.sharedInstance.host = newValue 150 | PreferenceData.sharedInstance.save() 151 | self.connectDB() 152 | } 153 | } 154 | 155 | var p_port:Int{ 156 | get{ return PreferenceData.sharedInstance.port } 157 | set{ PreferenceData.sharedInstance.port = newValue 158 | PreferenceData.sharedInstance.save() 159 | self.connectDB() 160 | } 161 | } 162 | 163 | var p_user:String{ 164 | get{ return PreferenceData.sharedInstance.user } 165 | set{ PreferenceData.sharedInstance.user = newValue 166 | PreferenceData.sharedInstance.save() 167 | self.connectDB() 168 | } 169 | } 170 | 171 | var p_pass:String{ 172 | get{ return PreferenceData.sharedInstance.pass } 173 | set{ PreferenceData.sharedInstance.pass = newValue 174 | PreferenceData.sharedInstance.save() 175 | self.connectDB() 176 | } 177 | } 178 | 179 | func filter(f:String){ 180 | self.listData.removeAll() 181 | if f != "" { 182 | for xxx in self.original_filter { 183 | let str:String = xxx["vsql"] as! String 184 | if str.lowercased().contains(f.lowercased()) { 185 | self.listData.append(xxx) 186 | } 187 | } 188 | }else{ 189 | self.listData = self.original_filter 190 | } 191 | self.TableView.reloadData() 192 | } 193 | 194 | } 195 | 196 | extension ViewController:NSTextFieldDelegate{ 197 | 198 | override func controlTextDidChange(_ obj: Notification) { 199 | if let textField = obj.object as? NSTextField { 200 | let text = textField.stringValue 201 | if(textField == self.filterTextField){ 202 | self.filter(f: text) 203 | VLog(msg: "filterTextField : \(text)") 204 | } 205 | } 206 | } 207 | } 208 | 209 | -------------------------------------------------------------------------------- /vMysqlMonitoring/libmariadb.3.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/virink/vMysqlMonitoring/7271a79e957fac0b2a051f01b1840679262f08e7/vMysqlMonitoring/libmariadb.3.dylib -------------------------------------------------------------------------------- /vMysqlMonitoring/vMysqlMonitoring-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef vMysqlMonitoring_Bridging_Header_h 3 | #define vMysqlMonitoring_Bridging_Header_h 4 | // vMysqlMonitoring_Bridging_Header_h 5 | 6 | #import "DBManager.h" 7 | 8 | #endif 9 | --------------------------------------------------------------------------------