From 2a7a3d879c42abf22202500b63dc74805064d116 Mon Sep 17 00:00:00 2001 From: longxuegang Date: Fri, 10 Mar 2017 10:13:42 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9QUICK=5FSTART.md=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0percona56=20yum=E6=BA=90=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=EF=BC=8C=E4=BB=A5=E5=8F=8A=E8=BD=AF=E9=93=BE?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/QUICK_START.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/QUICK_START.md b/doc/QUICK_START.md index 7e0ead6..19aa38c 100644 --- a/doc/QUICK_START.md +++ b/doc/QUICK_START.md @@ -13,8 +13,11 @@ git clone https://github.com/Meituan-Dianping/SQLAdvisor.git ``` **注意** + 1. 跟据glib安装的路径,修改SQLAdvisor/sqladvisor/CMakeLists.txt中的两处include_directories针对glib设置的path。glib yum 安装默认不需要修改路径 -2. 编译sqladvisor时依赖perconaserverclient_r, 因此需要安装Percona-Server-shared-56。有可能需要配置软链接例如:ln -s libperconaserverclient_r.so.18 libperconaserverclient_r.so +2. 编译sqladvisor时依赖perconaserverclient_r, 因此需要安装Percona-Server-shared-56。有可能需要配置软链接例如:1. cd /usr/lib64/ 2. ln -s libperconaserverclient_r.so.18 libperconaserverclient_r.so +3. 有可能需要配置percona56 yum源: yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm + #### 1.3 编译依赖项sqlparser From f547d11cf4447f0708c222e1fc882701bceefaa1 Mon Sep 17 00:00:00 2001 From: longxuegang Date: Fri, 10 Mar 2017 17:37:44 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9README.md,=E5=8E=BB?= =?UTF-8?q?=E6=8E=89=E4=B8=80=E4=BA=9B=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 73cd332..f3073c3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ### 一、简介 -SQLAdvisor是由美团点评公司技术工程部DBA团队(北京)开发维护的一个分析SQL给出索引优化建议的工具。它基于MySQL原生态词法解析,结合分析SQL中的where条件、聚合条件、多表Join关系 给出索引优化建议。**目前SQLAdvisor在美团点评广泛应用,包括美团支付、酒店旅游、外卖、团购等产品线,公司内部对SQLAdvisor的开发全面转到github上,开源和内部使用保持一致**。 +SQLAdvisor是由美团点评公司技术工程部DBA团队(北京)开发维护的一个分析SQL给出索引优化建议的工具。它基于MySQL原生态词法解析,结合分析SQL中的where条件、聚合条件、多表Join关系 给出索引优化建议。**目前SQLAdvisor在美团点评内部广泛应用,公司内部对SQLAdvisor的开发全面转到github上,开源和内部使用保持一致**。 **主要功能:输出SQL索引优化建议** From ce1652d8e476d52d98fc74b36a4ad026eea8ba79 Mon Sep 17 00:00:00 2001 From: tsthght <781181214@qq.com> Date: Tue, 14 Mar 2017 08:43:11 +0800 Subject: [PATCH 3/3] =?UTF-8?q?bugfix:=E4=BF=AE=E5=A4=8D=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E8=A1=8C=E4=B8=8D=E6=94=AF=E6=8C=81=E4=B8=AD=E6=96=87=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(issue=20#10)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sqladvisor/main.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sqladvisor/main.cc b/sqladvisor/main.cc index 36882a7..b39b625 100644 --- a/sqladvisor/main.cc +++ b/sqladvisor/main.cc @@ -2,6 +2,7 @@ #include #include +#include #include "sql/mysqld.h" #include "sql/sql_class.h" #include "sql/sql_lex.h" @@ -1339,7 +1340,7 @@ int main(int argc, char **argv) { char *query = NULL; char *sqlparse_path = strdup("/usr/local/sqlparser"); int i = 0; - + char *lc = NULL; if (mysqld_init(sqlparse_path)) { sql_print_error("加载sqlparser模块有错 \n"); if(sqlparse_path) free(sqlparse_path); @@ -1347,6 +1348,13 @@ int main(int argc, char **argv) { } if(sqlparse_path) free(sqlparse_path); + lc = setlocale(LC_ALL, ""); + if (NULL == lc) { + sql_print_error("setlocale 有错 \n"); + if(sqlparse_path) free(sqlparse_path); + return -1; + } + ConnectionOptionsInit(&options); context = g_option_context_new("sqladvisor"); g_option_context_add_main_entries(context, entries, NULL);