CÓïÑÔÁ¬½ÓMySQLÊý¾Ý¿â
Ç°¼¸Ì칫˾ÈÃÎÒ×öCÓïÑÔºÍMySQLÊý¾Ý¿âµÄ½»»¥²Ù×÷£¬·ÑÁ˾ÅÅ£¶þ»¢Ö®Á¦Ö®ºó×ÜËã×ö³öÀ´ÁË£¬½ñÌìÌصذÑÔ´´úÂëÌù³öÀ´¹©´ó¼Òѧϰ£»ÈçÓÐÈËÏëÒª´ò°üÏîÄ¿¿ÉÒÔ¼ÓÎÒQQ260990509,×¢Ã÷¼¼Êõ½»Á÷£¬¼´¿É»ñµÃ´ò°üÖ®ºóµÄÏîÄ¿£¡
#if defined(_WIN32) || defined(_WIN64) //ΪÁËÖ§³Öwindowsƽ̨ÉϵıàÒë
#include <windows.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include "mysql.h"
#include <winsock.h>
#include <iostream.h>
#include <string.h>
MYSQL mysql,*sock; //¶¨ÒåÊý¾Ý¿âÁ¬½ÓµÄ¾ä±ú£¬Ëü±»ÓÃÓÚ¼¸ºõËùÓеÄMySQLº¯Êý
MYSQL_RES *res; //²éѯ½á¹û¼¯£¬½á¹¹ÀàÐÍ
MYSQL_FIELD *fd ; //°üº¬×Ö¶ÎÐÅÏ¢µÄ½á¹¹
MYSQL_ROW row ; //´æ·ÅÒ»Ðвéѯ½á¹ûµÄ×Ö·û´®Êý×é
char qbuf[300]; //´æ·Å²éѯsqlÓï¾ä×Ö·û´®
//¶¨ÒåÊý¾Ý¿â²Ù×÷µÄºê£¬Ò²¿ÉÒÔ²»¶¨ÒåÁôןóÃæÖ±½Óд½ø´úÂë
#define MAX_STRING_LENGTH 256
//¶¨ÒåÔªËظöÊý
#define MAX_ELEMENT_LENGTH 33
//¶¨ÒåÏÔʾµÄÁÐÊý
#define ELEMENTS_PER_LINE 15
typedef struct
{
char line[MAX_STRING_LENGTH];
char data[ELEMENTS_PER_LINE][MAX_ELEMENT_LENGTH];
}DATA;
void main()
{
//ÉêÃ÷Êý¾Ý¿â²Ù×÷º¯Êý
int insertData(DATA parameter);
//´ò¿ªÖ¸¶¨Îļþ
FILE *fp=fopen("E:\\file.txt","r");
//´´½¨½á¹¹ÌåÀàÐÍʵÌå
DATA data;
memset(&data, 0x00, sizeof(DATA));
//µÃµ½Ò»ÐÐÊý¾Ý
fgets(data.line, MAX_STRING_LENGTH, fp);
while (!feof(fp))
{
int i=0,index=0;
for(i=0; i<ELEMENTS_PER_LINE; i++)
{
//·Ö¸ô×Ö·û´® °´¶ººÅ·Ö¸ô
&nbs
Ïà¹ØÎĵµ£º
1¡¢µ¼³ö
´ÓmysqlÊý¾Ý¿âÖе¼³ö´óÁ¿Êý¾Ý£¬ÍƼömysqldump ÃüÁÓÃÃüÁîµÄÓеãÔÚÓڱȹ¤¾ßÁé»î£¬¿ÉÒÔͨ¹ýÉèÖÃÃüÁîµÄ²ÎÊýÀ´¸ù¾ÝÌõ¼þµ¼³öÒ»¸ö±íÖеIJ¿·ÖÊý¾Ý
ÀýÈ磺½«Ò»¸ö±íµÄÊý¾Ý°´ÕÕÒ»¶¨µÄÌõ¼þµ¼³öµ½d:\sql1.sqlÎļþÖÐ
D:\MySQL5\bin>mysqldump -uÓû§Ãû -pÃÜÂë --no-create-db=TRUE --no-create-inf
o=TRUE --add-drop-t ......
select
count(*) as mcount ,
left(create_time,10) as ptime ,
count(if(receive_msg is null,id,null)) as nullcount ,
count(if(receive_msg = '1',receive_msg,null)) as apfcount ,
count(if(receive_msg = '2',receive_msg,null)) as dttcount ,
count(if(receive_msg = '3',receive_ms ......
1. CµÄʵÏÖ
//stack.h
#ifndef STACK_H
#define STACK_H
#define STACK_CAPACITY 20//maximum size of stack
typedef int stackEle;
typedef struct
{
stackEle myArray[ STACK_CAPACITY ];
int myTop;
}stack;
//construct(initialize) an empty stack
stack *stack_init(void);
//return 1 if stack is em ......
Ò»¡¢Ê²Ã´ÊÇc/sºÍb/s
ÒªÏë¶Ô“c/s”ºÍ“b/s”¼¼Êõ·¢Õ¹±ä»¯ÓÐËùÁ˽⣬Ê×ÏȱØÐë¸ãÇå³þÈý¸öÎÊÌâ¡£
µÚÒ»¡¢Ê²Ã´ÊÇc/s½á¹¹¡£
c/s£¨client/server£©½á¹¹£¬¼´´ó¼ÒÊìÖªµÄ¿Í»§»úºÍ·þÎñÆ÷½á¹¹¡£ËüÊÇÈí¼þϵͳÌåϵ½á¹¹£¬Í¨¹ýËü¿ÉÒÔ³ä·ÖÀûÓÃÁ½¶ËÓ²¼þ»·¾³µÄÓÅÊÆ£¬½«ÈÎÎñºÏÀí·ÖÅäµ½client¶ËºÍserver¶ËÀ´ÊµÏÖ£¬½µµÍÁ ......
Scale Out£ººáÏòÀ©Õ¹£¬Ôö¼Ó´¦Àí½ÚµãÌá¸ßÕûÌå´¦ÀíÄÜÁ¦
Scale Up£º×ÝÏòÀ©Õ¹£¬Í¨¹ýÌáÉýµ¥¸ö½ÚµãµÄ´¦ÀíÄÜÁ¦´ïµ½ÌáÉýÕûÌå´¦ÀíÄÜÁ¦µÄÄ¿µÄ
Replication
MySQLµÄreplicationÊÇÒì²½µÄ£¬ÊÊÓÃÓÚ¶ÔÊý¾ÝʵʱÐÔÒªÇó²»ÊÇÌرð¹Ø¼üµÄ³¡¾°¡£slave¶ËµÄIOÏ̸߳ºÔð´Ómaster¶ÁÈ¡ÈÕÖ¾£¬SQLÏß ³ÌרߺÔðÔÚslave¶ËÓ¦ÓôÓmaster¶Á¹ýÀ´µÄÈÕÖ¾£¨ÔçÆÚ ......