Skip to content

Commit

Permalink
Fix #114
Browse files Browse the repository at this point in the history
  • Loading branch information
astares committed Jun 26, 2023
1 parent d926665 commit 94e1168
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
11 changes: 8 additions & 3 deletions src/Glorp/AbstractReadQuery.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,18 @@ AbstractReadQuery >> defaultTracing [

{ #category : #executing }
AbstractReadQuery >> deleteFromDatabaseWithParameters: anArray [

| command |
self descriptor classesRequiringIndependentQueries size >1 ifTrue: [self error: 'Delete with where clause not yet supported for classes that cross tables.'].
(self class includesBehavior: SimpleQuery) ifFalse: [self error: 'Non-simple queries not yet supported for deletes with where clauses'].
self descriptor classesRequiringIndependentQueries size > 1 ifTrue: [
self error:
'Delete with where clause not yet supported for classes that cross tables.' ].
(self class includesBehavior: SimpleQuery) ifFalse: [
self error:
'Non-simple queries not yet supported for deletes with where clauses' ].
command := self deleteSqlWith: anArray.
"Should this duplicate the error handling in rowsFromDatabasewithParameters:?"
session accessor executeCommand: command returnCursor: false.
^command rowCount.
^ command rowCount
]

{ #category : #executing }
Expand Down
12 changes: 0 additions & 12 deletions src/Glorp/ActiveRecordQuery.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@ Class {
#category : #'Glorp-ActiveRecord'
}

{ #category : #executing }
ActiveRecordQuery >> deleteFromDatabaseWithParameters: anArray [
| command |
self descriptor classesRequiringIndependentQueries size >1 ifTrue: [self error: 'Delete with where clause not yet supported for classes that cross tables.'].
(self class includesBehavior: SimpleQuery) ifFalse: [self error: 'Non-simple queries not yet supported for deletes with where clauses'].
self halt.
command := self deleteSqlWith: anArray.
"Should this duplicate the error handling in rowsFromDatabasewithParameters:?"
session accessor executeCommand: command returnCursor: false.
^command rowCount.
]

{ #category : #accessing }
ActiveRecordQuery >> session: aSession [
super session: aSession.
Expand Down

0 comments on commit 94e1168

Please sign in to comment.