PersistentTable/Has - Maple Help

PersistentTable

 Has
 query a PersistentTable connection for the existence of a row

 Calling Sequence Has(connection, keys)

Parameters

 connection - PersistentTable object created with the Open command keys - expression sequence of values for the key columns

Description

 • The Has command returns true if the given connection contains a row with the given values in the primary key columns, and false otherwise.

 • Persistent tables are in general thread safe as of Maple 2021; see the Thread Safety section of the PersistentTable overview page for more details and caveats.

Examples

 > $\mathrm{with}\left(\mathrm{PersistentTable}\right)$
 $\left[{\mathrm{Close}}{,}{\mathrm{Count}}{,}{\mathrm{Get}}{,}{\mathrm{GetAll}}{,}{\mathrm{GetKeys}}{,}{\mathrm{Has}}{,}{\mathrm{MaybeGet}}{,}{\mathrm{Open}}{,}{\mathrm{RawCommand}}{,}{\mathrm{Set}}\right]$ (1)
 > $\mathrm{connection}≔\mathrm{Open}\left(":memory:",\mathrm{style}=\left[\mathrm{k1}::\mathrm{anything},\mathrm{k2}::'\mathrm{integer}',v::\mathrm{anything},\mathrm{primarykey}=2\right]\right)$
 ${\mathrm{connection}}{≔}{\mathrm{<< 3-column persistent table at :memory: >>}}$ (2)
 > $\mathrm{connection}\left[x,3\right]≔{y}^{2}$
 ${{\mathrm{connection}}}_{{x}{,}{3}}{≔}{{y}}^{{2}}$ (3)
 > $\mathrm{connection}\left[z,5\right]≔{y}^{3}$
 ${{\mathrm{connection}}}_{{z}{,}{5}}{≔}{{y}}^{{3}}$ (4)
 > $\mathrm{Has}\left(\mathrm{connection},x,3\right)$
 ${\mathrm{true}}$ (5)
 > $\mathrm{Has}\left(\mathrm{connection},a,4\right)$
 ${\mathrm{false}}$ (6)
 > $\mathrm{Close}\left(\mathrm{connection}\right)$

Compatibility

 • The PersistentTable[Has] command was introduced in Maple 2021.