2021-04-22 Fred Gleason <fredg@paravelsystems.com>

* Escaped all SQL identifiers in 'utils/rddbmgr/'.
	* Replaced " with ' delimiters in all SQL literal strings in
	'utils/rddbmgr/'.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2021-04-22 20:44:19 -04:00
parent c2fcc23cfd
commit 7f44ad5780
7 changed files with 6966 additions and 6636 deletions

View File

@@ -2,7 +2,7 @@
//
// Routines for --modify for rddbmgr(8)
//
// (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2018-2021 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -20,8 +20,6 @@
#include <stdlib.h>
#include <qstringlist.h>
#include <dbversion.h>
#include <rddb.h>
#include <rdescape_string.h>
@@ -79,10 +77,10 @@ bool MainObject::ModifyCharset(const QString &charset,
// Per-table Attributes
//
sql=QString("select ")+
"TABLE_NAME,"+ // 00
"TABLE_COLLATION "+ // 01
"from information_schema.TABLES where "+
"TABLE_SCHEMA='"+RDEscapeString(db_mysql_database)+"'";
"`TABLE_NAME`,"+ // 00
"`TABLE_COLLATION` "+ // 01
"from `information_schema`.`TABLES` where "+
"`TABLE_SCHEMA`='"+RDEscapeString(db_mysql_database)+"'";
q=new RDSqlQuery(sql,false);
while(q->next()) {
QStringList f0=q->value(1).toString().split("_");
@@ -98,10 +96,10 @@ bool MainObject::ModifyCharset(const QString &charset,
// Database Attributes
//
sql=QString("select ")+
"SCHEMA_NAME,"+ // 00
"DEFAULT_CHARACTER_SET_NAME,"+ // 01
"DEFAULT_COLLATION_NAME "+ // 02
"from information_schema.SCHEMATA";
"`SCHEMA_NAME`,"+ // 00
"`DEFAULT_CHARACTER_SET_NAME`,"+ // 01
"`DEFAULT_COLLATION_NAME` "+ // 02
"from `information_schema`.`SCHEMATA`";
q=new RDSqlQuery(sql);
while(q->next()) {
if(q->value(0).toString()==db_mysql_database) {
@@ -116,4 +114,3 @@ bool MainObject::ModifyCharset(const QString &charset,
delete q;
return true;
}