(account proto.AccountAddress)
| 145 | } |
| 146 | |
| 147 | func (c *Chain) queryAccountSQLChainProfiles(account proto.AccountAddress) (profiles []*types.SQLChainProfile, err error) { |
| 148 | var dbs []proto.DatabaseID |
| 149 | |
| 150 | dbs, err = func() (dbs []proto.DatabaseID, err error) { |
| 151 | c.RLock() |
| 152 | defer c.RUnlock() |
| 153 | |
| 154 | var ( |
| 155 | id string |
| 156 | rows *sql.Rows |
| 157 | querySQL = `SELECT "id" FROM "indexed_shardChains" WHERE "account" = ?` |
| 158 | ) |
| 159 | |
| 160 | rows, err = c.storage.Reader().Query(querySQL, account.String()) |
| 161 | |
| 162 | if err != nil { |
| 163 | return |
| 164 | } |
| 165 | |
| 166 | defer func() { |
| 167 | _ = rows.Close() |
| 168 | }() |
| 169 | |
| 170 | for rows.Next() { |
| 171 | err = rows.Scan(&id) |
| 172 | if err != nil { |
| 173 | return |
| 174 | } |
| 175 | |
| 176 | dbs = append(dbs, proto.DatabaseID(id)) |
| 177 | } |
| 178 | |
| 179 | return |
| 180 | }() |
| 181 | |
| 182 | if err != nil { |
| 183 | return |
| 184 | } |
| 185 | |
| 186 | var ( |
| 187 | profile *types.SQLChainProfile |
| 188 | ok bool |
| 189 | ) |
| 190 | |
| 191 | for _, db := range dbs { |
| 192 | profile, ok = c.loadSQLChainProfile(db) |
| 193 | if ok { |
| 194 | profiles = append(profiles, profile) |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | return |
| 199 | } |
| 200 | |
| 201 | func (c *Chain) immutableNextNonce(addr proto.AccountAddress) (n pi.AccountNonce, err error) { |
| 202 | c.RLock() |
no test coverage detected