Pass BOOL values as real types (int/bool) instead of strings to SQL parameters. (#101961)
* Pass BOOL values as real types (int/bool) instead of strings to SQL parameters.
Fixes following integration tests when running with Spanner:
* TestIntegrationDataAccess
* GetDataSourcesByType/Get_prunable_data_sources
* TestIntegrationUserAuthToken:
* expires_correctly
* can_properly_rotate_tokens
* keeps_prev_token_valid_for_1_minute_after_it_is_confirmed
* Fix more places where "true" or "false" string was passed as query parameter instead of bool value.
* Removed unit test because it brought unwanted dependencies on xorm into multiple modules.
This commit is contained in:
@@ -169,7 +169,7 @@ func (s *ServiceAccountsStoreImpl) DeleteServiceAccount(ctx context.Context, org
|
||||
func (s *ServiceAccountsStoreImpl) deleteServiceAccount(sess *db.Session, orgId, serviceAccountId int64) error {
|
||||
user := user.User{}
|
||||
has, err := sess.Where(`org_id = ? and id = ? and is_service_account = ?`,
|
||||
orgId, serviceAccountId, s.sqlStore.GetDialect().BooleanStr(true)).Get(&user)
|
||||
orgId, serviceAccountId, s.sqlStore.GetDialect().BooleanValue(true)).Get(&user)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -346,7 +346,7 @@ func (s *ServiceAccountsStoreImpl) SearchOrgServiceAccounts(ctx context.Context,
|
||||
whereConditions = append(
|
||||
whereConditions,
|
||||
"is_disabled = ?")
|
||||
whereParams = append(whereParams, s.sqlStore.GetDialect().BooleanStr(true))
|
||||
whereParams = append(whereParams, s.sqlStore.GetDialect().BooleanValue(true))
|
||||
case serviceaccounts.FilterOnlyExternal:
|
||||
whereConditions = append(
|
||||
whereConditions,
|
||||
|
||||
@@ -96,7 +96,7 @@ func (s *ServiceAccountsStoreImpl) RevokeServiceAccountToken(ctx context.Context
|
||||
rawSQL := "UPDATE api_key SET is_revoked = ? WHERE id=? and org_id=? and service_account_id=?"
|
||||
|
||||
return s.sqlStore.WithDbSession(ctx, func(sess *db.Session) error {
|
||||
result, err := sess.Exec(rawSQL, s.sqlStore.GetDialect().BooleanStr(true), tokenId, orgId, serviceAccountId)
|
||||
result, err := sess.Exec(rawSQL, s.sqlStore.GetDialect().BooleanValue(true), tokenId, orgId, serviceAccountId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user