# 1 map

Axional Studio XSQL-Script allows to use tables of hashing. This ara data structures specially designed to implement dictionarys (searching, insertion and remove operations).

A hash table is a type of collection formed by pairs of keys and values which are stored inside of a table. The key is used to obtain the index of value location inside the table, used for this a function called dispersion function or hash. So, a hash structure is formed by three basic elements:

Table: where the elements are stored.

Dispersion function: given a key, provides the index of the table where the value associated is stored. It is possible that exist two differents keys for which the hash function produces the same index. This fact is called collision, and the two differents keys which produces the same index, they are called synonymous respect to the function of dispersion used.

Collision resolution function: determine what to do when the same index is obtained in the table for two different keys.

So, this structure allows to access associatively to the information, but also she does it in a constant average time. It means, that the time necessary to access to a value is not going to depend on the number of keys that the structure stores.

Axional Studio XSQL-Script disposes of the function <map> which possibilities the use of hash structures, providing a set of operations which allows its management.

Create a map (set of key couples - value).

<map    name='name'    encoding='encoding'>    <expr /> ?    <var /> ?</map>
Example
Copy
<xsql-script name='map_clear_sample1'>
<body>
<map name='m_map'>
<item>0<string>ZERO</string></item>
<item>1<string>ONE</string></item>
<item>2<string>TWO</string></item>
<item>3<string>THREE</string></item>
<item>4<string>FOUR</string></item>
<item>5<string>FIVE</string></item>
<item>6<string>SIX</string></item>
<item>7<string>SEVEN</string></item>
<item>8<string>EIGHT</string></item>
<item>9<string>NINE</string></item>
</map>

<println><m_map/></println>
</body>
</xsql-script>