Re: Possible to get field names and types in a table without executing a query?

2006-06-27 Thread JupiterHost.Net
[EMAIL PROTECTED] wrote: Hi all. My goal is to get a list of all field names and data types for those fields in any given table in a mysql database. From reading the DBI documentation, the only way I've been able to do this is by preparing and executing a query against a table first. Then I

Re: Possible to get field names and types in a table without executing a query?

2006-06-27 Thread JupiterHost.Net
It is much more easily portable. Suppose you have a real query: select a.foo, b.bar.c.baz from a, b, c where . The 0= 1 method works for that too. Contrast that with parsing the from clause and the where clause to create a tabel catalog query. Yuk. How can you gaurantee all DB engines

Re: Possible to get field names and types in a table without executing a query?

2006-06-27 Thread JupiterHost.Net
Matthew Persico wrote: So now I need one for every database? For every database you need to support yes, not all engines will return the exact same data with a query if no results and that also not in the same format. But each database is 00% gauranteed to support what it documents it

Re: Identify PID for remote database handle--CLARIFICATION...

2006-05-23 Thread JupiterHost.Net
Reidy, Ron wrote: No, I do not know you are a DBA; maybe YOU cannot describe the problem well enough. -Original Message- From: Drozdowski, Catharine [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 23, 2006 10:11 AM To: Reidy, Ron; dbi-users@perl.org Subject: RE: Identify PID for

Re: Checking if a table exist

2006-04-28 Thread JupiterHost.Net
Reidy, Ron wrote: 1. Look in the data dictionary 2. Select from the table and trap the appropriate error code -Original Message- From: Loo, Peter # PHX [mailto:[EMAIL PROTECTED] Sent: Thursday, April 27, 2006 4:33 PM To: List - DBI users Subject: Checking if a table exist Hi All,

Re: Running DBI, ODBC in the crontab

2006-04-13 Thread JupiterHost.Net
Tim Bunce wrote: On Wed, Apr 12, 2006 at 04:33:39PM +0200, Dr.Ruud wrote: Jeffrey Seger schreef: perl -MData::Dumper -e' print Dumper @INC' Alternative: perl -MData::Dumper -e' print Data::Dumper-Dump([EMAIL PROTECTED], [qw(*INC)])' Oi, why not much cleaner (code and output): perl

DBD::Sybase + freetds from Linux to Microsoft SQL Server 2000 contest

2006-02-04 Thread JupiterHost.Net
Hello list, I'm about to go nuts trying to connect to Microsoft SQL Server 2000 from a linux machine. I'll pay $20 to the first person who can get me over this last hump, seriously I'll paypal it to you, maybe more if the solution is had quickly. No joke, I will pay :) Here's what I have:

Re: Extracting files using DBI

2006-01-31 Thread JupiterHost.Net
Sham Prasad wrote: Hi all, Hello, I have a bugzilla database running on mysql. If you are aware of bugzilla, it has a table called attachments. what i am trying to do is get the attachments of all the bugs having attachment/s into a directory. for example there is a bug with a attachment

Re: searching database on emailaddress field

2006-01-31 Thread JupiterHost.Net
[EMAIL PROTECTED] wrote: Hi. Hello, Solved after I posted. Surround $email with 's. As in '$email'. Close, but this is a gun pointed at your head :) You either need to $dbh-quote() it or do the bind value/placeholder (see `perldoc DBI` for details of both)

Re: Fwd: how to detect that we're running under CPAN::Testers?

2006-01-11 Thread JupiterHost.Net
Is there any way to tell if my package is being tested automatically under CPAN::Testers? Here's the situation: I've never used that module but this should work: if(exists $INC{'CPAN/Testers.pm'}) { print I am probably running under CPAN::Testers\n; } else { print I am

Re: Convenience function selectall_hasharrayref

2006-01-10 Thread JupiterHost.Net
Peter J. Holzer wrote: or selectall_arrayhashref? Anyway, I rather frequently find that the most natural way to represent a query result is an array of hashes: Each row is hashref, but the the rows are in an array(ref) so that the order is preserved, and the columns can be accessed by name.

Re: (Fwd) dbi-users@perl.org

2006-01-09 Thread JupiterHost.Net
Can't load = '/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Oracle/O= racle.so'=20 for module DBD::Oracle: libclntsh.so.10.1: cannot open shared object = file:=20 No such file or directory I imagine your web server does not have permissions to the

Re: trying to subclass DBI

2005-12-30 Thread JupiterHost.Net
wernerus sebastien wrote: Tim, I made the changes you suggested. Here is the code: --- package MySubDBI; ... package Main; try: package main; #IE lowercase M, not Main.. Also be sure to: use strict; use warnings; in each package as that will likley tell

Re: anyway to determine # rows before fetch loop ends and without seperate count(*)

2005-11-18 Thread JupiterHost.Net
listmail wrote: Well I'm not seeing why a number of arrays that each point to arrays could not be consider a matrix of arrays when considering one definition of the word matrix Something resembling such an array, as in the regular formation of elements into columns and rows. I dunno, i'm

Re: anyway to determine # rows before fetch loop ends and without seperate count(*)

2005-11-17 Thread JupiterHost.Net
Also very convoluted, all of that can be done with: my $results = $dbh-selectall_arrayref($sql); # if you only want to process a certain amount just LIMIT in your $sql... I appreciate the response. I tested selectall_arrayref and as I expected, irregardless of the number of rows

Re: anyway to determine # rows before fetch loop ends and without seperate count(*)

2005-11-16 Thread JupiterHost.Net
[EMAIL PROTECTED] wrote: #Here's an example which shows what I am trying to accomplish. If I can determine the number of rows before pushing the data, this can simply things for #me when processing the data throught my scripts. # use warnings; use strict; Good good :) use DBI; use

Re: can't create tables with a $

2005-09-29 Thread JupiterHost.Net
moma wrote: Hi, Hello, i am using postgresql 7.4.7 on an ubuntu box, perl 5.8.4 and DBI version 1.46 with DBD::Pg version 1.32. i can create tables from psql with an $ in the middle of it, e.g. create table foo$bar (id integer); That seems like a bad bad bad bad idea because how can you

Re: MySQL 4.1+ Password Incompatibility

2005-08-25 Thread JupiterHost.Net
folks :) HTH :) Lee.M - JupiterHost.Net

