help converting a mysql statement to perl
Hi, Im running into a simple problem with Perl and MySQL. How do I do the following MySQL statement on Perl? SELECT * FROM events WHERE source in ('ERROR','SYSTEM','LOGOFF'); This doesnt work: ## $source = "'ERROR','SYSTEM','LOGOFF'"; $sth = $dbh->prepare("SELECT * FROM events WHERE source in (?);"); $sth->execute($source); ## changing $source to $source = "ERROR,LOGOFF"; doesnot work either. How do I implement it in Perl? regards Jaime ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: DBI, DBD::ODBC y MSQLServer 7
FYI -- DBD::ODBC 0.40 which should make this better for you has been released to CPAN a few hours ago. Regards, Jeff > This is partly due to the way DBD::ODBC connects. I believe I changed the > semantics on this a while back, but the connection is failing. DBD::ODBC > tries two methods of connecting, one (SQLDriverConnect) allows the use of > the connect string you are using, the second allows only the DSN (up to 32 > chars). The problem is the second connect will fail and DBD::ODBC doesn't > return the correct error message because it 'hides' the problem with the > error on the second connect (which you are seeing). DBD::ODBC > 0.39 attempts > to make this better, but has a bug that I just fixed in DBD::ODBC 0.40 > (upcoming). > > Regards, > > Jeff > > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED]]On Behalf Of > > Joe Schell > > Sent: Thursday, April 11, 2002 12:40 PM > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > > Cc: [EMAIL PROTECTED] > > Subject: RE: DBI, DBD::ODBC y MSQLServer 7 > > > > > > > > > > > -Original Message- > > > Behalf Of [EMAIL PROTECTED] > > > > > > > > > I'm using DBI and DBD::ODBC module for get conected to a data base > > > MSQLServer 7 > > > > > > my $DSN = 'driver={SQL Server};Server=Eventos; > > > database=Administrador;uid=Administrator;pwd=;'; > > > my $dbh = DBI->connect("dbi:ODBC:$DSN") or die "$DBI::errstr\n"; > > > > > > > > > > Just a guess but in your posting there is a space after > > "Eventos;". If that > > is in your code then remove it. > > > > > Server's name is: Eventos > > > database's name is: Administrador > > > User Id is: Administrator or sa > > > PWD is '' (a space or nothing); > > > > > > I´m getting this wrong. > > > > > > Software error: > > > [Microsoft][ODBC Driver Manager] Invalid string or buffer length > > > (SQL-S1090)(DBD: db_login/SQLConnect err=-1) > > > > > > > > > > ___ > > Perl-Win32-Database mailing list > > [EMAIL PROTECTED] > > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > > > > ___ > Perl-Win32-Database mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
adding button to getSaveFile dialog box
Does anyone know how to add a button to the standard Win32 save as dialog box? Thanks. B (:-) B [EMAIL PROTECTED] ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: help with pack options
- Original Message - From: "Iacoboni, Vince" <[EMAIL PROTECTED]> To: "perl-win32-users" <[EMAIL PROTECTED]> Sent: Friday, April 12, 2002 11:47 AM Subject: Tk: help with pack options > I'm a newbie to Tk and just want to right-align my BrowseEntry boxes. I > thought that including (-side => 'right') would do it. Nope. Read the > docs. Tried (-anchor => 'w'). Nope. Read the docs. Stumped. > > For gravy, I'd like to have the BrowseEntry boxes expand with the window. > Am i putting the -expand option at the wrong place? > > One more question and I'll quit. I'd love to bind the Enter key to the Ok > button (as is commented out), but it seemed to press immediately when I ran > the app. What's the right way to do it? > First - it is always nice to just put together a snippet of code. Just enough to show the problem (in this case - just the Tk widget code). The entire script is not needed to show your packing options. Some answers - If you are trying to align widgets, ->grid is always a good solution. Below is some code which does what I think you want. If you aren't sure about some of the grid commands then look it up in the docs. Tk::grid gives nice clean looking aligned widgets. If using grid, the gridColumnconfigure command is the key to getting the grid geometry manager to fill the frame in the x direction. If using pack then -expand=>1,-fill=>'x' is the solution (Note: for the frame AND the entry) To bind the 'Enter' key - you use the 'Return' keysym ('' is reserved for the enter event for the mouse pointer - which is likely why your program triggered it so quickly. You can arrange them using pack as well - just set $GRIDDING = 0 to see the (non) difference.. ## use strict; use Tk; use Tk::BrowseEntry; my $GRIDDING=0; my $top = MainWindow->new; $top->title("Set Server/Database"); my $f = $top->Frame()->pack(-expand=>1,-fill=>'x'); my $srv_box = $f->BrowseEntry(-label => "Server"); my $db_box = $f->BrowseEntry(-label => "Database"); if ($GRIDDING){ #grid geometry manager $srv_box->grid(-row=>0,-column=>0,-sticky=>'ew'); $db_box->grid(-row=>1,-column=>0,-sticky=>'ew'); $f->gridColumnconfigure(0,-weight=>1); } else { #pack geometry manager $srv_box->pack(-expand=>1,-fill=>'x'); $db_box->pack(-expand=>1,-fill=>'x'); } my $b = $top->Frame; my $OK_button = $b->Button(-text => "Ok", -command => sub{print "OK pressed\n";}, -relief => "raised", -width => 10, )->pack(-side => "left", -padx => "5", -pady => "5"); my $can = $b->Button(-text => "Cancel", -command => sub {print "Cancelled\n"; exit(0);}, -relief => "raised", -width => 10, )->pack(-side => "left", -padx => "5", -pady => "5"); $top->bind('', sub {print "Hit Esc\n"; exit(0);}); $top->bind('', sub {$OK_button->invoke}); $b->pack(-side => "bottom", -padx => "5", -pady => "5"); $srv_box->focus; MainLoop; # __END__ Jack ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: win-perl regex seems to miss 0,0 with s/(\w),(\w)/$1\a$2/g search logic
You are just awesome Thanx. Also teaches me a lot too. :-) > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of > Carl Jolley > Sent: Tuesday, April 09, 2002 11:51 AM > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: Re: win-perl regex seems to miss 0,0 with > s/(\w),(\w)/$1\a$2/g > search logic > > > On Mon, 8 Apr 2002 [EMAIL PROTECTED] wrote: > > > After "5,0" is matched, you are expecting "0,0" to be > matched. However, the > > search position is now at the comma (since the first zero > was part of the > > previous match). > > > > If you need to split a line that has quoted strings in it, try the > > Text::ParseWords module, e.g. > > > > ## > > $buffer = 'custom,4/2/2002,4/3/2002,FALSE,4/3/2002,8:00:00 > > AM,,0.5,0,0,,"BODYCONTENT",Normal,FALSE,,,Normal,In Progress'; > > use Text::ParseWords "parse_line"; > > print join "\n", parse_line(',', 1, $buffer); > > ## > > > > > Or use the regex positive look-behind type of regex so the following > 0 which matches the trailing part of the (\w),(\w) is not included in > the match. Also, the multiple regex'es could be reduced somewhat: > > $buffer=~s/(?=\w|"\^),*,(?<=\w|")/\a/g; > > > [EMAIL PROTECTED] > All opinions are my own and not necessarily those of my > employer > > ___ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: pattern match timeout error using Net::Telnet
You don't need to waitfor() the prompt. Just use cmd() and Net::Telnet will automatically stop reading at the prompt. The prompt will not be included in the return value of cmd(). This, of course, assumes you've specified the prompt correctly. If this is your problem, you can use the nice debugging features to help you track this down. -- Mark Thomas [EMAIL PROTECTED] for($r=-1;$r!=38;$c++){print"\n"," "x(38-$r+++($c=0))if($c>$r);print~$r&$c?" `":" #";} > -Original Message- > From: Allegakoen, Justin Devanandan > [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 12, 2002 6:06 AM > To: '[EMAIL PROTECTED]'; > [EMAIL PROTECTED] > Subject: pattern match timeout error using Net::Telnet > > > Hello all, > > I'm using the Net::Telnet module on a SunOS based > system to run a program that resides on a > Windoze 2k server. > > By use of the log, I have determined that > connection, and login are fine. > > But I keep getting a pattern match timed-out error. > > According to the Help, it relates this to > matching the prompt and it states: "If the pattern chosen > doesn't match what's sent, then it's likely those commands > will timeout. " > > On a manual telnet session the command prompt is:- > C:\> > > In my program I set my prompt as :- > $obj->prompt('/C\:\\\>$/'); > > I follow that by :- > $obj->waitfor('/C\:\\\>$/'); > > And there's where it times out. > > Funnily enough if I remove the anchoring $ in the search > pattern the rest of the program will work, and the log will > even have the return of the command executed, but output from > the command won't go into the array I put it in (I get a 0 > element array instead). > > Obviously $obj->prompt needs a search pattern that works for > the rest of the program to. Question is what is the search > pattern I need? > > Oh, and using quot in Net::FTP doesnt work either. > > Just in > > > > > > > ___ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
pattern match timeout error using Net::Telnet
Hello all, I'm using the Net::Telnet module on a SunOS based system to run a program that resides on a Windoze 2k server. By use of the log, I have determined that connection, and login are fine. But I keep getting a pattern match timed-out error. According to the Help, it relates this to matching the prompt and it states: "If the pattern chosen doesn't match what's sent, then it's likely those commands will timeout. " On a manual telnet session the command prompt is:- C:\> In my program I set my prompt as :- $obj->prompt('/C\:\\\>$/'); I follow that by :- $obj->waitfor('/C\:\\\>$/'); And there's where it times out. Funnily enough if I remove the anchoring $ in the search pattern the rest of the program will work, and the log will even have the return of the command executed, but output from the command won't go into the array I put it in (I get a 0 element array instead). Obviously $obj->prompt needs a search pattern that works for the rest of the program to. Question is what is the search pattern I need? Oh, and using quot in Net::FTP doesnt work either. Just in ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs