Re: [PHP-DB] MSSQL "FOR XML AUTO" php

2004-09-14 Thread Bozhan Boiadzhiev
HAHAHAHA
i am so sorry this is so called problem infornt of computer.
i didn't look in source of page and becouse of XML it isn't shown in page.
Very sorry
Thanks
Bozhan
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] MSSQL "FOR XML AUTO" php

2004-09-14 Thread Bozhan Boiadzhiev
Thanks Robert
but one thing i can't understand.
As you can see in my first message
freetds log contains such thing:
--
19:32:55.245996 tds_put_string converting 23 bytes of "exec 
GET_RESUME_AS_XML1"
19:32:55.246050 tds_put_string wrote 46 bytes
Sending packet @ 19:32:55.246091
 01 01 00 36 00 00 01 00-65 00 78 00 65 00 63 00 |...6 e.x.e.c.|
0010 20 00 47 00 45 00 54 00-5f 00 52 00 45 00 53 00 | .G.E.T. _.R.E.S.|
0020 55 00 4d 00 45 00 5f 00-41 00 53 00 5f 00 58 00 |U.M.E._. A.S._.X.|
0030 4d 00 4c 00 31 00  -|M.L.1.|

19:32:55.246297 in dbsqlok()
Received header @ 19:32:55.246705
 04 01 00 c2 00 34 01 00-|.4..|
Received packet @ 19:32:55.246790
 81 01 00 00 00 01 00 63-00 10 00 00 01 00 78 00 |...c ..x.|
0010 28 58 00 4d 00 4c 00 5f-00 46 00 35 00 32 00 45 |(X.M.L._ .F.5.2.E|
0020 00 32 00 42 00 36 00 31-00 2d 00 31 00 38 00 41 |.2.B.6.1 .-.1.8.A|
0030 00 31 00 2d 00 31 00 31-00 64 00 31 00 2d 00 42 |.1.-.1.1 .d.1.-.B|
0040 00 31 00 30 00 35 00 2d-00 30 00 30 00 38 00 30 |.1.0.5.- .0.0.8.0|
0050 00 35 00 46 00 34 00 39-00 39 00 31 00 36 00 42 |.5.F.4.9 .9.1.6.B|
0060 00 d1 10 00 00 00 00 00-00 00 00 00 00 00 00 00 | |
0070 00 00 00 00 00 00 00 00-00 00 00 24 00 00 00 3c | ...$...<|
0080 00 72 00 6f 00 77 00 20-00 63 00 6f 00 6c 00 31 |.r.o.w.  .c.o.l.1|
0090 00 3d 00 22 00 64 00 61-00 74 00 61 00 22 00 2f |.=.".d.a .t.a."./|
00a0 00 3e 00 ff 11 00 c1 00-01 00 00 00 79 00 00 00 |.>.. y...|
00b0 00 fe 00 00 e0 00 01 00-00 00   | ..|

If this information is ( if i can say it like this) already come to my 
machine
and i can read it in freetds.log  i don't think it's encoding problem.

*
*

Robert Twitty wrote:
HI Bozhan
When you append the "FOR XML" clause at the end of a query, the xml data
will be sent in a single column result set. The column's type is ntext,
which is not easily handled by FreeTDS and PHP. The reason is because it
is UC2-2 encoded UNICODE text. UNICODE text is easier to deal with if it
is encoded using UTF-8. Somewhere in FreeTDS's docs it talks about how to
do this.
However, rather than using FreeTDS, I would suggest using ODBTP, which is
available at http://odbtp.sourceforge.net. One of its biggest strengths
and advantages over FreeTDS is UNICODE data and query processing. It had
no problems executing your "FOR XML" query.  It also provides support for
all of PHP's mssql functions, so you don't have to change your code.
-- bob
On Tue, 14 Sep 2004, Bozhan Boiadzhiev wrote:
 

Hello i have such problem
Executing this script
php code:

  $stmt_page=mssql_init("GET_RESUME_AS_XML");
  mssql_bind($stmt_page,"RETVAL",$returnval,SQLVARCHAR);
  $execute_stmt=mssql_execute($stmt_page);

echo mssql_num_rows($execute_stmt);
do {
 while ($row = mssql_fetch_array($execute_stmt)) {
 print_r($row);
 }
 } while (mssql_next_result($execute_stmt));
?>
   

-- SNIP --
 

but the only result is:
1Array ( [0] => [XML_F52E2B61-18A1-11d1-B105-00805F49916B] => )

a little simple example:
PROCEDURE:
CREATE   PROCEDURE PRINT_XML_DATA
AS
SELECT 'data' as col1
FOR XML RAW
GO
executing this procdure form SQL Query Analyzer gives:
XML_----(whaever)


include "../msdb_conn.php";
/*
   $stmt_page=mssql_init(" PRINT_XML_DATA");
   $execute_stmt=mssql_execute($stmt_page);
*/
// I can execute this way too but whit same result 
$query=mssql_query("exec  PRINT_XML_DATA");
echo mssql_num_rows($query);
/*
while ($row = mssql_fetch_array($query)) {
  print_r($row);
  }
*/
// I can execute this way too but whit same result 
do {
  while ($row = mssql_fetch_array($query)) {
  print_r($row);
  }
  } while (mssql_next_result($query));
?>
and result is:
Array ( [0] => [XML_F52E2B61-18A1-11d1-B105-00805F49916B] => )
   

-- SNIP --
 

Can some one to tell me or to suggest me how i can do this thing.
And where is the problem in PHP or in FreeTDS or in me:) ???
Thanks
Bozhan
   

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] MSSQL "FOR XML AUTO" php

