CurtHagenlocher commented on code in PR #1865: URL: https://github.com/apache/arrow-adbc/pull/1865#discussion_r1601754550
########## csharp/src/Apache.Arrow.Adbc/AdbcDatabase11.cs: ########## @@ -0,0 +1,85 @@ +/* + * 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. + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Apache.Arrow.Adbc +{ + /// <summary> + /// Clients first initialize a database, then create a connection. + /// This gives the implementation a place to initialize and own any + /// common connection state. + /// For example, in-memory databases can place ownership of the actual + /// database in this object. + /// </summary> + public abstract class AdbcDatabase11 : IDisposable + { + ~AdbcDatabase11() => Dispose(false); + + /// <summary> + /// Opens a new connection to the database. + /// </summary> + /// <param name="options">Additional options to use when connecting.</param> + /// <returns>The database connection.</returns> + public virtual AdbcConnection Connect(IReadOnlyDictionary<string, object>? options = default) + { + return Task.Run(() => Connect(options)).GetAwaiter().GetResult(); + } + + /// <summary> + /// Opens a new connection to the database + /// </summary> + /// <param name="options">Additional options to use when connecting.</param> + /// <returns>The database connection.</returns> + public abstract Task<AdbcConnection> ConnectAsync(IReadOnlyDictionary<string, object>? options = default); + + /// <summary> + /// Options are generally set before opening a database. + /// Throws an exception for unsupported options. + /// </summary> + /// <param name="key">Option name</param> + /// <returns>Option value.</returns> + public virtual object GetOption(string key) Review Comment: Similar to Driver.Open: if the ADBC "database" is like a connection string then the options should all be local; we haven't connected to anything yet. But I'll take a look at e.g. the Flight implementation to see how well my interpretation holds up. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
