Skip to Content.
Sympa Menu

freetds - [freetds] sp_tables (ODBC)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Patrick Poncet" <patrickp AT pintys.com>
  • To: "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] sp_tables (ODBC)
  • Date: Wed, 5 Nov 2003 15:13:11 -0500

Hello all,


Far from being expert in ODBC, I managed to use unixODBC in conjunction
with FreeTDS on RedHat 7.3. tsql works great, isql works great and I
can tap into my data sources.


Now the purpose of all this is to get Lotus Domino running on that box
to tap into MS SQL server data sources.

Up to freetds-0.61, Domino was crashing when trying to access the
datasource for some reason. In 0.61 the Domino ODBC test could not
report on freetds-odbc drivers details (returning "Operation not
supported"), now the latest nightly build does work and reports all
required Domino driver details. Now Domino does not crash anymore!!!
Thanks for making that work! Am I right to say that freetds-unixodbc
wasn;t completely unixODBC compliant???


In Lotus Notes Designer, you can set up ODBC data sources and get it to
point to a unixODBC datasource on the system the Domino Server runs on.
Once you have done that you can click on a button to browser metatadata
(Tables of a database) It works great with unixODBC / MyODBC (MySQL
ODBC driver) - I can see and pick tables from a database. But when I
use a FreeTDS unixODBC datasource it does not work (Domino says can't
find any Metadata)

After a bit of investigation and analysing the loigs I notices that the
following strored procedure was called by my "Browse Metedata" button
click:

sp_tables @table_type='TABLE'

Ran this from isql and no row came back

I went in the SQL query analyser on the MS SQL server I'm trying to
reach throuch unixODBX and ran it: no row came back.

Looked at the MS Sql books online to fine out that the correct syntax
shoould be:

sp_tables @table_type="'TABLE'"

Rand that from isql and all tables come back.


So my question is:


Is there a way to make freetds-unixodbc run that sp_table query by
enclosing the @table_type value in double quotes. Or is it domino that
should know it talks to a MSSQL server and should add these
double-quotes before calling unixODBC API? Or is it unixODBC API which
should add those double quotes???


Any thoughts anyone?

Thanks for your help!

Patrick




> -----Original Message-----
> From: freetds-bounces AT lists.ibiblio.org
> [mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of
> Christos Zoulas
> Sent: November 5, 2003 2:07 PM
> To: freetds AT lists.ibiblio.org
> Subject: [freetds] small patches
>
>
> Hello,
>
> 1. In c++ you cannot use cs_config() and typedef struct
> cs_config 2. constify server name 3. GO == go = Go etc. 4.
> Don't use readline when stdin is not a tty. Now we can use
> scripts from
> stdin.
>
> christos
>
> PS: BCP writes don't work?
>
> Index: include/cspublic.h
> ===================================================================
> RCS file: /src/twosigma/cvsroot/pub/devel/freetds/include/cspublic.h,v
> retrieving revision 1.1.1.5
> retrieving revision 1.8
> diff -u -u -1 -r1.1.1.5 -r1.8
> --- include/cspublic.h 10 Oct 2003 21:32:56 -0000 1.1.1.5
> +++ include/cspublic.h 10 Oct 2003 21:43:35 -0000 1.8
> @@ -75,3 +75,3 @@
>
> -typedef struct cs_config
> +typedef struct _cs_config
> {
> @@ -177,3 +177,3 @@
>
> -typedef struct cs_locale
> +typedef struct _cs_locale
> {
> @@ -197,6 +197,5 @@
>
> -
> #define CS_IODATA (CS_INT)1600
>
> -typedef struct cs_iodesc
> +typedef struct _cs_iodesc
> {
> @@ -221,3 +220,3 @@
>
> -typedef struct cs_command
> +typedef struct _cs_command
> {
> @@ -251,3 +250,3 @@
>
> -typedef struct cs_datafmt
> +typedef struct _cs_datafmt
> {
> @@ -273,3 +272,3 @@
>
> -typedef struct cs_daterec
> +typedef struct _cs_daterec
> {
> @@ -321,3 +320,3 @@
>
> -typedef struct cs_blkdesc
> +typedef struct _cs_blkdesc
> {
> Index: include/ctpublic.h
> ===================================================================
> RCS file: /src/twosigma/cvsroot/pub/devel/freetds/include/ctpublic.h,v
> retrieving revision 1.1.1.4
> retrieving revision 1.8
> diff -u -u -1 -r1.1.1.4 -r1.8
> --- include/ctpublic.h 10 Oct 2003 21:32:56 -0000 1.1.1.4
> +++ include/ctpublic.h 10 Oct 2003 21:51:30 -0000 1.8
> @@ -39,3 +39,3 @@
> CS_RETCODE ct_con_props(CS_CONNECTION * con, CS_INT action,
> CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT *
> out_len); -CS_RETCODE ct_connect(CS_CONNECTION * con, CS_CHAR
> * servername, CS_INT snamelen);
> +CS_RETCODE ct_connect(CS_CONNECTION * con, const CS_CHAR *
> servername,
> +CS_INT snamelen);
> CS_RETCODE ct_cmd_alloc(CS_CONNECTION * con, CS_COMMAND ** cmd);
> Index: src/apps/tsql.c
> ===================================================================
> RCS file: /src/twosigma/cvsroot/pub/devel/freetds/src/apps/tsql.c,v
> retrieving revision 1.1.1.3
> retrieving revision 1.2
> diff -u -u -1 -r1.1.1.3 -r1.2
> --- src/apps/tsql.c 10 Oct 2003 21:32:56 -0000 1.1.1.3
> +++ src/apps/tsql.c 10 Oct 2003 21:52:13 -0000 1.2
> @@ -79,2 +79,4 @@
>
> +static int istty = 0;
> +
> int do_query(TDSSOCKET * tds, char *buf, int opt_flags);
> @@ -86,8 +88,7 @@
>
> -#ifndef HAVE_READLINE
> -char *readline(char *prompt);
> -void add_history(const char *s);
> +char *my_readline(char *prompt);
> +void my_add_history(const char *s);
>
> char *
> -readline(char *prompt)
> +my_readline(char *prompt)
> {
> @@ -111,5 +112,9 @@
> void
> -add_history(const char *s)
> +my_add_history(const char *s)
> {
> }
> +
> +#ifndef HAVE_READLINE
> +#define readline my_readline
> +#define add_history my_add_history
> #endif
> @@ -229,2 +234,3 @@
>
> + *opt_flags = 0;
> /* make sure we have enough elements */
> @@ -442,3 +448,6 @@
> *n = '\0';
> - add_history(s);
> + if (istty)
> + add_history(s);
> + else
> + my_add_history(s);
> (*line)++;
> @@ -465,2 +474,4 @@
>
> + istty = isatty(0);
> +
> context = tds_alloc_context();
> @@ -496,3 +507,6 @@
> free(s);
> - s = readline(prompt);
> + if (istty)
> + s = readline(prompt);
> + else
> + s = my_readline(prompt);
> if (s != NULL) {
> @@ -506,6 +520,6 @@
>
> - if (!s || !strcmp(cmd, "exit") || !strcmp(cmd,
> "quit") || !strcmp(cmd, "bye")) {
> + if (!s || !strcasecmp(cmd, "exit") ||
> !strcasecmp(cmd, "quit") ||
> +!strcasecmp(cmd, "bye")) {
> break;
> }
> - if (!strcmp(cmd, "version")) {
> + if (!strcasecmp(cmd, "version")) {
> tds_version(tds, mybuf);
> @@ -516,3 +530,3 @@
> }
> - if (!strncmp(cmd, "go", 2)) {
> + if (!strncasecmp(cmd, "go", 2)) {
> line = 0;
> @@ -521,6 +535,6 @@
> mybuf[0] = '\0';
> - } else if (!strcmp(cmd, "reset")) {
> + } else if (!strcasecmp(cmd, "reset")) {
> line = 0;
> mybuf[0] = '\0';
> - } else if (!strcmp(cmd, ":r")) {
> + } else if (!strcasecmp(cmd, ":r")) {
> slurp_input_file(strtok(NULL, " \t"),
> &mybuf, &bufsz, &line); @@ -531,3 +545,6 @@
> }
> - add_history(s);
> + if (istty)
> + add_history(s);
> + else
> + my_add_history(s);
> strcat(mybuf, s);
> Index: src/ctlib/ct.c
> ===================================================================
> RCS file: /src/twosigma/cvsroot/pub/devel/freetds/src/ctlib/ct.c,v
> retrieving revision 1.1.1.5
> retrieving revision 1.6
> diff -u -u -1 -r1.1.1.5 -r1.6
> --- src/ctlib/ct.c 10 Oct 2003 21:32:56 -0000 1.1.1.5
> +++ src/ctlib/ct.c 10 Oct 2003 21:43:36 -0000 1.6
> @@ -470,3 +470,3 @@
> CS_RETCODE
> -ct_connect(CS_CONNECTION * con, CS_CHAR * servername, CS_INT
> snamelen)
> +ct_connect(CS_CONNECTION * con, const CS_CHAR * servername, CS_INT
> +snamelen)
> {
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/free> tds
>





Archive powered by MHonArc 2.6.24.

Top of Page