1255 break; |
1255 break; |
1256 |
1256 |
1257 case QVariant::String: { |
1257 case QVariant::String: { |
1258 col.bindAs = SQLT_STR; |
1258 col.bindAs = SQLT_STR; |
1259 for (uint j = 0; j < col.recordCount; ++j) { |
1259 for (uint j = 0; j < col.recordCount; ++j) { |
1260 uint len = boundValues.at(i).toList().at(j).toString().length() + 1; |
1260 uint len; |
|
1261 if(d->isOutValue(i)) |
|
1262 len = boundValues.at(i).toList().at(j).toString().capacity() + 1; |
|
1263 else |
|
1264 len = boundValues.at(i).toList().at(j).toString().length() + 1; |
1261 if (len > col.maxLen) |
1265 if (len > col.maxLen) |
1262 col.maxLen = len; |
1266 col.maxLen = len; |
1263 } |
1267 } |
1264 col.maxLen *= sizeof(QChar); |
1268 col.maxLen *= sizeof(QChar); |
1265 break; } |
1269 break; } |
1266 |
1270 |
1267 case QVariant::ByteArray: |
1271 case QVariant::ByteArray: |
1268 default: { |
1272 default: { |
1269 col.bindAs = SQLT_LBI; |
1273 col.bindAs = SQLT_LBI; |
1270 for (uint j = 0; j < col.recordCount; ++j) { |
1274 for (uint j = 0; j < col.recordCount; ++j) { |
1271 col.lengths[j] = boundValues.at(i).toList().at(j).toByteArray().size(); |
1275 if(d->isOutValue(i)) |
|
1276 col.lengths[j] = boundValues.at(i).toList().at(j).toByteArray().capacity(); |
|
1277 else |
|
1278 col.lengths[j] = boundValues.at(i).toList().at(j).toByteArray().size(); |
1272 if (col.lengths[j] > col.maxLen) |
1279 if (col.lengths[j] > col.maxLen) |
1273 col.maxLen = col.lengths[j]; |
1280 col.maxLen = col.lengths[j]; |
1274 } |
1281 } |
1275 break; } |
1282 break; } |
1276 } |
1283 } |
2191 } |
2198 } |
2192 |
2199 |
2193 QStringList QOCIDriver::tables(QSql::TableType type) const |
2200 QStringList QOCIDriver::tables(QSql::TableType type) const |
2194 { |
2201 { |
2195 QStringList tl; |
2202 QStringList tl; |
|
2203 QStringList sysUsers = QStringList() << QLatin1String("MDSYS") |
|
2204 << QLatin1String("LBACSYS") |
|
2205 << QLatin1String("SYS") |
|
2206 << QLatin1String("SYSTEM") |
|
2207 << QLatin1String("WKSYS") |
|
2208 << QLatin1String("CTXSYS") |
|
2209 << QLatin1String("WMSYS"); |
|
2210 |
|
2211 QString user = d->user; |
|
2212 if ( isIdentifierEscaped(user, QSqlDriver::TableName)) |
|
2213 user = stripDelimiters(user, QSqlDriver::TableName); |
|
2214 else |
|
2215 user = user.toUpper(); |
|
2216 |
|
2217 if(sysUsers.contains(user)) |
|
2218 sysUsers.removeAll(user);; |
|
2219 |
2196 if (!isOpen()) |
2220 if (!isOpen()) |
2197 return tl; |
2221 return tl; |
2198 |
2222 |
2199 QSqlQuery t(createResult()); |
2223 QSqlQuery t(createResult()); |
2200 t.setForwardOnly(true); |
2224 t.setForwardOnly(true); |
2201 if (type & QSql::Tables) { |
2225 if (type & QSql::Tables) { |
2202 t.exec(QLatin1String("select owner, table_name from all_tables " |
2226 QString query = QLatin1String("select owner, table_name from all_tables where "); |
2203 "where owner != 'MDSYS' " |
2227 QStringList whereList; |
2204 "and owner != 'LBACSYS' " |
2228 foreach(const QString &sysUserName, sysUsers) |
2205 "and owner != 'SYS' " |
2229 whereList << QLatin1String("owner != '") + sysUserName + QLatin1String("' "); |
2206 "and owner != 'SYSTEM' " |
2230 t.exec(query + whereList.join(QLatin1String(" and "))); |
2207 "and owner != 'WKSYS'" |
|
2208 "and owner != 'CTXSYS'" |
|
2209 "and owner != 'WMSYS'")); |
|
2210 |
|
2211 QString user = d->user; |
|
2212 if ( isIdentifierEscaped(user, QSqlDriver::TableName)) |
|
2213 user = stripDelimiters(user, QSqlDriver::TableName); |
|
2214 else |
|
2215 user = user.toUpper(); |
|
2216 |
2231 |
2217 while (t.next()) { |
2232 while (t.next()) { |
2218 if (t.value(0).toString().toUpper() != user.toUpper()) |
2233 if (t.value(0).toString().toUpper() != user.toUpper()) |
2219 tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); |
2234 tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); |
2220 else |
2235 else |
2221 tl.append(t.value(1).toString()); |
2236 tl.append(t.value(1).toString()); |
2222 } |
2237 } |
2223 |
2238 |
2224 // list all table synonyms as well |
2239 // list all table synonyms as well |
2225 t.exec(QLatin1String("select owner, synonym_name from all_synonyms " |
2240 query = QLatin1String("select owner, synonym_name from all_synonyms where "); |
2226 "where owner != 'MDSYS' " |
2241 t.exec(query + whereList.join(QLatin1String(" and "))); |
2227 "and owner != 'LBACSYS' " |
2242 while (t.next()) { |
2228 "and owner != 'SYS' " |
2243 if (t.value(0).toString() != d->user) |
2229 "and owner != 'SYSTEM' " |
2244 tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); |
2230 "and owner != 'WKSYS'" |
2245 else |
2231 "and owner != 'CTXSYS'" |
2246 tl.append(t.value(1).toString()); |
2232 "and owner != 'WMSYS'")); |
2247 } |
|
2248 } |
|
2249 if (type & QSql::Views) { |
|
2250 QString query = QLatin1String("select owner, view_name from all_views where "); |
|
2251 QStringList whereList; |
|
2252 foreach(const QString &sysUserName, sysUsers) |
|
2253 whereList << QLatin1String("owner != '") + sysUserName + QLatin1String("' "); |
|
2254 t.exec(query + whereList.join(QLatin1String(" and "))); |
|
2255 while (t.next()) { |
|
2256 if (t.value(0).toString().toUpper() != d->user.toUpper()) |
|
2257 tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); |
|
2258 else |
|
2259 tl.append(t.value(1).toString()); |
|
2260 } |
|
2261 } |
|
2262 if (type & QSql::SystemTables) { |
|
2263 t.exec(QLatin1String("select table_name from dictionary")); |
|
2264 while (t.next()) { |
|
2265 tl.append(t.value(0).toString()); |
|
2266 } |
|
2267 QString query = QLatin1String("select owner, table_name from all_tables where "); |
|
2268 QStringList whereList; |
|
2269 foreach(const QString &sysUserName, sysUsers) |
|
2270 whereList << QLatin1String("owner = '") + sysUserName + QLatin1String("' "); |
|
2271 t.exec(query + whereList.join(QLatin1String(" or "))); |
|
2272 |
|
2273 while (t.next()) { |
|
2274 if (t.value(0).toString().toUpper() != user.toUpper()) |
|
2275 tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); |
|
2276 else |
|
2277 tl.append(t.value(1).toString()); |
|
2278 } |
|
2279 |
|
2280 // list all table synonyms as well |
|
2281 query = QLatin1String("select owner, synonym_name from all_synonyms where "); |
|
2282 t.exec(query + whereList.join(QLatin1String(" or "))); |
2233 while (t.next()) { |
2283 while (t.next()) { |
2234 if (t.value(0).toString() != d->user) |
2284 if (t.value(0).toString() != d->user) |
2235 tl.append(t.value(0).toString() + QLatin1String(".") + t.value(1).toString()); |
2285 tl.append(t.value(0).toString() + QLatin1String(".") + t.value(1).toString()); |
2236 else |
2286 else |
2237 tl.append(t.value(1).toString()); |
2287 tl.append(t.value(1).toString()); |
2238 } |
|
2239 } |
|
2240 if (type & QSql::Views) { |
|
2241 t.exec(QLatin1String("select owner, view_name from all_views " |
|
2242 "where owner != 'MDSYS' " |
|
2243 "and owner != 'LBACSYS' " |
|
2244 "and owner != 'SYS' " |
|
2245 "and owner != 'SYSTEM' " |
|
2246 "and owner != 'WKSYS'" |
|
2247 "and owner != 'CTXSYS'" |
|
2248 "and owner != 'WMSYS'")); |
|
2249 while (t.next()) { |
|
2250 if (t.value(0).toString().toUpper() != d->user.toUpper()) |
|
2251 tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); |
|
2252 else |
|
2253 tl.append(t.value(1).toString()); |
|
2254 } |
|
2255 } |
|
2256 if (type & QSql::SystemTables) { |
|
2257 t.exec(QLatin1String("select table_name from dictionary")); |
|
2258 while (t.next()) { |
|
2259 tl.append(t.value(0).toString()); |
|
2260 } |
2288 } |
2261 } |
2289 } |
2262 return tl; |
2290 return tl; |
2263 } |
2291 } |
2264 |
2292 |