Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
big_record.pl
Package: mysql-3.23.35.tar.gz [view]
Upload User: tsgydb
Upload Date: 2007-04-14
Package Size: 10674k
Code Size: 1k
Category:
MySQL
Development Platform:
Visual C++
- #!/usr/bin/perl
- # This is a test with stores big records in a blob
- # Note that for the default test the mysql server should have been
- # started with at least 'mysqld -O max_allowed_packet=200k'
- $host= shift || "";
- $test_db="test";
- $opt_user=$opt_password="";
- use DBI;
- $|= 1; # Autoflush
- $table="test_big_record";
- $rows=20; # Test of blobs up to ($rows-1)*10000+1 bytes
- print "Connection to database $test_dbn";
- $dbh = DBI->connect("DBI:mysql:$test_db:$host",$opt_user,$opt_password) || die "Can't connect: $DBI::errstrn";
- $dbh->do("drop table if exists $table");
- print "Creating table $tablen";
- ($dbh->do("
- CREATE TABLE $table (
- auto int(5) unsigned NOT NULL DEFAULT '0' auto_increment,
- test mediumblob,
- PRIMARY KEY (auto))")) or die $DBI::errstr;
- print "Inserting $rows recordsn";
- for ($i=0 ; $i < $rows ; $i++)
- {
- $tmp= chr(65+$i) x ($i*10000+1);
- $tmp= $dbh->quote($tmp);
- $dbh->do("insert into $table (test) values ($tmp)") or die $DBI::errstr;
- }
- print "Testing recordsn";
- $sth=$dbh->prepare("select * from $table") or die $dbh->errstr;
- $sth->execute() or die $sth->errstr;
- $i=0;
- while (($row = $sth->fetchrow_arrayref))
- {
- print $row->[0]," ",length($row->[1]),"n";
- die "Record $i had wrong data in blob" if ($row->[1] ne (chr(65+$i)) x ($i*10000+1));
- $i++;
- }
- die "Didn't get all rows from server" if ($i != $rows);
- $dbh->do("drop table $table") or die $DBI::errstr;
- print "Test okn";
- exit 0;