Skip to Content.
Sympa Menu

freetds - Re: [freetds] Possible Bug

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: David Owen <dowen AT midsomer.org>
  • To: freetds AT lists.ibiblio.org
  • Subject: Re: [freetds] Possible Bug
  • Date: 03 Feb 2003 20:40:43 -0700

Sorry, should have included the following with the [possible] bug
report.

The table that will create the error:

CREATE TABLE dbo.appkey8 (
appkey8_id int NOT NULL,
appkey8_login_name varchar(40) NOT NULL,
appkey8_lname varchar(40) NOT NULL,
appkey8_fname varchar(40) NOT NULL,
sys_privs char(1) NOT NULL,
poll_time int DEFAULT 240 NOT NULL,
time_offset numeric(2,1) NOT NULL,
dst char(1) NOT NULL,
upd_date datetime NOT NULL,
upd_id int NOT NULL
)
go

IF OBJECT_ID('dbo.appkey8') IS NOT NULL
PRINT '<<< CREATED TABLE dbo.appkey8 >>>'
ELSE
PRINT '<<< FAILED TO CREATE TABLE dbo.appkey8 >>>'
go

IF OBJECT_ID('dbo.appkey8') IS NOT NULL
BEGIN
CREATE UNIQUE CLUSTERED INDEX appkey8_CU1
ON appkey8 (appkey8_id)
END
go


IF OBJECT_ID('dbo.appkey8') IS NOT NULL
BEGIN
CREATE UNIQUE NONCLUSTERED INDEX appkey8_NU1
ON appkey8 (appkey8_login_name)
END
go

Using TDS version 5.0 against Sybase 12.5 database (although I get the
same error with ASE 11.9.2 and 12.0).

I used the latest version of FreeTDS from the nightly snapshot. (I
tried to get the CVS version to compile, but it complained about
aclocal.m4 and all sorts of other stuff.)

I am currently testing it on RedHat 7.3, but I had the problem reported
to me from someone running against 12.5 on Solaris. I could probably
test it out on Solaris as well if it came to the push.

David Owen


On Mon, 2003-02-03 at 19:50, David Owen wrote:
> I am just trying to test a script I maintain with FreeTDS and am coming
> across a problem. The script extracts the schema from a Sybase server.
> I have attached the relevant piece of Sybperl (cut down to as small as
> will still generate the error) together with a dump file.
>
> I get the following output from the script:
>
> Msg 5701, Level 10, State 2
> Server 'BISCAY',
> Changed database context to 'master'.
>
> Msg 5701, Level 10, State 1
> Server 'BISCAY', Line 1
> Changed database context to 'dbschema'.
>
> DB-Library error:
> Attempt to initiate a new SQL Server operation with results
> pending.
> Operating-system error:
> OpenClient
> DB-Library error:
> Attempt to initiate a new SQL Server operation with results
> pending.
> Operating-system error:
> OpenClient
>
> Firstly, I know that the perl is far from perfect.
>
> Secondly, and I know that this is no guarantor of correctness, it works
> with the Sybase libs.
>
> I have looked for the problem, but am not familiar enough with the
> FreeTDS code (yet!). I thought that maybe someone here would be more
> familiar with the dump output and maybe see a problem (the two return
> packets with the index colunm names are correct). If not, maybe one of
> you can give me a hand in tracking it down further.
>
> Thanks
>
> dowen
> --
> David Owen Midsomer Consultants Inc. dowen AT midsomer.org
> Maintainer of the Sybase FAQ: http://www.isug.com/Sybase_FAQ
>
> ----
>

