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.ExtendedQueryCommandBase; 19 20 import hunt.database.base.impl.command.QueryCommandBase; 21 22 import hunt.database.base.Row; 23 import hunt.database.base.impl.PreparedStatement; 24 import hunt.database.base.impl.QueryResultHandler; 25 26 // import java.util.stream.Collector; 27 28 /** 29 * @author <a href="mailto:julien@julienviet.com">Julien Viet</a> 30 */ 31 abstract class ExtendedQueryCommandBase(R) : QueryCommandBase!(R) { 32 33 protected PreparedStatement ps; 34 protected int _fetch; 35 protected string _cursorId; 36 protected bool suspended; 37 private bool singleton; 38 39 this(PreparedStatement ps, 40 int fetch, 41 string cursorId, 42 bool suspended, 43 bool singleton, 44 QueryResultHandler!(R) resultHandler) { 45 super(resultHandler); 46 this.ps = ps; 47 this._fetch = fetch; 48 this._cursorId = cursorId; 49 this.suspended = suspended; 50 this.singleton = singleton; 51 } 52 53 PreparedStatement preparedStatement() { 54 return ps; 55 } 56 57 int fetch() { 58 return _fetch; 59 } 60 61 string cursorId() { 62 return _cursorId; 63 } 64 65 bool isSuspended() { 66 return suspended; 67 } 68 69 bool isSingleton() { 70 return singleton; 71 } 72 73 override 74 string sql() { 75 return ps.sql(); 76 } 77 }