Re: SQL Server and 'set dateformat'

2005-07-07 Thread JupiterHost.Net
Ron Savage wrote: On Thu, 07 Jul 2005 11:38:06 +1000, Daniel Kasak wrote: Hi Daniel my $sth = $dbh-prepate( set dateformat dmy ); What am I doing wrong? probably prepate is not a function, I think you mean prepare Does that exact query work via CLI interface (IE is the query bad)

Re: Perl Performance Help.

2005-05-12 Thread JupiterHost.Net
:) Lee.M JupiterHost.Net

Re: Perl Performance Help.

2005-05-12 Thread JupiterHost.Net
a) We are using Oracle 8i DB. The query (or the DBMS) takes only 6 seconds to return data to Perl. How did you determine this? I think you're just assuming that. c) So we conclude that it is mainly an issue with fetchrow especially when the number of records are high. We tried other possible

Re: cPanel / DBI / mySQL / Exim issue

2005-04-27 Thread JupiterHost.Net
After that did not work, they directed me to your list, in the hopes you could give me some assistance with how to resolve this. Any help you can offer is much appreicated. Er, you may want to not show your passwords on a public list... They were right, its not a cPanel issue. Have you upgraded

Re: Efficient select/insert

2005-04-26 Thread JupiterHost.Net
$dbh-do(INSERT INTO t (col1, ...) SELECT col1, ... FROM t2 WHERE x = '$element'); Oi SQL injection warning! Red lights and sirens - don't do that!! '$element' is supper dangerouse, evil evil evil either $dbh-quote it or use ? in your prepare/execute dance: $dbh-do( 'INSERT INTO t

Re: Paged Querys

2005-01-26 Thread JupiterHost.Net
Thilo Planz wrote: I make a page that returns the result of a select statement in Perl and DBI, but a lot of rows are returned, there is a way to page the result ? Yes, there are several modules for this. The best one (easy to use, all the functions you need in one place) I've used is

Re: Paged Querys

2005-01-25 Thread JupiterHost.Net
Hernan Arredondo wrote: Hi all, Hello, I make a page that returns the result of a select statement in Perl and DBI, but a lot of rows are returned, there is a way to page the result ? Yes, there are several modules for this. The best one (easy to use, all the functions you need in one place)

Re: Double quotes in select statement throw an error

2005-01-18 Thread JupiterHost.Net
Moosmann, James wrote: Nope, same results, Here is a simple example: Is the syntax invalid? use DBI; my $dbh = DBI-connect('dbi:ODBC:somedb','',''); my $qs = $dbh-quote( SELECT \Rows returned: \ ); Why are you quoting the entire query as a string? $dbh-do($qs); Use a valid query: $dbh-do(SELECT

Re: Double quotes in select statement throw an error

2005-01-18 Thread JupiterHost.Net
Moosmann, James wrote: Lee, Hello, The select statement is very valid and so is: SELECT 'Hello World!' as 'My first SQL Statement' -or- SELECT answer = 2+3 Really, try it. ok, but if you $dbh-quote() it, it becomes something like: 'SELECT \'Hello World!\' as \'My first SQL Statement\''

Re: (Fwd) perl future

2004-11-08 Thread JupiterHost.Net
all the applications of my company work with apache Perl oracle,I want to know as it is the future of the Perl in the world and if we go by the correct way, because the directors of the company think that no. as it is its use in the world. I can't speak for others but look at the history and

Re: (Fwd) perl future

2004-11-08 Thread JupiterHost.Net
Oscar Gomez wrote: all the applications of my company work with apache Perl oracle,I want to know as it is the future of the Perl in the world and if we Those will be developed , supported, and industry standard mission critical safe. go by the correct way, because the directors of the

Re: SQL question: Find next unused number...

2004-09-14 Thread JupiterHost.Net
the last uid, you can add DESC or something similar to reverse the results. But you'd need to see your DB vendor's website for more details. HTH :) Lee.M - JupiterHost.Net

