| .. 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. |
| |
| ============== |
| Driver Manager |
| ============== |
| |
| This document describes the installation and usage of the Rust :term:`driver |
| manager` which is available in the ``adbc_driver_manager`` crate. |
| |
| Installation |
| ============ |
| |
| .. code-block:: shell |
| |
| cargo add adbc_core adbc_driver_manager |
| |
| Usage |
| ===== |
| |
| .. code-block:: rust |
| |
| use adbc_core::options::AdbcVersion; |
| use adbc_core::{Database, Driver, LOAD_FLAG_DEFAULT}; |
| use adbc_driver_manager::ManagedDriver; |
| |
| // load_from_name searches for a driver via driver manifest (e.g. |
| // "sqlite.toml"). See the driver manifests documentation for details on |
| // search paths. |
| let mut driver = ManagedDriver::load_from_name( |
| "sqlite", |
| None, |
| AdbcVersion::default(), |
| LOAD_FLAG_DEFAULT, |
| None, |
| ) |
| .expect("Failed to load driver"); |
| let db = driver |
| .new_database() |
| .expect("Failed to create database handle"); |
| let mut conn = db.new_connection().expect("Failed to create connection") |
| |
| API Reference |
| ============= |
| |
| See the API reference: `Module driver_manager <https://docs.rs/adbc_core/latest/adbc_core/driver_manager/>`_. |