PERF: avoid unneeded safety check in encode

PERF: avoid unneeded safety check in encode

follows up on 86071d688210ed7ed34587659e645e1afd774074

Our contract is that we only call encode when actual encoding needs to happen.

The safety check upfront is not needed

diff --git a/lib/mini_sql/inline_param_encoder.rb b/lib/mini_sql/inline_param_encoder.rb
index 73897e2..8a4a3cc 100644
--- a/lib/mini_sql/inline_param_encoder.rb
+++ b/lib/mini_sql/inline_param_encoder.rb
@@ -9,8 +9,6 @@ module MiniSql
     end
 
     def encode(sql, *params)
-      return sql unless params && params.length > 0
-
       if Hash === (hash = params[0])
         raise ArgumentError, "Only one hash param is allowed, multiple were sent" if params.length > 1
         encode_hash(sql, hash)
diff --git a/lib/mini_sql/postgres_jdbc/connection.rb b/lib/mini_sql/postgres_jdbc/connection.rb
index d2f665e..0d3781a 100644
--- a/lib/mini_sql/postgres_jdbc/connection.rb
+++ b/lib/mini_sql/postgres_jdbc/connection.rb
@@ -89,7 +89,9 @@ module MiniSql
       private
 
       def run(sql, params)
-        sql = param_encoder.encode(sql, *params) if params && params.length > 0
+        if params && params.length > 0
+          sql = param_encoder.encode(sql, *params)
+        end
         conn = raw_connection
         conn.typemap = self.class.typemap
         conn.execute(sql)

GitHub sha: f12859b9