2004-09-14 Thread Robert Twitty
HI Bozhan

When you append the "FOR XML" clause at the end of a query, the xml data
will be sent in a single column result set. The column's type is ntext,
which is not easily handled by FreeTDS and PHP. The reason is because it
is UC2-2 encoded UNICODE text. UNICODE text is easier to deal with if it
is encoded using UTF-8. Somewhere in FreeTDS's docs it talks about how to
do this.

However, rather than using FreeTDS, I would suggest using ODBTP, which is
available at http://odbtp.sourceforge.net. One of its biggest strengths
and advantages over FreeTDS is UNICODE data and query processing. It had
no problems executing your "FOR XML" query.  It also provides support for
all of PHP's mssql functions, so you don't have to change your code.

-- bob

On Tue, 14 Sep 2004, Bozhan Boiadzhiev wrote:

> Hello i have such problem
> Executing this script
> php code:
>  session_start();
> include "../msdb_conn.php";
>
>
>$stmt_page=mssql_init("GET_RESUME_AS_XML");
>mssql_bind($stmt_page,"RETVAL",$returnval,SQLVARCHAR);
>
>$execute_stmt=mssql_execute($stmt_page);
>
>
>
> echo mssql_num_rows($execute_stmt);
> do {
>   while ($row = mssql_fetch_array($execute_stmt)) {
>   print_r($row);
>   }
>   } while (mssql_next_result($execute_stmt));
> ?>
>
-- SNIP --
>
> but the only result is:
> 1Array ( [0] => [XML_F52E2B61-18A1-11d1-B105-00805F49916B] => )
>
>
>
> a little simple example:
>
> PROCEDURE:
>
> CREATE   PROCEDURE PRINT_XML_DATA
> AS
> SELECT 'data' as col1
> FOR XML RAW
> GO
>
> executing this procdure form SQL Query Analyzer gives:
> XML_----(whaever)
> 
>
> 
> include "../msdb_conn.php";
>
> /*
> $stmt_page=mssql_init(" PRINT_XML_DATA");
> $execute_stmt=mssql_execute($stmt_page);
> */
> // I can execute this way too but whit same result 
>
>
> $query=mssql_query("exec  PRINT_XML_DATA");
> echo mssql_num_rows($query);
>
>
> /*
> while ($row = mssql_fetch_array($query)) {
>print_r($row);
>}
> */
> // I can execute this way too but whit same result 
>
>  do {
>while ($row = mssql_fetch_array($query)) {
>print_r($row);
>}
>
>} while (mssql_next_result($query));
> ?>
>
> and result is:
> Array ( [0] => [XML_F52E2B61-18A1-11d1-B105-00805F49916B] => )
>
-- SNIP --
> Can some one to tell me or to suggest me how i can do this thing.
> And where is the problem in PHP or in FreeTDS or in me:) ???
>
> Thanks
> Bozhan
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] MSSQL "FOR XML AUTO" php

