| 1213 | } |
| 1214 | |
| 1215 | void populate(const string& name, const string* /*role*/, Mapping::DbHandle& iDb) |
| 1216 | { |
| 1217 | MAP_DEBUG(fprintf(stderr, "populate %s\n", name.c_str())); |
| 1218 | if (!name.hasData()) |
| 1219 | return; |
| 1220 | |
| 1221 | ThrowLocalStatus st; |
| 1222 | RefPtr<ITransaction> tra(REF_NO_INCR, iDb->startTransaction(&st, 0, nullptr)); |
| 1223 | |
| 1224 | Message par; |
| 1225 | Field<Varying> user(par, MAX_SQL_IDENTIFIER_SIZE); |
| 1226 | user = name.c_str(); |
| 1227 | |
| 1228 | Message cols; |
| 1229 | Field<Varying> role(cols, MAX_SQL_IDENTIFIER_SIZE); |
| 1230 | |
| 1231 | const char* sql = "select RDB$RELATION_NAME from RDB$USER_PRIVILEGES " |
| 1232 | "where RDB$USER = ? and RDB$PRIVILEGE = 'M' and RDB$USER_TYPE = 8 and RDB$OBJECT_TYPE = 13"; |
| 1233 | |
| 1234 | RefPtr<IResultSet> curs(REF_NO_INCR, iDb->openCursor(&st, tra, 0, sql, 3, |
| 1235 | par.getMetadata(), par.getBuffer(), cols.getMetadata(), nullptr, 0)); |
| 1236 | |
| 1237 | void* buffer = cols.getBuffer(); |
| 1238 | string z; |
| 1239 | z += ROLESEP; |
| 1240 | |
| 1241 | while (curs->fetchNext(&st, buffer) == IStatus::RESULT_OK) |
| 1242 | { |
| 1243 | string r = (const char*) role; |
| 1244 | r.trim(); |
| 1245 | MAP_DEBUG(fprintf(stderr, "populate 2 %s\n", r.c_str())); |
| 1246 | z += r; |
| 1247 | z += ROLESEP; |
| 1248 | } |
| 1249 | |
| 1250 | put(name, z); |
| 1251 | } |
| 1252 | |
| 1253 | void invalidate() |
| 1254 | { |
nothing calls this directly
no test coverage detected