您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

用gcc批量建mysql库表

2025/9/29 8:48:30发布17次查看
file 1 my.c //-------------------------------------------------------- // mysql database create 1/13/2001. netkiller chen //-------------------------------------------------------- #include #include main() { char host[16]; //mysql host add
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 %sdb=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
即可。。。不用我在说了吧?
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product