Re: DBI Module.

2004-06-30 Thread JupiterHost.Net
Licensing may not be an issue with mysql but it is an issue with commercial databases. I use Informix with hundreds of users accessing the database for extremely short queries from a GUI. I cannot afford to have them connected constantly, I would have to spent $100,000 per server in licensing.

Re: DBI Module.

2004-06-30 Thread JupiterHost.Net
Sterin, Ilya (I.) wrote: Commercial databases have commercial support behind them, that's what is driving it. Most non-IT companies, do not want to invest in internal departments that are responsible for supporting an open source software product. Until a giant like IBM, HP, or similar puts

Re: DBI Module.

2004-06-30 Thread JupiterHost.Net
Sterin, Ilya (I.) wrote: I know Tim will kill me for this OT stuff:-) Tim's a pretty cool guy it seems, but maybe we should let the horse die :) I feel the likely hood of the economy changing and causing major issues for big companies is way more likely than the open source community to

Re: DBI CGI help

2004-05-16 Thread JupiterHost.Net
get you started :) perldoc DBI perldoc CGI HTH Lee.M - JupiterHost.Net

Re: do() with bind_values

2004-05-14 Thread JupiterHost.Net
I'm actually looking for the source code for execute() (IE sub execute { .. }), do() and quote() are in DBI.pm, prepare() is in DBD/mysql.pm but execute in neither. The source code for execute is in dbd_st_execute() in dbdimp.c, and if you want to know how the quoting is done, you will need to

do() with bind_values

2004-05-12 Thread JupiterHost.Net
essencially run: INSERT INTO Stuff (Id,Foo) VALUES (NULL,'foo'); INSERT INTO Stuff (Id,Foo) VALUES (NULL,'bar'); INSERT INTO Stuff (Id,Foo) VALUES (NULL,'baz'); since do() does the prepare and execute for you. correct? TIA Lee.M - JupiterHost.Net

Re: do() with bind_values

2004-05-12 Thread JupiterHost.Net
($foo), $dbh-quote($bar), $dbh-quote($baz) ) or die or $dbh-do( 'INSERT INTO Stuff (Id,Foo,Bar,Baz) VALUES (NULL,?,?,?)', undef, $foo, $bar, $baz ) or die Thanks! Lee.M - JupiterHost.Net

Re: do() with bind_values

2004-05-12 Thread JupiterHost.Net
Ronald J Kimball wrote: JupiterHost.Net [mailto:[EMAIL PROTECTED] wrote: I found do() and quote() in DBI.pm, prepare() in DBD::mysql, but I couldn't find execute() - I wanted to see how it does the quoting exactly (for binary data) - Anyone know where execute() is? All of these are covered

Re: using binary data in variable in an INSERT/UPDATE statement

2004-05-10 Thread JupiterHost.Net
Anyone ever do this before? JupiterHost.Net wrote: Hello DBI folks! If I have a column that is binary and data that is binary do I simply $dbh-quote() it on an insert? IE my $binary_content = get_binary_stuff(); my $binary_content_Q = $dbh-quote($binary_content); $dbh-do(UPDATE MyStuff SET

Re: using binary data in variable in an INSERT/UPDATE statement

2004-05-10 Thread JupiterHost.Net
appreciate the input :) On Mon, 2004-05-10 at 14:18, JupiterHost.Net wrote: Anyone ever do this before? JupiterHost.Net wrote: Hello DBI folks! If I have a column that is binary and data that is binary do I simply $dbh-quote() it on an insert? IE my $binary_content = get_binary_stuff(); my

Re: using binary data in variable in an INSERT/UPDATE statement

2004-05-10 Thread JupiterHost.Net
Andy Hassall wrote: The general approach is to always use placeholders, and never directly interpolate values into SQL statements. This should insulate you from whatever encoding's needed. Constants in SQL are OK, but if you're putting encoding as in quote()ing or encoding as in

Re: DBI and my.cnf socket file different

2004-04-11 Thread JupiterHost.Net
Rudy Lippan wrote: On Sat, 10 Apr 2004, JupiterHost.Net wrote: Via the command line I can connect to MySQL and do what I want fine. Via DBI I get the classic Can't connect to local MySQL server through socket '/tmp/MySQL.sock' (2) So MySQL seesmt to not be running but it is! The socket

DBI and my.cnf socket file different

2004-04-10 Thread JupiterHost.Net
/MySQL.soc (if so why)? Tia :) Lee.M - JupiterHost.Net