freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Libin Qi <libinsub AT yahoo.com>
- To: freetds AT lists.ibiblio.org
- Subject: [freetds] Bug in bcp.c
- Date: Fri, 20 Aug 2010 14:33:28 -0700 (PDT)
0.82 release.
When I call bcp_sendrow()
If I pass a non-numeric string e.g. "xx" to an integer field in database, the
conversion would fail, but instead of returning a -1, the library core-dumped.
Line 3485 in bcp.c, the assertion failed.
After modifying code like this, it started working:
3483: bindcol->bcp_column_data->datalen = converted_data_size;
3484: if(bindcol->bcp_column_data->datalen < 0)
3485: return (FAIL) ;
3486: bindcol->bcp_column_data->is_null = 0;
3487: assert(converted_data_size > 0);
--- On Fri, 8/20/10, freetds-request AT lists.ibiblio.org
<freetds-request AT lists.ibiblio.org> wrote:
From: freetds-request AT lists.ibiblio.org <freetds-request AT lists.ibiblio.org>
Subject: FreeTDS Digest, Vol 91, Issue 13
To: freetds AT lists.ibiblio.org
Date: Friday, August 20, 2010, 5:22 PM
Send FreeTDS mailing list submissions to
freetds AT lists.ibiblio.org
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.ibiblio.org/mailman/listinfo/freetds
or, via email, send a message with subject or body 'help' to
freetds-request AT lists.ibiblio.org
You can reach the person managing the list at
freetds-owner AT lists.ibiblio.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of FreeTDS digest..."
Today's Topics:
1. Re: HOWTO compille FreeTDS under Windows (Luis de Vasconcelos)
2. Re: HOWTO compille FreeTDS under Windows (David Dick)
3. Request for change in dblib.c in dbsetlversion (LacaK)
4. Re: HOWTO compille FreeTDS under Windows (LacaK)
5. BUG?: incorrect struct tds_microsoft_dbdaterec (LacaK)
----------------------------------------------------------------------
Message: 1
Date: Thu, 19 Aug 2010 20:08:41 +0200
From: "Luis de Vasconcelos" <nomail AT icon.co.za>
To: "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
Subject: Re: [freetds] HOWTO compille FreeTDS under Windows
Message-ID: <000a01cb3fc9$8e8c0af0$aba420d0$ AT co.za>
Content-Type: text/plain; charset="us-ascii"
> Hm,
> so nobody is ATM using (compiling) FreeTDS under Windows ?
Here's one way to compile it under Windows:
http://docs.moodle.org/en/Development:Compiling_FreeTDS_under_Windows
------------------------------
Message: 2
Date: Fri, 20 Aug 2010 06:52:26 +1000
From: David Dick <ddick AT cpan.org>
To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
Subject: Re: [freetds] HOWTO compille FreeTDS under Windows
Message-ID: <4C6D998A.802 AT cpan.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
On 16/08/10 23:05, LacaK wrote:
> Hi,
> sometime ago I posted in this list question with subject "FreeTDS on
> Windows", but with no reply ATM.
> So I am trying again.
> My basic question is how to compile (which compiler) under windows ?
I used Visual Studio 6 to compile what i needed (libct for the perl
DBD::Sybase library. I needed to apply some very simple patches to
0.82, which were applied by freddy77, but my compile step was
msdev "$freetds_src_path\\win32\\msvc6\\FreeTDS.dsw" /MAKE 'libct -
Win32 Release' /OUT
> I need dblib.dll (plus may be some others dlls) as a final product.
I imagine dblib requires a very similar process.
For the record, freetds on win32 has been very stable for me and happily
passes 10K application tests including some for stress testing the db
connection.
------------------------------
Message: 3
Date: Fri, 20 Aug 2010 07:14:41 +0200
From: LacaK <lacak AT zoznam.sk>
To: freetds AT lists.ibiblio.org
Subject: [freetds] Request for change in dblib.c in dbsetlversion
Message-ID: <4C6E0F41.9080001 AT zoznam.sk>
Content-Type: text/plain; charset=X-MAC-CE; format=flowed
Hi *,
I am playng with "db-lib" as a DB API for my FreePascal project.
I want use dblib.dll to connect to MS SQL Server 7+
So I want to set appropriate TDS protocol version using call to
"dbsetlversion"
(Yes, I know that I can set TDS protocol version by env.var. TDSVER or
freetds.conf, but I am looking for way how to set it in program).
So I use dbsetlversion with DBVER60 (becase it accepts only DBVER42
(which is too old and does not support new features) and DBVER60)
DBVER60 is defined like DBVERSION_70 (and DBVERSION_70 is used when
TDS70 is defined), but in code is set:
login->tds_login->tds_version=0x600
In this case in log file appears:
...
net.c:225:Connecting to 10.0.0.2 port 1433 (TDS version 6.0)
net.c:281:tds_open_socket: connect(2) returned "WSAEWOULDBLOCK: Resource
temporarily unavailable."
net.c:321:tds_open_socket() succeeded
util.c:156:Changed query state from DEAD to IDLE
*login.c:575:Unknown protocol version!*
*login.c:462:login packet rejected*
util.c:156:Changed query state from IDLE to DEAD
util.c:331:tdserror(02290500, 02290840, 20002, 0)
dblib.c:7861:dbperror(02290610, 20002, 0)
dblib.c:7913:20002: "Adaptive Server connection failed"
...
So IMHO TDS version 6.0 is bad (http://www.freetds.org/tds.html) and
should be changed to 7.0 :
(Sybase does not defines dbsetlversion, so only Microsoft is in game
http://www.freetds.org/userguide/dblib.api.summary.htm)
*login->tds_login->tds_version=0x700*
And/or if possible add also other cases:
case DBVERSION_71:
login->tds_login->tds_version = 0x710;
return SUCCEED;
...
TIA
-Laco.
------------------------------
Message: 4
Date: Fri, 20 Aug 2010 07:59:27 +0200
From: LacaK <lacak AT zoznam.sk>
To: luisdv AT icon.co.za, FreeTDS Development Group
<freetds AT lists.ibiblio.org>
Subject: Re: [freetds] HOWTO compille FreeTDS under Windows
Message-ID: <4C6E19BF.1020807 AT zoznam.sk>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>> Hm, so nobody is ATM using (compiling) FreeTDS under Windows ?
>>
>
> Here's one way to compile it under Windows:
> http://docs.moodle.org/en/Development:Compiling_FreeTDS_under_Windows
>
>
>
Thanks, but steps described leads to dblib.lib, but I need dblib.dll.
I think, that in mean time I found solution for VC++ 2005 Express:
When I import project, then in project properties I must change:
General
Configuration type: Dynamic library (instead of Static library)
Linker
Input
Add dependencies: ws2_32.lib
Module definition: ..\dblib.def (this is new file, which I
created and contains EXPORTS for routines in sybdb.h)
I am not sure if this is correct way (I am not C/C++ programmer at all),
but after experimenting this leads to successful build of dblib.dll
(if they are correct then it will be good include them in FreeTDS
sources to make process of bulding more simple)
Also it will be great if in sources of FreeTDS will be added "Project
definition" for VC 2005+ (win32/msvc7???)
L.
>
>
>
>
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>
>
------------------------------
Message: 5
Date: Fri, 20 Aug 2010 10:03:53 +0200
From: LacaK <lacak AT zoznam.sk>
To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
Subject: [freetds] BUG?: incorrect struct tds_microsoft_dbdaterec
Message-ID: <4C6E36E9.107 AT zoznam.sk>
Content-Type: text/plain; charset=X-MAC-CE; format=flowed
Hi,
I am not sure if this is right place to report bug or not, but I do not
know if bug-tracker on sourceforge.net is active.
(if there is active bug tracke, let me know please)
There is in sybdb.h defined:
struct tds_microsoft_dbdaterec
{
DBINT year; /* 1753 - 9999 */
DBINT quarter; /* 1 - 4 */
DBINT month; /* 1 - 12 */
DBINT day; /* 1 - 31 */
DBINT dayofyear; /* 1 - 366 */
DBINT week; /* 1 - 54 (for leap years) */
DBINT weekday; /* 1 - 7 (Mon. - Sun.) */
DBINT hour; /* 0 - 23 */
DBINT minute; /* 0 - 59 */
DBINT second; /* 0 - 59 */
DBINT millisecond; /* 0 - 999 */
DBINT tzone; /* 0 - 127 (Sybase only) */
};
But Microsoft uses slightly different format, see:
http://msdn.microsoft.com/en-us/library/aa937027(v=SQL.80).aspx
|typedef struct dbdaterec
{
int year; // 1753 - 9999
int quarter; // 1 - 4
int month; // 1 - 12
int dayofyear; // 1 - 366
int day; // 1 - 31
int week; // 1 - 54 (for leap years)
int weekday; // 1 - 7 (Mon. - Sun.)
int hour; // 0 - 23
int minute; // 0 - 59
int second; // 0 - 59
int millisecond; // 0 - 999
} DBDATEREC;|
*
"day" and "dayofyear" are exchanged !!!*
So I think, that struct tds_microsoft_dbdaterec and function dbdatecrack
(which only uses dbdaterec) must be adjusted:
(to keep "binnary" compatibilty with Microsoft implementation in
ntwdblib.dll)
...
if (dbproc ? dbproc->msdblib : msdblib) {
++di->quarter;
++di->datemonth;
++di->datedweek;
//add these two lines:
di->datedmonth = dr.dayofyear;
di->datedyear = dr.day;
}
...
-Laco.
------------------------------
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
End of FreeTDS Digest, Vol 91, Issue 13
***************************************
-
[freetds] Bug in bcp.c,
Libin Qi, 08/20/2010
- [freetds] SQL Server 2008 - DATE datatype support [NC], Cedric ROUVRAIS, 08/22/2010
Archive powered by MHonArc 2.6.24.