1 /* 2 * Copyright (C) 2019, HuntLabs 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 18 module hunt.database.base.impl.command.InitCommand; 19 20 import hunt.database.base.impl.command.CommandBase; 21 22 import hunt.database.base.impl.Connection; 23 import hunt.database.base.impl.SocketConnectionBase; 24 25 import hunt.collection.Map; 26 27 /** 28 * Initialize the connection so it can be used to interact with the database. 29 * 30 * @author <a href="mailto:julien@julienviet.com">Julien Viet</a> 31 */ 32 class InitCommand : CommandBase!(DbConnection) { 33 34 private SocketConnectionBase conn; 35 private string _username; 36 private string _password; 37 private string _database; 38 private Map!(string, string) _properties; 39 40 this(SocketConnectionBase conn, 41 string username, 42 string password, 43 string database, 44 Map!(string, string) properties) { 45 this.conn = conn; 46 this._username = username; 47 this._password = password; 48 this._database = database; 49 this._properties = properties; 50 } 51 52 SocketConnectionBase connection() { 53 return conn; 54 } 55 56 string username() { 57 return _username; 58 } 59 60 string password() { 61 return _password; 62 } 63 64 string database() { 65 return _database; 66 } 67 68 Map!(string, string) properties() { 69 return _properties; 70 } 71 72 }