Schema
public class Schema
Methods
object Execute(string cmd)
-
Execute an SQL-statement on the schema
DBReader Select(string cmd)
-
Execute an SQL-statement on the schema which returns data
void Close()
-
Close the schema
Example
This example sets and updates information about a person
s = Database.GetSchema("Datastorage")
hasData = False
with s.Select("select Id, Name, Age from Person") as reader:
while reader.Read():
hasData = True
ProcessInstance.Warn("DBData:"+str(reader.GetValue(1)))
mId = reader.GetValue(0)
mAge = reader.GetValue(2)
if hasData:
s.Execute("UPDATE Person SET Age=%d WHERE ID=%d" % (mAge + 1, mId))
else:
s.Execute("INSERT INTO Person (Name,Age) VALUES ('Frank',45)")
s.Close()