DBIx::Recordset : MySQL 2.9003 backquotes table names by default?

2003-12-28 Thread Terrence Brannon
running the below program show that table names are quoted automatically 
under MySQL-4.016 and DBD::mysql 2.9003.
This wasn't happening about 2 weeks ago when I ran the entire test suite 
and it passed.

needless to say, this is causing some problems with the MySQL part of 
the test suite, when checking that all tables that were
supposed to be created were created. We can code around it in the test 
suite, but it would be nice to have some way of turning
off this feature.

use DBI;

my $dbh = DBI->connect('dbi:mysql:test') or die $!;

warn $dbh->tables;
warn $DBD::mysql::VERSION;
 ~/hacks/dbirs/eg $ perl small.pl
`dbix_rs5``dbix_rs6``dbixrs1``dbixrs2``dbixrs3``dbixrs4``dbixrsdel``dbixseq` 
at small.pl line 5.
2.9003 at small.pl line 6.
   ~/hacks/dbirs/eg $

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Debugging a script running in an embedded Perl interpreter

2003-12-28 Thread Reinstein, Shlomo








Hi,

 

I am a first-time user of perlembed. I embedded the Perl
interpreter in my C/C++ application in order to provide users with scripting
capabilities for the application. I use “-e 0” as arguments for “perl_parse”,
and I use “perl_eval_pv” to evaluate the code entered by the user.

The user can use “require” or “use” to
load / execute Perl modules and the interpreter takes care of that. This is the
normal use of Perl by the users.

 

I would now like to enable the user to debug a script that
is loaded using “use” or “require”, much like invoking
the Perl debugger with “perl –d script.pl”. Is that possible?
If so, how do I do that? Please note the following:

1. There should be a single interpreter state throughout the
execution of the application. I don’t want to dismiss one interpreter and
start another because I lose the state.

2. The application is a GUI application. The user enters
code in some text editor, and the code is evaluated when some button is pressed.
Therefore, I imagine that I can’t use just give the “-d”
argument to “perl_parse”.

 

Thanks much,

Shlomo

 

 








Re: DBIx::Recordset : MySQL 2.9003 backquotes table names by default?

2003-12-28 Thread Rudy Lippan
On Sun, 28 Dec 2003, Terrence Brannon wrote:

> running the below program show that table names are quoted automatically 
> under MySQL-4.016 and DBD::mysql 2.9003.
> This wasn't happening about 2 weeks ago when I ran the entire test suite 
> and it passed.
> 

Intersting the quoting has been in there since 2.9002 -- I don't think 
that anything changed wrt quoting in 2.9002.

> needless to say, this is causing some problems with the MySQL part of 
> the test suite, when checking that all tables that were
> supposed to be created were created. We can code around it in the test 
> suite, but it would be nice to have some way of turning
> off this feature.

DBD::mysql does not do the quoting itself. The quoting is a feature of the 
DBI;  Quoting the DBI docs:


   If "$dbh->get_info(29)" returns true (29 is SQL_IDENTI-
   FIER_QUOTE_CHAR) then the table names are constructed and 
quoted by
   "quote_identifier" to ensure they are usable even if they 
contain
   whitespace or reserved words etc

Versions of DBD::mysql < 2.9002 did not implement get_info(), so when DBI 
went looking for the quote char, it did not get anything back, and 
therefore, did not quote the table names.

I can't think of an easy way to turn the quoting off from DBD::mysql other
than making $dbh->get_info(29)  return undef, but that would affect all
calls to get_info and possibly break applications that require the table
names to be quoted :(


> use DBI;
> 
> my $dbh = DBI->connect('dbi:mysql:test') or die $!;
> 
> warn $dbh->tables;
> warn $DBD::mysql::VERSION;
> 
>   ~/hacks/dbirs/eg $ perl small.pl
> `dbix_rs5``dbix_rs6``dbixrs1``dbixrs2``dbixrs3``dbixrs4``dbixrsdel``dbixseq` 
> at small.pl line 5.
> 2.9003 at small.pl line 6.
> ~/hacks/dbirs/eg $

I must admit that I have not used DBIx::Recordset before, and I have just
done a cursory scanning of the docs, so please forgive anthing that I may 
have overlooked.

That being said, how does DBIx::Recordset handle a search with a !Table
like, "This is a"" del!mited \Itdentifier as &^% a table 'na`me'."?  or
maybe a table named "select"?  Does the end-user have to use
$dbh->quote_indentifier()  first?


Rudy



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DBIx::Recordset : MySQL 2.9003 backquotes table names by default?

2003-12-28 Thread Terrence Brannon
Rudy Lippan wrote:

On Sun, 28 Dec 2003, Terrence Brannon wrote:



DBD::mysql does not do the quoting itself. The quoting is a feature of the 
DBI;  Quoting the DBI docs:

oh, I see. thank you for the reference.

Versions of DBD::mysql < 2.9002 did not implement get_info(), so when DBI 
went looking for the quote char, it did not get anything back, and 
therefore, did not quote the table names.

I can't think of an easy way to turn the quoting off from DBD::mysql other
than making $dbh->get_info(29)  return undef, but that would affect all
calls to get_info and possibly break applications that require the table
names to be quoted :(
hmmm...

That being said, how does DBIx::Recordset handle a search with a !Table
like, "This is a"" del!mited \Itdentifier as &^% a table 'na`me'."?  or
maybe a table named "select"?  Does the end-user have to use
$dbh->quote_indentifier()  first?
yes, I suppose they would have to call quote_identifier()



Rudy


thank you for the pointers.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


DBIx::Recordset : DBD::Pg 1.39 bind_param issues

2003-12-28 Thread Terrence Brannon
It looks like we are in some sort of (painful?) symbiotic relationship 
here. As I update my drivers to make sure that Recordset works before 
release, I keep having problems.

This time, I tried to do the following code which is part of Recordset:

my @bind_param = ($i+1, $bind_values -> [$i], (defined ($bt) && $bt <= 
DBI::SQL_CHAR())?{TYPE => $bt}:undef ) ;
warn Dumper([EMAIL PROTECTED]);
$sth -> bind_param (@bind_param);

which yields this debug output:

DB:  'SELECT * FROM dbixrs1 WHERE   (  (name = ?)) ' 
bind_values= bind_types=<1>
WARN: $VAR1 = [
 1,
 'Third Name',
 {
   'TYPE' => 1
 }
   ];

Cannot specify both sql_type and pg_type at blib/lib/DBIx/Recordset.pm 
line 1377.

which shows two things about dbdimp.c in DBD::Pg's latest distro:

(a) it should say DBD::Pg where it currently says DBD::ChurlPg:

if ((svp = hv_fetch((HV*)SvRV(attribs),"pg_type", 7, 0))==NULL)
   croak("DBD::ChurlPg only knows about the pg_type attribute");
(b) the call to bind_param in the format used by Recordset is not 
supported, but should be per the DBI and DBD::Pg docs?

dbdimp.c in DBD::Pg 1.39 distro says:

/* // XXX this is broken: bind_param(1,1,{TYPE=>SQL_INTEGER}); */
   if (attribs) {
   if (sql_type)
   croak ("Cannot specify both sql_type and pg_type");
but perldoc DBD::Pg says:

=item B

 $rv = $sth->bind_param($param_num, $bind_value, \%attr);

Supported by the driver as proposed by DBI.

Any suggestions for fixing this are welcome!



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]