SPAN class=postbody__mysql_password__ 는 자신의 MySQL DB 의 root 유저 암호로 편집해야 합니다. br /br //SPAN TABLE cellSpacing=1 cellPadding=3 width=90% align=center border=0 TBODY TR TDSPAN class=genmedB코드:/B/SPAN/TD/TR TR TD class=code/* br /nbsp; Copyright (C) Information Equipment co.,LTD br /nbsp; All rights reserved. br /nbsp; Code by JaeHyuk Cho lt;mailto:minzkn@infoeq.comgt; br /nbsp; CVSTAG=$Header$ br /*/ br /br /#include lt;stdio.hgt; br /#include lt;mysql/mysql.hgt; br /br /#define __mysql_host__nbsp; nbsp; nbsp;localhost br /#define __mysql_user__nbsp; nbsp; nbsp;root br /#define __mysql_password__ br /br /#define __mysql_database__ mysql br /#define __mysql_port__nbsp; nbsp; nbsp;(3306) br /#define __mysql_uds_path__ NULL br /br /int (main)(int s_argc, char **s_argv) br /{ br /nbsp;MYSQL s_mysql; br /nbsp;MYSQL *s_mysql_ptr; br /br /nbsp;/* MYSQL * STDCALL mysql_init(MYSQL *mysql); */ br /nbsp;(void)mysql_init((MYSQL *)(amp;s_mysql)); br /br /nbsp;/* MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd); */ br /nbsp;/* MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag); */ br /nbsp;s_mysql_ptr = mysql_real_connect((MYSQL *)(amp;s_mysql), __mysql_host__, __mysql_user__, __mysql_password__, __mysql_database__, __mysql_port__, __mysql_uds_path__, (unsigned long)0); br /nbsp;if(s_mysql_ptr != ((MYSQL *)0)) br /nbsp;{ br /nbsp; /* int STDCALL mysql_query(MYSQL *mysql, const char *q); */ br /nbsp; if(mysql_query((MYSQL *)(amp;s_mysql), SELECT Host,User FROM user) == 0) br /nbsp; { br /nbsp; nbsp;MYSQL_RES *s_mysql_res; br /br /nbsp; nbsp;/* MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); */ br /nbsp; nbsp;s_mysql_res = mysql_store_result((MYSQL *)(amp;s_mysql)); br /nbsp; nbsp;if(s_mysql_res != ((MYSQL_RES *)0)) br /nbsp; nbsp;{ br /nbsp; nbsp; MYSQL_ROW s_mysql_row; br /nbsp; nbsp; MYSQL_FIELD *s_mysql_field; br /nbsp; nbsp; unsigned int s_field_index, s_fields; br /br /nbsp; nbsp; /* unsigned int STDCALL mysql_num_fields(MYSQL_RES *res); */ br /nbsp; nbsp; s_fields = mysql_num_fields(s_mysql_res); br /br /nbsp; nbsp; (void)fprintf(stdout, \x1b[1;31mBEGIN.\x1b[0m (fields=%u)\n, s_fields); br /nbsp; nbsp; s_mysql_field = mysql_fetch_fields(s_mysql_res); br /nbsp; nbsp; for(s_field_index = 0u;s_field_index lt; s_fields;s_field_index++) br /nbsp; nbsp; { br /nbsp; nbsp; nbsp;(void)fprintf(stdout, \x1b[1;33m%25s\x1b[0m, (char *)s_mysql_field[s_field_index].name); br /nbsp; nbsp; } br /nbsp; nbsp; (void)fprintf(stdout, \n----------------------------------------------------\n); br /nbsp; nbsp; do br /nbsp; nbsp; { br /nbsp; nbsp; nbsp;/* MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result); */ br /nbsp; nbsp; nbsp;s_mysql_row = mysql_fetch_row(s_mysql_res); br /nbsp; nbsp; nbsp;if(s_mysql_row == ((MYSQL_ROW)0))break; br /br /nbsp; nbsp; nbsp;for(s_field_index = 0u;s_field_index lt; s_fields;s_field_index++) br /nbsp; nbsp; nbsp;{ br /nbsp; nbsp; nbsp; (void)fprintf(stdout, \x1b[1;37m%25s\x1b[0m, (char *)s_mysql_row[s_field_index]); br /nbsp; nbsp; nbsp;} br /br /nbsp; nbsp; nbsp;(void)fprintf(stdout, \n); br /nbsp; nbsp; }while(1); br /nbsp; nbsp; (void)fprintf(stdout, \x1b[1;31mEND.\x1b[0m\n); br /br /nbsp; nbsp; /* void STDCALL mysql_free_result(MYSQL_RES *result); */ br /nbsp; nbsp; mysql_free_result(s_mysql_res); br /nbsp; nbsp;} br /nbsp; nbsp;else (void)fprintf(stdout, can not store result (%s)\n, (char *)mysql_error((MYSQL *)(amp;s_mysql))); br /nbsp; } br /nbsp; else (void)fprintf(stdout, can not SELECT (%s)\n, (char *)mysql_error((MYSQL *)(amp;s_mysql))); br /nbsp;} br /nbsp;else (void)fprintf(stdout, can not connect (%s)\n, (char *)mysql_error((MYSQL *)(amp;s_mysql))); br /br /nbsp;/* void STDCALL mysql_close(MYSQL *sock); */ br /nbsp;mysql_close((MYSQL *)(amp;s_mysql)); br /br /nbsp;(void)fprintf(stdout, \nEnd of \%s\\n, s_argv[0]); br /nbsp;return(0); br /} br /br //* vim: set expandtab: */ br //* End of source *//TD/TR/TBODY/TABLE STYLE type=text/css !-- td.attachrow { font: normal 11px Verdana, Arial, Helvetica, sans-serif; color : #000000; border-color : #000000; } td.attachheader { font: normal 11px Verdana, Arial, Helvetica, sans-serif; color : #000000; border-color : #000000; background-color: #D1D7DC; } table.attachtable { font: normal 12px Verdana, Arial, Helvetica, sans-serif; color : #000000; border-color : #000000; border-collapse : collapse; } -- /STYLE br /
크리에이티브 커먼즈 라이센스
Creative Commons License
2007/06/01 23:45 2007/06/01 23:45
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://blog.minzkn.com/rss/response/136

댓글+트랙백 ATOM :: http://blog.minzkn.com/atom/response/136

트랙백 주소 :: http://blog.minzkn.com/trackback/136

트랙백 RSS :: http://blog.minzkn.com/rss/trackback/136

트랙백 ATOM :: http://blog.minzkn.com/atom/trackback/136

댓글을 달아 주세요

댓글 RSS 주소 : http://blog.minzkn.com/rss/comment/136
댓글 ATOM 주소 : http://blog.minzkn.com/atom/comment/136