2004-09-14 Thread Bozhan Boiadzhiev
Hello i have such problem
Executing this script
php code:

  $stmt_page=mssql_init("GET_RESUME_AS_XML");
  mssql_bind($stmt_page,"RETVAL",$returnval,SQLVARCHAR);
  $execute_stmt=mssql_execute($stmt_page);

echo mssql_num_rows($execute_stmt);
do {
 while ($row = mssql_fetch_array($execute_stmt)) {
 print_r($row);
 }
 } while (mssql_next_result($execute_stmt));
?>
i have this log
freetds.log:
Starting log file for FreeTDS 0.62.4
   on 2004-09-13 21:13:23 with debug level 99.
names for ISO-8859-1: ISO-8859-1
names for UTF-8: UTF-8
names for UCS-2LE: UCS-2LE
names for UCS-2BE: UCS-2BE
iconv to convert client-side data to the "ISO-8859-1" character set
21:13:23.147321 tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
21:13:23.147476 tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
21:13:23.147602 Connecting to 192.168.0.2 port 1433, TDS 8.0.
21:13:23.148371 tds_put_string converting 8 bytes of "carredas"
21:13:23.148535 tds_put_string wrote 16 bytes
21:13:23.148594 tds_put_string converting 2 bytes of "sa"
21:13:23.148642 tds_put_string wrote 4 bytes
21:13:23.148725 tds_put_string converting 7 bytes of "PHP 4.0"
21:13:23.148787 tds_put_string wrote 14 bytes
21:13:23.148828 tds_put_string converting 11 bytes of "192.168.0.2"
21:13:23.148873 tds_put_string wrote 22 bytes
21:13:23.148915 tds_put_string converting 10 bytes of "DB-Library"
21:13:23.148961 tds_put_string wrote 20 bytes
21:13:23.149003 tds_put_string converting 10 bytes of "us_english"
21:13:23.149049 tds_put_string wrote 20 bytes
21:13:23.149092 tds_put_string wrote 0 bytes
21:13:23.149300 tds_process_login_tokens()
Received header @ 21:13:23.150005
 04 01 01 73 00 38 01 00-|...s.8..|
Received packet @ 21:13:23.150166
 e3 1b 00 01 06 6d 00 61-00 73 00 74 00 65 00 72 |.m.a .s.t.e.r|
