in reply to Add Text record to access table?

I am using ODBC.

Replies are listed 'Best First'.
Re: Re: Add Text record to access table?
by dreadpiratepeter (Priest) on Feb 16, 2002 at 04:40 UTC
    You might want to look at DBI with DBD::ODBC. Many database do not allow the insertion of text and blob fields with straight insert statements (Informix, for one). In DBI one can use placeholders when inserting to do so. Placeholder will also automatically quote fields properly, removing another hassle.
    Assuming (and in all fairness I have not used it) that DBD::ODBC is as complete a driver as the others I have used (mysql, oracle, informix), you should find that it does what you want.
    It would lokk roughly like:
    my $dbh = DBI->connect(connect params...) or die "connect failed: $ +DBI::errstr"; $dbh->do("insert into table (a,b,c) values(?,?,?)",{}, 3,$x,$long_text_field_or_blob_data) or die "do failed: $DB +I::errstr";

    All the quoting and blob magic needed is done by the DBD driver.

    -pete
    Entropy is not what is used to be.
      What is connect param?
        The arguments to connect are DB specific parameters such as the type of db, the name of the db, and username/password info.
        DBI and the DBD::xxx documentation (where xxx is the name of your database, i.e. DBD::Oracle) will give you more information on the parameters needed for your particular db.

        -pete
        Entropy is not what is used to be.
      Thanks pete, that helped.