Hi,

I'm trying to determine what functions my version of my ODBC drivers (MDAC 2.8) and DBD::ODBC (v1.06) support. This is so I can make various function calls via ODBC to SQL Server 2000.

I have written a test program (included below) to determine if a function is supported or not. I'm specifically interested in SQLGetData and SQLPutData. However, on my machine (Windows 2000) the GetData is not supported yet PutData is. This struck me as a little odd so I wondered if my data table was incorrect. Especially as it only has 80-odd entries rather than 100.

However I don't have the defines from the C source so I had to scour the 'net and that is what I got.

Can anyone confirm the table (or provide the latest list of function numbers)?

If its worth it, once the program is fixed/verified I'll post it to CUFP?

Thanks

Code follows

use DBI qw(:sql_types); use strict; use warnings; use constant DATA => "driver={SQL Server};Server=10.173.2 +50.139; database=simonp;uid=hr_user;pwd=password;"; my @functions = ( [ 'SQL_API_SQLALLOCCONNECT', "SQLALLOCCONNECT" ], [ 'SQL_API_SQLALLOCENV', "SQLALLOCENV" ], [ 'SQL_API_SQLALLOCHANDLE', "SQLALLOCHANDLE" ], [ 'SQL_API_SQLALLOCSTMT', "SQLALLOCSTMT" ], [ 'SQL_API_SQLBINDCOL', "SQLBINDCOL" ], [ 'SQL_API_SQLBINDFILETOCOL', "SQLBINDFILETOCOL" ], [ 'SQL_API_SQLBINDFILETOPARAM', "SQLBINDFILETOPARAM" ], [ 'SQL_API_SQLBINDPARAM', "SQLBINDPARAM" ], [ 'SQL_API_SQLBINDPARAMETER', "SQLBINDPARAMETER" ], [ 'SQL_API_SQLBROWSECONNECT', "SQLBROWSECONNECT" ], [ 'SQL_API_SQLCANCEL', "SQLCANCEL" ], [ 'SQL_API_SQLCLOSECURSOR', "SQLCLOSECURSOR" ], [ 'SQL_API_SQLCOLATTRIBUTE', "SQLCOLATTRIBUTE" ], [ 'SQL_API_SQLCOLATTRIBUTES', "SQLCOLATTRIBUTES" ], [ 'SQL_API_SQLCOLUMNPRIVILEGES', "SQLCOLUMNPRIVILEGES" ], [ 'SQL_API_SQLCOLUMNS', "SQLCOLUMNS" ], [ 'SQL_API_SQLCONNECT', "SQLCONNECT" ], [ 'SQL_API_SQLCOPYDESC', "SQLCOPYDESC" ], [ 'SQL_API_SQLDATASOURCES', "SQLDATASOURCES" ], [ 'SQL_API_SQLDESCRIBECOL', "SQLDESCRIBECOL" ], [ 'SQL_API_SQLDESCRIBEPARAM', "SQLDESCRIBEPARAM" ], [ 'SQL_API_SQLDISCONNECT', "SQLDISCONNECT" ], [ 'SQL_API_SQLDRIVERCONNECT', "SQLDRIVERCONNECT" ], [ 'SQL_API_SQLENDTRAN', "SQLENDTRAN" ], [ 'SQL_API_SQLERROR', "SQLERROR" ], [ 'SQL_API_SQLEXECDIRECT', "SQLEXECDIRECT" ], [ 'SQL_API_SQLEXECUTE', "SQLEXECUTE" ], [ 'SQL_API_SQLEXTENDEDFETCH', "SQLEXTENDEDFETCH" ], [ 'SQL_API_SQLFETCH', "SQLFETCH" ], [ 'SQL_API_SQLFETCHSCROLL', "SQLFETCHSCROLL" ], [ 'SQL_API_SQLFOREIGNKEYS', "SQLFOREIGNKEYS" ], [ 'SQL_API_SQLFREECONNECT', "SQLFREECONNECT" ], [ 'SQL_API_SQLFREEENV', "SQLFREEENV" ], [ 'SQL_API_SQLFREEHANDLE', "SQLFREEHANDLE" ], [ 'SQL_API_SQLFREESTMT', "SQLFREESTMT" ], [ 'SQL_API_SQLGETCONNECTATTR', "SQLGETCONNECTATTR" ], [ 'SQL_API_SQLGETCONNECTOPTION', "SQLGETCONNECTOPTION" ], [ 'SQL_API_SQLGETCURSORNAME', "SQLGETCURSORNAME" ], [ 'SQL_API_SQLGETDATA', "SQLGETDATA" ], [ 'SQL_API_SQLGETDESCFIELD', "SQLGETDESCFIELD" ], [ 'SQL_API_SQLGETDESCREC', "SQLGETDESCREC" ], [ 'SQL_API_SQLGETDIAGFIELD', "SQLGETDIAGFIELD" ], [ 'SQL_API_SQLGETDIAGREC', "SQLGETDIAGREC" ], [ 'SQL_API_SQLGETENVATTR', "SQLGETENVATTR" ], [ 'SQL_API_SQLGETFUNCTIONS', "SQLGETFUNCTIONS" ], [ 'SQL_API_SQLGETINFO', "SQLGETINFO" ], [ 'SQL_API_SQLGETLENGTH', "SQLGETLENGTH" ], [ 'SQL_API_SQLGETPOSITION', "SQLGETPOSITION" ], [ 'SQL_API_SQLGETSQLCA', "SQLGETSQLCA" ], [ 'SQL_API_SQLGETSTMTATTR', "SQLGETSTMTATTR" ], [ 'SQL_API_SQLGETSTMTOPTION', "SQLGETSTMTOPTION" ], [ 'SQL_API_SQLGETSUBSTRING', "SQLGETSUBSTRING" ], [ 'SQL_API_SQLGETTYPEINFO', "SQLGETTYPEINFO" ], [ 'SQL_API_SQLMORERESULTS', "SQLMORERESULTS" ], [ 'SQL_API_SQLNATIVESQL', "SQLNATIVESQL" ], [ 'SQL_API_SQLNUMPARAMS', "SQLNUMPARAMS" ], [ 'SQL_API_SQLNUMRESULTCOLS', "SQLNUMRESULTCOLS" ], [ 'SQL_API_SQLPARAMDATA', "SQLPARAMDATA" ], [ 'SQL_API_SQLPARAMOPTIONS', "SQLPARAMOPTIONS" ], [ 'SQL_API_SQLPREPARE', "SQLPREPARE" ], [ 'SQL_API_SQLPRIMARYKEYS', "SQLPRIMARYKEYS" ], [ 'SQL_API_SQLPROCEDURECOLUMNS', "SQLPROCEDURECOLUMNS" ], [ 'SQL_API_SQLPROCEDURES', "SQLPROCEDURES" ], [ 'SQL_API_SQLPUTDATA', "SQLPUTDATA" ], [ 'SQL_API_SQLROWCOUNT', "SQLROWCOUNT" ], [ 'SQL_API_SQLSETCOLATTRIBUTES', "SQLSETCOLATTRIBUTES" ], [ 'SQL_API_SQLSETCONNECTATTR', "SQLSETCONNECTATTR" ], [ 'SQL_API_SQLSETCONNECTION', "SQLSETCONNECTION" ], [ 'SQL_API_SQLSETCONNECTOPTION', "SQLSETCONNECTOPTION" ], [ 'SQL_API_SQLSETCURSORNAME', "SQLSETCURSORNAME" ], [ 'SQL_API_SQLSETDESCFIELD', "SQLSETDESCFIELD" ], [ 'SQL_API_SQLSETDESCREC', "SQLSETDESCREC" ], [ 'SQL_API_SQLSETENVATTR', "SQLSETENVATTR" ], [ 'SQL_API_SQLSETPARAM', "SQLSETPARAM" ], [ 'SQL_API_SQLSETPOS', "SQLSETPOS" ], [ 'SQL_API_SQLSETSCROLLOPTIONS', "SQLSETSCROLLOPTIONS" ], [ 'SQL_API_SQLSETSTMTATTR', "SQLSETSTMTATTR" ], [ 'SQL_API_SQLSETSTMTOPTION', "SQLSETSTMTOPTION" ], [ 'SQL_API_SQLSPECIALCOLUMNS', "SQLSPECIALCOLUMNS" ], [ 'SQL_API_SQLSTATISTICS', "SQLSTATISTICS" ], [ 'SQL_API_SQLTABLEPRIVILEGES', "SQLTABLEPRIVILEGES" ], [ 'SQL_API_SQLTABLES', "SQLTABLES" ], [ 'SQL_API_SQLTRANSACT', "SQLTRANSACT" ], ); my $dbh = DBI->connect( 'dbi:ODBC:'. DATA ); my $count = 1; foreach my $tuple (@functions) { my $flag = $dbh->func($count, 'GetFunctions'); if($flag) { print $tuple->[1]," is supported\n"; } else { print $tuple->[1]," is not supported\n"; } $count++; } $dbh->disconnect();

In reply to DBD::ODBC supported functions by simon.proctor

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.