RE: Make Test Failed For DBD-Oracle 1.24

2010-06-04 Thread Yeow Yiew Choong-PBKN64
Hi John,
 
I read in the link, but I do not have Gnu ld 64bit as mentioned in the
document.
I cannot do the same for my issue.
However, I found another link
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=10
95121 which mentioned that most likely cause by mixing 32bit perl using
/usr/lib/dld.sl trying to access/load 64bit Oracle.
My perl version is listed below:
 
# perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 3) configuration:
  Platform:
osname=hpux, osvers=11.00, archname=PA-RISC1.1-thread-multi

Can someone tell me what should I do.
Do I need to upgrade my perl to 64bit version?
How?
 
Thanks.
 
regards,
YC



From: John Scoles [mailto:byter...@hotmail.com] 
Sent: Wednesday, June 02, 2010 8:41 PM
To: Yeow Yiew Choong-PBKN64; dbi-users@perl.org
Subject: RE: Make Test Failed For DBD-Oracle 1.24


Never ran into that myself but this link looks like the same error
 
http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=10944
7626+1272030523151+28353475threadId=1078200
 
cheers
John
 



Subject: Make Test Failed For DBD-Oracle 1.24
Date: Tue, 1 Jun 2010 19:04:44 +0800
From: pbk...@motorola.com
To: dbi-users@perl.org


Hi,
 
I have problem when I run make test for DBD::Oracle 1.24 module.
My Oracle database is on remote server.
Oracle database version is 10g, and my Oracle client is version 10.2
(64bit) on HP-UX 11.11(PA-RISC) 64bit OS.
I can run splplus to connect to remote database.
My perl is version 5.8.3.
My DBI version is 1.611.
perl Makefile.PL -l and make command completed without error.
However, make test failed.
 
Please refer the below output and maketest.log in attachment.
 
# perl Makefile.PL -l
Using DBI 1.611 (for perl 5.008003 on PA-RISC1.1-thread-multi) installed
in /opt/perl/lib/site_perl/5.8.3/PA-RISC1.1-thread-multi/auto/DBI/
 
Configuring DBD::Oracle for perl 5.008003 on hpux
(PA-RISC1.1-thread-multi)
 
Remember to actually *READ* the README file! Especially if you have any
problems.
 
Installing on a hpux, Ver#11.00
Using Oracle in /opt/oracle/product/10.2.0/client_1
DEFINE _SQLPLUS_RELEASE = 1002000100 (CHAR)
Oracle version 10.2.0.1 (10.2)
Found direct-link candidates: libclntsh.sl
Oracle sysliblist:  -lrt -lpthread -l:libnss_dns.1 -lnsl
Found header files in /opt/oracle/product/10.2.0/client_1/rdbms/public.
Your LD_LIBRARY_PATH env var is set to
'/opt/oracle/product/10.2.0/client_1/lib'
WARNING: Your LD_LIBRARY_PATH env var doesn't include
'/opt/oracle/product/10.2.0/client_1/lib32' but probably needs to.
WARNING: If you have trouble, see README.hpux.txt...
you may have to build your own perl, or go hunting for libraries
 
Checking for functioning wait.ph
 

System: perl5.008003 hp-ux bertha b.11.00 u 9000800 136901587
unlimited-user license
Compiler:   cc -fast +Onolimit +Opromote_indirect_calls +DAportable
+DS2.0  -D_POSIX_C_SOURCE=199506L -D_REENTRANT -Ae -D_HPUX_SOURCE
-Wl,+vnocompatwarnings -DNO_HASH_SEED -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64
Linker: /usr/bin/ld
Sysliblist:  -lrt -lpthread -l:libnss_dns.1 -lnsl
Linking with -lclntsh.
 
Checking if your kit is complete...
Looks good
Note (probably harmless): No library found for -l:libnss_dns.1
LD_RUN_PATH=/opt/oracle/product/10.2.0/client_1/lib32
Using DBD::Oracle 1.24.
Using DBD::Oracle 1.24.
Using DBI 1.611 (for perl 5.008003 on PA-RISC1.1-thread-multi) installed
in /opt/perl/lib/site_perl/5.8.3/PA-RISC1.1-thread-multi/auto/DBI/
Writing Makefile for DBD::Oracle
 
