Skip to content

Commit

Permalink
Traduction du chapitre sur les chaînes de bits
Browse files Browse the repository at this point in the history
  • Loading branch information
gleu committed Jul 9, 2020
1 parent 550730a commit a3f54b6
Showing 1 changed file with 61 additions and 60 deletions.
121 changes: 61 additions & 60 deletions postgresql/func.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4536,37 +4536,38 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');


<sect1 id="functions-bitstring">
<title>Bit String Functions and Operators</title>
<title>Fonctions et opérateurs pour les chaînes de bit</title>

<indexterm zone="functions-bitstring">
<primary>bit strings</primary>
<secondary>functions</secondary>
<primary>chaînes de bit</primary>
<secondary>fonctions</secondary>
</indexterm>

<para>
This section describes functions and operators for examining and
manipulating bit strings, that is values of the types
<type>bit</type> and <type>bit varying</type>. (While only
type <type>bit</type> is mentioned in these tables, values of
type <type>bit varying</type> can be used interchangeably.)
Bit strings support the usual comparison operators shown in
<xref linkend="functions-comparison-op-table"/>, as well as the
operators shown in <xref linkend="functions-bit-string-op-table"/>.
Cette section décrit les fonctions et opérateurs pour examiner et
manipuler les chaînes de bit, c'est-à-dire des valeurs de type
<type>bit</type> et <type>bit varying</type>. (Alors que seul le type
<type>bit</type> est mentionné dans ces tables, les valeurs de type
<type>bit varying</type> peuvent être utilisées de façon interchangeable.)
Les chaînes de bit supportent les opérateurs de comparaison habituels
indiqués dans <xref linkend="functions-comparison-op-table"/>, ainsi que
les opérateurs montrés dans <xref
linkend="functions-bit-string-op-table"/>.
</para>

<table id="functions-bit-string-op-table">
<title>Bit String Operators</title>
<title>Opérateurs pour les chaînes de bit</title>
<tgroup cols="1">
<thead>
<row>
<entry role="func_table_entry"><para role="func_signature">
Operator
Opérateur
</para>
<para>
Description
</para>
<para>
Example(s)
Exemple(s)
</para></entry>
</row>
</thead>
Expand All @@ -4578,7 +4579,7 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
<returnvalue>bit</returnvalue>
</para>
<para>
Concatenation
Concaténation
</para>
<para>
<literal>B'10001' || B'011'</literal>
Expand All @@ -4592,7 +4593,7 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
<returnvalue>bit</returnvalue>
</para>
<para>
Bitwise AND (inputs must be of equal length)
AND bit à bit (les arguments doivent être de même longueur)
</para>
<para>
<literal>B'10001' &amp; B'01101'</literal>
Expand All @@ -4606,7 +4607,7 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
<returnvalue>bit</returnvalue>
</para>
<para>
Bitwise OR (inputs must be of equal length)
OR bit à bit (les arguments doivent être de même longueur)
</para>
<para>
<literal>B'10001' | B'01101'</literal>
Expand All @@ -4620,7 +4621,7 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
<returnvalue>bit</returnvalue>
</para>
<para>
Bitwise exclusive OR (inputs must be of equal length)
OR exclusif bit à bit (les arguments doivent être de même longueur)
</para>
<para>
<literal>B'10001' # B'01101'</literal>
Expand All @@ -4634,7 +4635,7 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
<returnvalue>bit</returnvalue>
</para>
<para>
Bitwise NOT
NOT bit à bit
</para>
<para>
<literal>~ B'10001'</literal>
Expand All @@ -4648,8 +4649,8 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
<returnvalue>bit</returnvalue>
</para>
<para>
Bitwise shift left
(string length is preserved)
Décalage à gauche bit à bit
(la longueur de la chaîne est préservée)
</para>
<para>
<literal>B'10001' &lt;&lt; 3</literal>
Expand All @@ -4663,8 +4664,8 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
<returnvalue>bit</returnvalue>
</para>
<para>
Bitwise shift right
(string length is preserved)
Décalage à droite bit à bit
(la longueur de la chaîne est préservée)
</para>
<para>
<literal>B'10001' &gt;&gt; 2</literal>
Expand All @@ -4676,23 +4677,24 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
</table>

<para>
Some of the functions available for binary strings are also available
for bit strings, as shown in <xref linkend="functions-bit-string-table"/>.
Certaines des fonctions disponibles pour les chaînes binaires sont aussi
disponibles pour les chaînes de bit, comme indiquées dans <xref
linkend="functions-bit-string-table"/>.
</para>

