[python] (no subject
azurIt
azurit na pobox.sk
Pondělí Duben 2 13:04:35 CEST 2007
pred tym vsetky je samozrejme nutne urobit import modulu:
import _mysql, _mysql_exceptions
azur
>-----Pôvodná správa-----
>Od: azurIt [mailto:azurit na pobox.sk]
>Komu: python na py.cz
>Predmet: Re: [python] (no subject
>
>
>ahoj,
>
>MySQL modul stiahnes tu:
>http://mysql-python.sourceforge.net/
>
>mala ukazka ako to potom stade vytiahnes:
>
>db_conn = _mysql.connect(host="localhost", user="login", passwd="heslo", db="databaza")
>db_conn.query("SELECT name FROM users")
>mysql_result = db_conn.store_result().fetch_row(maxrows=0)
>db_conn.close()
>print mysql_result
>
>azur
>
>
>>-----Pôvodná správa-----
>>Od: xxxyyyxxx [mailto:xyz007 na centrum.cz]
>>Komu: python na py.cz
>>Predmet: [python] (no subject
>>
>>
>>Ahoj, mam nasledujici databazi:
>>--------------------------------------------------------------------
>>CREATE TABLE `users` (
>>`uid` int(10) unsigned NOT NULL default '0',
>>`name` varchar(60) NOT NULL default '',
>>`pass` varchar(32) NOT NULL default '',
>>`mail` varchar(64) default '',
>>`mode` tinyint(4) NOT NULL default '0',
>>`sort` tinyint(4) default '0',
>>`threshold` tinyint(4) default '0',
>>`theme` varchar(255) NOT NULL default '',
>>`signature` varchar(255) NOT NULL default '',
>>`created` int(11) NOT NULL default '0',
>>`access` int(11) NOT NULL default '0',
>>`login` int(11) NOT NULL default '0',
>>`status` tinyint(4) NOT NULL default '0',
>>`timezone` varchar(8) default NULL,
>>`language` varchar(12) NOT NULL default '',
>>`picture` varchar(255) NOT NULL default '',
>>`init` varchar(64) default '',
>>`data` longtext,
>>PRIMARY KEY (`uid`),
>>UNIQUE KEY `name` (`name`),
>>KEY `access` (`access`)
>>) ENGINE=MyISAM DEFAULT CHARSET=latin1;
>>
>>INSERT INTO `users` (`uid`, `name`, `pass`, `mail`, `mode`, `sort`, `threshold`, `theme`, `signature`, `created`, `access`, `login`, `status`, `timezone`, `language`, `picture`, `init`, `data`) VALUES (0, '', '', '', 0, 0, 0, '', '', 0, 0, 0, 0, NULL, '', '', '', NULL),
>>(1, 'aaa', 'bbb', 'ccc', 0, 0, 0, '', '', 1171668726, 1174774597, 1174774596, 1, '3600', 'cs', '', 'ddd', ''),
>>(2, 'abc', 'def', 'ghi', 0, 0, 0, '', '', 1172416606, 1174761843, 1174760211, 1, NULL, '', '', 'jkl', '');
>>
>>--------------------------------------------------------------------
>>Pouzivam python 2.4.3 a MySQL 5.0.22. Potrebuju napsat v pythonu skript, ktery me ulozi do promene (asi jako seznam) obsah slupce name (aaa, abc). Z propejenim mysql a pythonu nemam zadne zkusenosti - prosim poradte.
>>
>>_______________________________________________
>>Python mailing list
>>Python na py.cz
>>http://www.py.cz/mailman/listinfo/python
>
>_______________________________________________
>Python mailing list
>Python na py.cz
>http://www.py.cz/mailman/listinfo/python
Další informace o konferenci Python