***  If you have problems...
 read all the log printed above, and the README and README.help.txt
files.
 (Of course, you have read README by now anyway, haven't you?)

 
Refer my perl version:
 
# perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 3) configuration:
  Platform:
osname=hpux, osvers=11.00, archname=PA-RISC1.1-thread-multi
uname='hp-ux bertha b.11.00 u 9000800 136901587 unlimited-user
license '
config_args='-ders -Dcc=cc -Accflags=-DNO_HASH_SEED -Dusethreads
-Duseithreads -Ud_sigsetjmp -Uinstallusrbinperl -Ulocincpth=
-Uloclibpth= -Dd_attribut=undef -Dd_u32align=define
-Darchname=PA-RISC1.1 -Doptimize=-fast +Onolimit
+Opromote_indirect_calls  +DAportable +DS2.0 -Duselargefiles
-Dinc_version_list=5.8.2/$archname 5.8.2 5.8.1/$archname 5.8.1
5.8.0/$archname 5.8.0 -Duseshrplib -Dprefix=/opt/perl
-Dcf_by=ActiveState -dcf_email=supp...@activestate.com'
mailto:-dcf_email=supp...@activestate.com' 
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
  Compiler:
cc='cc', ccflags =' -D_POSIX_C_SOURCE=199506L -D_REENTRANT -Ae
-D_HPUX_SOURCE -Wl,+vnocompatwarnings -DNO_HASH_SEED -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 ',
optimize='-fast 

Re: SQLite - Time to build a database

2010-06-04 Thread Bart Lateur
On Thu, 3 Jun 2010 11:55:47 +0300, Henri Asseily wrote:

If you're ok with one big transaction where if it fails you have to redo it 
all, then just do the above.

Well in the root post he did say:

1500 of these rows have faulty data.

so I don't think it's OK to fail completely on an error... Unless the
data gets prescreened. In Perl.

-- 
Bart Lateur
bart.lat...@telenet.be


RE: Make Test Failed For DBD-Oracle 1.24

2010-06-04 Thread Yeow Yiew Choong-PBKN64
Hi John,
 
I use both 32bit  64bit instant client of Oracle, still failed at make
test.
Thanks.
 
regards,
YC



From: John Scoles [mailto:byter...@hotmail.com] 
Sent: Thursday, June 03, 2010 7:12 PM
To: Yeow Yiew Choong-PBKN64; dbi-users@perl.org
Subject: RE: Make Test Failed For DBD-Oracle 1.24


If that is the case then use the 32bit instant client, (you can get that
for free from Oracle)
and compile against that.  

 



Subject: RE: Make Test Failed For DBD-Oracle 1.24
Date: Thu, 3 Jun 2010 17:42:16 +0800
From: pbk...@motorola.com
To: byter...@hotmail.com; dbi-users@perl.org


Hi John,
 
I read in the link, but I do not have Gnu ld 64bit as mentioned in the
document.
I cannot do the same for my issue.
However, I found another link
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=10
95121 which mentioned that most likely cause by mixing 32bit perl using
/usr/lib/dld.sl trying to access/load 64bit Oracle.
My perl version is listed below:
 
# perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 3) configuration:
  Platform:
osname=hpux, osvers=11.00, archname=PA-RISC1.1-thread-multi

Can someone tell me what should I do.
Do I need to upgrade my perl to 64bit version?
How?
 
Thanks.
 
regards,
YC



From: John Scoles [mailto:byter...@hotmail.com] 
Sent: Wednesday, June 02, 2010 8:41 PM
To: Yeow Yiew Choong-PBKN64; dbi-users@perl.org
Subject: RE: Make Test Failed For DBD-Oracle 1.24


Never ran into that myself but this link looks like the same error
 
http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=10944
7626+1272030523151+28353475threadId=1078200
 
cheers
John
 



Subject: Make Test Failed For DBD-Oracle 1.24
Date: Tue, 1 Jun 2010 19:04:44 +0800
From: pbk...@motorola.com
To: dbi-users@perl.org


Hi,
 
I have problem when I run make test for DBD::Oracle 1.24 module.
My Oracle database is on remote server.
Oracle database version is 10g, and my Oracle client is version 10.2
(64bit) on HP-UX 11.11(PA-RISC) 64bit OS.
I can run splplus to connect to remote database.
My perl is version 5.8.3.
My DBI version is 1.611.
perl Makefile.PL -l and make command completed without error.
However, make test failed.
 
Please refer the below output and maketest.log in attachment.
 
# perl Makefile.PL -l
Using DBI 1.611 (for perl 5.008003 on PA-RISC1.1-thread-multi) installed
in /opt/perl/lib/site_perl/5.8.3/PA-RISC1.1-thread-multi/auto/DBI/
 
Configuring DBD::Oracle for perl 5.008003 on hpux
(PA-RISC1.1-thread-multi)
 
Remember to actually *READ* the README file! Especially if you have any
problems.
 
Installing on a hpux, Ver#11.00
Using Oracle in /opt/oracle/product/10.2.0/client_1
DEFINE _SQLPLUS_RELEASE = 1002000100 (CHAR)
Oracle version 10.2.0.1 (10.2)
Found direct-link candidates: libclntsh.sl
Oracle sysliblist:  -lrt -lpthread -l:libnss_dns.1 -lnsl
Found header files in /opt/oracle/product/10.2.0/client_1/rdbms/public.
Your LD_LIBRARY_PATH env var is set to
'/opt/oracle/product/10.2.0/client_1/lib'
WARNING: Your LD_LIBRARY_PATH env var doesn't include
'/opt/oracle/product/10.2.0/client_1/lib32' but probably needs to.
WARNING: If you have trouble, see README.hpux.txt...
you may have to build your own perl, or go hunting for libraries
 
Checking for functioning wait.ph
 

System: perl5.008003 hp-ux bertha b.11.00 u 9000800 136901587
unlimited-user license
Compiler:   cc -fast +Onolimit +Opromote_indirect_calls +DAportable
+DS2.0  -D_POSIX_C_SOURCE=199506L -D_REENTRANT -Ae -D_HPUX_SOURCE
-Wl,+vnocompatwarnings -DNO_HASH_SEED -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64
Linker: /usr/bin/ld
Sysliblist:  -lrt -lpthread -l:libnss_dns.1 -lnsl
Linking with -lclntsh.
 
Checking if your kit is complete...
Looks good
Note (probably harmless): No library found for -l:libnss_dns.1
LD_RUN_PATH=/opt/oracle/product/10.2.0/client_1/lib32
Using DBD::Oracle 1.24.
Using DBD::Oracle 1.24.
Using DBI 1.611 (for perl 5.008003 on PA-RISC1.1-thread-multi) installed
in /opt/perl/lib/site_perl/5.8.3/PA-RISC1.1-thread-multi/auto/DBI/
Writing Makefile for DBD::Oracle
 
***  If you have problems...
 read all the log printed above, and the README and README.help.txt
files.
 (Of course, you have read README by now anyway, haven't you?)

 
Refer my perl version:
 
# perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 3) configuration:
  Platform:
osname=hpux, osvers=11.00, archname=PA-RISC1.1-thread-multi
uname='hp-ux bertha b.11.00 u 9000800 136901587 unlimited-user
license '
config_args='-ders -Dcc=cc -Accflags=-DNO_HASH_SEED -Dusethreads
-Duseithreads -Ud_sigsetjmp -Uinstallusrbinperl -Ulocincpth=
-Uloclibpth= -Dd_attribut=undef -Dd_u32align=define
-Darchname=PA-RISC1.1 -Doptimize=-fast +Onolimit
+Opromote_indirect_calls  +DAportable +DS2.0 -Duselargefiles
-Dinc_version_list=5.8.2/$archname 5.8.2 5.8.1/$archname 5.8.1

Re: Make Test Failed For DBD-Oracle 1.24

2010-06-04 Thread John Scoles
You will have to point the compile job to point to the 32bit client.

Can we the output of the perl Makefile.PL  and make runs?

On Fri, Jun 4, 2010 at 2:17 AM, Yeow Yiew Choong-PBKN64 pbk...@motorola.com
 wrote:

 Hi John,

 I use both 32bit  64bit instant client of Oracle, still failed at make
 test.
 Thanks.

 regards,
 YC

 

 From: John Scoles [mailto:byter...@hotmail.com]
 Sent: Thursday, June 03, 2010 7:12 PM
 To: Yeow Yiew Choong-PBKN64; dbi-users@perl.org
 Subject: RE: Make Test Failed For DBD-Oracle 1.24


 If that is the case then use the 32bit instant client, (you can get that
 for free from Oracle)
 and compile against that.



 

 Subject: RE: Make Test Failed For DBD-Oracle 1.24
 Date: Thu, 3 Jun 2010 17:42:16 +0800
 From: pbk...@motorola.com
 To: byter...@hotmail.com; dbi-users@perl.org


 Hi John,

 I read in the link, but I do not have Gnu ld 64bit as mentioned in the
 document.
 I cannot do the same for my issue.
 However, I found another link
 http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=10
 95121 which mentioned that most likely cause by mixing 32bit perl using
 /usr/lib/dld.sl trying to access/load 64bit Oracle.
 My perl version is listed below:

 # perl -V
 Summary of my perl5 (revision 5.0 version 8 subversion 3) configuration:
  Platform:
osname=hpux, osvers=11.00, archname=PA-RISC1.1-thread-multi

 Can someone tell me what should I do.
 Do I need to upgrade my perl to 64bit version?
 How?

 Thanks.

 regards,
 YC

 

 From: John Scoles [mailto:byter...@hotmail.com]
 Sent: Wednesday, June 02, 2010 8:41 PM
 To: Yeow Yiew Choong-PBKN64; dbi-users@perl.org
 Subject: RE: Make Test Failed For DBD-Oracle 1.24


 Never ran into that myself but this link looks like the same error

 http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=10944
 7626+1272030523151+28353475threadId=1078200http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=10944%0A7626+1272030523151+28353475threadId=1078200

 cheers
 John


 

 Subject: Make Test Failed For DBD-Oracle 1.24
 Date: Tue, 1 Jun 2010 19:04:44 +0800
 From: pbk...@motorola.com
 To: dbi-users@perl.org


 Hi,

 I have problem when I run make test for DBD::Oracle 1.24 module.
 My Oracle database is on remote server.
 Oracle database version is 10g, and my Oracle client is version 10.2
 (64bit) on HP-UX 11.11(PA-RISC) 64bit OS.
 I can run splplus to connect to remote database.
 My perl is version 5.8.3.
 My DBI version is 1.611.
 perl Makefile.PL -l and make command completed without error.
 However, make test failed.

 Please refer the below output and maketest.log in attachment.

 # perl Makefile.PL -l
 Using DBI 1.611 (for perl 5.008003 on PA-RISC1.1-thread-multi) installed
 in /opt/perl/lib/site_perl/5.8.3/PA-RISC1.1-thread-multi/auto/DBI/

 Configuring DBD::Oracle for perl 5.008003 on hpux
 (PA-RISC1.1-thread-multi)

 Remember to actually *READ* the README file! Especially if you have any
 problems.

 Installing on a hpux, Ver#11.00
 Using Oracle in /opt/oracle/product/10.2.0/client_1
 DEFINE _SQLPLUS_RELEASE = 1002000100 (CHAR)
 Oracle version 10.2.0.1 (10.2)
 Found direct-link candidates: libclntsh.sl
 Oracle sysliblist:  -lrt -lpthread -l:libnss_dns.1 -lnsl
 Found header files in /opt/oracle/product/10.2.0/client_1/rdbms/public.
 Your LD_LIBRARY_PATH env var is set to
 '/opt/oracle/product/10.2.0/client_1/lib'
 WARNING: Your LD_LIBRARY_PATH env var doesn't include
 '/opt/oracle/product/10.2.0/client_1/lib32' but probably needs to.
 WARNING: If you have trouble, see README.hpux.txt...
you may have to build your own perl, or go hunting for libraries

 Checking for functioning wait.ph


 System: perl5.008003 hp-ux bertha b.11.00 u 9000800 136901587
 unlimited-user license
 Compiler:   cc -fast +Onolimit +Opromote_indirect_calls +DAportable
 +DS2.0  -D_POSIX_C_SOURCE=199506L -D_REENTRANT -Ae -D_HPUX_SOURCE
 -Wl,+vnocompatwarnings -DNO_HASH_SEED -D_LARGEFILE_SOURCE
 -D_FILE_OFFSET_BITS=64
 Linker: /usr/bin/ld
 Sysliblist:  -lrt -lpthread -l:libnss_dns.1 -lnsl
 Linking with -lclntsh.

 Checking if your kit is complete...
 Looks good
 Note (probably harmless): No library found for -l:libnss_dns.1
 LD_RUN_PATH=/opt/oracle/product/10.2.0/client_1/lib32
 Using DBD::Oracle 1.24.
 Using DBD::Oracle 1.24.
 Using DBI 1.611 (for perl 5.008003 on PA-RISC1.1-thread-multi) installed
 in /opt/perl/lib/site_perl/5.8.3/PA-RISC1.1-thread-multi/auto/DBI/
 Writing Makefile for DBD::Oracle

 ***  If you have problems...
 read all the log printed above, and the README and README.help.txt
 files.
 (Of course, you have read README by now anyway, haven't you?)


 Refer my perl version:

 # perl -V
 Summary of my perl5 (revision 5.0 version 8 subversion 3) configuration:
  Platform:
osname=hpux, osvers=11.00, archname=PA-RISC1.1-thread-multi
uname='hp-ux bertha b.11.00 u 

need help on $sth-bind_param

2010-06-04 Thread Palla, James
PERL.ORG DBI-USERS,
Where can I find the valid syntax for the  DBI command $sth-bind_param.

The perldoc DBI command shows me this:

   $rc = $sth-bind_param($p_num, $bind_value);
   $rc = $sth-bind_param($p_num, $bind_value, $bind_type);
   $rc = $sth-bind_param($p_num, $bind_value, \%attr);

How can I see the valid $bind_type values, the third parameter in the command   
$sth-bind_param($p_num, $bind_value, $bind_type) ???

I need to know  this because of an SQL0440N error I got when running a perl 
program under development.  It is the first time I am using a WHERE CLAUSE LIKE 
predicate.  A google search suggests I need to provide a bind_parameter to 
resolve the SQL0440N error such as this:

$sth-bind_param( 1, 'DB', $attrib_char );
$sth-bind_param( 2, 'TEXAS', $attrib_char );

The column in the DBI prepare that we believe is the problem is a TIMESTAMP 
column.

Our perl release is perl v5.8.6.

We are running DB2 V8.2 fixpack 18 on UNIX.

An help you can give us will be much appreciated.

James
858-246-0300

James Palla
Database Administrator
ACT Data Center
University of California, San Diego
Office:   858-246-0300
Home:   858-538-5685
Cell:  858-380-7912
Fax:   858-534-8610
Email: jpa...@ucsd.edu

   my $sthINQ = $dbh-prepare(SELECT DBA_ID, .
  CHANGE_TIME, .
  FP_TICKET, .
  DB_NAME, .
  SCHEMA_NAME, .
  OBJ_NAME, .
  OBJ_TYPE, .
  ENV_CODE, .
  SCRIPT_DIRECTORY, .
  SUBSTR(CHANGE_DESC,1,50) AS CHANGE_DESC, .
  REQUESTED_BY  .
  FROM DBA.DBA_CHANGE_LOG .
  WHERE DBA_ID = ? .
  AND CHANGE_TIME LIKE ? .
  ORDER BY 1,2 )
  or die prepare #4 failed:  . $dbh-errstr();

   $sthINQ-bind_param(1,$dba_id);
   $sthINQ-bind_param(2,$change_time_LIKE);

   $sthINQ-execute()
  or die execute #4 failed:  . $sthINQ-errstr();


Re: need help on $sth-bind_param

2010-06-04 Thread Robert Roggenbuck

Palla, James schrieb:

PERL.ORG DBI-USERS,
Where can I find the valid syntax for the  DBI command $sth-bind_param.

The perldoc DBI command shows me this:

   $rc = $sth-bind_param($p_num, $bind_value);
   $rc = $sth-bind_param($p_num, $bind_value, $bind_type);
   $rc = $sth-bind_param($p_num, $bind_value, \%attr);

How can I see the valid $bind_type values, the third parameter in the command   
$sth-bind_param($p_num, $bind_value, $bind_type) ???

I need to know  this because of an SQL0440N error I got when running a perl 
program under development.  It is the first time I am using a WHERE CLAUSE LIKE 
predicate.  A google search suggests I need to provide a bind_parameter to 
resolve the SQL0440N error such as this:

$sth-bind_param( 1, 'DB', $attrib_char );
$sth-bind_param( 2, 'TEXAS', $attrib_char );

The column in the DBI prepare that we believe is the problem is a TIMESTAMP 
column.

Our perl release is perl v5.8.6.

We are running DB2 V8.2 fixpack 18 on UNIX.

An help you can give us will be much appreciated.

James
858-246-0300

James Palla
Database Administrator
ACT Data Center
University of California, San Diego
Office:   858-246-0300
Home:   858-538-5685
Cell:  858-380-7912
Fax:   858-534-8610
Email: jpa...@ucsd.edu

   my $sthINQ = $dbh-prepare(SELECT DBA_ID, .
  CHANGE_TIME, .
  FP_TICKET, .
  DB_NAME, .
  SCHEMA_NAME, .
  OBJ_NAME, .
  OBJ_TYPE, .
  ENV_CODE, .
  SCRIPT_DIRECTORY, .
  SUBSTR(CHANGE_DESC,1,50) AS CHANGE_DESC, .
  REQUESTED_BY  .
  FROM DBA.DBA_CHANGE_LOG .
  WHERE DBA_ID = ? .
  AND CHANGE_TIME LIKE ? .
  ORDER BY 1,2 )
  or die prepare #4 failed:  . $dbh-errstr();

   $sthINQ-bind_param(1,$dba_id);
   $sthINQ-bind_param(2,$change_time_LIKE);

   $sthINQ-execute()
  or die execute #4 failed:  . $sthINQ-errstr();



Have a look at the DBI documentation:

citation src=http://search.cpan.org/~timb/DBI-1.609/DBI.pm#bind_param;

Data Types for Placeholders

The \%attr parameter can be used to hint at the data type the placeholder should 
have. This is rarely needed. Typically, the driver is only interested in knowing 
if the placeholder should be bound as a number or a string.


  $sth-bind_param(1, $value, { TYPE = SQL_INTEGER });

As a short-cut for the common case, the data type can be passed directly, in 
place of the \%attr hash reference. This example is equivalent to the one above:


  $sth-bind_param(1, $value, SQL_INTEGER);

The TYPE value indicates the standard (non-driver-specific) type for this 
parameter. To specify the driver-specific type, the driver may support a 
driver-specific attribute, such as { ora_type = 97 }.


The SQL_INTEGER and other related constants can be imported using

  use DBI qw(:sql_types);

/citation

For the possible values of $bind_type look in the code of DBI.pm for 
'sql_types'.

Greetings

Robert



Re: Unicode and Sybase univarchar

2010-06-04 Thread Alexander Foken


... should just work. It doesn't quite, because the hex string is not 
just a dump of a 16 Bit Unicode encoding, but it is a UTF-8 byte 
stream written with a 16 Bit Hex Format for each byte. Each and every 
16-Bit-Word has its most significant byte set to 0.


If it was a dump of a 16 Bit Unicode encoding, it should read
0065006d00200064006100730068003a00202014
and not
0065006d00200064006100730068003a002000e200800094

Your call to decode() compensates that, probably because you encoded 
once too much before writing the data into the database.


I did not encode at all. I simply created a utf8 string in Perl land 
and inserted it into Sybase.
And Sybase / DBD::Sybase happily ignored Perl's UTF8 flag and stored the 
byte stream as if it were characters.


Really, DBD::Sybase needs to handle any character set translation, not 
the end user.


Right. (But remember that DBI was there before Unicode support was added 
to Perl, and also most DBDs are older that the Unicode support. Before 
Unicode was there, you just passed bytes around and everything just worked.)


For the same reason, but with a different DBD, I hacked the first 
Unicode patch for DBD::ODBC, just enough code to have proper Unicode 
support in bind parameters from Perl to the database, and in returned 
fetch values. DBD::ODBC has been improved since the patch was merged by 
Martin J. Evans into v1.14, and it now supports Unicode in many other 
places, too. The DBI API was also improved during that process, allowing 
to have Unicode SQL query strings.


That's why I proposed to switch to DBD::ODBC: It is well tested and 
supports Unicode as good as the ODBC driver does.


The raw patch is still available at 
http://www.alexander-foken.de/unicode-patch.txt.gz. DBD::Sybase 
obviously lacks such a patch. Sybase may have a Unicode API, but no part 
of DBD::Sybase uses it (properly). In DBD::ODBC, the patch just tests 
the UTF8 flag for all relevant data coming from Perl and converts UTF8 
to the UCS2 encoding required by the ODBC API, and converts UCS2 encoded 
data back to UTF8, settings the UTF8 flag when needed. Most of the new 
test just tests that all conversions work, even inside the database. The 
length check is very primitive, but a good indicator to test if the 
database saw bytes (length too large) or characters (length just right). 
The original patch has some minor problems in the test code with ancient 
perls that were fixed during DBD::ODBC development, see DBD::ODBC Changes.


Now you just need to find someone who is willing and has the time to 
patch DBD::Sybase ... ;-)
The new tests should work nearly unmodified with a properly patched 
DBD::Sybase.


Alexander


Re: Unicode and Sybase univarchar

2010-06-04 Thread Dave Rolsky

On Fri, 4 Jun 2010, Alexander Foken wrote:

Right. (But remember that DBI was there before Unicode support was added to 
Perl, and also most DBDs are older that the Unicode support. Before Unicode 
was there, you just passed bytes around and everything just worked.)


Only if by everything you exclude any and all operations that need to be 
character aware, such as length, substr, regexes, encoding, etc.


That's why I proposed to switch to DBD::ODBC: It is well tested and supports 
Unicode as good as the ODBC driver does.


And as I said in private email, that's not really feasible for us.

Now you just need to find someone who is willing and has the time to patch 
DBD::Sybase ... ;-)


Which is why I'm hoping we can pay Michael to work on this. Clearly, he's 
the most qualified. Otherwise, I might have to do this, which is a scary 
thought.



-dave

/*
http://VegGuide.org   http://blog.urth.org
Your guide to all that's veg  House Absolute(ly Pointless)
*/


Re: SQLite - Time to build a database

2010-06-04 Thread Owen
On Thu, 03 Jun 2010 20:12:51 +0200
Bart Lateur bart.lat...@telenet.be wrote:

 On Thu, 3 Jun 2010 11:55:47 +0300, Henri Asseily wrote:
 
 If you're ok with one big transaction where if it fails you have to
 redo it all, then just do the above.
 
 Well in the root post he did say:
 
 1500 of these rows have faulty data.
 
 so I don't think it's OK to fail completely on an error... Unless the
 data gets prescreened. In Perl.
 


Thanks for all the responses. It was a one off exercise that roused my
curiosity which has now been satisfied.

SQLite is a great facility for my purposes, I don't know how it would
get on with gigabyte sized files, but certainly for smaller stuff and
general hack work, it and its perl interface are ideal


Owen