| 120 | } |
| 121 | |
| 122 | QString XSqlQuery::rewriteQuery(QString _q) |
| 123 | { |
| 124 | static const QStringList tables { |
| 125 | "items" , "crls" , "private_keys" , "public_keys" , |
| 126 | "tokens" , "token_mechanism" , "templates" , "certs" , |
| 127 | "authority" , "revocations" , "requests" , "x509super" , |
| 128 | "settings" , "takeys", |
| 129 | |
| 130 | "view_public_keys" , "view_certs" , "view_requests" , |
| 131 | "view_crls" , "view_templates" , "view_private", |
| 132 | }; |
| 133 | |
| 134 | lastq = query = _q; |
| 135 | if (table_prefix.isEmpty()) |
| 136 | return query; |
| 137 | |
| 138 | QString m = tables.join("|") + "|i_" + tables.join("|i_"); |
| 139 | m = QString("\\b(%1)").arg(m); |
| 140 | query = query.replace(QRegularExpression(m), table_prefix + "\\1"); |
| 141 | |
| 142 | return query; |
| 143 | } |
| 144 | |
| 145 | QString XSqlQuery::query_details() |
| 146 | { |