[Libreoffice-commits] core.git: connectivity/source external/mysqlcppconn

Julien Nabet serval2412 at yahoo.fr
Thu Jan 30 07:14:57 PST 2014


 connectivity/source/drivers/mysql/YUser.cxx           |    2 -
 external/mysqlcppconn/UnpackedTarball_mysqlcppconn.mk |    1 
 external/mysqlcppconn/patches/retrieve_grants.patch.1 |   31 ++++++++++++++++++
 3 files changed, 33 insertions(+), 1 deletion(-)

New commits:
commit bfefe113f69031ff3c3196858bd8dfd11add44ac
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Fri Dec 20 22:17:50 2013 +0100

    User grants debug Mysql part: retrieve IS_GRANTABLE + update column privs
    
    (See http://dev.mysql.com/doc/refman/5.6/en/grant-table-structure.html
    Table 6.7. Set-Type Privilege Column Values Section)
    
    Change-Id: I6173ba0df84f722a872afa59d7d7dc9eefe3e368
    Reviewed-on: https://gerrit.libreoffice.org/7155
    Reviewed-by: Lionel Elie Mamane <lionel at mamane.lu>
    Tested-by: Lionel Elie Mamane <lionel at mamane.lu>

diff --git a/connectivity/source/drivers/mysql/YUser.cxx b/connectivity/source/drivers/mysql/YUser.cxx
index d44c345..aff9841 100644
--- a/connectivity/source/drivers/mysql/YUser.cxx
+++ b/connectivity/source/drivers/mysql/YUser.cxx
@@ -126,7 +126,7 @@ void OMySQLUser::findPrivilegesAndGrantPrivileges(const OUString& objName, sal_I
         static const OUString sREAD(  "READ" );
         static const OUString sCREATE(  "CREATE" );
         static const OUString sALTER(  "ALTER" );
-        static const OUString sREFERENCE(  "REFERENCE" );
+        static const OUString sREFERENCE(  "REFERENCES" );
         static const OUString sDROP(  "DROP" );
         static const OUString sYes(  "YES" );
 
diff --git a/external/mysqlcppconn/UnpackedTarball_mysqlcppconn.mk b/external/mysqlcppconn/UnpackedTarball_mysqlcppconn.mk
index ae0f267..dd2b98e 100644
--- a/external/mysqlcppconn/UnpackedTarball_mysqlcppconn.mk
+++ b/external/mysqlcppconn/UnpackedTarball_mysqlcppconn.mk
@@ -18,6 +18,7 @@ $(eval $(call gb_UnpackedTarball_add_file,mysqlcppconn,driver/nativeapi/binding_
 $(eval $(call gb_UnpackedTarball_add_patches,mysqlcppconn,\
 	external/mysqlcppconn/patches/mysql-connector-c++-1.1.0.patch \
 	external/mysqlcppconn/patches/default_to_protocol_tcp.patch \
+	external/mysqlcppconn/patches/retrieve_grants.patch.1 \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/mysqlcppconn/patches/retrieve_grants.patch.1 b/external/mysqlcppconn/patches/retrieve_grants.patch.1
new file mode 100644
index 0000000..eb63cff
--- /dev/null
+++ b/external/mysqlcppconn/patches/retrieve_grants.patch.1
@@ -0,0 +1,31 @@
+diff -ur mysqlcppconn.org/driver/mysql_metadata.cpp mysqlcppconn/driver/mysql_metadata.cpp
+--- mysqlcppconn.org/driver/mysql_metadata.cpp	2013-12-20 22:12:07.044698692 +0100
++++ mysqlcppconn/driver/mysql_metadata.cpp	2013-12-20 22:14:56.320394472 +0100
+@@ -3633,12 +3633,14 @@
+-	sql::SQLString strAllPrivs("ALTER, DELETE, DROP, INDEX, INSERT, LOCK TABLES, SELECT, UPDATE");
++	sql::SQLString strAllPrivs("SELECT, INSERT, UPDATE, DELETE, CREATE, DROPT, GRANT, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER");
+ 
+ 	sql::SQLString cQuote(getIdentifierQuoteString());
++	size_t posIsGrantable = sql::SQLString::npos;
+ 
+ 	while (rs->next() ) {
+ 		sql::SQLString aGrant = rs->getString(1);
+ 		aGrant = aGrant.replace(0, 6, "");
+ 
+ 		size_t pos = aGrant.find("ALL PRIVILEGES");
++		posIsGrantable = aGrant.find("WITH GRANT OPTION");
+ 
+ 		if (pos != sql::SQLString::npos) {
+ 			aGrant = aGrant.replace(pos, sizeof("ALL PRIVILEGES") - 1, strAllPrivs);
+@@ -3737,7 +3739,10 @@
+ 						rs_data_row.push_back("");				// GRANTOR
+ 						rs_data_row.push_back(getUserName());	// GRANTEE
+ 						rs_data_row.push_back(privToken);		// PRIVILEGE
+-						rs_data_row.push_back("");				// IS_GRANTABLE - ToDo maybe here WITH GRANT OPTION??
++                                                if (posIsGrantable != sql::SQLString::npos)
++                                                     rs_data_row.push_back("YES");
++                                                else
++						     rs_data_row.push_back("");				// IS_GRANTABLE
+ 
+ 						rs_data->push_back(rs_data_row);
+ 					}


More information about the Libreoffice-commits mailing list