Cleanup
This commit is contained in:
parent
edde131c4b
commit
5821c23439
3 changed files with 2 additions and 154 deletions
|
|
@ -28,17 +28,6 @@ QVariant ParamListModel::headerData(int section, Qt::Orientation orientation, in
|
|||
return result;
|
||||
}
|
||||
|
||||
//bool ParamListModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role)
|
||||
//{
|
||||
// if (value != headerData(section, orientation, role)) {
|
||||
// // FIXME: Implement me!
|
||||
// emit headerDataChanged(orientation, section, section);
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
//}
|
||||
|
||||
|
||||
int ParamListModel::rowCount(const QModelIndex &) const
|
||||
{
|
||||
return static_cast<int>(m_paramList.size());
|
||||
|
|
@ -105,20 +94,12 @@ Qt::ItemFlags ParamListModel::flags(const QModelIndex &index) const
|
|||
bool ParamListModel::insertRows(int row, int count, const QModelIndex &parent)
|
||||
{
|
||||
beginInsertRows(parent, row, row + count - 1);
|
||||
// FIXME: Implement me!
|
||||
auto iter = m_paramList.begin() + row;
|
||||
m_paramList.insert(iter, count, Param());
|
||||
endInsertRows();
|
||||
return true;
|
||||
}
|
||||
|
||||
//bool ParamListModel::insertColumns(int column, int count, const QModelIndex &parent)
|
||||
//{
|
||||
// beginInsertColumns(parent, column, column + count - 1);
|
||||
// // FIXME: Implement me!
|
||||
// endInsertColumns();
|
||||
//}
|
||||
|
||||
bool ParamListModel::removeRows(int row, int count, const QModelIndex &parent)
|
||||
{
|
||||
beginRemoveRows(parent, row, row + count - 1);
|
||||
|
|
@ -128,13 +109,6 @@ bool ParamListModel::removeRows(int row, int count, const QModelIndex &parent)
|
|||
return true;
|
||||
}
|
||||
|
||||
//bool ParamListModel::removeColumns(int column, int count, const QModelIndex &parent)
|
||||
//{
|
||||
// beginRemoveColumns(parent, column, column + count - 1);
|
||||
// // FIXME: Implement me!
|
||||
// endRemoveColumns();
|
||||
//}
|
||||
|
||||
const t_ParamList& ParamListModel::GetParams() const
|
||||
{
|
||||
return m_paramList;
|
||||
|
|
|
|||
|
|
@ -55,128 +55,6 @@ QString escapeLiteral(const QString &input)
|
|||
return escapeInternal(input, '\'');
|
||||
}
|
||||
|
||||
//char *
|
||||
//PQescapeInternal(PGconn *conn, const char *str, size_t len, bool as_ident)
|
||||
//{
|
||||
// const char *s;
|
||||
// char *result;
|
||||
// char *rp;
|
||||
// int num_quotes = 0; /* single or double, depending on as_ident */
|
||||
// int num_backslashes = 0;
|
||||
// int input_len;
|
||||
// int result_size;
|
||||
// char quote_char = as_ident ? '"' : '\'';
|
||||
|
||||
//// /* We must have a connection, else fail immediately. */
|
||||
//// if (!conn)
|
||||
//// return NULL;
|
||||
|
||||
// /* Scan the string for characters that must be escaped. */
|
||||
// for (s = str; (s - str) < len && *s != '\0'; ++s)
|
||||
// {
|
||||
// if (*s == quote_char)
|
||||
// ++num_quotes;
|
||||
// else if (*s == '\\')
|
||||
// ++num_backslashes;
|
||||
// else if (IS_HIGHBIT_SET(*s))
|
||||
// {
|
||||
// int charlen;
|
||||
|
||||
// /* Slow path for possible multibyte characters */
|
||||
// charlen = pg_encoding_mblen(conn->client_encoding, s);
|
||||
|
||||
// /* Multibyte character overruns allowable length. */
|
||||
// if ((s - str) + charlen > len || memchr(s, 0, charlen) != NULL)
|
||||
// {
|
||||
// printfPQExpBuffer(&conn->errorMessage,
|
||||
// libpq_gettext("incomplete multibyte character\n"));
|
||||
// return NULL;
|
||||
// }
|
||||
|
||||
// /* Adjust s, bearing in mind that for loop will increment it. */
|
||||
// s += charlen - 1;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /* Allocate output buffer. */
|
||||
// input_len = s - str;
|
||||
// result_size = input_len + num_quotes + 3; /* two quotes, plus a NUL */
|
||||
// if (!as_ident && num_backslashes > 0)
|
||||
// result_size += num_backslashes + 2;
|
||||
// result = rp = (char *) malloc(result_size);
|
||||
// if (rp == NULL)
|
||||
// {
|
||||
// printfPQExpBuffer(&conn->errorMessage,
|
||||
// libpq_gettext("out of memory\n"));
|
||||
// return NULL;
|
||||
// }
|
||||
|
||||
// /*
|
||||
// * If we are escaping a literal that contains backslashes, we use the
|
||||
// * escape string syntax so that the result is correct under either value
|
||||
// * of standard_conforming_strings. We also emit a leading space in this
|
||||
// * case, to guard against the possibility that the result might be
|
||||
// * interpolated immediately following an identifier.
|
||||
// */
|
||||
// if (!as_ident && num_backslashes > 0)
|
||||
// {
|
||||
// *rp++ = ' ';
|
||||
// *rp++ = 'E';1
|
||||
// }
|
||||
|
||||
// /* Opening quote. */
|
||||
// *rp++ = quote_char;
|
||||
|
||||
// /*
|
||||
// * Use fast path if possible.
|
||||
// *
|
||||
// * We've already verified that the input string is well-formed in the
|
||||
// * current encoding. If it contains no quotes and, in the case of
|
||||
// * literal-escaping, no backslashes, then we can just copy it directly to
|
||||
// * the output buffer, adding the necessary quotes.
|
||||
// *
|
||||
// * If not, we must rescan the input and process each character
|
||||
// * individually.
|
||||
// */
|
||||
// if (num_quotes == 0 && (num_backslashes == 0 || as_ident))
|
||||
// {
|
||||
// memcpy(rp, str, input_len);
|
||||
// rp += input_len;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// for (s = str; s - str < input_len; ++s)
|
||||
// {
|
||||
// if (*s == quote_char || (!as_ident && *s == '\\'))
|
||||
// {
|
||||
// *rp++ = *s;
|
||||
// *rp++ = *s;
|
||||
// }
|
||||
// else if (!IS_HIGHBIT_SET(*s))
|
||||
// *rp++ = *s;
|
||||
// else
|
||||
// {
|
||||
// int i = pg_encoding_mblen(conn->client_encoding, s);
|
||||
|
||||
// while (1)
|
||||
// {
|
||||
// *rp++ = *s;
|
||||
// if (--i == 0)
|
||||
// break;
|
||||
// ++s; /* for loop will provide the final increment */
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// /* Closing quote and terminating NUL. */
|
||||
// *rp++ = quote_char;
|
||||
// *rp = '\0';
|
||||
|
||||
// return result;
|
||||
//}
|
||||
|
||||
|
||||
bool identNeedsQuotes(QString ident)
|
||||
{
|
||||
if (ident[0].isDigit())
|
||||
|
|
@ -188,10 +66,8 @@ bool identNeedsQuotes(QString ident)
|
|||
auto kw = getPgsqlKeyword(ident);
|
||||
if (kw == nullptr)
|
||||
return false;
|
||||
else if (kw->getCategory() == UNRESERVED_KEYWORD)
|
||||
if (kw->getCategory() == UNRESERVED_KEYWORD)
|
||||
return false;
|
||||
// if (forTypes && sk->category == COL_NAME_KEYWORD)
|
||||
// return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -209,8 +85,7 @@ QString quoteIdent(QString ident)
|
|||
out += dquote;
|
||||
return out;
|
||||
}
|
||||
else
|
||||
return ident;
|
||||
return ident;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -349,7 +349,6 @@ QString ConvertLangToSqlString(const QString &in)
|
|||
QChar c = in[index];
|
||||
if (escape) {
|
||||
if (c == 'a') output += '\x07';
|
||||
else if (c == 'a') output += '\x07';
|
||||
else if (c == 'b') output += '\x08';
|
||||
else if (c == 'f') output += '\x0c';
|
||||
else if (c == 'n') output += '\n';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue