From 137bef1cf5c5a148606eb88b983417e205f3679e Mon Sep 17 00:00:00 2001 From: Nemanja Boric <4burgos@gmail.com> Date: Wed, 1 Feb 2017 22:46:58 +0100 Subject: [PATCH] Rename opCall to constructMessage To be more clear, methods that are constructing message are now named constructMessage. --- src/postgres/connection.d | 16 ++++++++-------- src/postgres/message.d | 21 ++++++++++++--------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/postgres/connection.d b/src/postgres/connection.d index dc9ac3c..579aec7 100644 --- a/src/postgres/connection.d +++ b/src/postgres/connection.d @@ -177,7 +177,7 @@ struct Connection { if (auth_msg.format == AuthenticationMessage.AuthFormat.MD5PASS) { - this.send(Md5PasswordMessage(this.payload_appender, this.username, + this.send(Md5PasswordMessage.constructMessage(this.payload_appender, this.username, this.password, auth_msg.salt.md5_salt)); } else @@ -232,7 +232,7 @@ struct Connection ReadyForQueryMessage; // TODO: make receiveOne static - this.send(QueryMessage(this.payload_appender, query_string)); + this.send(QueryMessage.constructMessage(this.payload_appender, query_string)); auto response = msg.receiveOne(this); if (auto rows = response.peek!(RowDescriptionMessage)) @@ -301,7 +301,7 @@ struct Connection ReadyForQueryMessage; // TODO: make receiveOne static - this.send(QueryMessage(this.payload_appender, query_string)); + this.send(QueryMessage.constructMessage(this.payload_appender, query_string)); this.set.response = msg.receiveOne(this); if (auto rows = this.set.response.peek!(RowDescriptionMessage)) @@ -387,11 +387,11 @@ struct Connection SyncMessage sync; parsemsg.query_string = query_string; - this.send(ParseMessage(this.payload_appender, parsemsg)); - this.send(BindMessage(this.payload_appender, bindmsg)); - this.send(DescribeMessage(this.payload_appender, describemsg)); - this.send(ExecuteMessage(this.payload_appender, execmsg)); - this.send(SyncMessage(this.payload_appender, sync)); + this.send(ParseMessage.constructMessage(this.payload_appender, parsemsg)); + this.send(BindMessage.constructMessage(this.payload_appender, bindmsg)); + this.send(DescribeMessage.constructMessage(this.payload_appender, describemsg)); + this.send(ExecuteMessage.constructMessage(this.payload_appender, execmsg)); + this.send(SyncMessage.constructMessage(this.payload_appender, sync)); this.set.response = msg.receiveOne(this); enforce(this.set.response.peek!(ParseCompleteMessage), diff --git a/src/postgres/message.d b/src/postgres/message.d index e072ff3..cf50068 100644 --- a/src/postgres/message.d +++ b/src/postgres/message.d @@ -308,12 +308,15 @@ struct Md5PasswordMessage /// Constructs a MD5 password responde message /// using the given password and salt - static ubyte[] opCall(ref Appender!(ubyte[]) app, string username, string password, int salt) + static ubyte[] constructMessage(ref Appender!(ubyte[]) app, + string username, string password, int salt) { - return Md5PasswordMessage(app, username, password, (cast(ubyte*)&salt)[0..int.sizeof]); + return Md5PasswordMessage.constructMessage(app, username, password, + (cast(ubyte*)&salt)[0..int.sizeof]); } - static ubyte[] opCall(ref Appender!(ubyte[]) app, string username, string password, ubyte[] salt) + static ubyte[] constructMessage(ref Appender!(ubyte[]) app, + string username, string password, ubyte[] salt) { ubyte[32 + 4] hash_buf; // md5+password string @@ -558,7 +561,7 @@ struct QueryMessage /// Constructs a query message using the /// query string - static ubyte[] opCall(ref Appender!(ubyte[]) app, string query) + static ubyte[] constructMessage(ref Appender!(ubyte[]) app, string query) { return Message.constructMessage(app, Tag, query); } @@ -824,7 +827,7 @@ struct ParseMessage public TypeOID[] data_types = [TypeOID.NOT_SPECIFIED]; /// Constructs a Parse message - static ubyte[] opCall(ref Appender!(ubyte[]) app, ParseMessage msg) + static ubyte[] constructMessage(ref Appender!(ubyte[]) app, ParseMessage msg) { return Message.constructMessage(app, Tag, msg.prepared_statement_name, @@ -887,7 +890,7 @@ struct BindMessage public FormatCodes[] result_format_codes; /// Constructs a Bind message - static ubyte[] opCall(ref Appender!(ubyte[]) app, BindMessage msg) + static ubyte[] constructMessage(ref Appender!(ubyte[]) app, BindMessage msg) { return Message.constructMessage(app, Tag, msg.dest_portal_name, @@ -1008,7 +1011,7 @@ struct DescribeMessage /// Constructs a Bind message - static ubyte[] opCall(ref Appender!(ubyte[]) app, DescribeMessage msg) + static ubyte[] constructMessage(ref Appender!(ubyte[]) app, DescribeMessage msg) { return Message.constructMessage(app, Tag, msg.type, @@ -1034,7 +1037,7 @@ struct ExecuteMessage /// Constructs a Bind message - static ubyte[] opCall(ref Appender!(ubyte[]) app, ExecuteMessage msg) + static ubyte[] constructMessage(ref Appender!(ubyte[]) app, ExecuteMessage msg) { return Message.constructMessage(app, Tag, msg.portal_name, @@ -1083,7 +1086,7 @@ struct SyncMessage enum origin = Origin.FRONTEND; /// Constructs a Sync message - static ubyte[] opCall(ref Appender!(ubyte[]) app, SyncMessage msg) + static ubyte[] constructMessage(ref Appender!(ubyte[]) app, SyncMessage msg) { return Message.constructMessage(app, Tag); }