l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
August 5: Social gathering
Next Installfest:
TBD
Latest News:
Jul. 4: July, August and September: Security, Photography and Programming for Kids
Page last updated:
2004 Dec 23 11:16

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] sqlite + perl - wierd unrecognized token error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] sqlite + perl - wierd unrecognized token error



I'm getting an error message that I don't know how to fix:


   $ ./driver.pl 

   Grade Utility
   +-=-=-=-=-=-=-=-=-=-+
   1. Create a new class
   2. Add a student
   3. Modify a student
   4. Print a student
   5. Dump all records
   q. Quit
   +-=-=-=-=-=-=-=-=-=-+

   Choice: 1
   Enter semester: 20051
   Enter course: SAPHY223
   Enter Course Desc: Theoretical Dilithium Crystal Designs
   Enter college: Starfleet Academy
   Enter reference: 10543
   DBD::SQLite::db do failed: unrecognized token: ":" at Create_Tables.pm line
   52, <> line 6.




Excerpt from driver.pl:


   sub Create_Course()
   {
      my %course;

      print "Enter semester: ";
      $course{semester} = <>;

      print "Enter course: ";
      $course{course} = <>;

      print "Enter Course Desc: ";
      $course{course_desc} = <>;

      print "Enter college: ";
      $course{college} = <>;

      print "Enter reference: ";
      $course{reference} = <>;

      foreach (keys %course) { chomp $course{$_}; }

      Create_Database(\%course);
   }




Excerpt from Create_Tables.pm:


   sub Create_Database(%)
   {
      my ($course) = @_;

      my $table_name =
         "$course->{semester}.$course->{course}.$course->{reference}.dat";

      die "Database file already exists" if -e $table_name;

      my $dbh = DBI->connect("dbi:SQLite:$table_name");

      # Create the course table
      #
      $dbh->do("
         CREATE TABLE course (
            semester    VARCHAR(10),
            course      VARCHAR(10),
            course_desc VARCHAR(10),
            college     VARCHAR(20),
            reference   INT
         )
      ");


      # Populate the course table.  FIXME.  Clunky.
      #
      $dbh->do("
         INSERT INTO course VALUES (
            $dbh->quote ( $course->{semester} ),
            $dbh->quote ( $course->{course} ),
            $dbh->quote ( $course->{course_desc} ),
            $dbh->quote ( $course->{college} ),
            $dbh->quote ( $course->{reference} )
         )
      ");

   }





I printed out a trace log at level 3, but it didn't give any clues.
Everything looked more or less normal, until:

    -> execute for DBD::SQLite::st (DBI::st=HASH(0x8407760)~0x840773c)
thr#814c008  
sqlite error 1 recorded: unrecognized token: ":"
    !! ERROR: 1 'unrecognized token: ":"' (err#0)
    <- execute= undef at DBI.pm line 1436 via Create_Tables.pm line 52
    <> DESTROY(DBI::st=HASH(0x8407760)) ignored for outer handle (inner
DBI::st=HASH(0x840773c) has ref cnt 1)
    -> DESTROY for DBD::SQLite::st (DBI::st=HASH(0x840773c)~INNER)
thr#814c008
Statement handle DBI::st=HASH(0x840773c) DESTROY ignored - never set up
       ERROR: 1 'unrecognized token: ":"' (err#0)



I'm brand spanking new to this stuff.  Any ideas on what's going on?  I
don't really see any ":" anywhere except for the DBI connection statement.

Thanks!
Pete

-- 
The mathematics of physics has become ever more abstract, rather than more
complicated.  The mind of God appears to be abstract but not complicated.
He also appears to like group theory.  --  Tony Zee's "Fearful Symmetry"

GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.