您的位置:建站学院首页 >> 文章 >> CGI技术
foreach $line (@resoult)
{
print $line->{'id'}."\n";
print $line->{'name'}."\n";
}
=item create_db
usage:
my $ids = "id,name,pass,lover"; # Now,$main::split = ","
# If $ids = "id||name||pass||lover" then $main::split = "||"
my $dbname = "jtdatabase";
create_db("<path-to>/".$dbname,$ids);
# Then,<path-to>/jtdatabase.txt and <path-to>/jtdatabase_info.txt has been
# created !
=head2 SQL-String
select id,name from $db where id>6
select * from from $db where name=~ m"Aren"i and email ne ""
notices: at the block of WHERE ,u can use a-short-perl-code !!
--------------------------------------------------------------
INSERT INTO $db (id,name) values(2009,Aren)
insert into $db values ( 2009,Aren,12345,mylover)
notices: do not use ' or " at values-list
insert into $db values ( '2009','Aren','12345','mylover')
will set id="'2009'" and name="'Aren'" and ...
--------------------------------------------------------------
DELETE FROM $db WHERE id =~ /J/
--------------------------------------------------------------
update $db set name='jack',pass=\"123\",lover='jack\"lover' where id = 3
=head1 BUGS
Author Aren <boyaren@sina.com> http://www.justake.com
=cut
尝试用sql查询语句操纵普通文本数据库!使用简单的select就可以实现文本的索引访问,用update……
foreach $line (@resoult)
{
print $line->{'id'}."\n";
print $line->{'name'}."\n";
}
=item create_db
usage:
my $ids = "id,name,pass,lover"; # Now,$main::split = ","
# If $ids = "id||name||pass||lover" then $main::split = "||"
my $dbname = "jtdatabase";
create_db("<path-to>/".$dbname,$ids);
# Then,<path-to>/jtdatabase.txt and <path-to>/jtdatabase_info.txt has been
# created !
=head2 SQL-String
select id,name from $db where id>6
select * from from $db where name=~ m"Aren"i and email ne ""
notices: at the block of WHERE ,u can use a-short-perl-code !!
--------------------------------------------------------------
INSERT INTO $db (id,name) values(2009,Aren)
insert into $db values ( 2009,Aren,12345,mylover)
notices: do not use ' or " at values-list
insert into $db values ( '2009','Aren','12345','mylover')
will set id="'2009'" and name="'Aren'" and ...
--------------------------------------------------------------
DELETE FROM $db WHERE id =~ /J/
--------------------------------------------------------------
update $db set name='jack',pass=\"123\",lover='jack\"lover' where id = 3
=head1 BUGS
Author Aren <boyaren@sina.com> http://www.justake.com
=cut