Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

SQL92[EXPERTS]

Name: Anonymous 2010-04-16 12:53

Hey /prog/

Is it legal to modify a table while there's a read cursor open on it? Is it defined behavior?

For example, in some pseudo-code:

result = sql("SELECT * FROM faggot_table WHERE faggot_type=5;");
for each (result) {
  if (whatever) sql("DELETE FROM faggot_table WHERE faggot_id=3;");
}

The reason I ask is because I tested with several database engines from the ENTERPRISE to the toy, and it works on some but errors out in others. So I can't use it in the general case.

However I'd like to know if it should work and some databases suck, if it shouldn't but is supported on some, or if it mustn't and it works by chance on some.

(It could work in some because they prefetch results, and maybe if they prefetch everything the cursor is already closed the moment you read the first row)

Name: Anonymous 2010-04-17 4:07

/prog/ at its finest: nobody is able or willing to answer the actual question.

The question is whether the behavior is valid in general, not how to overcome it, neither how to design the system such as to make the problem irrelevant.

"Can you cast a float as an integer in C? I have this weird compiler where it doesn't work"

"Well you shouldn't be doing that in the first place but you can always sprintf it and then atoi it back"

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List