1. Common cmds
SQLite is a small embedded relational database that can be embedded into almost all programming languages, especially C, C ++, PHP, Perl, etc. This section describes how to use Perl to connect to and operate the SQLite database.
Use dBi; # Perl is used to operate the SQLite module. This module is enough to use strict; # This sentence must be added for beginners to write the use warnings statement strictly required; Main: {my $ dbargs = {autocommit => 0, # Use the event printerror => 1}; # connect to the database my $ DBH = DBI-> connect ("DBI: SQLite: dbname = test. DB "," "," ", $ dbargs); # create a table $ DBH-> do (" create table test (ID int primary key, age, name )"); # insert data $ DBH-> do ("insert into test values (null, '34', 'Liu Qiang '"); # update data $ DBH-> do ("Update test set age = '33' where name = 'Liu Qiang '"); # delete data $ DBH-> do ("delete from test where name = 'Liu Qiang '"); # query data my $ SQL = "select * from test "; my $ dbconn = $ DBH-> prepare ($ SQL); $ dbconn-> execute (); my (@ row_ary, $ CC, $ BB, $ dd ); while (@ row_ary = $ dbconn-> fetchrow_array) {My ($ CC, $ BB, $ dd) = @ row_ary; print "Table Test content is \ n "; print "\ t @ row_ary \ n ";}