当前位置:七道奇文章资讯数据防范MySQL防范
日期:2011-05-02 15:44:00  来源:本站整理

用gcc批量建mysql库表[MySQL防范]

赞助商链接



  本文“用gcc批量建mysql库表[MySQL防范]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
 

file 1

my.c

//--------------------------------------------------------

// MySQL Database Create 1/13/2001. Netkiller Chen

//--------------------------------------------------------

#include

#include

main()

{

char host[16]; //mysql host address.

char sid[15]; //root user name.

char pwd[15]; //root password.

/* char *table_file[]={

"gsxx",

"bcxx",

"fgxx",

"hmbxx",

"ltxx",

NULL

};*/

//char *mysql;

char mydatabase[256];

char mysqltable[256];

int i;

int max_table_num;

int db,status;

i=0;

max_table_num=4; //max_table_num

system("clear");

showme();printf("\n");

printf("MySQL host:");scanf("%s",host);

printf("Root user:");scanf("%s",sid);

printf("Password:");scanf("%s",pwd);

printf("Loading........\n\n");

while(table_file[i]){

sprintf(mydatabase,"echo \"create database %s\"|mysql -h%s -u%s -p%s",table_file[i],host,sid,pwd);

sprintf(mysqltable,"mysql -h%s -u%s -p%s %s<%s.sql",host,sid,pwd,table_file[i],table_file[i]);

db=system(mydatabase);

status=system(mysqltable);

// printf("%s\n%s",mydatabase,mysqltable);

printf(table_file[i]);

//printf("%d",status);

if(db==0 && status==0){

printf("\t\t\tInstall [ OK ]\n");

}else{

printf("\t\t\tInstall [ :( ]\n");

}

i++;

}

address();

}

//------------------- Function ------------------

showme()

{

printf("-------------------------------------------------------------------\n");

printf("\tI am Netkiller Chen.\n");

printf("\tI am a programmer and system&net manager.\n");

printf("\tI am glad to be friend with you!\n");

printf("-------------------------------------------------------------------\n");

}

address()

{

printf("\n----------------------------------\n");

printf("|\tnewtech@sina.com |\n");

printf("|\tOICQ:13721218 |\n");

printf("|\t 1/13/2001 |\n");

printf("----------------------------------\n");

}

file 2

table.h

char *table_file[]={

"alxx",

"bcxx",

"fycx",

"fyxwxx",

"fyzxxx",

"hwzx",

"lhzxxx",

"xxdexx",

"xxdsxx",

"xxfgxx",

"xxglxx",

"xxgsxx",

"xxhmbxx",

"xxhtxx",

"xxjbxx",

"xxltxx",

"xxzwxx",

"xxzx",

NULL

};

些程序可以便利建表...有什么不懂得与我接洽.

程序随算不上什么.....但也办理了一些批量建表的问提.

这个程序可以做为gcc刚入门爱好的参考,因为这个程序象hello world一样间简单.并且很全包含了指针,数组,文件包含,NULL

用户办法两个文件置于./root/mygcc/下,将预建库mysql语句文件,文件名命名为xxxx.sql同上然后

#gcc my.c -o my

#my

便可...不用我在说了吧?

  以上是“用gcc批量建mysql库表[MySQL防范]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
  • 用gcc批量建mysql库表
  • 本文地址: 与您的QQ/BBS好友分享!
    • 好的评价 如果您觉得此文章好,就请您
        0%(0)
    • 差的评价 如果您觉得此文章差,就请您
        0%(0)

    文章评论评论内容只代表网友观点,与本站立场无关!

       评论摘要(共 0 条,得分 0 分,平均 0 分) 查看完整评论
    Copyright © 2020-2022 www.xiamiku.com. All Rights Reserved .