1 byte.length
<byte.length encoding='encoding'>
<data /> !
</byte.length>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aencoding | string | Type of encode of the argument. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Edata | byte[] | Content of the data in byte format. |
Returns | |
---|---|
Type | Description |
Integer | Returns the number of bytes.If the received value is null, immediately it will return null as result. |
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.
Gets the size of a string if characters.
<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:
11
Gets the size of a column of blob type.
<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.
39 200281 23 735 40 200281
Gets the size of the content of a variable.
<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.
null
Get the size of a file.
<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:
123569