Explorar el Código

修复执行sql代码bugp

qdy hace 3 meses
padre
commit
e2098edafd
Se han modificado 1 ficheros con 7 adiciones y 6 borrados
  1. 7
    6
      functions/query_json.go

+ 7
- 6
functions/query_json.go Ver fichero

19
 	}
19
 	}
20
 
20
 
21
 	// 处理命名参数
21
 	// 处理命名参数
22
-	query, args, err := sqlx.Named(sql, params)
23
-	if err != nil {
24
-		return createErrorResult(fmt.Sprintf("Failed to process named parameters: %v", err), startTime)
25
-	}
22
+	//query, args, err := sqlx.Named(sql, params)
23
+	//if err != nil {
24
+	//	return createErrorResult(fmt.Sprintf("Failed to process named parameters: %v", err), startTime)
25
+	//}
26
 
26
 
27
 	// 执行查询
27
 	// 执行查询
28
-	rows, err := db.Query(sqlx.Rebind(sqlx.DOLLAR, query), args...)
28
+	//rows, err := db.Query(sqlx.Rebind(sqlx.DOLLAR, query), args...)
29
+	rows, err := sqlx.NamedQuery(db, sql, params)
29
 	if err != nil {
30
 	if err != nil {
30
 		return createErrorResult(fmt.Sprintf("Query execution failed: %v", err), startTime)
31
 		return createErrorResult(fmt.Sprintf("Query execution failed: %v", err), startTime)
31
 	}
32
 	}
32
 	defer rows.Close()
33
 	defer rows.Close()
33
 
34
 
34
 	// 处理结果集
35
 	// 处理结果集
35
-	return processQueryResult(rows, startTime)
36
+	return processQueryResult(rows.Rows, startTime)
36
 }
37
 }
37
 
38
 
38
 // QueryPositionalToJSON 执行带位置参数的查询
39
 // QueryPositionalToJSON 执行带位置参数的查询

Loading…
Cancelar
Guardar