| 1134 | } |
| 1135 | |
| 1136 | void populate(const string& key, Mapping::DbHandle& iDb) |
| 1137 | { |
| 1138 | if (!key.hasData()) |
| 1139 | return; |
| 1140 | |
| 1141 | if (get(key)) |
| 1142 | return; |
| 1143 | |
| 1144 | ThrowLocalStatus st; |
| 1145 | RefPtr<ITransaction> tra(REF_NO_INCR, iDb->startTransaction(&st, 0, nullptr)); |
| 1146 | |
| 1147 | Message par; |
| 1148 | Field<Varying> user(par, MAX_SQL_IDENTIFIER_SIZE); |
| 1149 | user = key.c_str(); |
| 1150 | |
| 1151 | RefPtr<IResultSet> curs(REF_NO_INCR, iDb->openCursor(&st, tra, 0, sql, 3, |
| 1152 | par.getMetadata(), par.getBuffer(), nullptr, nullptr, 0)); |
| 1153 | |
| 1154 | RefPtr<IMessageMetadata> meta(curs->getMetadata(&st)); |
| 1155 | AutoPtr<UCHAR, ArrayDelete> buffer(FB_NEW UCHAR[meta->getMessageLength(&st)]); |
| 1156 | UCHAR* bits = buffer + meta->getOffset(&st, 0); |
| 1157 | UserId::Privileges g, l; |
| 1158 | |
| 1159 | while(curs->fetchNext(&st, buffer) == IStatus::RESULT_OK) |
| 1160 | { |
| 1161 | l.load(bits); |
| 1162 | g |= l; |
| 1163 | } |
| 1164 | |
| 1165 | FB_UINT64 gg = 0; |
| 1166 | static_assert(sizeof(gg) >= g.BYTES_COUNT, |
| 1167 | "The value for storing system privileges is too small"); |
| 1168 | |
| 1169 | g.store(&gg); |
| 1170 | MAP_DEBUG(fprintf(stderr, "poprole %s 0x%x\n", key.c_str(), gg)); |
| 1171 | put(key, g); |
| 1172 | } |
| 1173 | |
| 1174 | void invalidate() |
| 1175 | { |
nothing calls this directly
no test coverage detected