sqliteºÍpdo mysqlµÄÊý¾Ý¿â²Ù×÷
½ñÌìµÄѧϰÄÚÈÝÊÇsqliteºÍPDO mysql¡£
ÓÃ×Ô¼ºµÄ»°ËµËµÁ½¸ö¶«Î÷°É£º
sqliteËãÊÇÒ»ÖÖ²»ÏµÍ³µÄÊý¾Ý¿â´æ´¢·½Ê½£¬ËüµÄ´æ·Å¸ñʽÊÇÒ»¸ö.dbºó׺µÄÎļþ£¬ÔÚphpÖÐËü´æ·ÅÔÚµ±Ç°µÄĿ¼Ï£¬Ã²ËƲ»ÓÃÓû§ÃûÃÜÂ룬°²È«ÐԽϵͣ¬È´±È½Ï·½±ã¡£PHP5ÖÐ×Ô´øµÄһЩϵͳº¯Êý£¬¶¼ÊÇÒÔsqlite_¿ªÍ·µÄ¡£
PDOÈ«³ÆPHP Data Object£¬¹ËÃû˼Òå¾ÍÊÇPHPµÄÒ»ÖÖϵͳ¶ÔÏó£¿ÔÚ²Ù×÷ÓÃÒ²ÊÇÒÔÒ»¸öÀàΪ¿ªÊ¼¡£ÀàËÆmysqlµÄ·½Ê½¡£
Ö÷Ҫժ¼һϺ¯Êý°É£º
1. sqlite£º
$db = sqlite_open("php100.db");
$sql = "select * from test";
$result = sqlite_query($db,$sql);
$row = sqlite_fetch_array($result);
print_r($row);
2. PDO mysql:
$db = new PDO("mysql:host=localhost;dbname=student",'root','');
$rs = $db->query("SELECT * from testmem");
while($row = $rs->fetch()){
print_r($row);
echo "<hr size=1>";
}
Ïà¹ØÎĵµ£º
DELIMITER $$
DROP PROCEDURE IF EXISTS `heli`.`prodtest` $$
CREATE PROCEDURE `heli`.`prodtest` ()
BEGIN
/*¾Ö²¿±äÁ¿µÄ¶¨Òå declare*/
declare pid varchar(45) default '';
declare pq int default 0;
declare pk double default 0.0;
declare cur1 CURSOR FOR SELECT pro ......
SQLite3ÊÇSQLiteÒ»¸öȫеİ汾,ËüËäÈ»ÊÇÔÚSQLite 2.8.13µÄ´úÂë»ù´¡Ö®ÉÏ¿ª·¢µÄ,µ«ÊÇʹÓÃÁ˺Í֮ǰµÄ°æ±¾²»¼æÈݵÄÊý¾Ý¿â¸ñʽºÍAPI. SQLite3ÊÇΪÁËÂú×ãÒÔϵÄÐèÇó¶ø¿ª·¢µÄ:
Ö§³ÖUTF-16±àÂë.
Óû§×Ô¶¨ÒåµÄÎı¾ÅÅÐò·½·¨.
¿ÉÒÔ¶ÔBLOBs×ֶν¨Á¢Ë÷Òý.
Òò´ËΪÁËÖ§³ÖÕâÐ©ÌØÐÔÎҸıäÁËÊý¾Ý¿âµÄ¸ñʽ,½¨Á¢ÁËÒ»¸öÓë֮ǰ°æ±¾²»¼æÈݵ ......
ÎÒÔڵǼMySQLºóµÄÃüÁîÐÐÊÇÕâ¸öÑù×ӵģº
warmbupt@pchuang:/windows/MyCode/SS$ mysql -u root -ppassw0rd
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.1.37-1ubuntu5.1 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the curr ......
¹«Ë¾mysqlͳһÓÃlatin1µÄ±àÂë£¬ÕæÊǽÐÈ˿಻¿°ÑÔ¡£DjangoÓÃĬÈÏUTF8·ÃÎÊMYSQLÊý¾Ý¿â¡£ÔÚ²Ù×÷Êý¾Ý¿âʱ£¬²»¹ÜÄãÔõôתÂ룬×îÖÕдµ½Êý¾Ý¿âÀïµÄÖÐÎͼÊÇÂÒÂë¡£ÔÚÍøÉÏÕÒÁ˺ܾã¬Ò²Ã»½â¾öÕâ¸öÎÊÌâ¡£
ºóÀ´¿´ÁËÒ»¸öDJANGOµÄMYSQL²Ù×÷µÄÔ´Â룬·¢ÏÖÁËһЩÎÊÌâ ÏÈÊÇ/d ......
mysql µ¼³ö±í£º
mysqldump -u Óû§Ãû -p --opt Êý¾Ý¿âÓû§Ãû ±íÃû
> ±íÃû.sql
mysql µ¼³öÊý¾Ý¿â£º
mysqldump -u
Óû§Ãû -p --opt Êý¾Ý¿âÓû§Ãû
>
Êý¾Ý¿â
Ãû.sql
mysql µ¼Èë±í£º
>source e:\base\pet.sql;
mysql µ¼Èë±íÊý¾Ý£º
>LOAD DATA LOCAL INFILE 'e:path/pet.txt ......