Listing of db/delete.pl


#!/usr/bin/perl -w
#
# Delete all records from the GPS table in the MySQL database
#
# Tested with WinXP and perl, v5.8.0 built for MSWin32-x86-multi-thread
# Binary build 806 provided by ActiveState Corp. http://www.ActiveState.com
# Built 00:45:44 Mar 31 2003
#
# ------------------------------
# Installing MySQL API into perl:
# (The interface requires Perl Version 5.6.0 or later)
# ppm> install DBI
# ppm> install DBD-MySQL
# ------------------------------
# Change History:
# 2004-11-22 jje - SQL script created for MySQL 4.0
# 2005-03-30 jje - Adapted for MySQL 4.1.1 and above (renamed columns UTC_TIME and UTC_DATE into UTCTIME and UTCDATE)

require 5.008;
use strict;
use DBI;

  my $data_source = "dbi:mysql:gsmtrack";
  my $user = "root";
  my $password = shift || ""; # you may give password at the command line
  my $dbh = DBI->connect($data_source, $user, $password)
      or die "Can't connect to $data_source: $DBI::errstr";
  
# If you get the following error with MySQL 4.1.1 or newer
# 
#   DBI connect('gsmtrack','root',...) failed: Client does not support authenticatio
#   n protocol requested by server; consider upgrading MySQL client ...
#
# Reset the root password to pre-4.1 style as follows: 
#   mysql>  SET PASSWORD = OLD_PASSWORD('newpwd');
#
# (See http://dev.mysql.com/doc/mysql/en/old-client.html)

  my $sql_stmt;
  $sql_stmt = q{
            DELETE FROM GPS
  };
  my $sth = $dbh->prepare( $sql_stmt ) or die "Can't prepare statement: $DBI::errstr";

  my $rc = $sth->execute
      or die "Can't execute statement: $DBI::errstr";

  # $dbh->commit;        # To commit your changes to the database (when AutoCommit is off)
  $dbh->disconnect;

exit;

This file was generated by Gabriel Knoy's perl2html script.