my question is :
can any body help in that
the following are code sample I use
thanks in advance
best regards
hg
====================
db.sql
====================
CREATE TABLE IF NOT EXISTS `animal` (
`name` char(40) default NULL,
`category` char(40) character set utf8 collate utf8_unicode_ci
default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `animal`
--
INSERT INTO `animal` (`name`, `category`) VALUES
('hatem', 'عبد'),
('atif', 'عاطف'),
('hatem', 'عبد');
====================
====================
db02.py
====================
#!/usr/bin/python
# animal.py - create animal table and
# retrieve information from it
import sys
import MySQLdb
try:
conn = MySQLdb.connect (host = "localhost",
user = "root",
passwd = "",
db = "py",
charset = "utf8",
use_unicode = True)
except MySQLdb.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
sys.exit (1)
cursor = conn.cursor ()
cursor.execute (u""" INSERT INTO animal (name, category) VALUES
('hatem', 'عبد') """ )
print "Number of rows inserted: %d" % cursor.rowcount
============
============
db04.py
============
#!/usr/bin/python
# animal.py - create animal table and
# retrieve information from it
import sys
import MySQLdb
import string
try:
conn = MySQLdb.connect (host = "localhost",
user = "root",
passwd = "",
db = "py",
charset = "utf8",
use_unicode = True)
except MySQLdb.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
sys.exit (1)
cursor = conn.cursor ()
cursor.execute ("SELECT name, category FROM animal")
while (1):
row = cursor.fetchone ()
if row == None:
break
print u"name : %s, category : %s" % (row[0],
string.decode(row[1]))
print "Number of rows returned: %d" % cursor.rowcount
============