MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / populate

Method populate

src/jrd/Mapping.cpp:1215–1251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 9

putFunction · 0.50
c_strMethod · 0.45
hasDataMethod · 0.45
startTransactionMethod · 0.45
openCursorMethod · 0.45
getMetadataMethod · 0.45
getBufferMethod · 0.45
fetchNextMethod · 0.45
trimMethod · 0.45

Tested by

no test coverage detected