Re: missing divide by zero error

Adam Baratz <[email protected]> Tue, 20 Sep 2016 17:23:02 -0400
Newsgroups gmane.comp.db.tds.freetds
Message-ID <CADxrgCP_itNGoc-5LkefLcUF71HtOE-2mOvo2AZwsGofz13jUA@mail.gmail.com>
>
> I don't see the issue. Would be worth seeing the server reply
> entirely (some rows above if enabled) but if I remember there
> should be the error inside the result.
>

I attached the full log. I understand the two queries are different, but
the div/0 query produces an error (and no results) in SSMS. I'd like to
figure out how to get to the div/0 error message that's part of the NULL
result to replicate that behavior with db-library.

Thanks,
Adam

_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
div0.log (application/octet-stream, 12.5 KB)
log.c:167:Starting log file for FreeTDS 1.00.15
	on 2016-09-14 17:56:31 with debug flags 0x4fff.
dblib.c:1175:tdsdbopen(0x1e21890, DEVBOSQLC6, [sybase])
dblib.c:1201:tdsdbopen: dbproc->dbopts = 0x1e821e0
dblib.c:1212:tdsdbopen: tds_set_server(0x1d4acb0, "DEVBOSQLC6")
dblib.c:256:dblib_get_tds_ctx(void)
dblib.c:1229:tdsdbopen: About to call tds_read_config_info...
config.c:168:Getting connection information for [DEVBOSQLC6].
config.c:172:Attempting to read conf files.
config.c:355:... $FREETDSCONF not set.  Trying $FREETDS/etc.
config.c:368:... $FREETDS not set.  Trying $HOME.
config.c:294:Could not open '/home/vagrant/.freetds.conf' ((.freetds.conf)).
config.c:298:Found conf file '/usr/local/etc/freetds.conf' (default).
config.c:506:Looking for section global.
config.c:565:	Found section global.
config.c:568:Got a match.
config.c:591:	tds version = 'auto'
config.c:915:Setting tds version to auto (0x0).
config.c:591:	text size = '64512'
config.c:565:	Found section egserver50.
config.c:565:	Found section egserver70.
config.c:579:	Reached EOF
config.c:506:Looking for section DEVBOSQLC6.
config.c:565:	Found section global.
config.c:565:	Found section egserver50.
config.c:565:	Found section egserver70.
config.c:579:	Reached EOF
config.c:304:[DEVBOSQLC6] not found.
config.c:192:Failed in reading conf file.  Trying interface files.
config.c:1164:Looking for server DEVBOSQLC6....
config.c:1181:Looking for server in /home/vagrant/.interfaces.
config.c:1046:Searching interfaces file //home/vagrant/.interfaces.
config.c:1071:Couldn't open /home/vagrant/.interfaces.
config.c:1201:Looking for server in /etc/freetds/interfaces.
config.c:1046:Searching interfaces file /etc/freetds/interfaces.
config.c:1071:Couldn't open /etc/freetds/interfaces.
config.c:1234:Setting 'ip_port' to 1433 as a guess.
config.c:194:Failed to find [DEVBOSQLC6] in configuration files; trying 'SYBASE' instead.
config.c:793:Setting 'dump_file' to '/tmp/freetds.log' from $TDSDUMP.
config.c:714:tds_config_login: database_name is csn_junk.
config.c:793:Setting 'dump_file' to '/tmp/freetds.log' from $TDSDUMP.
dblib.c:1256:tdsdbopen: Calling tds_connect_and_login(0x1e82690, 0x1e82d00)
iconv.c:325:tds_iconv_open(0x1e82690, UTF-8)
iconv.c:185:local name for ISO-8859-1 is ISO-8859-1
iconv.c:185:local name for UTF-8 is UTF-8
iconv.c:185:local name for UCS-2LE is UCS-2LE
iconv.c:185:local name for UCS-2BE is UCS-2BE
iconv.c:343:setting up conversions for client charset "UTF-8"
iconv.c:345:preparing iconv for "UTF-8" <-> "UCS-2LE" conversion
iconv.c:384:tds_iconv_open: done
net.c:216:Connecting to 10.24.30.12 port 1433 (TDS version 7.2)
net.c:242:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:343:tds_open_socket() succeeded
packet.c:741:Sending packet
0000 12 01 00 3a 00 00 00 00-00 00 1a 00 06 01 00 20 |...:.... ....... |
0010 00 01 02 00 21 00 0c 03-00 2d 00 04 04 00 31 00 |....!... .-....1.|
0020 01 ff 09 00 00 00 00 00-00 4d 53 53 51 4c 53 65 |........ .MSSQLSe|
0030 72 76 65 72 00 5a 69 00-00 00                   |rver.Zi. ..|

packet.c:639:Received packet
0000 04 01 00 2b 00 00 01 00-00 00 1a 00 06 01 00 20 |...+.... ....... |
0010 00 01 02 00 21 00 01 03-00 22 00 00 04 00 22 00 |....!... ."....".|
0020 01 ff 0d 00 08 65 00 00-00 00 00                |.....e.. ...|

login.c:1185:detected flag 0
tls.c:116:in tds_push_func_login
tls.c:86:in tds_pull_func_login
packet.c:741:Sending packet
[redacted]

packet.c:639:Received packet
[redacted]

tls.c:86:in tds_pull_func_login
tls.c:116:in tds_push_func_login
packet.c:741:Sending packet
[redacted]

tls.c:86:in tds_pull_func_login
packet.c:639:Received packet
[redacted]

tls.c:86:in tds_pull_func_login
tls.c:86:in tds_pull_func_login
tls.c:86:in tds_pull_func_login
tls.c:901:handshake succeeded!!
login.c:923:quietly sending TDS 7+ login packet
token.c:298:tds_process_login_tokens()
packet.c:639:Received packet
[redacted]

token.c:306:looking for login token, got  e3(ENVCHANGE)
token.c:125:tds_process_default_tokens() marker is e3(ENVCHANGE)
dblib.c:310:db_env_chg(0x1e82690, 1, master, [redacted])
token.c:306:looking for login token, got  ab(INFO)
token.c:125:tds_process_default_tokens() marker is ab(INFO)
token.c:2328:tds_process_info() reading message 5701 from server
token.c:2400:tds_process_info() calling client msg handler
dbutil.c:74:_dblib_handle_info_message(0x1e37f30, 0x1e82690, 0x7fffffff9c70)
dbutil.c:75:msgno 5701: "Changed database context to '[redacted]'."
token.c:2417:tds_process_info() returning TDS_SUCCESS
token.c:306:looking for login token, got  e3(ENVCHANGE)
token.c:125:tds_process_default_tokens() marker is e3(ENVCHANGE)
token.c:2163:tds_process_env_chg(): 5 bytes of collation data received
token.c:2164:tds->conn->collation was
0000 00 00 00 00 00         -                        |.....|

iconv.c:780:setting server single-byte charset to "CP1252"
token.c:2174:tds->conn->collation now
0000 09 04 d0 20 00         -                        |... .|

token.c:306:looking for login token, got  e3(ENVCHANGE)
token.c:125:tds_process_default_tokens() marker is e3(ENVCHANGE)
dblib.c:310:db_env_chg(0x1e82690, 2, , us_english)
token.c:306:looking for login token, got  ab(INFO)
token.c:125:tds_process_default_tokens() marker is ab(INFO)
token.c:2328:tds_process_info() reading message 5703 from server
token.c:2400:tds_process_info() calling client msg handler
dbutil.c:74:_dblib_handle_info_message(0x1e37f30, 0x1e82690, 0x7fffffff9c70)
dbutil.c:75:msgno 5703: "Changed language setting to us_english."
token.c:2417:tds_process_info() returning TDS_SUCCESS
token.c:306:looking for login token, got  ad(LOGINACK)
token.c:344:server reports TDS version 72.9.0.2
token.c:346:Product name for 0x72090002 is 2005
token.c:378:Product version 8D000865
token.c:306:looking for login token, got  e3(ENVCHANGE)
token.c:125:tds_process_default_tokens() marker is e3(ENVCHANGE)
token.c:2220:changing block size from 4096 to 4096
dblib.c:310:db_env_chg(0x1e82690, 4, 4096, 4096)
token.c:306:looking for login token, got  fd(DONE)
token.c:125:tds_process_default_tokens() marker is fd(DONE)
token.c:2065:tds_process_end: more_results = 0
		was_cancelled = 0
		error = 0
		done_count_valid = 0
token.c:2082:                rows_affected = 0
token.c:2085:tds_process_end() state set to TDS_IDLE
token.c:415:tds_process_login_tokens() returning TDS_SUCCESS
mem.c:644:tds_free_all_results()
util.c:165:Changed query state from IDLE to WRITING
util.c:165:Changed query state from WRITING to PENDING
packet.c:741:Sending packet
0000 01 01 00 44 00 00 00 00-16 00 00 00 12 00 00 00 |...D.... ........|
0010 02 00 00 00 00 00 00 00-00 00 01 00 00 00 73 00 |........ ......s.|
0020 65 00 74 00 20 00 74 00-65 00 78 00 74 00 73 00 |e.t. .t. e.x.t.s.|
0030 69 00 7a 00 65 00 20 00-36 00 34 00 35 00 31 00 |i.z.e. . 6.4.5.1.|
0040 32 00 20 00            -                        |2. .|

token.c:525:tds_process_tokens(0x1e82690, 0x7fffffff9d58, 0x7fffffff9d5c, 0x100)
util.c:165:Changed query state from PENDING to READING
packet.c:639:Received packet
0000 04 01 00 15 01 7f 01 00-fd 00 00 be 00 00 00 00 |........ ........|
0010 00 00 00 00 00         -                        |.....|

token.c:540:processing result tokens.  marker is  fd(DONE)
token.c:2065:tds_process_end: more_results = 0
		was_cancelled = 0
		error = 0
		done_count_valid = 0
token.c:2082:                rows_affected = 0
token.c:2085:tds_process_end() state set to TDS_IDLE
util.c:165:Changed query state from READING to IDLE
util.c:83:logic error: cannot change query state from IDLE to PENDING
util.c:165:Changed query state from IDLE to IDLE
token.c:525:tds_process_tokens(0x1e82690, 0x7fffffff9d58, 0x7fffffff9d5c, 0x100)
token.c:528:tds_process_tokens() state is COMPLETED
dblib.c:222:dblib_add_connection(0x7fffebf5cb40, 0x1e82690)
dblib.c:1299:tdsdbopen: Returning dbproc = 0x1e81e10
dblib.c:4294:dbsetopt(0x1e81e10, 17, 2147483647, -1)
dblib.c:4294:dbsetopt(0x1e81e10, 35, 1, -1)
dblib.c:5759:dbsetuserdata(0x1e81e10, 0x7fffedc5a308)
dblib.c:3207:dbcancel(0x1e81e10)
query.c:2202:tds_send_cancel: not in_cancel and idle
dblib.c:1359:dbcmd(0x1e81e10, SELECT 1/0)
dblib.c:1365:dbcmd() bufsz = 0
dblib.c:1405:dbsqlexec(0x1e81e10)
dblib.c:6872:dbsqlsend(0x1e81e10)
mem.c:644:tds_free_all_results()
util.c:165:Changed query state from IDLE to WRITING
util.c:165:Changed query state from WRITING to PENDING
packet.c:741:Sending packet
0000 01 01 00 80 00 00 01 00-16 00 00 00 12 00 00 00 |........ ........|
0010 02 00 00 00 00 00 00 00-00 00 01 00 00 00 73 00 |........ ......s.|
0020 65 00 74 00 20 00 74 00-65 00 78 00 74 00 73 00 |e.t. .t. e.x.t.s.|
0030 69 00 7a 00 65 00 20 00-32 00 31 00 34 00 37 00 |i.z.e. . 2.1.4.7.|
0040 34 00 38 00 33 00 36 00-34 00 37 00 0a 00 73 00 |4.8.3.6. 4.7...s.|
0050 65 00 74 00 20 00 71 00-75 00 6f 00 74 00 65 00 |e.t. .q. u.o.t.e.|
0060 64 00 5f 00 69 00 64 00-65 00 6e 00 74 00 69 00 |d._.i.d. e.n.t.i.|
0070 66 00 69 00 65 00 72 00-20 00 6f 00 6e 00 0a 00 |f.i.e.r.  .o.n...|

token.c:525:tds_process_tokens(0x1e82690, 0x7fffffffa4bc, (nil), 0x6914)
util.c:165:Changed query state from PENDING to READING
packet.c:639:Received packet
0000 04 01 00 15 01 7f 01 00-fd 00 00 be 00 00 00 00 |........ ........|
0010 00 00 00 00 00         -                        |.....|

token.c:540:processing result tokens.  marker is  fd(DONE)
token.c:2065:tds_process_end: more_results = 0
		was_cancelled = 0
		error = 0
		done_count_valid = 0
token.c:2082:                rows_affected = 0
token.c:2085:tds_process_end() state set to TDS_IDLE
util.c:165:Changed query state from READING to IDLE
util.c:83:logic error: cannot change query state from IDLE to PENDING
util.c:165:Changed query state from IDLE to IDLE
token.c:525:tds_process_tokens(0x1e82690, 0x7fffffffa4bc, (nil), 0x6914)
token.c:528:tds_process_tokens() state is COMPLETED
mem.c:644:tds_free_all_results()
util.c:165:Changed query state from IDLE to WRITING
util.c:165:Changed query state from WRITING to PENDING
packet.c:741:Sending packet
0000 01 01 00 32 00 00 01 00-16 00 00 00 12 00 00 00 |...2.... ........|
0010 02 00 00 00 00 00 00 00-00 00 01 00 00 00 53 00 |........ ......S.|
0020 45 00 4c 00 45 00 43 00-54 00 20 00 31 00 2f 00 |E.L.E.C. T. .1./.|
0030 30 00                  -                        |0.|

dblib.c:4637:dbsqlok(0x1e81e10)
dblib.c:4666:dbsqlok() not done, calling tds_process_tokens()
token.c:525:tds_process_tokens(0x1e82690, 0x7fffffffa598, 0x7fffffffa59c, 0x6914)
util.c:165:Changed query state from PENDING to READING
packet.c:639:Received packet
0000 04 01 00 7c 01 7f 01 00-81 01 00 00 00 00 00 21 |...|.... .......!|
0010 00 26 04 00 d1 00 ab 56-00 17 0e 00 00 00 00 1a |.&.....V ........|
0020 00 44 00 69 00 76 00 69-00 73 00 69 00 6f 00 6e |.D.i.v.i .s.i.o.n|
0030 00 20 00 62 00 79 00 20-00 7a 00 65 00 72 00 6f |. .b.y.  .z.e.r.o|
0040 00 20 00 6f 00 63 00 63-00 75 00 72 00 72 00 65 |. .o.c.c .u.r.r.e|
[redacted]

token.c:540:processing result tokens.  marker is  81(TDS7_RESULT)
token.c:1538:processing TDS7 result metadata.
mem.c:644:tds_free_all_results()
token.c:1563:set current_results (1 column) to tds->res_info
token.c:1570:setting up 1 columns
token.c:1507:tds7_get_data_info: 
	colname = 
	type = 38 (integer-null)
	server's type = 38 (integer-null)
	column_varint_size = 1
	column_size = 4 (4 on server)
token.c:1579: name                 size/wsize      type/wtype      utype  
token.c:1580: -------------------- --------------- --------------- -------
token.c:1585:                            4/4            38/38            0
util.c:165:Changed query state from READING to PENDING
dblib.c:4692:dbsqlok() found result token
dblib.c:1700:dbresults(0x1e81e10)
dblib.c:1705:dbresults: dbresults_state is 1 (_DB_RES_RESULTSET_EMPTY)
token.c:525:tds_process_tokens(0x1e82690, 0x7fffffffa538, 0x7fffffffa53c, 0x6914)
util.c:165:Changed query state from PENDING to READING
token.c:540:processing result tokens.  marker is  d1(ROW)
token.c:644:tds_process_tokens::SET_RETURN stopping on current token
util.c:165:Changed query state from READING to PENDING
dblib.c:1726:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS),
			result_type TDS_ROW_RESULT
dblib.c:1689:dbresults returning 1 (SUCCEED)
dblib.c:2776:dbcount(0x1e81e10)
dblib.c:1838:dbnumcols(0x1e81e10)
dblib.c:2776:dbcount(0x1e81e10)
dblib.c:1838:dbnumcols(0x1e81e10)
dblib.c:1864:dbcolname(0x1e81e10, 1)
dblib.c:3048:dbcollen(0x1e81e10, 1)
dblib.c:1476:dbclose(0x1e81e10)
dblib.c:241:dblib_del_connection(0x7fffebf5cb40, 0x1e82690)
query.c:3796:tds_disconnect() 
util.c:165:Changed query state from PENDING to DEAD
mem.c:644:tds_free_all_results()
dblib.c:288:dblib_release_tds_ctx(1)
dblib.c:5881:dbfreebuf(0x1e81e10)
dblib.c:749:dbloginfree(0x1e21890)
dblib.c:1543:dbexit(void)
dblib.c:288:dblib_release_tds_ctx(1)