Hi,

I've run into an issue where Sequel appears to be generating an incorrect 
query for parsing the information schema from SQL Server 2005. Small 
example:

module Omegadb
  class ProfilePicture < 
Sequel::Model(OMEGADB[:dbo__tblfiles.qualify(:omegadb)])
  end
end

will generate:

SELECT
    [COLUMN_NAME] AS [COLUMN]
  , [DATA_TYPE] AS [DB_TYPE]
  , [CHARACTER_MAXIMUM_LENGTH] AS [MAX_CHARS]
  , [COLUMN_DEFAULT] AS [DEFAULT]
  , [IS_NULLABLE] AS [ALLOW_NULL]
  , [NUMERIC_PRECISION] AS [COLUMN_SIZE]
  , [NUMERIC_SCALE] AS [SCALE]
FROM
    [INFORMATION_SCHEMA].[TABLES] AS [T]
    INNER JOIN [INFORMATION_SCHEMA].[COLUMNS] AS [C] ON (
                                                          ( 
[C].[TABLE_CATALOG] = [T].[TABLE_CATALOG] )
                                                          AND ( 
[C].[TABLE_SCHEMA] = [T].[TABLE_SCHEMA] )
                                                          AND ( 
[C].[TABLE_NAME] = [T].[TABLE_NAME] )
                                                        )
WHERE
    (
      ( [C].[TABLE_NAME] = N'DBO__TBLFILES' )
      AND ( [C].[TABLE_SCHEMA] = [OMEGADB] )
    )

When executed, it fails with error: Invalid column name 'OMEGADB'. Assuming 
you are connected to the correct database, I believe the generated where 
statement should be:

WHERE
    (
      ( [C].[TABLE_NAME] = N'TBLFILES' )
      AND ( [C].[TABLE_SCHEMA] = 'dbo' )
    )

I'm using Sequel 3.40.0 with tiny_tds 0.5.1. Hopefully I'm just doing 
something wrong here :)

Thanks,
Doug

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/86y0O697CmkJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to