Re: postgres & perl

Поиск
Список
Период
Сортировка
От Devinder K Rajput
Тема Re: postgres & perl
Дата
Msg-id OFA499F6D5.FFE35A08-ON86256CA2.004CE853@ipaper.com
обсуждение исходный текст
Ответ на postgres & perl  (Farah <cwfarah@yahoo.com>)
Список pgsql-admin

here is some sample code:

use Pg;  # perl module for PostgreSQL

# connect to the database
        $conn = Pg::connectdb("dbname = $database_name");
        # make sure connection to db was established
        if (PGRES_CONNECTION_OK ne $conn->status) {
                print $conn->errorMessage;
                exit(-1);
        }
        print "connected to db $database_name\n";

# Build query:
        $sql_query = ("UPDATE items \
                SET vendor_group  =  " . $group . " \
                WHERE number      = '" . $row[ITEM_NUMBER] . "' \
                and hub_id      =  " . $row[HUB_ID] . " \
                ");

#Execute query:
        $result = $conn->exec("$_[0]");

#Error Checking:
        if($result->resultStatus ne PGRES_COMMAND_OK &&
        $result->resultStatus ne PGRES_TUPLES_OK) {
                ...
        }

You can build your delete statements and any other queries just by modifying the "Build query:" section.

regards,

Devinder Rajput
Stores Division Corporate Offices
Chicago, IL
(773) 442-6474



Farah <cwfarah@yahoo.com>
Sent by: pgsql-admin-owner@postgresql.org

01/01/2003 02:25 AM

       
        To:        pgsql-admin@postgresql.org
        cc:        
        Subject:        [ADMIN] postgres & perl



admin, (sorry if my english is not well)

i want to know the perl source code for delete and editing the table values from pgsql. i have a problem of that. can you help me...?


Do you Yahoo!?

Yahoo! Mail Plus - Powerful. Affordable. Sign up now

В списке pgsql-admin по дате отправления:

Предыдущее
От: John Burski
Дата:
Сообщение: Re: No Space left on Device
Следующее
От: "Campano, Troy"
Дата:
Сообщение: Viewing connections