> Starting log file with debug level 99.
> 2003-02-03 19:36:05.334763 iconv will convert client-side data to the ""
> character set
> 2003-02-03 19:36:05.335070 Connecting addr 192.168.37.2 port 4100 with TDS
> version 5.0
> Sending packet @ 2003-02-03 19:36:05.335261
> 0000 02 00 02 00 00 00 00 00 62 69 73 63 61 79 2e 6d |........ biscay.m|
> 0010 69 64 73 6f 6d 65 72 2e 6f 72 67 00 00 00 00 00 |idsomer. org.....|
> 0020 00 00 00 00 00 00 13 73 61 00 00 00 00 00 00 00 |.......s a.......|
> 0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 0040 00 00 00 00 00 02 64 75 6d 6d 79 70 61 73 73 00 |......du mmypass.|
> 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 0060 00 00 00 00 09 33 37 38 37 36 00 00 00 00 00 00 |.....378 76......|
> 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 0080 00 00 00 05 03 01 06 0a 09 01 00 00 00 00 00 00 |........ ........|
> 0090 00 00 00 00 66 74 64 73 5f 65 72 72 6f 72 2e 70 |....ftds _error.p|
> 00a0 6c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |l....... ........|
> 00b0 00 00 0d 42 49 53 43 41 59 00 00 00 00 00 00 00 |...BISCA Y.......|
> 00c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 00d0 00 06 00 09 64 75 6d 6d 79 70 61 73 73 00 00 00 |....dumm ypass...|
> 00e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 00f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 0100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 0110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 0120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 0130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 0150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 0170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 0180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 0190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 01a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 01b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 01c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........|
> 01d0 00 0b 05 00 00 00 44 42 2d 4c 69 62 72 61 72 79 |......DB -Library|
> 01e0 0a 05 00 00 00 00 0d 11 75 73 5f 65 6e 67 6c 69 |........ us_engli|
> 01f0 73 68 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |sh...... ........|
>
>
> Sending packet @ 2003-02-03 19:36:05.335696
> 0000 02 01 00 61 00 00 00 00 00 00 00 00 00 00 0a 00 |...a.... ........|
> 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 69 73 6f |........ .....iso|
> 0020 5f 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |_1...... ........|
> 0030 00 00 00 00 00 00 00 00 00 00 00 05 01 35 31 32 |........ .....512|
> 0040 00 00 00 03 00 00 00 00 e2 16 00 01 09 00 00 06 |........ â.......|
> 0050 6d 7f ff ff ff fe 02 09 00 00 00 00 0a 68 00 00 |m.ÿÿÿþ.. .....h..|
> 0060 00 |.|
>
>
> 2003-02-03 19:36:05.335807 inside tds_process_login_tokens()
> Received header @ 2003-02-03 19:36:05.336812
> 0000 04 01 00 a0 00 00 00 00 |... ....|
>
>
> Received packet @ 2003-02-03 19:36:05.336852
> 0000 e3 0f 00 01 06 6d 61 73 74 65 72 06 6d 61 73 74 |ã....mas ter.mast|
> 0010 65 72 e5 41 00 45 16 00 00 02 0a 05 5a 5a 5a 5a |eråA.E.. ....ZZZZ|
> 0020 5a 00 01 00 26 00 43 68 61 6e 67 65 64 20 64 61 |Z...&.Ch anged da|
> 0030 74 61 62 61 73 65 20 63 6f 6e 74 65 78 74 20 74 |tabase c ontext t|
> 0040 6f 20 27 6d 61 73 74 65 72 27 2e 0a 06 42 49 53 |o 'maste r'...BIS|
> 0050 43 41 59 00 00 00 e3 06 00 04 03 35 31 32 00 ad |CAY...ã. ...512.­|
> 0060 14 00 05 05 00 00 00 0a 73 71 6c 20 73 65 72 76 |........ sql serv|
> 0070 65 72 0c 05 00 00 e2 16 00 01 09 00 00 02 61 41 |er....â. ......aA|
> 0080 ff ff ff e6 02 09 00 00 00 00 02 00 00 00 00 fd |ÿÿÿæ.... .......ý|
> 0090 00 00 02 00 0d 00 00 00 |........|
>
>
> 2003-02-03 19:36:05.336980 inside tds_process_default_tokens() marker is
> e3(ENVCHANGE)
> 2003-02-03 19:36:05.337025 inside tds_process_default_tokens() marker is
> e5(EED)
> 2003-02-03 19:36:05.337097 inside tds_process_default_tokens() marker is
> e3(ENVCHANGE)
> 2003-02-03 19:36:05.337117 inside tds_process_default_tokens() marker is
> e2(CAPABILITY)
> 2003-02-03 19:36:05.337132 inside tds_process_default_tokens() marker is
> fd(DONE)
> 2003-02-03 19:36:05.337153 inside tds_process_end() more_results = 0,
> was_cancelled = 0
> 2003-02-03 19:36:05.337168 inside tds_process_default_tokens() setting
> state to COMPLETED
> 2003-02-03 19:36:05.337181 leaving tds_process_login_tokens() returning 1
> 2003-02-03 19:36:05.337721 inside dbuse()
> Sending packet @ 2003-02-03 19:36:05.337830
> 0000 0f 01 00 1a 00 00 00 00 21 0d 00 00 00 00 75 73 |........ !.....us|
> 0010 65 20 64 62 73 63 68 65 6d 61 |e dbsche ma|
>
>
> 2003-02-03 19:36:05.337976 in dbsqlok()
> Received header @ 2003-02-03 19:36:05.338418
> 0000 04 01 00 6b 00 00 00 00 |...k....|
>
>
> Received packet @ 2003-02-03 19:36:05.338457
> 0000 e3 11 00 01 08 64 62 73 63 68 65 6d 61 06 6d 61 |ã....dbs chema.ma|
> 0010 73 74 65 72 e5 43 00 45 16 00 00 01 0a 05 5a 5a |steråC.E ......ZZ|
> 0020 5a 5a 5a 00 01 00 28 00 43 68 61 6e 67 65 64 20 |ZZZ...(. Changed |
> 0030 64 61 74 61 62 61 73 65 20 63 6f 6e 74 65 78 74 |database context|
> 0040 20 74 6f 20 27 64 62 73 63 68 65 6d 61 27 2e 0a | to 'dbs chema'..|
> 0050 06 42 49 53 43 41 59 00 01 00 fd 00 00 02 00 00 |.BISCAY. ..ý.....|
> 0060 00 00 00 |...|
>
>
> 2003-02-03 19:36:05.338803 dbsqlok() marker is e3
> 2003-02-03 19:36:05.338820 dbsqlok() found throwaway token
> 2003-02-03 19:36:05.338834 inside tds_process_default_tokens() marker is
> e3(ENVCHANGE)
> 2003-02-03 19:36:05.338856 dbsqlok() marker is e5
> 2003-02-03 19:36:05.338889 dbsqlok() found throwaway token
> 2003-02-03 19:36:05.338902 inside tds_process_default_tokens() marker is
> e5(EED)
> 2003-02-03 19:36:05.339342 dbsqlok() marker is fd
> 2003-02-03 19:36:05.339364 dbsqlok() found end token
> 2003-02-03 19:36:05.339378 inside tds_process_end() more_results = 0,
> was_cancelled = 0
> 2003-02-03 19:36:05.339393 dbsqlok() end status was success
> 2003-02-03 19:36:05.339421 inside dbresults()
> 2003-02-03 19:36:05.339458 inside tds_process_row_tokens() state is
> COMPLETED
> Sending packet @ 2003-02-03 19:36:05.339582
> 0000 0f 01 01 90 00 00 00 00 21 83 01 00 00 00 0a 0a |........ !.......|
> 0010 20 20 20 20 20 20 53 45 4c 45 43 54 20 73 79 73 | SE LECT sys|
> 0020 69 6e 64 2e 6e 61 6d 65 2c 0a 20 20 20 20 20 20 |ind.name ,. |
> 0030 20 20 20 20 20 20 20 73 79 73 69 6e 64 2e 69 6e | s ysind.in|
> 0040 64 69 64 2c 0a 20 20 20 20 20 20 20 20 20 20 20 |did,. |
> 0050 20 20 73 79 73 69 6e 64 2e 73 74 61 74 75 73 2c | sysind .status,|
> 0060 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 73 79 |. sy|
> 0070 73 69 6e 64 2e 73 74 61 74 75 73 32 2c 0a 20 20 |sind.sta tus2,. |
> 0080 20 20 20 20 20 20 20 20 20 20 20 73 79 73 69 6e | sysin|
> 0090 64 2e 73 65 67 6d 65 6e 74 2c 0a 20 20 20 20 20 |d.segmen t,. |
> 00a0 20 20 20 20 20 20 20 20 73 79 65 67 2e 6e 61 6d | syeg.nam|
> 00b0 65 0a 20 20 20 20 20 20 20 20 46 52 4f 4d 20 64 |e. FROM d|
> 00c0 62 6f 2e 73 79 73 69 6e 64 65 78 65 73 20 73 79 |bo.sysin dexes sy|
> 00d0 73 69 6e 64 2c 0a 20 20 20 20 20 20 20 20 20 20 |sind,. |
> 00e0 20 20 20 64 62 6f 2e 73 79 73 73 65 67 6d 65 6e | dbo.s yssegmen|
> 00f0 74 73 20 73 79 65 67 0a 20 20 20 20 20 20 20 57 |ts syeg. W|
> 0100 48 45 52 45 20 73 79 73 69 6e 64 2e 69 64 20 20 |HERE sys ind.id |
> 0110 20 20 20 20 3d 20 4f 42 4a 45 43 54 5f 49 44 28 | = OB JECT_ID(|
> 0120 27 64 62 6f 2e 61 70 70 6b 65 79 38 27 29 0a 20 |'dbo.app key8'). |
> 0130 20 20 20 20 20 20 20 20 41 4e 44 20 73 79 73 69 | AND sysi|
> 0140 6e 64 2e 73 65 67 6d 65 6e 74 20 3d 20 73 79 65 |nd.segme nt = sye|
> 0150 67 2e 73 65 67 6d 65 6e 74 0a 20 20 20 20 20 20 |g.segmen t. |
> 0160 20 20 20 41 4e 44 20 73 79 73 69 6e 64 2e 69 6e | AND s ysind.in|
> 0170 64 69 64 20 42 45 54 57 45 45 4e 20 31 20 41 4e |did BETW EEN 1 AN|
> 0180 44 20 32 35 34 0a 0a 20 20 20 20 20 20 20 20 20 |D 254.. |
>
>
> 2003-02-03 19:36:05.339916 in dbsqlok()
> Received header @ 2003-02-03 19:36:05.341625
> 0000 04 01 00 ac 00 00 00 00 |...¬....|
>
>
> Received packet @ 2003-02-03 19:36:05.341692
> 0000 ee 55 00 06 00 04 6e 61 6d 65 30 12 00 00 00 27 |îU....na me0....'|
> 0010 1e 00 05 69 6e 64 69 64 10 06 00 00 00 34 00 06 |...indid .....4..|
> 0020 73 74 61 74 75 73 10 06 00 00 00 34 00 07 73 74 |status.. ...4..st|
> 0030 61 74 75 73 32 10 06 00 00 00 34 00 07 73 65 67 |atus2... ..4..seg|
> 0040 6d 65 6e 74 10 06 00 00 00 34 00 04 6e 61 6d 65 |ment.... .4..name|
> 0050 10 12 00 00 00 27 1e 00 ae 06 00 00 00 00 00 00 |.....'.. ®.......|
> 0060 00 d1 0b 61 70 70 6b 65 79 38 5f 43 55 31 01 00 |.Ñ.appke y8_CU1..|
> 0070 92 00 00 00 01 00 07 64 65 66 61 75 6c 74 d1 0b |.......d efaultÑ.|
> 0080 61 70 70 6b 65 79 38 5f 4e 55 31 02 00 02 00 00 |appkey8_ NU1.....|
> 0090 00 01 00 07 64 65 66 61 75 6c 74 fd 10 00 02 00 |....defa ultý....|
> 00a0 02 00 00 00 |....|
>
>
> 2003-02-03 19:36:05.341818 dbsqlok() marker is ee
> 2003-02-03 19:36:05.341831 dbsqlok() found result token
> 2003-02-03 19:36:05.341884 inside dbresults()
> 2003-02-03 19:36:05.341905 inside dbresults_r()
> 2003-02-03 19:36:05.341924 processing result tokens. marker is ee(RESULT)
> 2003-02-03 19:36:05.341968 processing result. type = 39(varchar),
> varint_size 1
> 2003-02-03 19:36:05.341984 processing result. column_size 30
> 2003-02-03 19:36:05.342008 processing result. type = 52(smallint),
> varint_size 0
> 2003-02-03 19:36:05.342022 processing result. column_size 2
> 2003-02-03 19:36:05.342046 processing result. type = 52(smallint),
> varint_size 0
> 2003-02-03 19:36:05.342060 processing result. column_size 2
> 2003-02-03 19:36:05.342073 processing result. type = 52(smallint),
> varint_size 0
> 2003-02-03 19:36:05.342086 processing result. column_size 2
> 2003-02-03 19:36:05.342098 processing result. type = 52(smallint),
> varint_size 0
> 2003-02-03 19:36:05.342111 processing result. column_size 2
> 2003-02-03 19:36:05.342123 processing result. type = 39(varchar),
> varint_size 1
> 2003-02-03 19:36:05.342136 processing result. column_size 30
> 2003-02-03 19:36:05.342155 inside dbresults_r() result_type = 4049 retcode
> = 1
> 2003-02-03 19:36:05.342170 processing result tokens. marker is ae(CONTROL)
> 2003-02-03 19:36:05.342183 inside tds_process_default_tokens() marker is
> ae(CONTROL)
> eating token 174
> 2003-02-03 19:36:05.342205 processing result tokens. marker is d1(ROW)
> 2003-02-03 19:36:05.342218 inside dbresults_r() result_type = 4040 retcode
> = 1
> 2003-02-03 19:36:05.342233 leaving dbresults() returning 1
> 2003-02-03 19:36:05.342280 inside dbnextrow()
> 2003-02-03 19:36:05.342296 processing row tokens. marker is d1(ROW)
> 2003-02-03 19:36:05.342311 processing row. column is 0 varint size = 1
> 2003-02-03 19:36:05.342325 processing row. column size is 11
> 2003-02-03 19:36:05.342341 clearing column 0 NULL bit
> 2003-02-03 19:36:05.342354 processing row. column is 1 varint size = 0
> 2003-02-03 19:36:05.342367 processing row. column size is 2
> 2003-02-03 19:36:05.342379 clearing column 1 NULL bit
> 2003-02-03 19:36:05.342390 processing row. column is 2 varint size = 0
> 2003-02-03 19:36:05.342403 processing row. column size is 2
> 2003-02-03 19:36:05.342415 clearing column 2 NULL bit
> 2003-02-03 19:36:05.342426 processing row. column is 3 varint size = 0
> 2003-02-03 19:36:05.342439 processing row. column size is 2
> 2003-02-03 19:36:05.342451 clearing column 3 NULL bit
> 2003-02-03 19:36:05.342463 processing row. column is 4 varint size = 0
> 2003-02-03 19:36:05.342475 processing row. column size is 2
> 2003-02-03 19:36:05.342487 clearing column 4 NULL bit
> 2003-02-03 19:36:05.342538 processing row. column is 5 varint size = 1
> 2003-02-03 19:36:05.342553 processing row. column size is 7
> 2003-02-03 19:36:05.342565 clearing column 5 NULL bit
> 2003-02-03 19:36:05.342581 leaving dbnextrow() returning -1
> 2003-02-03 19:36:05.342627 dbdatlen() type = 39
> 2003-02-03 19:36:05.342644 leaving dbdatlen() returning 11
> 2003-02-03 19:36:05.342690 dbdatlen() type = 52
> 2003-02-03 19:36:05.342704 leaving dbdatlen() returning 2
> 2003-02-03 19:36:05.342719 dbdatlen() type = 52
> 2003-02-03 19:36:05.342732 leaving dbdatlen() returning 2
> 2003-02-03 19:36:05.342745 dbdatlen() type = 52
> 2003-02-03 19:36:05.342757 leaving dbdatlen() returning 2
> 2003-02-03 19:36:05.342771 dbdatlen() type = 52
> 2003-02-03 19:36:05.342783 leaving dbdatlen() returning 2
> 2003-02-03 19:36:05.342796 dbdatlen() type = 39
> 2003-02-03 19:36:05.342809 leaving dbdatlen() returning 7
> 2003-02-03 19:36:05.342847 inside dbnextrow()
> 2003-02-03 19:36:05.342861 processing row tokens. marker is d1(ROW)
> 2003-02-03 19:36:05.342886 processing row. column is 0 varint size = 1
> 2003-02-03 19:36:05.342900 processing row. column size is 11
> 2003-02-03 19:36:05.342912 clearing column 0 NULL bit
> 2003-02-03 19:36:05.342924 processing row. column is 1 varint size = 0
> 2003-02-03 19:36:05.342937 processing row. column size is 2
> 2003-02-03 19:36:05.342949 clearing column 1 NULL bit
> 2003-02-03 19:36:05.342962 processing row. column is 2 varint size = 0
> 2003-02-03 19:36:05.342975 processing row. column size is 2
> 2003-02-03 19:36:05.342987 clearing column 2 NULL bit
> 2003-02-03 19:36:05.342999 processing row. column is 3 varint size = 0
> 2003-02-03 19:36:05.343012 processing row. column size is 2
> 2003-02-03 19:36:05.343024 clearing column 3 NULL bit
> 2003-02-03 19:36:05.343036 processing row. column is 4 varint size = 0
> 2003-02-03 19:36:05.343049 processing row. column size is 2
> 2003-02-03 19:36:05.343062 clearing column 4 NULL bit
> 2003-02-03 19:36:05.343091 processing row. column is 5 varint size = 1
> 2003-02-03 19:36:05.343115 processing row. column size is 7
> 2003-02-03 19:36:05.343128 clearing column 5 NULL bit
> 2003-02-03 19:36:05.343141 leaving dbnextrow() returning -1
> 2003-02-03 19:36:05.343154 dbdatlen() type = 39
> 2003-02-03 19:36:05.343166 leaving dbdatlen() returning 11
> 2003-02-03 19:36:05.343181 dbdatlen() type = 52
> 2003-02-03 19:36:05.343195 leaving dbdatlen() returning 2
> 2003-02-03 19:36:05.343209 dbdatlen() type = 52
> 2003-02-03 19:36:05.343222 leaving dbdatlen() returning 2
> 2003-02-03 19:36:05.343235 dbdatlen() type = 52
> 2003-02-03 19:36:05.343248 leaving dbdatlen() returning 2
> 2003-02-03 19:36:05.343261 dbdatlen() type = 52
> 2003-02-03 19:36:05.343274 leaving dbdatlen() returning 2
> 2003-02-03 19:36:05.343287 dbdatlen() type = 39
> 2003-02-03 19:36:05.343300 leaving dbdatlen() returning 7
> 2003-02-03 19:36:05.343323 inside dbnextrow()
> 2003-02-03 19:36:05.343338 processing row tokens. marker is fd(DONE)
> 2003-02-03 19:36:05.343352 inside tds_process_end() more_results = 0,
> was_cancelled = 0
> 2003-02-03 19:36:05.343377 leaving dbnextrow() returning -2
> Sending packet @ 2003-02-03 19:36:05.343448
> 0000 0f 01 00 b8 00 00 00 00 21 ab 00 00 00 00 0a 0a |...ž.... !«......|
> 0010 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
> 0020 20 20 20 20 53 45 4c 45 43 54 0a 20 20 20 20 20 | SELE CT. |
> 0030 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
> 0040 20 20 20 69 6e 64 65 78 5f 63 6f 6c 28 27 64 62 | index _col('db|
> 0050 6f 2e 61 70 70 6b 65 79 38 27 2c 20 31 2c 20 31 |o.appkey 8', 1, 1|
> 0060 29 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 |),. |
> 0070 20 20 20 20 20 20 20 20 20 20 20 69 6e 64 65 78 | index|
> 0080 5f 63 6f 6c 6f 72 64 65 72 28 27 64 62 6f 2e 61 |_colorde r('dbo.a|
> 0090 70 70 6b 65 79 38 27 2c 20 31 2c 20 31 29 0a 0a |ppkey8', 1, 1)..|
> 00a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
> 00b0 20 20 20 20 20 20 20 20 | |
>
>
> 2003-02-03 19:36:05.343646 in dbsqlok()
> Received header @ 2003-02-03 19:36:05.344344
> 0000 04 01 00 3d 00 00 00 00 |...=....|
>
>
> Received packet @ 2003-02-03 19:36:05.344379
> 0000 ee 14 00 02 00 00 30 02 00 00 00 27 1e 00 00 30 |î.....0. ...'...0|
> 0010 02 00 00 00 27 1e 00 ae 02 00 00 00 d1 0a 61 70 |....'..® ....Ñ.ap|
> 0020 70 6b 65 79 38 5f 69 64 03 41 53 43 fd 10 00 02 |pkey8_id .ASCý...|
> 0030 00 01 00 00 00 |.....|
>
>
> 2003-02-03 19:36:05.344425 dbsqlok() marker is ee
> 2003-02-03 19:36:05.344438 dbsqlok() found result token
> 2003-02-03 19:36:05.344458 inside dbresults()
> 2003-02-03 19:36:05.344471 inside dbresults_r()
> 2003-02-03 19:36:05.344484 processing result tokens. marker is ee(RESULT)
> 2003-02-03 19:36:05.344504 processing result. type = 39(varchar),
> varint_size 1
> 2003-02-03 19:36:05.344518 processing result. column_size 30
> 2003-02-03 19:36:05.344532 processing result. type = 39(varchar),
> varint_size 1
> 2003-02-03 19:36:05.344545 processing result. column_size 30
> 2003-02-03 19:36:05.344571 inside dbresults_r() result_type = 4049 retcode
> = 1
> 2003-02-03 19:36:05.344585 processing result tokens. marker is ae(CONTROL)
> 2003-02-03 19:36:05.344599 inside tds_process_default_tokens() marker is
> ae(CONTROL)
> eating token 174
> 2003-02-03 19:36:05.344621 processing result tokens. marker is d1(ROW)
> 2003-02-03 19:36:05.344634 inside dbresults_r() result_type = 4040 retcode
> = 1
> 2003-02-03 19:36:05.344648 leaving dbresults() returning 1
> 2003-02-03 19:36:05.344666 inside dbnextrow()
> 2003-02-03 19:36:05.344678 processing row tokens. marker is d1(ROW)
> 2003-02-03 19:36:05.344691 processing row. column is 0 varint size = 1
> 2003-02-03 19:36:05.344704 processing row. column size is 10
> 2003-02-03 19:36:05.344717 clearing column 0 NULL bit
> 2003-02-03 19:36:05.344729 processing row. column is 1 varint size = 1
> 2003-02-03 19:36:05.344742 processing row. column size is 3
> 2003-02-03 19:36:05.344754 clearing column 1 NULL bit
> 2003-02-03 19:36:05.344767 leaving dbnextrow() returning -1
> 2003-02-03 19:36:05.344797 dbdatlen() type = 39
> 2003-02-03 19:36:05.344810 leaving dbdatlen() returning 10
> 2003-02-03 19:36:05.344829 dbdatlen() type = 39
> 2003-02-03 19:36:05.344841 leaving dbdatlen() returning 3
> 2003-02-03 19:36:05.344873 inside dbnextrow()
> 2003-02-03 19:36:05.344887 processing row tokens. marker is fd(DONE)
> 2003-02-03 19:36:05.344900 inside tds_process_end() more_results = 0,
> was_cancelled = 0
> 2003-02-03 19:36:05.344915 leaving dbnextrow() returning -2
> Sending packet @ 2003-02-03 19:36:05.344954
> 0000 0f 01 00 b8 00 00 00 00 21 ab 00 00 00 00 0a 0a |...ž.... !«......|
> 0010 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
> 0020 20 20 20 20 53 45 4c 45 43 54 0a 20 20 20 20 20 | SELE CT. |
> 0030 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
> 0040 20 20 20 69 6e 64 65 78 5f 63 6f 6c 28 27 64 62 | index _col('db|
> 0050 6f 2e 61 70 70 6b 65 79 38 27 2c 20 31 2c 20 32 |o.appkey 8', 1, 2|
> 0060 29 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 |),. |
> 0070 20 20 20 20 20 20 20 20 20 20 20 69 6e 64 65 78 | index|
> 0080 5f 63 6f 6c 6f 72 64 65 72 28 27 64 62 6f 2e 61 |_colorde r('dbo.a|
> 0090 70 70 6b 65 79 38 27 2c 20 31 2c 20 32 29 0a 0a |ppkey8', 1, 2)..|
> 00a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
> 00b0 20 20 20 20 20 20 20 20 | |
>
>
> 2003-02-03 19:36:05.345112 in dbsqlok()
> Received header @ 2003-02-03 19:36:05.345620
> 0000 04 01 00 30 00 00 00 00 |...0....|
>
>
> Received packet @ 2003-02-03 19:36:05.345646
> 0000 ee 14 00 02 00 00 30 02 00 00 00 27 1e 00 00 30 |î.....0. ...'...0|
> 0010 02 00 00 00 27 1e 00 ae 02 00 00 00 d1 00 00 fd |....'..® ....Ñ..ý|
> 0020 10 00 02 00 01 00 00 00 |........|
>
>
> 2003-02-03 19:36:05.345683 dbsqlok() marker is ee
> 2003-02-03 19:36:05.345695 dbsqlok() found result token
> 2003-02-03 19:36:05.345708 inside dbresults()
> 2003-02-03 19:36:05.345741 inside dbresults_r()
> 2003-02-03 19:36:05.345754 processing result tokens. marker is ee(RESULT)
> 2003-02-03 19:36:05.345770 processing result. type = 39(varchar),
> varint_size 1
> 2003-02-03 19:36:05.345784 processing result. column_size 30
> 2003-02-03 19:36:05.345797 processing result. type = 39(varchar),
> varint_size 1
> 2003-02-03 19:36:05.345810 processing result. column_size 30
> 2003-02-03 19:36:05.345822 inside dbresults_r() result_type = 4049 retcode
> = 1
> 2003-02-03 19:36:05.345836 processing result tokens. marker is ae(CONTROL)
> 2003-02-03 19:36:05.345848 inside tds_process_default_tokens() marker is
> ae(CONTROL)
> eating token 174
> 2003-02-03 19:36:05.345869 processing result tokens. marker is d1(ROW)
> 2003-02-03 19:36:05.345882 inside dbresults_r() result_type = 4040 retcode
> = 1
> 2003-02-03 19:36:05.345896 leaving dbresults() returning 1
> 2003-02-03 19:36:05.345910 inside dbnextrow()
> 2003-02-03 19:36:05.345922 processing row tokens. marker is d1(ROW)
> 2003-02-03 19:36:05.345936 processing row. column is 0 varint size = 1
> 2003-02-03 19:36:05.345959 processing row. column size is 0
> 2003-02-03 19:36:05.345985 setting column 0 NULL bit
> 2003-02-03 19:36:05.345997 processing row. column is 1 varint size = 1
> 2003-02-03 19:36:05.346011 processing row. column size is 0
> 2003-02-03 19:36:05.346023 setting column 1 NULL bit
> 2003-02-03 19:36:05.346036 leaving dbnextrow() returning -1
> 2003-02-03 19:36:05.346048 dbdatlen() type = 39
> 2003-02-03 19:36:05.346061 leaving dbdatlen() returning 0
> 2003-02-03 19:36:05.346075 dbdatlen() type = 39
> 2003-02-03 19:36:05.346086 leaving dbdatlen() returning 0
> 2003-02-03 19:36:05.346636 inside dbresults()
> 2003-02-03 19:36:05.346666 inside dbresults_r()
> 2003-02-03 19:36:05.346681 processing result tokens. marker is fd(DONE)
> 2003-02-03 19:36:05.346696 inside tds_process_end() more_results = 0,
> was_cancelled = 0
> 2003-02-03 19:36:05.346711 inside dbresults_r() result_type = 4046 retcode
> = 1
> 2003-02-03 19:36:05.346725 inside tds_process_result_tokens() state is
> COMPLETED
> 2003-02-03 19:36:05.347063 leaving dbresults() returning 2
> 2003-02-03 19:36:05.347095 inside dbnextrow()
> 2003-02-03 19:36:05.347111 inside tds_process_row_tokens() state is
> COMPLETED
> 2003-02-03 19:36:05.347125 leaving dbnextrow() returning -2
> Sending packet @ 2003-02-03 19:36:05.347196
> 0000 0f 01 01 62 00 00 00 00 21 55 01 00 00 00 0a 0a |...b.... !U......|
> 0010 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
> 0020 20 20 20 20 53 45 4c 45 43 54 0a 20 20 20 20 20 | SELE CT. |
> 0030 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
> 0040 20 20 20 69 6e 64 65 78 5f 63 6f 6c 28 27 64 62 | index _col('db|
> 0050 6f 2e 61 70 70 6b 65 79 38 27 2c 20 32 2c 20 31 |o.appkey 8', 2, 1|
> 0060 29 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 |),. |
> 0070 20 20 20 20 20 20 20 20 20 20 20 69 6e 64 65 78 | index|
> 0080 5f 63 6f 6c 6f 72 64 65 72 28 27 64 62 6f 2e 61 |_colorde r('dbo.a|
> 0090 70 70 6b 65 79 38 27 2c 20 32 2c 20 31 29 0a 0a |ppkey8', 2, 1)..|
> 00a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
> 00b0 20 20 20 20 20 20 20 20 0a 0a 20 20 20 20 20 20 | .. |
> 00c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 45 | SE|
> 00d0 4c 45 43 54 0a 20 20 20 20 20 20 20 20 20 20 20 |LECT. |
> 00e0 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 64 | ind|
> 00f0 65 78 5f 63 6f 6c 28 27 64 62 6f 2e 61 70 70 6b |ex_col(' dbo.appk|
> 0100 65 79 38 27 2c 20 32 2c 20 32 29 2c 0a 20 20 20 |ey8', 2, 2),. |
> 0110 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
> 0120 20 20 20 20 20 69 6e 64 65 78 5f 63 6f 6c 6f 72 | ind ex_color|
> 0130 64 65 72 28 27 64 62 6f 2e 61 70 70 6b 65 79 38 |der('dbo .appkey8|
> 0140 27 2c 20 32 2c 20 32 29 0a 0a 20 20 20 20 20 20 |', 2, 2) .. |
> 0150 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
> 0160 20 20 | |
>
>
> 2003-02-03 19:36:05.347490 in dbsqlok()
> Received header @ 2003-02-03 19:36:05.348208
> 0000 04 01 00 6d 00 00 00 00 |...m....|
>
>
> Received packet @ 2003-02-03 19:36:05.348236
> 0000 ee 14 00 02 00 00 30 02 00 00 00 27 1e 00 00 30 |î.....0. ...'...0|
> 0010 02 00 00 00 27 1e 00 ae 02 00 00 00 d1 12 61 70 |....'..® ....Ñ.ap|
> 0020 70 6b 65 79 38 5f 6c 6f 67 69 6e 5f 6e 61 6d 65 |pkey8_lo gin_name|
> 0030 03 41 53 43 fd 11 00 02 00 01 00 00 00 ee 14 00 |.ASCý... .....î..|
> 0040 02 00 00 30 02 00 00 00 27 1e 00 00 30 02 00 00 |...0.... '...0...|
> 0050 00 27 1e 00 ae 02 00 00 00 d1 00 00 fd 10 00 02 |.'..®... .Ñ..ý...|
> 0060 00 01 00 00 00 |.....|
>
>
> 2003-02-03 19:36:05.348307 dbsqlok() marker is ee
> 2003-02-03 19:36:05.348319 dbsqlok() found result token
> 2003-02-03 19:36:05.348334 inside dbresults()
> 2003-02-03 19:36:05.348346 inside dbresults_r()
> 2003-02-03 19:36:05.348357 processing result tokens. marker is ee(RESULT)
> 2003-02-03 19:36:05.348377 processing result. type = 39(varchar),
> varint_size 1
> 2003-02-03 19:36:05.348404 processing result. column_size 30
> 2003-02-03 19:36:05.348418 processing result. type = 39(varchar),
> varint_size 1
> 2003-02-03 19:36:05.348431 processing result. column_size 30
> 2003-02-03 19:36:05.348444 inside dbresults_r() result_type = 4049 retcode
> = 1
> 2003-02-03 19:36:05.348458 processing result tokens. marker is ae(CONTROL)
> 2003-02-03 19:36:05.348472 inside tds_process_default_tokens() marker is
> ae(CONTROL)
> eating token 174
> 2003-02-03 19:36:05.348493 processing result tokens. marker is d1(ROW)
> 2003-02-03 19:36:05.348506 inside dbresults_r() result_type = 4040 retcode
> = 1
> 2003-02-03 19:36:05.348520 leaving dbresults() returning 1
> 2003-02-03 19:36:05.348535 inside dbnextrow()
> 2003-02-03 19:36:05.348547 processing row tokens. marker is d1(ROW)
> 2003-02-03 19:36:05.348561 processing row. column is 0 varint size = 1
> 2003-02-03 19:36:05.348574 processing row. column size is 18
> 2003-02-03 19:36:05.348587 clearing column 0 NULL bit
> 2003-02-03 19:36:05.348610 processing row. column is 1 varint size = 1
> 2003-02-03 19:36:05.348623 processing row. column size is 3
> 2003-02-03 19:36:05.348636 clearing column 1 NULL bit
> 2003-02-03 19:36:05.348650 leaving dbnextrow() returning -1
> 2003-02-03 19:36:05.348664 dbdatlen() type = 39
> 2003-02-03 19:36:05.348676 leaving dbdatlen() returning 18
> 2003-02-03 19:36:05.348702 dbdatlen() type = 39
> 2003-02-03 19:36:05.348714 leaving dbdatlen() returning 3
> 2003-02-03 19:36:05.348750 inside dbnextrow()
> 2003-02-03 19:36:05.348764 processing row tokens. marker is fd(DONE)
> 2003-02-03 19:36:05.348777 inside tds_process_end() more_results = 1,
> was_cancelled = 0
> 2003-02-03 19:36:05.348792 leaving dbnextrow() returning -2
> 2003-02-03 19:36:05.348814 inside dbresults()
> 2003-02-03 19:36:05.348828 inside dbresults_r()
> 2003-02-03 19:36:05.348840 processing result tokens. marker is ee(RESULT)
> 2003-02-03 19:36:05.348856 processing result. type = 39(varchar),
> varint_size 1
> 2003-02-03 19:36:05.348870 processing result. column_size 30
> 2003-02-03 19:36:05.348893 processing result. type = 39(varchar),
> varint_size 1
> 2003-02-03 19:36:05.348907 processing result. column_size 30
> 2003-02-03 19:36:05.348919 inside dbresults_r() result_type = 4049 retcode
> = 1
> 2003-02-03 19:36:05.348933 processing result tokens. marker is ae(CONTROL)
> 2003-02-03 19:36:05.348946 inside tds_process_default_tokens() marker is
> ae(CONTROL)
> eating token 174
> 2003-02-03 19:36:05.348966 processing result tokens. marker is d1(ROW)
> 2003-02-03 19:36:05.348979 inside dbresults_r() result_type = 4040 retcode
> = 1
> 2003-02-03 19:36:05.348993 leaving dbresults() returning 1
> 2003-02-03 19:36:05.349476 inside dbresults()
> 2003-02-03 19:36:05.349499 inside dbresults_r()
> 2003-02-03 19:36:05.349514 processing result tokens. marker is d1(ROW)
> 2003-02-03 19:36:05.349527 inside dbresults_r() result_type = 4040 retcode
> = 1
> 2003-02-03 19:36:05.349542 leaving dbresults() returning 1
> 2003-02-03 19:36:05.349559 inside dbnextrow()
> 2003-02-03 19:36:05.349571 processing row tokens. marker is d1(ROW)
> 2003-02-03 19:36:05.349611 processing row. column is 0 varint size = 1
> 2003-02-03 19:36:05.349625 processing row. column size is 0
> 2003-02-03 19:36:05.349638 setting column 0 NULL bit
> 2003-02-03 19:36:05.349649 processing row. column is 1 varint size = 1
> 2003-02-03 19:36:05.349662 processing row. column size is 0
> 2003-02-03 19:36:05.349674 setting column 1 NULL bit
> 2003-02-03 19:36:05.349687 leaving dbnextrow() returning -1
> 2003-02-03 19:36:05.349701 dbdatlen() type = 39
> 2003-02-03 19:36:05.349712 leaving dbdatlen() returning 0
> 2003-02-03 19:36:05.349727 dbdatlen() type = 39
> 2003-02-03 19:36:05.349738 leaving dbdatlen() returning 0
> ----
>

> #!/usr/bin/perl -w
> use strict;
> use Sybase::DBlib;
> use Getopt::Long;
> use English;
>
> my(@col);
> my($dbproc);
> my($srvVersion) = 12050000;
>
> if (!($dbproc = new Sybase::DBlib ("sa",
> "praxwas",
> "BISCAY"))) {
> die("Cannot connect to server.\n");
> }
>
> $dbproc->{"dbNullIsUndef"} = TRUE;
> if (!$dbproc->dbuse("dbschema")) {
> die("Cannot locate dbschema database.");
> }
>
> @col = BuildIndexColumnsArray("dbo.appkey8");
>
> dbexit;
> exit 0;
>
>
> sub BuildIndexColumnsArray {
>
> my($fullname) = shift;
>
> my(@col, @field, $field, @index, $i, $index);
>
> $dbproc->dbcmd (qq{
>
> SELECT sysind.name,
> sysind.indid,
> sysind.status,
> sysind.status2,
> sysind.segment,
> syeg.name
> FROM dbo.sysindexes sysind,
> dbo.syssegments syeg
> WHERE sysind.id = OBJECT_ID(\'$fullname\')
> AND sysind.segment = syeg.segment
> AND sysind.indid BETWEEN 1 AND 254
>
> });
>
> $dbproc->dbsqlexec;
> $dbproc->dbresults;
>
> @col = ();
>
> while (@field = $dbproc->dbnextrow) {
> push(@col, [ @field ]);
> }
>
> INDEX:
> foreach $index (@col) {
> $field = \@$index;
>
> $i = 1;
> COLUMN:
> while (1) {
>
> if ($srvVersion >= 11090000) {
> $dbproc->dbcmd (qq{
>
> SELECT
> index_col(\'$fullname\', $$field[1], $i),
> index_colorder(\'$fullname\', $$field[1], $i)
>
> });
> }
> else {
> $dbproc->dbcmd (qq{
>
> SELECT
> index_col(\'$fullname\', $$field[1], $i),
> \'ASC\'
>
> });
> }
>
> $dbproc->dbsqlexec;
> $dbproc->dbresults;
>
> while (@index = $dbproc->dbnextrow) {
> last COLUMN if !$index[0];
> push(@$field, [ @index ]);
> }
>
> #$dbproc->dbcancel; # Ensure that there is no outstanding
> batch.
>
> $i++;
> }
> }
>
> return @col;
> }
--
David Owen Midsomer Consultants Inc. dowen AT midsomer.org
Maintainer of the Sybase FAQ: http://www.isug.com/Sybase_FAQ






Archive powered by MHonArc 2.6.24.

Top of Page