Fehlerbehandlung in MySQL

Wo finde ich die im Block "when Web1 GotText" verwendeten responseCodes?

Drag out to designer

image

open palette to Web1

image

Meine Frage ist: Wo finde ich eine Liste der responseCodes,
z.B für

  • text gefunden
  • key nicht eindeutig
  • txt nicht gefunden
  • Systemfehler xyz
    ....?

You can Google "web response codes". That's how I got this:

Danke, darauf wäre ich nie gekommen!
Da ich ja eine SQL-Abfrage sende, hatte ich einen SQL-Returncode erwartet!

1 Like

The thing is that is not an SQL component. It's the web component. So I think it can only return http codes.

Status Code 200 bedeutet "gefunden".
Ich möchte aber nicht nur unterscheiden zwischen 200 und not = 200,
sondern

Was ist gemeint mit
204 No Content The server successfully processed the request, and is not returning any content.
Heißt dies "Satz nicht gefunden" oder "Satz gefunden aber keine Datenwerte - not any content"?

Again, the web component is not a SQL component. The web component will show you whatever the server throws back at you as HTTP. The codes returned are not SQL codes.

Also, why do you have the red X in the "when Web1.GotText" block? Is it a duplicate? If yes, that's not correct. Use only one and test it again.

this depends on the php script you are using...
if you are using mine from here App Inventor Tutorials and Examples: MySQL | Pura Vida Apps, you wil get the following 3 response codes

  • Returns HTTP code 200 for a successful SELECT query
  • Returns HTTP code 201 to return anything that's not a SELECT statement
  • Returns HTTP code 400 for any error with your SQL or setup

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

"HTTP code 200 for a successful SELECT query"
Im allgemeinen heißt "successfull", wenn die Suche erfolgreich war.
Im vorliegenden Fall kommt 200 auch, wenn zu dem Key kein Satz gefunden wird.
Geliefert wird stattdessen eine Liste der Namen der Datenfelder in der Tabelle.
Muss man demnach abfragen
1 Liste , dann nicht gefunden
Mehr als 1 Liste, dann Satz/Sätze gefunden?

"successful" heißt, dass kein Fehler aufgetreten ist
ein leeres Ergebnis ist auch ein Ergebnis

ja, das kannst du so machen...

Taifun

OK, danke!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.