You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Return a string such that for every bit set in the value bits, you get an on string and for every unset bit, you get an off string.
414
429
430
+
The full signature of this function is:
431
+
432
+
```
433
+
EXPORT_SET(bits, on, off, [separator, number_of_bits])
434
+
```
435
+
436
+
```sql
437
+
SELECT EXPORT_SET(b'00001111', 'x', '_', '', 8);
438
+
```
439
+
440
+
```
441
+
+------------------------------------------+
442
+
| EXPORT_SET(b'00001111', 'x', '_', '', 8) |
443
+
+------------------------------------------+
444
+
| xxxx____ |
445
+
+------------------------------------------+
446
+
1 row in set (0.00 sec)
447
+
```
448
+
449
+
In the example above `bits` is set to `00001111` and this causes the function to return `____` for the bits that are set to 0 and `xxxx` for the bits that are set to 1. Here `x` means "on" and "_" means "off".
450
+
451
+
```sql
452
+
SELECT EXPORT_SET(b'01010101', 'x', '_', '', 8);
453
+
```
454
+
455
+
```
456
+
+------------------------------------------+
457
+
| EXPORT_SET(b'01010101', 'x', '_', '', 8) |
458
+
+------------------------------------------+
459
+
| x_x_x_x_ |
460
+
+------------------------------------------+
461
+
1 row in set (0.00 sec)
462
+
```
463
+
464
+
In the example above you can see the off (`_`) / on (`x`) pattern from right to left as set by the `bits.
0 commit comments