Skip to Content.
Sympa Menu

freetds - Re: [freetds] defncopy query "order by" different for ASE

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: John Kendall <john AT capps.com>
  • To: FreeTDS Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] defncopy query "order by" different for ASE
  • Date: Wed, 24 Aug 2016 01:38:25 +0000

I figured it out. Getting the right headers in the right order slowed me
down.
Here is my patch for consideration.
Cheers,
John


*** src/apps/defncopy.c 2016-06-19 02:00:01.000000000 -0700
--- src/apps/defncopy.c-patch 2016-08-23 18:17:24.897056456 -0700
*************** int getopt(int argc, const char *argv[],
*** 80,86 ****
--- 80,88 ----
#include <locale.h>
#endif

+ #include <freetds/tds.h>
#include <sybfront.h>
+ #include <dblib.h>
#include <sybdb.h>
#ifndef MicrosoftsDbLib
#include "replacements.h"
*************** 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);
--- 222,235 ----
" 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,
! (dbproc->tds_socket->conn->tds_version == 0x500)
? "c.colid2, ":"");

/* Send the query to the server (we could use dbsqlexec(),
instead) */
erc = dbsqlsend(dbproc);




> On Aug 22, 2016, at 12:55 AM, John Kendall <john AT capps.com> wrote:
>
>
>> On Aug 18, 2016, at 8:16 PM, James K. Lowden <james.k.lowden AT icloud.com>
>> wrote:
>>
>> On Wed, 17 Aug 2016 23:55:43 +0000
>> John Kendall <john AT capps.com> wrote:
>>
>>> It should be a quick patch, but I'm not sure the best way to
>>> determine if the server is ASE and MS SQL.
>>
>> Test for TDS version 5.
>
> Excellent idea, thank you!
>
> However after trying for a few hours, I'm going to have to ask how to get
> the tds_version.
> I assume I get it from dbproc, but I never seem to have the right headers
> (or something).
>
> Thanks, anyone.
>
> John
>
>
>
>> --jkl
>>
>> _______________________________________________
>> FreeTDS mailing list
>> FreeTDS AT lists.ibiblio.org
>> http://lists.ibiblio.org/mailman/listinfo/freetds
>





Archive powered by MHonArc 2.6.24.

Top of Page