1 /** 2 Kinda hacked-together and not really complete prepared-statement thing. 3 Needs a lot of work, as well as tests. 4 5 Accepting donations in tests. 6 */ 7 module dpq.prepared; 8 9 //import derelict.pq.pq; 10 import libpq.libpq; 11 import dpq.connection; 12 import dpq.result; 13 14 struct PreparedStatement 15 { 16 private 17 { 18 Connection* _connection; 19 string _name; 20 string _command; 21 Oid[] _paramTypes; 22 } 23 24 this(ref Connection conn, string name, string command, Oid[] paramTypes...) 25 { 26 _connection = &conn; 27 _name = name; 28 _command = command; 29 _paramTypes = paramTypes; 30 } 31 32 @property string name() 33 { 34 return _name; 35 } 36 37 @property string command() 38 { 39 return _command; 40 } 41 42 43 Result run(T...)(T params) 44 { 45 return _connection.execPrepared(_name, params); 46 } 47 48 bool runAsync(T...)(T params) 49 { 50 return _connection.sendPrepared(_name, params); 51 } 52 }