Any PostgreSQL user to confirm/debunk this?
Code: Select all
UsePostgreSQLDatabase()
EnableExplicit
Global ConnStr.s = "host=localhost port=5432 dbname=folders application_name=MyApp"
Global DBHandle = OpenDatabase(#PB_Any, ConnStr, "my_user", "my_password")
If Not DBHandle
Debug "Open DB failed"
End(-1)
EndIf
Define columnname.s = "vdatehi",
value = RGB(25, 100, 120),
visitid = 66844
; this does not work???
SetDatabaseString(DBHandle, 0, columnname)
SetDatabaseLong(DBHandle, 1, value)
SetDatabaseLong(DBHandle, 2, visitid)
If DatabaseUpdate(DBHandle, "update visits set $1 = $2 where id = $3")
Debug "Update OK"
Else
Debug "Update failed"
EndIf
; this works just fine
If DatabaseUpdate(DBHandle, "update visits set " + columnname + " = " + Str(value) + " where id = " + Str(visitid))
Debug "Update OK"
Else
Debug "Update failed"
EndIf