[Cuis-dev] DatabaseSupport ODBC and getting table schema info

Jon Raiford raiford at labware.com
Tue Nov 5 23:16:27 PST 2024


No, I’m only using Cuis. I just don’t use that old odbc package. If there is no FFI method implemented that would call SQLColumns then you would need to enhance the package to add that support yourself. Alternatively you might be able to execute a query that is guaranteed to answer an empty set and pull the column information from it. You can do this like this: select * from my_table where 1 = 0

Jon
________________________________
From: Mark Volkmann <r.mark.volkmann at gmail.com>
Sent: Tuesday, November 5, 2024 7:57:50 PM
To: Jon Raiford <raiford at labware.com>
Cc: Discussion of Cuis Smalltalk <cuis-dev at lists.cuis.st>
Subject: Re: [Cuis-dev] DatabaseSupport ODBC and getting table schema info

In the Cuis ODBC package, I think all communication with the ODBC driver happens in the instance methods of the ODBCLibrary class. I don't see any methods there that query a table to get information about its columns.

Are you working with ODBC in Squeak?

On Mon, Nov 4, 2024 at 7:27 PM Jon Raiford <raiford at labware.com<mailto:raiford at labware.com>> wrote:
Although i don’t know that package well enough to say how to do it, i can tell you the correct way to fetch column information is to call SQLColumns (https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlcolumns-function?view=sql-server-ver16<https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlcolumns-function?view=sql-server-ver16>). Note that current Cuis odbc package is very old and maybe uses the v1 calls. I'm not sure how or if that would affect things.

Jon
________________________________
From: Cuis-dev <cuis-dev-bounces at lists.cuis.st<mailto:cuis-dev-bounces at lists.cuis.st>> on behalf of Mark Volkmann via Cuis-dev <cuis-dev at lists.cuis.st<mailto:cuis-dev at lists.cuis.st>>
Sent: Monday, November 4, 2024 8:17:42 PM
To: Discussion of Cuis Smalltalk <cuis-dev at lists.cuis.st<mailto:cuis-dev at lists.cuis.st>>
Cc: Mark Volkmann <r.mark.volkmann at gmail.com<mailto:r.mark.volkmann at gmail.com>>
Subject: [Cuis-dev] DatabaseSupport ODBC and getting table schema info

I've been searching the code for the ODBC package and haven't found a way to get information about the columns in a given table including their names and data types. I can get that from a row from a result set, but I don't see a way to do it for an empty table. Am I overlooking it?

--
R. Mark Volkmann
Object Computing, Inc.


--
R. Mark Volkmann
Object Computing, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20241106/87adf1c1/attachment.htm>


More information about the Cuis-dev mailing list