您现在的位置: 飞速资源网文章中心电脑教学数据库教程用gcc批量建mysql库表

用gcc批量建mysql库表

飞速资源网| http://www.ff70.com |数据库教程|人气:136次| 06-11
用gcc批量建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
即可。。。不用我在说了吧?

  上一篇      目录      下一篇 来源:unknown   ◆ 本站相关教程 MySQL的数据类型和建库策略MySQL怎样优化WHERE子句用gcc批量建mysql库表不同平台上mysql的对比使一个新的MySQL安装更安全将OICQ数据转成MYSQL数据MySQL数据库类的定义
如果觉得《用gcc批量建mysql库表》数据库教程,sql数据库教程,access数据库教程,oracle数据库教程不错,可以推荐给好友哦。
本文Tags: 电脑教学 - 数据库教程,sql数据库教程,access数据库教程,oracle数据库教程,
广告联系|管理下载|游戏下载|公文中心|驾驶考试|电脑教学|教育教学|名言名句|网站地图|热门专题
Copyright © 资源下载. All Rights Reserved .
本页提供用gcc批量建mysql库表,数据库教程,sql数据库教程,access数据库教程,oracle数据库教程参考。
1 2 3 4 5 6 7 8 9 10 11 12