| --- |
| { |
| "title": "BITMAP_TO_BASE64", |
| "language": "en" |
| } |
| --- |
| |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| http://www.apache.org/licenses/LICENSE-2.0 |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| ## bitmap_to_base64 |
| |
| ### description |
| #### Syntax |
| |
| `VARCHAR BITMAP_TO_BASE64(BITMAP input)` |
| |
| Convert an input BITMAP to a base64 string. If input is null, return null. Since BE config item `enable_set_in_bitmap_value` will change the format of bitmap value in memory, it also affect the result of this function. |
| Since the order of elements in the bitmap cannot be guaranteed, there is no guarantee that the base64 results generated by bitmaps with the same content are always the same, but the bitmap after bitmap_from_base64 decoding can be guaranteed to be the same. |
| |
| ### example |
| |
| ``` |
| mysql> select bitmap_to_base64(null); |
| +------------------------+ |
| | bitmap_to_base64(NULL) | |
| +------------------------+ |
| | NULL | |
| +------------------------+ |
| |
| mysql> select bitmap_to_base64(bitmap_empty()); |
| +----------------------------------+ |
| | bitmap_to_base64(bitmap_empty()) | |
| +----------------------------------+ |
| | AA== | |
| +----------------------------------+ |
| |
| mysql> select bitmap_to_base64(to_bitmap(1)); |
| +--------------------------------+ |
| | bitmap_to_base64(to_bitmap(1)) | |
| +--------------------------------+ |
| | AQEAAAA= | |
| +--------------------------------+ |
| |
| mysql> select bitmap_to_base64(bitmap_from_string("1,9999999")); |
| +---------------------------------------------------------+ |
| | bitmap_to_base64(bitmap_from_string("1,9999999")) | |
| +---------------------------------------------------------+ |
| | AjowAAACAAAAAAAAAJgAAAAYAAAAGgAAAAEAf5Y= | |
| +---------------------------------------------------------+ |
| |
| ``` |
| |
| ### keywords |
| |
| BITMAP_TO_BASE64,BITMAP |