<table id="functions-bit-string-table">
<title>Bit String Functions</title>
<title>Fonctions pour les chaînes de bit</title>
<tgroup cols="1">
<thead>
<row>
<entry role="func_table_entry"><para role="func_signature">
Function
Fonction
</para>
<para>
Description
</para>
<para>
Example(s)
Exemple(s)
</para></entry>
</row>
</thead>
Expand All @@ -4707,7 +4709,7 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
<returnvalue>integer</returnvalue>
</para>
<para>
Returns number of bits in the bit string.
Renvoie le nombre de bits d'une chaîne de bit.
</para>
<para>
<literal>bit_length(B'10111')</literal>
Expand All @@ -4721,14 +4723,14 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
<primary>length</primary>
</indexterm>
<indexterm>
<primary>bit string</primary>
<secondary>length</secondary>
<primary>chaîne de bit</primary>
<secondary>longueur</secondary>
</indexterm>
<function>length</function> ( <type>bit</type> )
<returnvalue>integer</returnvalue>
</para>
<para>
Returns number of bits in the bit string.
Renvoie le nombre de bits d'une chaîne de bit.
</para>
<para>
<literal>length(B'10111')</literal>
Expand All @@ -4745,7 +4747,7 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
<returnvalue>integer</returnvalue>
</para>
<para>
Returns number of bytes in the bit string.
Renvoie le nombre d'octets d'une chaîne de bit.
</para>
<para>
<literal>octet_length(B'1011111011')</literal>
Expand All @@ -4762,12 +4764,12 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
<returnvalue>bit</returnvalue>
</para>
<para>
Replaces the substring of <parameter>bits</parameter> that starts at
the <parameter>start</parameter>'th bit and extends
for <parameter>count</parameter> bits
with <parameter>newsubstring</parameter>.
If <parameter>count</parameter> is omitted, it defaults to the length
of <parameter>newsubstring</parameter>.
Remplace la sous-chaîne de <parameter>bits</parameter> commençant au
<parameter>start</parameter>-ième bit et s'étendant sur
<parameter>count</parameter> bits avec
<parameter>newsubstring</parameter>. Si <parameter>count</parameter>
est omis, sa valeur par défaut est la longueur de
<parameter>newsubstring</parameter>.
</para>
<para>
<literal>overlay(B'01010101010101010' placing B'11111' from 2 for 3)</literal>
Expand All @@ -4784,8 +4786,8 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
<returnvalue>integer</returnvalue>
</para>
<para>
Returns starting index of specified <parameter>substring</parameter>
within <parameter>bits</parameter>, or zero if it's not present.
Renvoie la position de départ de <parameter>substring</parameter>
dans <parameter>bits</parameter>, ou zéro s'il n'est pas présent.
</para>
<para>
<literal>position(B'010' in B'000001101011')</literal>
Expand All @@ -4802,11 +4804,11 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
<returnvalue>bit</returnvalue>
</para>
<para>
Extracts the substring of <parameter>bits</parameter> starting at
the <parameter>start</parameter>'th bit if that is specified,
and stopping after <parameter>count</parameter> bits if that is
specified. Provide at least one of <parameter>start</parameter>
and <parameter>count</parameter>.
Extrait la sous-chaîne de <parameter>bits</parameter> commençant au
<parameter>start</parameter>-ième bit s'il est précisé, et s'arrêtant
après <parameter>count</parameter> bits s'il est précisé. Il est
requis qu'au moins soit <parameter>start</parameter> soit
<parameter>count</parameter> soient renseignés.
</para>
<para>
<literal>substring(B'110010111111' from 3 for 2)</literal>
Expand All @@ -4824,8 +4826,8 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
<returnvalue>integer</returnvalue>
</para>
<para>
Extracts <parameter>n</parameter>'th bit
from bit string; the first (leftmost) bit is bit 0.
Extrait le <parameter>n</parameter>-ième bit de la chaîne de bits.
Le premier bit (le plus à gauche) est le bit 0.
</para>
<para>
<literal>get_bit(B'101010101010101010', 6)</literal>
Expand All @@ -4844,9 +4846,9 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
<returnvalue>bit</returnvalue>
</para>
<para>
Sets <parameter>n</parameter>'th bit in
bit string to <parameter>newvalue</parameter>;
the first (leftmost) bit is bit 0.
Initialise le <parameter>n</parameter>-ième bit dans la chaîne de bit
avec <parameter>newvalue</parameter>. Le premier bit (le plus à
gauche) est le bit 0.
</para>
<para>
<literal>set_bit(B'101010101010101010', 6, 0)</literal>
Expand All @@ -4858,21 +4860,20 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
</table>

<para>
In addition, it is possible to cast integral values to and from type
<type>bit</type>.
Casting an integer to <type>bit(n)</type> copies the rightmost
<literal>n</literal> bits. Casting an integer to a bit string width wider
than the integer itself will sign-extend on the left.
Some examples:
De plus, il est possible de convertir les valeurs intégrales à partir ou
vers le type <type>bit</type>. Convertir un entier en <type>bit(n)</type>
copie les <literal>n</literal> bits les plus à droite. Convertir un entier
en une chaîne de bits, dont la largeur est plus importante que l'entier
lui-même, l'étendra sur la gauche. Quelques exemples&nbsp;:
<programlisting>
44::bit(10) <lineannotation>0000101100</lineannotation>
44::bit(3) <lineannotation>100</lineannotation>
cast(-44 as bit(12)) <lineannotation>111111010100</lineannotation>
'1110'::bit(4)::integer <lineannotation>14</lineannotation>
</programlisting>
Note that casting to just <quote>bit</quote> means casting to
<literal>bit(1)</literal>, and so will deliver only the least significant
bit of the integer.
Il faut noter que la conversion vers simplement <quote>bit</quote>
signifie une conversion vers <literal>bit(1)</literal>, et ne renverra
donc que le bit le moins significatif de l'entier.
</para>
</sect1>

Expand Down

0 comments on commit a3f54b6

Please sign in to comment.