Results 1 to 1 of 1

Thread: RC6: What should I prefer FieldType or cColumnType

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Question RC6: What should I prefer FieldType or cColumnType

    Hello!

    While writing a class that would be able to comfortably convert and edit databases, I asked myself if I should get the SQLite database structure by

    Version 1:

    Code:
    "SELECT * FROM tablename LIMIT 0"
    or by

    'Version 2:
    Code:
    "SELECT * FROM dbname.sqlite_master""
    or by

    Version 3:
    Code:
       
        Dim DB As cDataBase
        For Each DB In uCn.DataBases
            DB.ReScanSchemaInfo 'Seems necessary if a table has just been created and the connection had not been closed ye
            If VBA.LCase(DB.Name) = VBA.LCase(uDBName) Then
                Dim tbl As cTable
                For Each tbl In DB.Tables
                    If LCase(tbl.Name) = LCase(uTableName) Then
                        TableExists = True
                        Exit Function
                    End If
                Next tbl
            End If
        Next DB
    I am asking this here now because I noticed that the order in which fields are returned by "SELECT * FROM..." differs from the order that Table.Column has.

    Why this is of importance:

    A cRecordset however has cFields.cField.ColumnType which is FieldType
    Code:
    cFields.cField.ColumnType
    cFields.cField.OriginalDataType
    cFields.cField.IndexInFieldList As Long
    However, a cColumn does not have the cField.ColumnType.

    Instead it has a string value:
    Code:
    cTables.cTable.cColumns.cColumn.ColumnType (String)
    I dare to ask this as I have spent much time on that already, and I compared with some apps doing sqlite conversions, and I noticed that it's a broard topic.

    I wonder what I should rely on in order to get away with the least conversions and iterations possible. I only need the RC6 definitions, I think, and that is why I wonder why cColumn is of type String. Was that to leave future additions open?

    Thank you!
    Last edited by tmighty2; Sep 11th, 2024 at 02:28 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width