[prev in list] [next in list] [prev in thread] [next in thread]
List: freetds
Subject: Re: [freetds] defncopy query "order by" different for ASE
From: Frediano Ziglio <freddy77 () gmail ! com>
Date: 2016-08-25 11:34:45
Message-ID: CAHt6W4dw8_eLPEURcG2AEMidgxatic8xJbzR4CF74NAiNPzm9A () mail ! gmail ! com
[Download RAW message or body]
2016-08-24 19:20 GMT+01:00 John Kendall <john@capps.com>:
>
> > On Aug 24, 2016, at 10:50 AM, James K. Lowden <james.k.lowden@icloud.com> wrote:
> >
> > On Wed, 24 Aug 2016 06:25:47 +0000
> > John Kendall <john@capps.com> wrote:
> >
> > >
> > > > On Aug 23, 2016, at 10:41 PM, James K. Lowden
> > > > <james.k.lowden@icloud.com> wrote:
> > > >
> > > > On Wed, 24 Aug 2016 01:38:25 +0000
> > > > John Kendall <john@capps.com> wrote:
> > > >
> > > > > I figured it out. Getting the right headers in the right order
> > > > > slowed me down. Here is my patch for consideration.
> > > >
> > > > John, I think all you need is a call to the public function
> > > >
> > > > const char *dbversion(void);
> > > >
> > >
> > > It looks like dbversion() returns the FreeTDS version number,
> > > currently "freetds v1.00.13." The patch is working for me, but if
> > > there is a better way... John
> >
> > Sorry, late night. The macro you want is DBTDS(). It returns an
> > integer for which symbolic constants are defined in sybdb.h.
> >
> > --jkl
>
> That's the ticket! Many thanks.
> New, simpler patch for consideration:
>
> *** defncopy.c 2016-06-19 02:00:01.000000000 -0700
> --- defncopy.c-patch 2016-08-24 11:13:30.883345277 -0700
> *************** main(int argc, char *argv[])
> *** 220,232 ****
> " and o.name = '%s'"
> " and o.uid = user_id('%s')"
> " and o.type not in ('U', 'S')" /* no user or system tables */
> ! " order by c.number, c.colid"
> ;
> static const char query_table[] = " execute sp_help '%s.%s' ";
>
> parse_argument(argv[i], &procedure);
>
> ! erc = dbfcmd(dbproc, query, procedure.name, procedure.owner);
>
> /* Send the query to the server (we could use dbsqlexec(), instead) */
> erc = dbsqlsend(dbproc);
> --- 220,233 ----
> " and o.name = '%s'"
> " and o.uid = user_id('%s')"
> " and o.type not in ('U', 'S')" /* no user or system tables */
> ! " order by c.number, %s c.colid"
> ;
> static const char query_table[] = " execute sp_help '%s.%s' ";
>
> parse_argument(argv[i], &procedure);
>
> ! erc = dbfcmd(dbproc, query, procedure.name, procedure.owner,
> ! (DBTDS(dbproc) == DBTDS_5_0) ? "c.colid2, ":"");
>
> /* Send the query to the server (we could use dbsqlexec(), instead) */
> erc = dbsqlsend(dbproc);
>
Hi,
converted to a patch and applied. Both master and 1.0.
Thanks,
Frediano
_______________________________________________
FreeTDS mailing list
FreeTDS@lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic