CurtHagenlocher commented on code in PR #4318:
URL: https://github.com/apache/arrow-adbc/pull/4318#discussion_r3255562559


##########
csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverExporter.cs:
##########
@@ -502,6 +518,63 @@ private unsafe static AdbcStatusCode 
SetStatementSqlQuery(CAdbcStatement* native
             }
         }
 
+#if NET5_0_OR_GREATER
+        [UnmanagedCallersOnly]
+#endif
+        private unsafe static AdbcStatusCode 
SetStatementOption(CAdbcStatement* nativeStatement, byte* name, byte* value, 
CAdbcError* error)
+        {
+            try
+            {
+                if (name == null) throw new 
ArgumentNullException(nameof(name));
+
+                GCHandle gch = 
GCHandle.FromIntPtr((IntPtr)nativeStatement->private_data);
+                AdbcStatement stub = (AdbcStatement)gch.Target!;
+
+                stub.SetOption(MarshalExtensions.PtrToStringUTF8(name)!, 
MarshalExtensions.PtrToStringUTF8(value)!);
+                return AdbcStatusCode.Success;

Review Comment:
   Maybe it should be okay for value to be null? Rather than worry about that 
for now, I'll aim for consistency with the preexisting call sites. Also, the 
need for a `!` operator suggests that the C# definition also expects a not-null 
value.
   
   I've separately changed the shared error-handling code to turn 
`ArgumentException` into `AdbcStatusCode.InvalidArgument`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to