Gets the size of an array byte.
 

1 byte.length

<byte.length encoding='encoding'>
    <data /> !
</byte.length>

Exceptions

requires 1 values, received [...]

It has been specified an incorrect number of values.

unsupportedEncodingException

Encode not supported

bad type - expected [string | byte[] | file | blob | node] while found [...]

A value with a non-allowed type has been indicated.

Remarks

Allow any type of data convertible to byte array as a value: a string, uan array of bytes, a node (of a XML or HTML file), a BLOB (Binary Large OBject), or a file.

Example

Gets the size of a string if characters.

Copy
<xsql-script name='byte_length_sample1'>
    <body>
        <println>
            <byte.length>hello world</byte.length>
        </println>
    </body>
</xsql-script>

The number of bytes occupied by the string of characters is printed on the screen:

Copy
11
Example

Gets the size of a column of blob type.

Copy
<xsql-script name='column_blob_length'>
   <body>
       <foreach>
          <select prefix = 'm_'>
             <columns>
                *
             </columns>
             <from table = 'gcomfach_docs'/>
             <where>
                file_data IS NOT NULL
             </where>
          </select>
          <do>
           <print><m_seqno/></print>
           <println>
              <byte.length>
                  <m_file_data />
              </byte.length>
           </println>
          </do>
       </foreach>
   </body>
</xsql-script>

The identifier of the registry and the number of bytes occupied by the file_data column are printed on the screen.

Copy
39
              200281
           
23
              735
           
40
              200281
Example

Gets the size of the content of a variable.

Copy
<xsql-script name='byte_length_sample2'>
   <body>
       <null name='sentence' />
       <println>
           <byte.length><sentence /></byte.length>
       </println>
   </body>

</xsql-script>

A null value occupies 0 bytes.

Copy
null
Example

Get the size of a file.

Copy
<xsql-script name='byte_length_sample3'>
   <body>
       <println>
           <byte.length>
               <file name='z:\test.xml' type='absolute' />
           </byte.length>
       </println>
   </body>

</xsql-script>

Returns the size of the indicated file:

Copy
123569