MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / queryAccountSQLChainProfiles

Method queryAccountSQLChainProfiles

blockproducer/chain_io.go:147–199  ·  view source on GitHub ↗
(account proto.AccountAddress)

Source from the content-addressed store, hash-verified

145}
146
147func (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
201func (c *Chain) immutableNextNonce(addr proto.AccountAddress) (n pi.AccountNonce, err error) {
202 c.RLock()

Callers 1

Calls 8

loadSQLChainProfileMethod · 0.95
DatabaseIDTypeAlias · 0.92
QueryMethod · 0.65
ReaderMethod · 0.65
CloseMethod · 0.65
StringMethod · 0.45
NextMethod · 0.45
ScanMethod · 0.45

Tested by

no test coverage detected