Fw: Problem when used union with differents column legth

Fw: Problem when used union with differents column legth

am 10.01.2006 14:12:52 von milton

This is a multi-part message in MIME format.

------=_NextPart_000_0026_01C615C6.08EC7560
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


Execute the script:
--------------------------------------------------------
CREATE TABLE A(
COL VARCHAR(3)
);

CREATE TABLE B(
COL VARCHAR(6)
);

INSERT INTO A VALUES ('T1');
INSERT INTO A VALUES ('T2');
INSERT INTO A VALUES ('T3');

INSERT INTO B VALUES ('T4');
INSERT INTO B VALUES ('T5');
INSERT INTO B VALUES ('T6');
--------------------------------------------------------


The result of the sql: SELECT COL FROM A UNION SELECT COL FROM B
COL

---------

T1

T2

T3

T4

T5

T6

=20

=20

But when i use rdoResultset(DAO), the result is:

COL

-----------

T1

T1

T1

T1

T1

T1



Now i use the sql "SELECT COL::varchar(6) FROM A UNION SELECT COL FROM =
B"

with rdoresultset i have the positive result:

COL

---------

T1

T2

T3

T4

T5

T6




In the others db=B4s drive it work...





I read the data with rdoResultset like this:

==================== =====3D=
==

set rdoQuery =3D connection.OpenResultset("SELECT COL FROM A UNION =
SELECT COL FROM B
", rdOpenKeyset, rdConcurReadOnly)

do while rdoQuery.EOF

Debug.print(rdoQuery!Col)

rdoQuery.MoveNext

loop

==================== =====3D=
===3D





Thanks...






------=_NextPart_000_0026_01C615C6.08EC7560
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



http-equiv=3DContent-Type>




 

Execute the script:

size=3D2>--------------------------------------------------- -----<=
/DIV>
CREATE TABLE A(
 COL=20
VARCHAR(3)
);

 

CREATE TABLE B(
 COL=20
VARCHAR(6)
);


INSERT INTO A VALUES =
('T1');
INSERT INTO A=20
VALUES ('T2');
INSERT INTO A VALUES ('T3');


INSERT INTO B VALUES =
('T4');
INSERT INTO B=20
VALUES ('T5');
INSERT INTO B VALUES ('T6');
size=3D2>--------------------------------------------------- -----<=
/FONT>


 


size=3D2>The=20
result of the sql: SELECT COL FROM A UNION SELECT COL FROM =
B
COL


size=3D2>---------


size=3D2>T1


size=3D2>T2


size=3D2>T3


size=3D2>T4


size=3D2>T5


size=3D2>T6


size=3D2> 


size=3D2> 


size=3D2>But when=20
i use rdoResultset(DAO), the result is:


size=3D2>COL


size=3D2>-----------


size=3D2>T1


size=3D2>T1


size=3D2>T1


size=3D2>T1


size=3D2>T1


size=3D2>T1


 


size=3D2>Now i use=20
the sql "SELECT COL::varchar(6) FROM A UNION SELECT COL FROM =
B"


size=3D2>with=20
rdoresultset i have the positive result:


size=3D2>COL


size=3D2>---------


size=3D2>T1


size=3D2>T2


size=3D2>T3


size=3D2>T4


size=3D2>T5


size=3D2>T6



 


size=3D2>In the=20
others db=B4s drive it work...


 


 


size=3D2>I read=20
the data with rdoResultset like this:


size=3D2>=================3D =====3D=
=====3D


size=3D2> face=3DArial size=3D2>set rdoQuery =3D connection.OpenResultset("SELECT =
COL FROM A=20
UNION SELECT COL FROM B
", rdOpenKeyset, =
rdConcurReadOnly)


size=3D2>do while=20
rdoQuery.EOF


size=3D2>    Debug.print(rdoQuery!Col)


size=3D2>    rdoQuery.MoveNext


size=3D2>loop


size=3D2>=================3D =====3D=
======


 


 


size=3D2>Thanks...


 


0px"> 



------=_NextPart_000_0026_01C615C6.08EC7560--

Re: Fw: Problem when used union with differents column legth

am 10.01.2006 18:05:29 von Ludek Finstrle

--GvXjxJ+pjyke8COw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

> But when i use rdoResultset(DAO), the result is:
>
> COL
> -----------
> T1
> T1
> T1
> T1
> T1
> T1

There is a problem in PGAPI_SetPos function.
Please try this patch which solve the problem.

Patch attached. Please test review and comment

Luf

--GvXjxJ+pjyke8COw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="psqlodbc-setpos.dif"

diff -c psqlodbc.orig\results.c psqlodbc\results.c
*** psqlodbc.orig\results.c Fri Dec 09 02:55:48 2005
--- psqlodbc\results.c Tue Jan 10 19:04:56 2006
***************
*** 3116,3121 ****
--- 3116,3123 ----
if (gdata)
for (i = 0; i < num_cols; i++)
gdata[i].data_left = -1;
+ if (irow < rowsetSize)
+ s.stmt->currTuple = s.stmt->rowset_start + irow - 1;
ret = SQL_SUCCESS;
#ifdef DRIVER_CURSOR_IMPLEMENT
conn = SC_get_conn(s.stmt);

--GvXjxJ+pjyke8COw
Content-Type: text/plain
Content-Disposition: inline
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

--GvXjxJ+pjyke8COw--