0010 00 06 6d 00 61 00 73 00-74 00 65 00 72 00 ab 64 |..m.a.s. t.e.r..d|
0020 00 45 16 00 00 02 00 25-00 43 00 68 00 61 00 6e |.E.% .C.h.a.n|
0030 00 67 00 65 00 64 00 20-00 64 00 61 00 74 00 61 |.g.e.d.  .d.a.t.a|
0040 00 62 00 61 00 73 00 65-00 20 00 63 00 6f 00 6e |.b.a.s.e . .c.o.n|
0050 00 74 00 65 00 78 00 74-00 20 00 74 00 6f 00 20 |.t.e.x.t . .t.o. |
0060 00 27 00 6d 00 61 00 73-00 74 00 65 00 72 00 27 |.'.m.a.s .t.e.r.'|
0070 00 2e 00 07 57 00 49 00-4e 00 32 00 30 00 30 00 |W.I. N.2.0.0.|
0080 33 00 00 00 00 e3 08 00-07 05 09 04 d0 00 34 00 |3... ..4.|
0090 e3 17 00 02 0a 75 00 73-00 5f 00 65 00 6e 00 67 |.u.s ._.e.n.g|
00a0 00 6c 00 69 00 73 00 68-00 00 ab 68 00 47 16 00 |.l.i.s.h ...h.G..|
00b0 00 01 00 27 00 43 00 68-00 61 00 6e 00 67 00 65 |...'.C.h .a.n.g.e|
00c0 00 64 00 20 00 6c 00 61-00 6e 00 67 00 75 00 61 |.d. .l.a .n.g.u.a|
00d0 00 67 00 65 00 20 00 73-00 65 00 74 00 74 00 69 |.g.e. .s .e.t.t.i|
00e0 00 6e 00 67 00 20 00 74-00 6f 00 20 00 75 00 73 |.n.g. .t .o. .u.s|
00f0 00 5f 00 65 00 6e 00 67-00 6c 00 69 00 73 00 68 |._.e.n.g .l.i.s.h|
0100 00 2e 00 07 57 00 49 00-4e 00 32 00 30 00 30 00 |W.I. N.2.0.0.|
0110 33 00 00 00 00 ad 36 00-01 71 00 00 01 16 4d 00 |3.6. .qM.|
0120 69 00 63 00 72 00 6f 00-73 00 6f 00 66 00 74 00 |i.c.r.o. s.o.f.t.|
0130 20 00 53 00 51 00 4c 00-20 00 53 00 65 00 72 00 | .S.Q.L.  .S.e.r.|
0140 76 00 65 00 72 00 00 00-00 00 08 00 02 f8 e3 11 |v.e.r... |
0150 00 04 03 35 00 31 00 32-00 04 34 00 30 00 39 00 |...5.1.2 ..4.0.9.|
0160 36 00 fd 00 00 00 00 00-00 00 00|6... ...|
21:13:23.150658 looking for login token, got  e3(ENVCHANGE)
21:13:23.150697 tds_process_default_tokens() marker is e3(ENVCHANGE)
tds_get_string: reading 12 from wire to give 6 to client.
tds_get_string: reading 12 from wire to give 6 to client.
21:13:23.150981 looking for login token, got  ab(INFO)
21:13:23.151034 tds_process_default_tokens() marker is ab(INFO)
tds_get_string: reading 74 from wire to give 37 to client.
tds_get_string: reading 14 from wire to give 7 to client.
21:13:23.151297 looking for login token, got  e3(ENVCHANGE)
21:13:23.151359 tds_process_default_tokens() marker is e3(ENVCHANGE)
21:13:23.153423 tds_iconv_info_init: converting "ISO-8859-1"->"CP1252"
21:13:23.153503 looking for login token, got  e3(ENVCHANGE)
21:13:23.153542 tds_process_default_tokens() marker is e3(ENVCHANGE)
tds_get_string: reading 20 from wire to give 10 to client.
21:13:23.153616 looking for login token, got  ab(INFO)
21:13:23.153661 tds_process_default_tokens() marker is ab(INFO)
tds_get_string: reading 78 from wire to give 39 to client.
tds_get_string: reading 14 from wire to give 7 to client.
21:13:23.153811 looking for login token, got  ad(LOGINACK)
tds_get_string: reading 44 from wire to give 22 to client.
21:13:23.153902 looking for login token, got  e3(ENVCHANGE)
21:13:23.153947 tds_process_default_tokens() marker is e3(ENVCHANGE)
tds_get_string: reading 6 from wire to give 3 to client.
tds_get_string: reading 8 from wire to give 4 to client.
21:13:23.154051 looking for login token, got  fd(DONE)
21:13:23.154097 tds_process_default_tokens()