Click here to Skip to main content
15,896,269 members
Articles / Programming Languages / Visual Basic

Object-Oriented database design with the DatabaseObjects library

Rate me:
Please Sign up or sign in to vote.
4.00/5 (6 votes)
31 Jan 20076 min read 110.5K   3.9K   64  
Demonstrates creating object-oriented database systems with the DatabaseObjects library.
' ___________________________________________________
'
'  � Hi-Integrity Systems 2007. All rights reserved.
'  www.hisystems.com.au - Toby Wicks
' ___________________________________________________
'

Option Strict On
Option Explicit On 

Namespace SQL

    ''' --------------------------------------------------------------------------------
    ''' <summary>
    ''' Provides a set of uniform and portable data types that can be used between 
    ''' Microsoft Access, SQLServer and MySQL. Please refer to the DataTypeString 
    ''' function in the Source\SQL\SQLTable.vb file for the actual SQL equivalents for 
    ''' each database.
    ''' </summary>
    ''' --------------------------------------------------------------------------------
    Public Enum DataType

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' Integer data from 0 through 255
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        TinyInteger

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' Integer data from 2^15 (-32,768) through 2^15 - 1 (32,767)
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        SmallInteger

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' Integer (whole number) data from -2^31 (-2,147,483,648) through 2^31 - 1 (2,147,483,647)
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        [Integer]

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' Integer (whole number) data from -2^63 (-9223372036854775808) through 2^63-1 (9223372036854775807)
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        BigInteger

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' SQLServer limitation: Fixed-length non-Unicode character data with a maximum length of 8,000 characters
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        Character

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' SQLServer limitation: Fixed-length Unicode data with a maximum length of 4,000 characters
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        UnicodeCharacter

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' SQLServer limitation: Variable-length non-Unicode data with a maximum of 8,000 characters
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        VariableCharacter

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' SQLServer limitation: Variable-length Unicode data with a maximum length of 4,000 characters
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        UnicodeVariableCharacter

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' Fixed precision and scale numeric data.
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        [Decimal]

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' Floating precision number data from -3.40E + 38 through 3.40E + 38. Equivalent
        ''' to VB.NET Single data type. The MySQL equivalent used is FLOAT.
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        Real

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' Floating precision number data from -1.79E + 308 through 1.79E + 308. Equivalent
        ''' to .NET Double data type. The MySQL equivalent used is DOUBLE.
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        Float

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' Monetary data values from -214,748.3648 through +214,748.3647, with accuracy to a 
        ''' ten-thousandth of a monetary unit. The MySQL equivalent used is DECIMAL(10,4). 
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        SmallMoney

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' Monetary data values from -2^63 (-922,337,203,685,477.5808) through 2^63 - 1 
        ''' (+922,337,203,685,477.5807), with accuracy to a ten-thousandth of a monetary unit.
        ''' The MySQL equivalent used is DECIMAL(19,4). 
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        Money

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' Integer data with either a 1 or 0 value
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        [Boolean]

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' SQL Server: Date and time data from January 1, 1900, through June 6, 2079, with 
        ''' an accuracy of one minute. This data type for Access and MySQL is equivalent to 
        ''' DATETIME.
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        SmallDateTime

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' Date and time data from January 1, 1753, through December 31, 9999, with an 
        ''' accuracy of three-hundredths of a second, or 3.33 milliseconds. This is a SQLServer
        ''' limitation. MySQL supports '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. To 
        ''' provide portability, accuracy to only 1 second can be assumed.
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        DateTime

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' 
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        TimeStamp

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' Variable-length non-Unicode data with a maximum length of 2^31 - 1 (2,147,483,647) characters
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        Text

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' Variable-length Unicode data with a maximum length of 2^30 - 1 (1,073,741,823) characters
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        UnicodeText

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' SQLServer limitation: Fixed-length binary data with a maximum length of 8,000 bytes
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        Binary

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' SQLServer limitation: Variable-length binary data with a maximum length of 8,000 bytes
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        ''' 
        VariableBinary

        ''' --------------------------------------------------------------------------------
        ''' <summary>
        ''' Variable-length binary data with a maximum length of 2^31 - 1 (2,147,483,647) bytes
        ''' </summary>
        ''' --------------------------------------------------------------------------------
        Image

    End Enum

    Public Enum KeyType
        None
        Primary
        Unique
    End Enum

    Public Enum AggregateFunction
        Average = 1
        Count
        Sum
        Minimum
        Maximum
        StandardDeviation
        Variance
    End Enum

    'Ascending and Descending are 0 and -1 so that the Not operator will 
    'negate the ordering from ascending to descending and visa versa. 
    'i.e. 'Not Ascending' is equivalent to 'Descending'
    Public Enum OrderBy
        None = 1
        Ascending = 0
        Descending = Not Ascending  ' -1
    End Enum

    Public Enum ComparisonOperator
        EqualTo
        NotEqualTo
        LessThan
        LessThanOrEqualTo
        GreaterThan
        GreaterThanOrEqualTo
        [Like]
        NotLike
    End Enum

    Public Enum LogicalOperator
        [And]
        [Or]
    End Enum

End Namespace

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions