Bug #30344 Headers
Submitted: 9 Aug 2007 22:18 Modified: 5 Dec 2007 8:40
Reporter: Maximiliano Manuel Polimeni
Status: Analyzing
Category:Connector/ODBC Severity:S3 (Non-critical)
Version:3.51.18,3.51.19,3.51.20 OS:Microsoft Windows (XP and 2003 Server)
Assigned to: Tonci Grgin Target Version:
Tags: powerbuilder, headers, odbc51_postga

[9 Aug 2007 22:18] Maximiliano Manuel Polimeni
Description:
Hello:

I'm using Sybase PowerBuilder 10.5.1 Build 6662 (the latest patch) in a system with
Windows 2003 Server. When I use MyODBC version 3.51.02, I can see the columns label y
heading perfectly, but when I update to the version 3.51.16 with the same ambient (PC,
database, etc) I see the headers incorrectly. Idem whith latest version, 3.51.18. I have
html examples files, and logs of this 3 version.

Thank you in advance.

Maxi

How to repeat:
With PowerBuilder installed (verions 6, 9, 10 and 10.5), MyODBC driver installed (since
versions 3.51.03 till 3.51.18). I open PowerBuilder, connect to a database and show the
column label and heading. For example: I am connected to NorthChamp database, from table
"equ" and column "codequ", I got label: equ_codequ and heading: equ_codequ (whit MyODBC
3.51.18). Using version 3.51.02 I got label:CODIGO and heading:codigo. For the tests, I
only change between differents versions of MyODBC, leaving alone everything else.
[9 Aug 2007 22:20] Maximiliano Manuel Polimeni
Result OK in HTML

Attachment: Resultado.html (application/octet-stream, text), 2.42 KiB.

[9 Aug 2007 22:21] Maximiliano Manuel Polimeni
Result Wrong in HTML

Attachment: Resultado.html (application/octet-stream, text), 2.15 KiB.

[9 Aug 2007 22:23] Maximiliano Manuel Polimeni
ODBC Log - 3.51.02

Attachment: SQL.LOG (application/octet-stream, text), 169.06 KiB.

[9 Aug 2007 22:24] Maximiliano Manuel Polimeni
ODBC Log - 3.51.16

Attachment: SQL.LOG (application/octet-stream, text), 169.68 KiB.

[14 Aug 2007 9:31] Susanne Ebrecht
Hi Maximiliano,

thank you for writing a bug report.

Usually you will get the column names as headers in your result.  

What happened, when you give aliases to the columns?
Something like:
select tab1.col1 as a, tab1.col2 as b from tab1;

Please try MyODBC version 3.51.19.

Regards,

Susanne
[27 Aug 2007 19:32] Maximiliano Manuel Polimeni
Hi Susanne:

If I use "as" like you told me, works fine. But the problem is that I need to change
headers and labels in the column properties, so that I can see anytime I make a query.

Thanks in advance.

Maxi
[27 Aug 2007 19:34] Maximiliano Manuel Polimeni
I forgot to say that now I am using MyODBC 3.51.19

Thanks.

Maxi

(Excuse my english. Surely you notice I don`t write it very well).
[28 Aug 2007 13:35] Tonci Grgin
Maxmiliano, I'll have latest release of PB in my hands by the start of next week. Then
I'll try to figure out what's happening.
[10 Sep 2007 22:01] Maximiliano Manuel Polimeni
Hello:

I try ODBC version 3.51.19 and I have same effects than with the previous versions.

Thanks.

Maxi
[11 Sep 2007 16:34] Tonci Grgin
Maximiliano, I have a request for you... I can't get past connecting MyODBC to PB 11. Can
you please attach full PB project that uses MyODBC and has like 1 form with box to enter
SQL to be executed so I can test?
[12 Sep 2007 16:34] Maximiliano Manuel Polimeni
Tonci: I attach a PB project that uses MyODBC.
Please, read the ReadMe.txt file.

Regards,
              Maxi.
[17 Sep 2007 8:17] Tonci Grgin
Maximiliano, I'm getting "transaction error" every time I try your example, so I actually
can't test. Could it be due to me using PB 11? I also noticed some of the PB tables
missing:
070917  8:12:49	      5 Query       SHOW TABLE STATUS LIKE 'pbcattbl'
070917  8:12:52	      5 Query       SHOW TABLE STATUS LIKE 'pbcatfmt'
070917  8:12:53	      5 Query       SHOW TABLE STATUS LIKE 'pbcatvld'
070917  8:12:55	      5 Query       SHOW TABLE STATUS LIKE 'pbcatedt'
[17 Sep 2007 17:02] Maximiliano Manuel Polimeni
Tonci: I don“t believe the problem is that you use PB 11. 
I detailed for you the steps for the connection:
1 - I suposse the:
		a - MySQL database is installed in your PC or in another PC accesible via MyODBC
		b - MyODBC driver is installed in your PC
		c - the MySQL database "test" is accesible via the MyODBC driver with the Data Source
Name "test", the User "root" and the Password "root". If you don't have a such Data
Source Name, please create it. If the User or Password is different, please go (in PB11)
to the window "w_example", open event and modify the line: SQLCA.DBParm =
"ConnectString='DSN=test;UID=root;PWD=root" with the aproppiate values
2 - Connect to a MySQL database "test" with PB11 (in DB Profile select ODB ODBC, New,
Profile name: test, Data Source: test, UserId=root, Password: root, 		OK). If this fail,
please tell me the error message you obtain.
3 - If 2 is ok, then run the application and now it would have to connect at database. If
this fail, please tell me the error message you obtain.

I send a new version the "Example_PB_vs_MyODBC.rar" with error messages for a connection
fail.

Regards,
					Maxi.
[28 Sep 2007 20:57] Tonci Grgin
Maximiliano, thanks for additional info provided and sorry for the delay. We had DevCon
last week.
[28 Sep 2007 21:33] Tonci Grgin
Maximiliano, I would be very very pleased if I get more report like yours. Thanks!

Environment:
 - MySQL server 5.0.50-pb1046 on WinXP Pro SP2 localhost
 - MyODBC 3.51.20
 - PB 11.0
 - DSN set up with latin1 as default connection cset, Return matching rows, Allow big
result, Change BIGINT columns to Int, Enable auto_increment search, forward only cursors,
Force use of FO cursors

I did not observe the problem you described, not in PB nor in generic MS ODBC client,
odbcte32.exe...

Snip from odbcte32.exe:
	Full Connect(Default)

	Env. Attr. SQL_ATTR_ODBC_VERSION set to SQL_OV_ODBC3

	Successfully connected to DSN 'test'.
SQLExecDirect:
				In:				hstmt = 0x008522C0, szSqlStr = "SELECT * FROM example", 
										cbSqlStr = -3
				Return:	SQL_SUCCESS=0

Get Data All:
"exa_code", "exa_desc"
1, "DESCR 1"
2, "DESCR 2"
2 rows fetched from 2 columns.

In PB I see only one row retrieved but that could be due to functions called for reading
and I have absolutely no expertise in PB.

What I recommend is to upgrade to latest version of MyODBC and try again.
[28 Sep 2007 21:34] Tonci Grgin
PB 11.0 screen-shot

Attachment: Bug30344.JPG (image/jpeg, text), 13.64 KiB.

[1 Oct 2007 19:49] Maximiliano Manuel Polimeni
Comparing table headers

Attachment: Comparing Table Headers.JPG (image/pjpeg, text), 36.51 KiB.

[1 Oct 2007 19:50] Maximiliano Manuel Polimeni
Tonci: I sent a new screenshot, comparing the headers. When I use MyODBC 3.51.02, I get
the headers on the left capture and when I use MyODBC 3.51.20 (any version greater than
3.51.02) I get the headers on the right capture. The problem is in the table headers, not
in table data as you can see in the attachment.

Thanks.

Maxi
[1 Oct 2007 20:37] Tonci Grgin
Maximiliano, I do understand the problem, it's clear from the title :-). As you can see
from my screen shot, I can't repeat it. However, I'll try to get second opinion as for
what might be causing this.
[1 Oct 2007 20:49] Maximiliano Manuel Polimeni
Tonci:

To repeat the problem, uninstall MyODBC 3.51.20 and install MyODBC 3.51.02. After that,
run the aplication I sent to you and you will see the corrects headers.

Thanks.

Maxi
[3 Oct 2007 8:27] Tonci Grgin
Maximiliano, I fail to recognize the problem here. Obviously PB does some of it's own
formatting (notice that "_" is missing and the table names are in camel caps) much like
MS interprets Some_Text as Some_T_ext (T is underlined). Also, I don't see where you
change "exa_code" to "Code" in your source as it is not done via SQL (SELECT exa_code AS
Code ...). How is it done actually?
[3 Oct 2007 14:31] Maximiliano Manuel Polimeni
Tonci: as you tell PB does some with the syntax for the datawindow (SyntaxFromSQL
instruction). If you open the script for the click event of the cb_1 button of the
w_example window you see my comment:

// The problem is here, with SyntaxFromSQL: 
// connecting with MyODBC 3.51.02 ls_sin contains "text(band=header text="CODE" x="14"
y="8" height="52" width="274" font.face="Tahoma" font.height="-8" font.weight="400"
font.charset="0" font.pitch="2" font.family="2" font.underline="0" font.italic="0"
font.strikethrough="0" border="0" color="0" background.mode="1"
background.color="536870912" alignment="2"  name=exa_code_t )"
// and we can see the headers correctly;
// whereas, with other MyODBC ls_sin contain "text(band=header text="exa_code_t" x="14"
y="8" height="52" width="274" font.face="Tahoma" font.height="-8" font.weight="400"
font.charset="0" font.pitch="2" font.family="2" font.underline="0" font.italic="0"
font.strikethrough="0" border="0" color="0" background.mode="1"
background.color="536870912" alignment="2"  name=exa_code_t )"
// and we see the headers with the name of the fields not with the header in the pbcatcol
table.
ls_sin = SQLCA.SyntaxFromSQL(mle_1.text,'Style(Type=Grid)',ls_err)

The key is in the pbcatcol table of PB: if you run "select pbc_hdr, pbc_tnam, pbc_ownr,
pbc_cnam from pbcatcol where pbc_cnam = 'exa_code' ;" you can modify the pbc_hdr column.
In the example the value for pbc_hdr is 'CODE'. If you change this value for, by example,
'PEPITO' with MyODBC 3.51.02 you will see the correct header: 'PEPITO'; but with other
MyODBC you will see 'exa_code' (the name of column, not the "alias" (PEPITO) you put in
pbc_hdr).

Regards,
           Maxi.
[4 Dec 2007 21:07] Maximiliano Manuel Polimeni
Hello Tonci:

Any news in my case?

Regards,
           Maxi.
[5 Dec 2007 8:40] Tonci Grgin
Maximiliano, sorry for the delay. I haven't forgotten this report! Indeed I made contact
with people from Sybase Europe and they promised to help me on this (as Croatian office
is not fully staffed yet). First I'll install software I got from them on clean VM and
retest.
[25 Feb 2008 9:01] Tonci Grgin
This could have been fixed with fix for Bug#30965 but still needs proper test.