Hier mal ein Beispielskript auf Deutsch zur Verbindung zu MySQL:
# Start a new connection
Variable setzen [ $Connection ; Wert: MBS("SQL.NewConnection") ]
# Tell plugin where MySQL library is (put it where you like)
Variable setzen [ $result ; Wert: MBS("SQL.SetConnectionOption"; $Connection; "MYSQL.LIBS"; "/Users/cs/Desktop/libmysqlclient.dylib") ]
# Connect to a mysql database:
Variable setzen [ $result ; Wert: MBS("SQL.Connect"; $Connection; "192.168.11.51@Server_Config"; "user"; "password"; "MySQL") ]
Wenn [ $result ≠ "OK" ]
# Connection failed
Eigenes Dialogfeld anzeigen [ "Error: " & $result ]
Variable setzen [ $result ; Wert: MBS("SQL.FreeConnection"; $Connection) ]
Alle Scripts abbrechen
Sonst
# Create a query:
Variable setzen [ $Command ; Wert: MBS("SQL.NewCommand"; $Connection; "SELECT * FROM Server_Config where ServerName=:Name") ]
# If you use parameters, you can fill them here
Variable setzen [ $r ; Wert: MBS("SQL.SetParamAsText"; $Command; "Name"; "MacMini") ]
# Execute it
Variable setzen [ $result ; Wert: MBS("SQL.Execute"; $Command) ]
Wenn [ $result ≠ "OK" ]
Feldwert setzen [ MySQL Query::Result ; $result ]
Eigenes Dialogfeld anzeigen [ "Error: " & $result ]
Sonst
Variable setzen [ $lines ; Wert: "" ]
Variable setzen [ $fieldcount ; Wert: MBS("SQL.FieldCount"; $command) ]
Schleife (Anfang)
# call FetchNext to get the next record
Variable setzen [ $result ; Wert: MBS("SQL.FetchNext"; $Command) ]
Verlasse Schleife wenn [ $result ≠ 1 ]
Variable setzen [ $line ; Wert: "" ]
Variable setzen [ $i ; Wert: 1 ]
Schleife (Anfang)
# We query field names and values to show them later
Variable setzen [ $v ; Wert: MBS("SQL.GetFieldAsText"; $command; $i) ]
Variable setzen [ $n ; Wert: MBS("SQL.GetFieldName"; $command; $i) ]
Variable setzen [ $line ; Wert: $line & $n & ": " & $v & ¶ ]
Variable setzen [ $i ; Wert: $i+1 ]
Verlasse Schleife wenn [ $i > $fieldCount ]
Schleife (Ende)
Variable setzen [ $lines ; Wert: $lines & ($line & ¶) ]
Schleife (Ende)
Variable setzen [ $lines ; Wert: $lines & ¶ ]
Eigenes Dialogfeld anzeigen [ "Result from Query:" ; $lines ]
Ende (wenn)
# Cleanup
Variable setzen [ $result2 ; Wert: MBS("SQL.FreeCommand"; $Command) ]
Ende (wenn)
Variable setzen [ $result2 ; Wert: MBS("SQL.FreeConnection"; $Connection) ]
Vielleicht hilft es ja mal einem.