zeroshade commented on code in PR #2254:
URL: https://github.com/apache/arrow-adbc/pull/2254#discussion_r1801276710


##########
go/adbc/driver/snowflake/connection.go:
##########
@@ -85,82 +127,165 @@ func (c *connectionImpl) GetObjects(ctx context.Context, 
depth adbc.ObjectDepth,
        defer conn.Close()
 
        gQueryIDs, gQueryIDsCtx := errgroup.WithContext(ctx)
+
        queryFile := queryTemplateGetObjectsAll
        switch depth {
        case adbc.ObjectDepthCatalogs:
-               if catalog == nil {
-                       queryFile = queryTemplateGetObjectsTerseCatalogs
-                       // if the catalog is null, show the terse databases
-                       // which doesn't require a database context
-                       gQueryIDs.Go(func() error {
-                               return conn.Raw(func(driverConn any) error {
-                                       rows, err := 
driverConn.(driver.QueryerContext).QueryContext(gQueryIDsCtx, "SHOW TERSE 
DATABASES", nil)
-                                       if err != nil {
-                                               return err
-                                       }
+               queryFile = queryTemplateGetObjectsTerseCatalogs
+               gQueryIDs.Go(func() error {
+                       return conn.Raw(func(driverConn any) (err error) {
+                               query := "SHOW TERSE /* ADBC:getObjectsCatalogs 
*/ DATABASES"
+                               if catalog != nil && len(*catalog) > 0 && 
*catalog != "%" && *catalog != ".*" {
+                                       query += " LIKE '" + 
escapeSingleQuoteForLike(*catalog) + "'"

Review Comment:
   in my testing, that was the case. My original attempt was to use bind 
parameters but it didn't pick up the values (it didn't error, just was a blank 
string)



-- 
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