Repository navigation
DBObject
Only use the methods documented here. Although other methods may be available to use, they could be changed or removed in future versions of Storm.
Returns an array of DBObjects containing all the children for the current DBObject.
For example, if you have an instance of a Team class, you can get all its players with this syntax:
Dim allPlayers() As Storm.DBObject
allPlayers = mCurrentTeam.Children("Players")
When you use this syntax, Storm will look for a table called “Player” and find all the rows that have a column TeamID that is the same as mCurrentTeam.ID. You will have to name your tables so that they are always singular in order for this to work.
Returns a String array containing the names of all the columns in the table.
Creates a new instance. If you do not supply dbConn, then Storm will use DBConnection.Default as the connection.
Creates a new instance. If a row in the table as ID as its primary key, then that row will be loaded into this instance. Used for Integer primary keys.
If you do not supply dbConn, then Storm will use DBConnection.Default as the connection.
Constructor(ID As String, dbConn As DBConnection = Nil) Creates a new instance. If a row in the table as ID as its primary key, then that row will be loaded into this instance. Use for String primary keys.
If you do not supply dbConn, then Storm will use DBConnection.Default as the connection.
Creates a new instance, allowing you to select a row based on your own criteria.
column: The name of the column to use
value: The value to look for in the specified column
If a row is find where column = value, then it will be loaded into this instance.
If you do not supply dbConn, then Storm will use DBConnection.Default as the connection.
The duplicate method with create an all-new database object that has the exact same values (except for the primary key) as the original database object.
Dim newTeam As Team
newTeam = oldTeam.Duplicate
Note: In order for this to work, Team must have been loaded into the DBObjectFactory.
Returns an array of DBObjects of the current class containing all the rows in the database that match the criteria specified in where.
where: The WHERE clause you want to use to retrieve rows from the database
sort: The ORDER BY clause you want to use to sort the rows retrieved from the database
Note: In order for this to work, Team must have been loaded into the DBObjectFactory.
Normally you would just refer to the column name directly, but sometimes it is helpful to be able to use a string for the column name:
Dim value As String
value = myClass.GetColumn("MyColumn")
This is the same as:
Dim value As String
value = myClass.MyColumn
If “MyColumn” does not exist, then a ColumnNotFoundException is raised.
Use this method to check if your database object actually has a specific column. This can be useful for code that has to work with multiple versions of a schema. You can check to make sure that a column actually exists before using it to maintain compatibility with older database schemas.
The Save method writes out any changes made to the object out to the database. If none of the values have changed, then nothing is written to the database.
Save returns True is it succeeded and False if there was an error.
Generates an XML representation of the database object. This XML can be used by Deserialize to create an instance of the object.
Normally you would just refer to the column name directly, but sometimes it is helpful to be able use a string for the column name:
myClass.SetColumn("MyColumn") = value
This is the same as:
myClass.MyColumn = value
Returns the name of the class, which is also the name of the corresponding database table.
Contains the name of the database file that this instance is connected to.
Returns True is this instance is new (was not loaded from the database).
Delete(table As String, primaryKey As String, ID As Integer, dbConn As DBConnection = Nil) As Boolean
For classes that will be automatically instantiated by Storm (when using GetAll), you will need to assign the object factory here. Since this is a shared property, you only need to do this once after you create the factory.