openbsd-ports/security/sqlat/patches/patch-sqlquery_c
margarida 9f54a54744 Make sqlat compile with the new FreeTDS API.
Patches submitted upstream.
2003-06-03 01:26:50 +00:00

32 lines
1.0 KiB
Plaintext

$OpenBSD: patch-sqlquery_c,v 1.3 2003/06/03 01:26:50 margarida Exp $
--- sqlquery.c.orig Mon Dec 3 18:08:30 2001
+++ sqlquery.c Tue Jun 3 02:10:04 2003
@@ -22,7 +22,6 @@
#include "util.h"
#include "constants.h"
#include "sqldumplogins.h"
-#include <getopt.h>
void usage(char **argv) {
@@ -63,11 +62,18 @@ TDSLOGIN *set_target_defaults(TDSLOGIN *
void doInterpret(TDSLOGIN *pLogin, char *pQuery) {
TDSSOCKET *pTds = NULL;
+ TDSCONTEXT *context = NULL;
+ TDSCONNECTINFO *connect_info;
char *pCmd;
pCmd = (char *) malloc ( 256 );
/* connect to the SQL server */
- if( (pTds = tds_connect(pLogin)) !=NULL ) {
+ context = tds_alloc_context();
+ pTds = tds_alloc_socket(context, 512);
+ tds_set_parent(pTds, NULL);
+ connect_info = tds_read_config_info(NULL, pLogin, context->locale);
+
+ if (!connect_info || tds_connect(pTds, connect_info) != TDS_FAIL) {
fprintf(stderr, "SQLExec %s by <patrik.karlsson@ixsecurity.com>\n",
SQLTOOLS_VERSION);
fprintf(stderr, "----------------------------------------------------" \