dbi Questions
11
Solved
Is CPAN DBI the best database interface to use in Perl for general database use? Are there some better options?
5
Solved
I cannot use %ENV var on my Perl script to use Oracle libs.
BEGIN {
$ORACLE_HOME = "/usr/lib/oracle/10.2.0.3/client64";
$LD_LIBRARY_PATH = "$ORACLE_HOME/lib";
$ORACLE_SID="prod";
$ENV{ORACLE_S...
2
Solved
I'm trying to store the runtime mssql error in variable and continue with all other data.
my $sth = $dbh->prepare("exec TEST_ABC_DB.dbo.testprocedure");
$sth->execute() ;
my $db_error =$DBI...
Boldfaced asked 2/1, 2017 at 8:46
3
Solved
I am using Perl DBI. I know that $dbase->tables() will return all the tables in the corresponding database. Likewise, I want to know the schemas available in the database. Is there any function ...
1
Solved
I have written a sample Perl program to delete data from a database table.
This is the code I have written,
use DBI;
my $dbh = DBI->connect("DBI:Pg:host=192.168.12.23;port=5432;", "adhi");
i...
4
Solved
Is there a way to reuse the ?'s used on a DBI prepare statement. Consider the following code:
$sth=$dbh->prepare("INSERT INTO mytable(a,b,c) SELECT ?,B(?),C(?)");
$sth->execute($a,$a,$a);
It wo...
2
Specifically, I need to delete some rows from a table while iterating over all rows in the table. Does DBI have something like an updateable resultset in Java? So, if I do something like:
$query_a...
6
Solved
My delicious-to-wp perl script works but gives for all "weird" characters even weirder output.
So I tried
$description = decode_utf8( $description );
but that doesnt make a difference. I would...
2
Solved
On many front ends,
I wish to enforce my scripts using a readonly connection to a sqlite3 file mirrored from a master server.
Is there's a way to say DBI to do this ?
For the moment, I'm doing th...
2
Solved
I'm trying to connect with an SSL client key using DBI and DBD::Pg.
use strict;
use warnings 'all';
use DBI;
my $dsn = "dbi:Pg:db=mydb;sslmode=require;host=localhost;"
."sslcert=C:\\path with\\s...
5
Solved
Could some tell me if there is a function which works the same as PHP's mysql_real_escape_string() for Perl from the DBI module?
Laurice asked 5/2, 2010 at 13:59
3
Solved
i am pulling urls from my database with a perl script where i employ fetchrow_array to pull URL from the database which worked fine until i encountered a very long URL georgelog24.blog.iskreni.net/...
7
Solved
I have this query select * from table where ID in (1,2,3,5...)
How is it possible to build this query with the DBI using placeholders ?
for example :
my @list = (1, 2, 3, 4, 5);
my $sql = "selec...
1
I'm getting:
"Use of uninitialized value in join or string at ./test_script.pl line 69, <fh> line 91."
The code creating this warning is here:
# Write results of SQL execution to output f...
9
Solved
Our website uses Perl to provide a simple mechanism for our HR people to post vacancies to our website. It was developed by a third party, but they have been long since kicked into touch, and sadly...
2
Solved
What's the best way of capturing any DBI errors in Perl? For example if an insert fails because there were illegal characters in the values being inserted, how can I not have the script fail, but c...
Hulbert asked 27/1, 2011 at 23:2
3
Solved
How can I fetch the last row that was inserted using DBI (DBD::mysql)?
Code sample:
my $sth = $dbh->prepare('INSERT INTO a ( x, y, z ) VALUES ( ?, ?, ? )');
$sth->execute( $x, $y, $z );
H...
3
Solved
I have the weirdest problem and my extremely basic knowledge of SQL must be terribly wrong, but I cannot make sense of the behaviour illustrated below.
I have this file test.csv
id,field
A,0
B,1
...
2
Solved
At the moment, I am running multiple statements on MYSQL as below;
my $sth1 = $dbh->prepare("ALTER TABLE whatever....");
my $sth2 = $dbh->prepare("UPDATE whatever....");
my $sth3 = $db...
2
Solved
Suppose I am querying a table with something like the following:
$dbh->selectrow_hashref('SELECT id, name FROM foos WHERE name = "bar"');
Naturally, id would be an integer, but the resulting ...
3
Solved
I can successfully create a connection to a Postgres db using the following:
my $settings = {
host => 'myhost',
db => 'mydb',
user => 'myuser',
passwd => 'mypasswd'
};
my $connec...
Impressionable asked 16/5, 2013 at 4:28
2
I'm having a hard time getting manual transactions to work as documented in DBD::Pg, or I'm simply misunderstanding said documentation.
My understanding is that if I want to manually manage transa...
Animalism asked 13/6, 2013 at 3:51
2
Solved
I am trying to fetch data like (Select 1 from table) which returns data with one row and one column.
I dont want to use $sth->fetchrow_array method to retreive the data in to array. Is there an...
6
Solved
1
Solved
I have a Perl program that we have run successfully every day for almost the past 2 years, but which crashes today with the error message:
FATAL ERR: Can't do PRAGMA cache_size = 1000000: attemp...
© 2022 - 2024 — McMap. All rights reserved.