This is Sybtcl -- a dynamicly loadable TCL extension, which provides

your interpreter with connectivity to a Sybase server. Althghough it was
written to work with Sybase's own client libraries (not available for
FreeBSD), this port patches it enough to make it work with FreeTDS.

WWW: http://sybtcl.sourceforge.net/
This commit is contained in:
Mikhail Teterin 2004-03-30 00:02:11 +00:00
parent 085605d0ec
commit a623e2d6cf
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=105655
10 changed files with 308 additions and 0 deletions

View file

@ -260,6 +260,7 @@
SUBDIR += sqlrelay SUBDIR += sqlrelay
SUBDIR += sqsh SUBDIR += sqsh
SUBDIR += sybase-ocsd SUBDIR += sybase-ocsd
SUBDIR += sybtcl
SUBDIR += tcl-Mysql SUBDIR += tcl-Mysql
SUBDIR += tdb SUBDIR += tdb
SUBDIR += tinycdb SUBDIR += tinycdb

35
databases/sybtcl/Makefile Normal file
View file

@ -0,0 +1,35 @@
# New ports collection makefile for: sybtcl
# Date created: Jul 30, 2002
# Whom: mi
#
# $FreeBSD$
#
PORTNAME= sybtcl
PORTVERSION= 3.0rc2
CATEGORIES= databases devel
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
MAINTAINER= mi@aldan.algebra.com
COMMENT= TCL extension to connect to Sybase servers
LIB_DEPENDS= tcl${TCL_DVER}:${PORTSDIR}/lang/tcl${TCL_DVER} \
sybdb:${PORTSDIR}/databases/freetds
TCL_VER?= 8.4
TCL_DVER= ${TCL_VER:S/.//}
MAKEFILE= ${FILESDIR}/Makefile.bsd
MAKE_ARGS+= TCL_VER=${TCL_VER}
MANN= ${PORTNAME}.n
post-install:
#######
# This port installs two of the vendor-supplied sample programs,
# which have general-purpose utility. If you'd like to browse
# through other examples, do ``make patch'' and look inside the
# ${WRKSRC}/samples
#######
.include <bsd.port.mk>

View file

@ -0,0 +1 @@
MD5 (sybtcl-3.0rc2.tar.gz) = 1b357dd7b7081f8083b87849e8c9f4e3

View file

@ -0,0 +1,45 @@
# $FreeBSD$
.PATH: ${.CURDIR}/generic
SRCS= sybtcl.c
LOCALBASE?= /usr/local
PREFIX?= ${LOCALBASE}
TCL_VER?= 8.4
TCL_DVER= ${TCL_VER:S/.//}
CFLAGS+= -I${LOCALBASE}/include -I${LOCALBASE}/include/tcl${TCL_VER}
LDADD= -L${LOCALBASE}/lib -lsybdb # -ltcl${TCL_DVER}
SHLIB_NAME= libSybtcl.so.3
LIBDIR= ${PREFIX}/lib
PKGDIR= ${LIBDIR}/Sybtcl
SCRIPTS= sp_who wisqlite
all: ${SHLIB_NAME} pkgIndex.tcl ${SCRIPTS}
pkgIndex.tcl: pkgIndex.tcl.in
echo 'package ifneeded Sybtcl 3.0 "load $$dir/../${SHLIB_NAME}; \
set auto_index(getSignOn) \"source $$dir/sign_on.tcl\""' \
> pkgIndex.tcl
.for s in ${SCRIPTS}
$s: ${.CURDIR}/samples/$s
sed -e 's,#!/usr/local/bin/wishx,#!${LOCALBASE}/bin/wish${TCL_VER},'\
-e 's,#!/usr/local/bin/wish8.0,#!${LOCALBASE}/bin/wish${TCL_VER},'\
< ${.CURDIR}/samples/$s > $s
.endfor
sp_who wisqlite: ${.CURDIR}
${PKGDIR}:
mkdir -p ${PKGDIR}
beforeinstall: ${PKGDIR}
${BSD_INSTALL_DATA} pkgIndex.tcl ${.CURDIR}/samples/sign_on.tcl \
${PKGDIR}
${BSD_INSTALL_SCRIPT} ${SCRIPTS} ${PREFIX}/bin/
${BSD_INSTALL_MAN} ${.CURDIR}/doc/sybtcl.man \
${LOCALBASE}/man/mann/sybtcl.n
.include <bsd.lib.mk>

View file

@ -0,0 +1,105 @@
--- generic/sybtcl.c Wed Aug 30 20:24:18 2000
+++ generic/sybtcl.c Mon Mar 29 16:18:01 2004
@@ -279,4 +279,12 @@
#endif
+#ifndef CS_INTERNAL
+#define CS_INTERNAL /* Not defined by FreeTDS */
+#endif
+
+#ifndef TDS_DEF_CHARSET
+#define TDS_DEF_CHARSET NULL /* Not defined by Sybase */
+#endif
+
typedef struct SybTclProcs { /* struct for handle entries */
int in_use; /* if this entry is opened */
@@ -393,5 +401,5 @@
#else
-extern void * malloc();
+#include <stdlib.h>
#endif
@@ -461,7 +469,9 @@
Tcl_Interp *interp));
+#ifdef POLLED_EVENTS
static int dbEventProc _ANSI_ARGS_((Tcl_Event *evPtr, int flags));
static void dbSetupProc _ANSI_ARGS_((ClientData cd_hand, int flags));
static void dbCheckProc _ANSI_ARGS_((ClientData cd_hand, int flags));
+#endif
void Sybtcl_Kill _ANSI_ARGS_((ClientData clientData));
static int CS_INTERNAL syb_tcl_err_handler _ANSI_ARGS_((
@@ -496,4 +506,5 @@
+#ifdef POLLED_EVENTS /* { */
/*
*----------------------------------------------------------------------
@@ -566,5 +577,5 @@
}
}
-
+#endif /* POLLED_EVENTS } */
@@ -1669,6 +1680,8 @@
-#ifdef DBVERSION_100
+#ifdef SYBBOUNDARY
case SYBBOUNDARY:
+#endif
+#ifdef SYBSENSITIVITY
case SYBSENSITIVITY:
#endif
@@ -2556,5 +2569,7 @@
DBSETLUSER(login,Tcl_GetStringFromObj(objv[1],NULL));
- DBSETLPWD(login, Tcl_GetStringFromObj(objv[2],NULL));
+ server_str = Tcl_GetStringFromObj(objv[2],&len);
+ if (len > 0)
+ DBSETLPWD(login, server_str);
/* check for server optional parameter */
@@ -2594,8 +2609,8 @@
DBSETLCHARSET(login, charset_str);
} else {
- DBSETLCHARSET(login, NULL);
+ DBSETLCHARSET(login, TDS_DEF_CHARSET);
}
} else {
- DBSETLCHARSET(login, NULL);
+ DBSETLCHARSET(login, TDS_DEF_CHARSET);
}
@@ -2607,5 +2622,6 @@
if (SybProcs[hand].dbproc == NULL) {
Sybtcl_AppendObjResult (interp, CMD_STR,
- ": sybconnect failed in dbopen", (char *) NULL);
+ ": sybconnect to ", server_str ? server_str : "(DEFAULT)",
+ " failed in dbopen", (char *) NULL);
return TCL_ERROR;
}
@@ -2909,5 +2925,5 @@
if (SybProcs[hand].last_text != SybOptions[i].maxtext) {
SybProcs[hand].last_text = SybOptions[i].maxtext;
- sprintf(conv_buf,"%d",SybOptions[i].maxtext);
+ sprintf(conv_buf,"%ld",SybOptions[i].maxtext);
dbsetopt(SybProcs[hand].dbproc, DBTEXTSIZE, conv_buf, -1);
dbsqlexec(SybProcs[hand].dbproc); /* execute dbsetopt() */
@@ -4190,5 +4206,5 @@
int obj_parm;
int isvar = 0;
- Tcl_Channel fd;
+ Tcl_Channel fd = NULL;
#ifndef MAC_TCL
struct stat stat_buf;
@@ -4305,5 +4321,6 @@
txtptr = dbtxptr(SybProcs[hand].dbproc,col);
if (txtptr == NULL) {
- Tcl_Close (NULL,fd);
+ if (fd != NULL)
+ Tcl_Close (NULL,fd);
Sybtcl_AppendObjResult (interp, CMD_STR,
": dbtxptr failed ", (char *) NULL);

View file

@ -0,0 +1,78 @@
The supplied man-page provides comprehensive documentation, but contains
an amazing amount of spelling typos. I ran it through ispell, but, quite
possibly, some remain. Please, let me know if you find something, I missed.
-mi
--- doc/sybtcl.man Thu Dec 28 18:25:29 2000
+++ doc/sybtcl.man Mon Mar 29 17:28:33 2004
@@ -9,3 +9,3 @@
Sybase Open Client (a.k.a. DB-Library) library functions.
-Programmers using Sybtcl should be familar with basic concepts of
+Programmers using Sybtcl should be familiar with basic concepts of
DB-Library programming.
@@ -23,5 +23,5 @@
value is passed to the server to display during a process list.
-If \fIifile\fR is specified, that file is used to resovle server addresses;
+If \fIifile\fR is specified, that file is used to resolve server addresses;
if not specified, the normal $SYBASE/interfaces file is used.
-If \fIcharset\fR is specified, the charset should reference a vaild
+If \fIcharset\fR is specified, the charset should reference a valid
character set available on your Sybase installation.
@@ -31,4 +31,4 @@
\fILogin-name\fR and \fIpassword\fR are required parameters. All other
-parameters are optional postitional parameters. For example, to specify
-the \fIifile\fR paramater, \fIserver\fR and \fIappname\fR must
+parameters are optional positional parameters. For example, to specify
+the \fIifile\fR parameter, \fIserver\fR and \fIappname\fR must
also be specified. Optional parameters may be a null string, in which
@@ -141,3 +141,3 @@
.I line
-The line numer of the procedure generating the message, if any.
+The line number of the procedure generating the message, if any.
.RE
@@ -177,3 +177,3 @@
called to determine if result rows were generated. If \fB-async\fR is omitted,
-then sybsql will wait until the server has responed.
+then sybsql will wait until the server has responded.
Sybsql will return "REG_ROW" if
@@ -415,3 +415,3 @@
be opened or a failure in internal DB-Library routines. Common failures
-are specifing \fB-nolog\fR when the database does not support nolog;
+are specifying \fB-nolog\fR when the database does not support nolog;
unable to access a valid text pointer
@@ -516,3 +516,3 @@
The dateformat string can contain substitution values or literals.
-Substitions are made from the list below; other literals are copied
+Substitutions are made from the list below; other literals are copied
verbatim. The default value is null, which will format dates a default format.
@@ -603,3 +603,3 @@
causes the polling loop to execute more frequently, which may cause
-higer CPU usage.
+higher CPU usage.
.sp
@@ -618,3 +618,3 @@
indicates the handle of the last sybtcl command. Handle is set on every
-sybtcl command (execpt where an invalid handle is used.)
+sybtcl command (except where an invalid handle is used.)
.sp
@@ -706,3 +706,3 @@
Since each sybtcl command
-may invoke several DB-Lib routines, there is a possiblity that
+may invoke several DB-Lib routines, there is a possibility that
several messages may be received from the server. Sybtcl will
@@ -714,3 +714,3 @@
the message text associated with msgno. Since each sybtcl command
-may invoke several DB-Lib routines, there is a possiblity that
+may invoke several DB-Lib routines, there is a possibility that
several messages may be received from the server. Sybtcl will
@@ -718,3 +718,3 @@
separating individual messages by newlines.
-Output from Transact-SQL PRINT statments are collected in msgtext.
+Output from Transact-SQL PRINT statements are collected in msgtext.
.TP
@@ -766,3 +766,3 @@
values are: "system10" if linked with Sybase System 10 DB-Libs or higher,
-"ctcompt" if compiled with the CT-Lib compatiblity library.
+"ctcompt" if compiled with the CT-Lib compatibility library.
.sp

View file

@ -0,0 +1,16 @@
--- samples/sign_on.tcl Fri Jun 2 02:35:54 2000
+++ samples/sign_on.tcl Mon Mar 29 18:16:50 2004
@@ -19,5 +19,5 @@
#upvar 1 $p password
#upvar 1 $s server
- global env mainwindow
+ global env mainwindow tcl_platform
# get valid servers from interfaces file
@@ -91,5 +91,5 @@
frame $mainwindow.s.p
entry $mainwindow.s.p.pw -relief sunken -width 10 \
- -font -*-symbol-*-r-*--20-*-*-*-*-*-*-*
+ -show * -exportselection false
label $mainwindow.s.p.p -text " Password" -anchor e

View file

@ -0,0 +1,15 @@
--- samples/sp_who Fri Jun 2 02:35:54 2000
+++ samples/sp_who Mon Mar 29 18:10:59 2004
@@ -22,12 +22,4 @@
package require Sybtcl
-if {[file isfile sign_on.tcl]} {
- source sign_on.tcl
-} elseif {[file isfile [file join [file dirname [info script]] sign_on.tcl]]} {
- source [file join [file dirname [info script]] sign_on.tcl]
-} elseif {[file isfile [file join [file dirname [info nameofexecutable]] sign_on.tcl]]} {
- source [file join [file dirname [info nameofexecutable]] sign_on.tcl]
-}
-
global server interval now intervalid env secorsecs user password sybhandle
global opened WhoIsThere order_by_orders order_by order_by_stmnt order_by_text

View file

@ -0,0 +1,6 @@
This is Sybtcl -- a dynamicly loadable TCL extension, which provides
your interpreter with connectivity to a Sybase server. Althghough it was
written to work with Sybase's own client libraries (not available for
FreeBSD), this port patches it enough to make it work with FreeTDS.
WWW: http://sybtcl.sourceforge.net/

View file

@ -0,0 +1,6 @@
bin/sp_who
bin/wisqlite
lib/libSybtcl.so.3.0
lib/Sybtcl/pkgIndex.tcl
lib/Sybtcl/sign_on.tcl
@dirrm lib/Sybtcl