dbi

PostgreSQL - INSERT an array of composite type containing arrays

老子叫甜甜 提交于 2019-12-12 08:56:03
问题 I have a composite type containing arrays of TEXT, etc. I am using this inside my main table to create an array of composite type. How do I generate an INSERT command (without using the default field names of the composite type) ? Can I create a TEMPORARY TABLE with the array of composites and then insert it into the main table? For example: DROP TABLE collection; DROP TABLE book_set; DROP TYPE book; CREATE TYPE book AS ( title TEXT, authors TEXT[], extra_spare TEXT ); CREATE TEMPORARY TABLE

Perl DBI fetchall_hashref

折月煮酒 提交于 2019-12-12 08:33:05
问题 Consider the following table: mysql> select * from vCountryStatus; +-------------+------------+------+---------+--------+-----------------+ | CountryName | CountryISO | Code | Status | Symbol | CurrencyName | +-------------+------------+------+---------+--------+-----------------+ | Brazil | BR | 55 | LIVE | BRL | Brazilian Real | | France | FR | 33 | offline | EUR | Euro | | Philippines | PH | 63 | LIVE | PHP | Philippino Peso | +-------------+------------+------+---------+--------+---------

DBI connect() fails to establish the connection and doesnt return an error message

我们两清 提交于 2019-12-12 05:19:57
问题 When i am trying to establish a connection to database, it fails. But It doesnt return any error message either. Code for it is as below my $dbh; $dbh = DBI->connect('DBI:SQLAnywhere:', $connString, undef, {PrintError => 0, PrintWarn => 0})or die "died",$DBI::errstr,"\n"; #dbh = DBI->connect('DBI:SQLAnywhere:', $connString); # setting up the authentication signature for the connection print "$dbh"; if($dbh) { if(DbAuth::AuthenticateConnection($dbh)) { return($dbh,$DbAuth::errstr) if

Perl inserting into MySQL DB

自古美人都是妖i 提交于 2019-12-11 23:57:08
问题 What I have: MySQL DB A table with 9 columns. An array that gets generated with the values that need to get inserted into the table. Note: The array that gets generated automatically will have a different length every time but the length will not exceed the number of columns that I have in the table. The column names will be something like field1, field2, field3 etc. where the name will always being with the word field and then followed by a number. I think this can be done using Perl's map

trouble creating table with a field of type MEMO in Access db using perl/dbi/ODBC

冷暖自知 提交于 2019-12-11 21:11:19
问题 perl 5.8.9 Hello folks, I am successful in using DBI/DBD/ODBC to create a new table in an existing Access 2003 (.mdb) database with the following string: $q = "CREATE TABLE memoTestA (name TEXT, addr TEXT)"; # works but I can't figure out how to add a field of type MEMO ie $q = "CREATE TABLE memoTestB (name TEXT, addr TEXT, desc MEMO)"; # throws syntax error There must be a way - what is the trick? switching form using DBD::ODBC to Win32::OLE gets me past the "bad syntax" error thrown by the

Problem using Perl to connect to MySQL database on remote server

。_饼干妹妹 提交于 2019-12-11 19:45:34
问题 I have a Perl script that gets data from a MySQL database on one server (let's call it server1), does stuff with it and writes it out to another database on another server (server2). Both servers are remote to the server that runs the Perl script. I can connect to the DB on server1 OK, but when I try to connect to the DB on server2, using the same DBI method, I get an error. Here, as command-line Perl, is the bit that's causing the error: perl -MDBI -e 'DBI->connect("DBI:mysql:myDB:server2

Where are Teradata header files downloaded from? (DBD::Teradata build)

旧巷老猫 提交于 2019-12-11 18:48:23
问题 I am attempting to build the Perl DBD::Teradata DBI driver on 64 bit linux. However, I do not have the header files necessary to do so. According to the documentation (http://www.presicient.com/tdatdbd/), the following files are required: parcel.h dbcarea.h coperr.h coptypes.h I've spent hours scouring Teradata's site and the internet at large with no success. I saw mention of a CLIv2 developer's kit, but could not locate this either. Could anyone point me to where I can get these files? I

Using Perl ? bind inside single quotes

安稳与你 提交于 2019-12-11 18:35:06
问题 This scripts works fine for all commands that don't require % wildcards. When I attempt to wrap the ? in %?% which producing a bind error. Also I have tried adding %value% to the argument when running the script and it also producing the same error. Is there a way to substitue an argument into a SQL DBI command in perl? Thanks, in advance. #!/usr/bin/perl use DBI; use Text::Diff; use File::stat; use Fcntl ':flock'; open (LOCK_FH, $0) || die "$0 for lock: $!\n"; flock (LOCK_FH, LOCK_EX|LOCK_NB

DBI::ProxyServer: Problem with writing a log-file

三世轮回 提交于 2019-12-11 16:54:28
问题 When starting the proxyserver (DBI::ProxyServer) with dbiproxy --logfile C:\WINDOWS\temp\dbiproxy.log --debug 1 --localport 2000 or with dbiproxy --configfile dbiproxy.config everything works, except the writing of a logfile. My dbiproxy config file: { 'logfile' => 'C:\WINDOWS\temp\dbiproxy.log', 'localport' => '2000', 'debug' => 1, } I pass a filename, but the Net::Daemon::Log needs a filehandle. Is the code not OK or have I missed something? # Net/Daemon.pm sub ReadConfigFile { my($self,

Perl DBI when to close prepared statements

怎甘沉沦 提交于 2019-12-11 09:27:24
问题 I have an odd problem. On my dev computer I am getting errors. However on the live system the errors do not happen. If I fix the issues on dev the fixes cause problems in production. It has to do with when I am closing prepared statements. On production I have to call finish after every fetch. If I do this on my dev system then the next execute of the statement will return undef, and there is nothing $dbh->errstr or in $DBI::errstr. Any Idea where to even start with this one? Here is a simple