linux下如何增量增量传输mysql binlog日志

在实际的工作中我们遇到了一个问题,MYSQL 5.5 我们备份使用的mysqldump,然后每天传输的备份到备份机器,但是binlog却不好传输主要要考虑几个问题:
1、binlog 没法取时间,按照什么规则来传?
2、binlog的传输并不是每次都全部传输过去,而是需要增量的。
3、binlog的最后一个日志是在使用的是不能传输的。
4、为了更通用需要使用一个前缀,因为每个数据库的binlog前缀是可以自己指定的
如 mysqlbin.000001

那么有了上面的问题,如何解决?也许shell脚本能够完成,但是我选择使用C/C++ 和LINUX系统函数 opendir readdir lstat来完成
这是我最后挂载的脚本
#!/bin/sh
TIME_TAG=`date +%Y%m%d`
/root/ftptool/tool  /dbdata/data/  /root/ftptool/ mysql-bin > tool_${TIME_TAG}.log
if [ $? != 0  ]; then
    echo "tool failed"
    exit
else
    echo "tool sucess!"
fi
cat /root/ftptool/ftphead > /root/ftptool/ftp_${TIME_TAG}.sh
cat /root/ftptool/${TIME_TAG} >> /root/ftptool/ftp_${TIME_TAG}.sh
cat /root/ftptool/ftptail >> /root/ftptool/ftp_${TIME_TAG}.sh


chmod 755 /root/ftptool/ftp_${TIME_TAG}.sh
sh /root/ftptool/ftp_${TIME_TAG}.sh
实际上 ftp_${TIME_TAG}.sh来自3个部分
1、 ftphead --这个很简单自己写明白ip 用户名密码就好了,如下:
#!/bin/sh

ftp -i -v -n<< EOF
open 192.168.*.*
user mysql ****
cd /backup/mysql
bin
2、 ftptail  这个更简单
quit
EOF
就这点
3、cat ${TIME_TAG}
这部分是我自己写的工具 tool 生成的
工具使用如下:
Usage:./tool binlogdir ftpdir binlogprefix
需要一个binlog目录 一个ftp目录和binlong的前缀
binlog目录不用多说是binlog的所在目录,需要以/结尾比如 /mysql/data/不能是/mysql/data 否则抛错error 20 binlogdir Must End With /

ftp目录下存放两个东西一个tmp文件和生成的ftp脚本,ftp脚本生成和当前时间一致比如20160713
tmp文件用于存放当前取到的最大的binlog序号,如果不存在可以新建一个,如果不新建抛错error 15 tmp file not found
如果想再次全部传输删除tmp文件新建一个空的就可以比如touch tmp
这个ftp目录同样必须使用/结尾 否则抛错error 21 ftpdir Must End With /

binlogprefix 就是你的前缀比如mysql-bin

使用就是这么简单,有了这3部分就能够通过shell
cat ftphead > ftp_${TIME_TAG}.sh
cat ${TIME_TAG} >> ftp_${TIME_TAG}.sh
cat ftptail >> ftp_${TIME_TAG}.sh
生成一个全部的脚本。然后运行了。
另外tool工具会输出一些信息,当然可以关闭,这些输出信息我重定向到了 tool_${TIME_TAG}.log
可以查看下面就是一份:
WARNING:Ftpdir Less Than 1000 Char!
PROCESS:Create Chain Now:
INFO:Current Binog Dir Is :/dbdata/
PROCESS:Checkbin Binlogprefix: mysql-bin
................. 这里省略很多
PROCESS:Print chain info
................. 这里省略很多
PROCESS:Now Acc Ftpdir:
INFO:Ftp_scirpt fun time:
Wed Jul 13 14:44:13 2016
20160713
INFO:Ftp_scirpt Fun Tmpfile :/root/ftptool/tmp
INFO:Tmpfile Write Mode Succ!
INFO:Ftp_Scirpt Fun Tmp_max_st:0 Max_st_1:2028:
INFO:Scan Put Counter :163
INFO:Current Max Binlog-1 is:2028
PROCESS:Free Node Is:164

可以清楚看到将会生成163个put脚本信息,最高的传输是2028,实际最大是2029,我在编码的时候做了-1操作,目的在于不要传输当前的binlog,
因为当前的binlog正在使用
最后释放了链表节点164个.同事你的tmp文件目录也会输出,binglog 的目录也会输出.

下面是全部分出错码:
error 10 open bindbr error
error 11 argv parameter error
eroor 12 not find binlog
error 14 fptdir open error
error 15 tmp file not found
error 16 lstat tmp file error
error 18 tmp file write error
error 20 binlogdir Must End With /
error 21 ftpdir Must End With /
当然成功放回 0

编译好的我放到了百度云盘
http://pan.baidu.com/s/1i4WuBB3
下面是全部的源代码
编译使用 g++ main.cpp mybin.cpp -o tool 即可 注意本工具使用了LINUX系统函数所以必须是LINUX系统或者其他满足posix标准的系统不包含windows
在LINUX下编译没有问题。有什么问题可以联系QQ 22389860.

点击(此处)折叠或打开

  1. /*************************************************************************
  2.   > File Name: mbin.h
  3.   > Author: gaopeng
  4.   > Mail: gaopp_200217@163.com
  5.   > Created Time: Tue 02 Aug 2016 05:57:27 PM CST
  6.  ************************************************************************/

  7. #include<iostream>
  8. #define _DEG
  9. using namespace std;
  10. typedef unsigned char uchar;
  11. typedef unsigned long ulong;
  12. typedef unsigned int uint;
  13. typedef unsigned short ushort;


  14. typedef struct data
  15. {

  16.     char* file_name;
  17.     char* path_name;
  18.     char* full_name;
  19.     ulong file_st;
  20.     uint nuse;
  21. } DATA;

  22. typedef struct f_node
  23. {

  24.     struct f_node *next;
  25.     DATA* data;
  26. } F_NODE;

  27. typedef struct quence
  28. {

  29.     F_NODE* first;
  30.     F_NODE* last;
  31.     int items;
  32. } QUE;

  33. uint checkbin(const char* file_name,const char* binprefix);
  34. F_NODE* create_que(const char *bindir,const char* binprefix);
  35. QUE* ini_que(void);
  36. void show( F_NODE* const frs_nd);
  37. void ins_chan(const char* f_name,const char* p_name,const char* ful_name,QUE * que);
  38. ulong char_to_num(const char* file_name);
  39. void time_to_time(char* ltime,char* mytime);
  40. void ftp_script(const char* ftp_dir,F_NODE* frs_nd);
  41. int get_max_st(F_NODE* const frs_nd);
  42. ulong readtmp(FILE *fd,const char* tmpdir);
  43. int myfree(F_NODE* const frs_nd);
  44. uint checkdir(const char* mychar);


点击(此处)折叠或打开

  1. /*************************************************************************
  2.   > File Name: main.cpp
  3.   > Author: gaopeng
  4.   > Mail: gaopp_200217@163.com
  5.   > Created Time: Tue 02 Aug 2016 05:58:15 PM CST
  6.  ************************************************************************/

  7. #include<iostream>
  8. #include<iostream>
  9. #include<stdio.h>
  10. #include <sys/types.h>
  11. #include <dirent.h>
  12. #include <string.h>
  13. #include"mbin.h"
  14. #include <stdlib.h>

  15. using namespace std;



  16. int main(int argc,char *argv[])
  17. {
  18.     F_NODE* frs_nd=0;
  19.     int freeno =0;
  20.     printf("%s\n","Usage:./tool binlogdir ftpdir binlogprefix");
  21.     if(argc<4)
  22.     {
  23.         cout<<"ERROR(9):Parameter Error Like:"<<endl;
  24.         printf("%s\n","Usage:./tool binlogdir ftpdir binlogprefix");
  25.         exit(9);
  26.     }
  27.     if(checkdir(argv[1]) == 1)
  28.     {
  29.         cout<<"ERROR(20):binlogdir Must End With /"<<endl;
  30.         exit(20);
  31.     }
  32.     if(checkdir(argv[2]) == 1)
  33.     {
  34.         cout<<"ERROR(21):ftpdir Must End With /"<<endl;
  35.         exit(21);
  36.     }
  37.     printf("WARNING:Ftpdir Less Than 1000 Char!\n");
  38.     printf("PROCESS:Create Chain Now:\n");
  39.     frs_nd = create_que(argv[1],argv[3]);
  40.     cout<<"PROCESS:Print chain info"<<endl;
  41.     show(frs_nd);
  42.     cout<<"PROCESS:Now Acc Ftpdir:"<<endl;
  43.     ftp_script(argv[2], frs_nd);
  44.     
  45.     freeno = myfree(frs_nd);
  46.     cout<<"PROCESS:Free Node Is:"<<freeno<<endl;

  47. return 0;
  48. }


点击(此处)折叠或打开

  1. /*************************************************************************
  2.   > File Name: mybin.cpp
  3.   > Author: gaopeng
  4.   > Mail: gaopp_200217@163.com
  5.   > Created Time: Tue 02 Aug 2016 05:57:34 PM CST
  6.  ************************************************************************/

  7. #include<iostream>
  8. #include "mbin.h"
  9. #include <sys/types.h>
  10. #include <sys/stat.h>
  11. #include <unistd.h>
  12. #include <time.h>
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <string.h>
  16. #include <dirent.h>
  17. #include <math.h>

  18. using namespace std;

  19. QUE* ini_que(void)
  20. {
  21.     QUE* que = new QUE;
  22.     que->first =0;
  23.     que->last =0;
  24.     que->items =0;
  25.     return que;
  26. }

  27. void ins_chan(const char* f_name,const char* p_name,const char* ful_name,QUE * que)
  28. {
  29.     F_NODE *add = new F_NODE; //inital node pointer
  30.     DATA *name = new DATA; //inital data pointer
  31.     name->file_name = new char[strlen(f_name)+5];
  32.     name->path_name = new char[strlen(p_name)+5];
  33.     name->full_name = new char[strlen(ful_name)+5];

  34.     //init mem

  35.     memset(name->file_name,0,strlen(f_name)+5);
  36.     memset(name->path_name,0,strlen(p_name)+5);
  37.     memset(name->full_name,0,strlen(ful_name)+5);

  38.     name->file_st = char_to_num(f_name);
  39.     name->nuse = 0;
  40.     strcpy(name->file_name,f_name);
  41.     strcpy(name->path_name,p_name);
  42.     strcpy(name->full_name,ful_name);

  43.     add->next =0;
  44.     add->data = name;

  45.     if( que->items==0)
  46.     {
  47.         que->first =add;
  48.         que->last =add;
  49.         que->items++;
  50.     }
  51.     else
  52.     {
  53.         que->last->next = add;
  54.         que->last = add;
  55.         que->items++;
  56.     }
  57. }

  58. F_NODE* create_que(const char *bindir,const char* binprefix)
  59. {
  60.     struct dirent *DirEntry=0;
  61.     DIR* Dir=0;
  62.     QUE* myq=0;
  63.     uint nob=0; //check if binlog find

  64.     myq = ini_que();
  65.     F_NODE* frs_nd =0;

  66.     if( !(Dir = opendir(bindir)))
  67.     {
  68.         perror("ERROR(10):Open Binlog Dir Error:");
  69.         exit(10);
  70.     }
  71.     else
  72.     {
  73.         printf("INFO:Current Binog Dir Is :%s\n",bindir);
  74.         while( DirEntry = readdir(Dir))
  75.         {
  76.             if(DirEntry->d_type == DT_REG && checkbin(DirEntry->d_name,binprefix) == 1)            
  77.             {
  78.                 nob++;

  79. #ifdef _DEG
  80.                 printf("%s%s\n",bindir,DirEntry->d_name);
  81. #endif
  82.                 char *tloop = new char[strlen(bindir) + strlen(DirEntry->d_name)+5];
  83.                 strcat(strcat(tloop,bindir),DirEntry->d_name); //bindir like /test/test/test/ last / is must
  84.                 ins_chan(DirEntry->d_name,bindir,tloop,myq);
  85.                 delete [] tloop;
  86.             }
  87.         }
  88.         closedir(Dir);
  89.         if(nob == 0)
  90.         {
  91.             printf("WARNING:No Bin Log Find!!\n");
  92.             delete myq;
  93.             exit(12);
  94.         }
  95.     }
  96.     frs_nd = myq->first;
  97.     delete myq;
  98.     return frs_nd;
  99. }

  100. uint checkbin(const char* file_name,const char* binprefix)
  101. {
  102.     uint lenprefix = strlen(binprefix); //exp 5
  103.     uint filelen = strlen(file_name);
  104.     uint i;
  105.     uint t;
  106.     char tmpfix[strlen(binprefix)+1]; //exp strlen(binprefix)+1 =6
  107.     memset(tmpfix,0,strlen(binprefix)+1);
  108.     for(i=0;i<=lenprefix-1;i++) //exp lenprefix-1=4
  109.     {
  110.         tmpfix[i]=file_name[i]; //5 char copy tmpfix[0-4]
  111.     }
  112.     tmpfix[lenprefix]='\0'; //tmpfix[5] = '\0'
  113. #ifdef _DEG
  114.     cout<<"PROCESS:Checkbin Binlogprefix: "<<tmpfix<<endl;
  115. #endif
  116.     if(!strcmp(tmpfix,binprefix)) //check prefix eq tmpfix
  117.     {
  118.         for(t=(filelen-1);t>=(filelen-6);t--) //exp filelen-1=10 filelen-6=5
  119.         {
  120.             if(file_name[t]<48 || file_name[t]>57 ) //check 000000
  121.             {
  122.                 return 0;
  123.             }
  124.         }
  125.         if(file_name[filelen-7] !='.') //check . of .000000
  126.         {
  127.             return 0;
  128.         }
  129.     }
  130.     else
  131.     {
  132.         return 0;
  133.     }
  134.     return 1;
  135. }

  136. void show( F_NODE* const frs_nd)
  137. {
  138.     F_NODE* scan_nd = frs_nd;
  139.     do {
  140.         if(!scan_nd->next)
  141.         {
  142.             break;
  143.         }
  144.         printf("INFO:%s,%s,%s,%lu,%u\n",scan_nd->data->file_name,scan_nd->data->path_name,scan_nd->data->full_name,scan_nd->data->file_st,scan_nd->data->nuse);
  145.         scan_nd = scan_nd->next;
  146.     } while(scan_nd->next);
  147.     printf("INFO:%s,%s,%s,%lu,%u\n",scan_nd->data->file_name,scan_nd->data->path_name,scan_nd->data->full_name,scan_nd->data->file_st,scan_nd->data->nuse);
  148. }



  149. ulong char_to_num(const char* file_name)
  150. {
  151.     uint len = strlen(file_name);
  152.     uint i;
  153.     ulong num=0;
  154.     uint chk=0;

  155.     for(i=(len-1);i>0;i--)
  156.     {
  157.         if(file_name[i]>=48 && file_name[i]<=57)
  158.         {
  159.             num = (ulong)(file_name[i] - 48)*(ulong)pow(10,chk)+num;
  160.             chk++;
  161.         }
  162.     }
  163.     return num;
  164. }


  165. void time_to_time(char* ltime,char* mytime)
  166. {
  167.     char buffer[10];
  168.     buffer[0] = ltime[4];
  169.     buffer[1] = ltime[5];
  170.     buffer[2] = ltime[6];
  171.     buffer[3] = '\0';

  172.     mytime[0]=ltime[20];
  173.     mytime[1]=ltime[21];
  174.     mytime[2]=ltime[22];
  175.     mytime[3]=ltime[23];
  176.     if(!strcmp(buffer,"Jan"))
  177.     {

  178.         mytime[4]='0';
  179.         mytime[5]='1';
  180.     }
  181.     if(!strcmp(buffer,"Feb"))
  182.     {

  183.         mytime[4]='0';
  184.         mytime[5]='2';
  185.     }
  186.     if(!strcmp(buffer,"Mar"))
  187.     {

  188.         mytime[4]='0';
  189.         mytime[5]='3';
  190.     }
  191.     if(!strcmp(buffer,"Apr"))
  192.     {

  193.         mytime[4]='0';
  194.         mytime[5]='4';
  195.     }
  196.     if(!strcmp(buffer,"May"))
  197.     {

  198.         mytime[4]='0';
  199.         mytime[5]='5';
  200.     }
  201.     if(!strcmp(buffer,"Jun"))
  202.     {

  203.         mytime[4]='0';
  204.         mytime[5]='6';
  205.     }
  206.     if(!strcmp(buffer,"Jul"))
  207.     {

  208.         mytime[4]='0';
  209.         mytime[5]='7';
  210.     }
  211.     if(!strcmp(buffer,"Aug"))
  212.     {

  213.         mytime[4]='0';
  214.         mytime[5]='8';
  215.     }
  216.     if(!strcmp(buffer,"Sep"))
  217.     {

  218.         mytime[4]='0';
  219.         mytime[5]='9';
  220.     }
  221.     if(!strcmp(buffer,"Oct"))
  222.     {

  223.         mytime[4]='1';
  224.         mytime[5]='0';
  225.     }
  226.     if(!strcmp(buffer,"Nov"))
  227.     {

  228.         mytime[4]='1';
  229.         mytime[5]='1';
  230.     }
  231.     if(!strcmp(buffer,"Dec"))
  232.     {

  233.         mytime[4]='1';
  234.         mytime[5]='2';
  235.     }

  236.     if(ltime[8]<48 ||ltime[8]>57)
  237.     {

  238.         mytime[6]=48;
  239.     }
  240.     else
  241.     {

  242.         mytime[6]=ltime[8];
  243.     }
  244.     mytime[7]=ltime[9];
  245.     mytime[8]='\0';
  246. }



  247. void ftp_script(const char* ftp_dir,F_NODE* frs_nd)
  248. {
  249.     time_t now;
  250.     F_NODE* scan_nd = frs_nd;
  251.     struct tm* nowtm;
  252.     FILE* ftp=0;
  253.     FILE* tmp=0;
  254.     char timebuf[40];
  255.     char mytime[25];
  256.     char myftpdir[1000];
  257.     char tmpdir[1000];
  258.     ulong tmp_max_st;
  259.     ulong max_st_1;
  260.     int i=0;
  261.     int freeno=0;

  262.     memset(timebuf,0,40);
  263.     memset(mytime,0,40);
  264.     time(&now);
  265.     nowtm = localtime(&now);
  266.     asctime_r(nowtm,timebuf);
  267.     time_to_time(timebuf,mytime);
  268. #ifdef _DEG
  269.     printf("INFO:Ftp_scirpt fun time:\n%s%s\n",timebuf,mytime);
  270. #endif
  271.     memset(myftpdir,0,1000);
  272.     if((ftp=fopen(strcat(strcat(myftpdir,ftp_dir),mytime),"w"))==NULL)
  273.     {

  274.         perror("ERROR(14):Ftpdir open error:");
  275.         freeno=myfree(frs_nd);
  276.         cout<<"PROCESS:Free Mem:Free Node Is:"<<freeno<<endl;
  277.         exit(14);
  278.     }
  279.     memset(tmpdir,0,1000);
  280.     if((tmp=fopen(strcat(strcat(tmpdir,ftp_dir),"tmp"),"r"))==NULL)
  281.     {
  282.         printf("ERROR(15):No Tmp File Found,Please Create it frist!\n");
  283.         freeno=myfree(frs_nd);
  284.         cout<<"PROCESS:Free Mem:Free Node Is:"<<freeno<<endl;
  285.         exit(15);
  286.     }
  287.     else
  288.     {
  289. #ifdef _DEG
  290.         printf("INFO:Ftp_scirpt Fun Tmpfile :%s\n",tmpdir);
  291. #endif
  292.         tmp_max_st=readtmp(tmp,tmpdir);    
  293.     }
  294.     memset(tmpdir,0,1000);
  295.     if((tmp=fopen(strcat(strcat(tmpdir,ftp_dir),"tmp"),"w"))==NULL)
  296.     {

  297.         printf("ERROR:Have No Write Privi In %s?\n",tmpdir);
  298.         perror("ERROR(18):Tmpfile Open W Error:");
  299.         freeno=myfree(frs_nd);
  300.         cout<<"PROCESS:Free Mem:Free Node Is:"<<freeno<<endl;
  301.         exit(18);
  302.     }
  303.     else
  304.     {
  305.         printf("INFO:Tmpfile Write Mode Succ!\n");
  306.     }

  307.     max_st_1 = get_max_st(frs_nd) - 1;
  308.     printf("INFO:Ftp_Scirpt Fun Tmp_max_st:%lu Max_st_1:%lu:\n",tmp_max_st,max_st_1);    
  309.     do{
  310.         if(!scan_nd->next)
  311.         {
  312.             break;
  313.         }
  314.         if(scan_nd->data->file_st > tmp_max_st && scan_nd->data->file_st <= max_st_1)
  315.         {
  316.             i++;
  317.             fputs("put ",ftp);
  318.             fputs(scan_nd->data->full_name,ftp);
  319.             fputs(" ",ftp);
  320.             fputs(scan_nd->data->file_name,ftp);
  321.             fputs("\n",ftp);
  322.         }
  323.         scan_nd = scan_nd->next;
  324.     }while(scan_nd->next);
  325.     if(scan_nd->data->file_st > tmp_max_st && scan_nd->data->file_st <= max_st_1)
  326.     {
  327.         i++;
  328.         fputs("put ",ftp);
  329.         fputs(scan_nd->data->full_name,ftp);
  330.         fputs(" ",ftp);
  331.         fputs(scan_nd->data->file_name,ftp);
  332.         fputs("\n",ftp);
  333.     }

  334.     printf("INFO:Scan Put Counter :%d\n",i);
  335.     if(i == 0)
  336.     {
  337.         printf("INFO:Read Max Binlog From Temp is :%lu\n",tmp_max_st);
  338.         fprintf(tmp,"%lu",tmp_max_st);
  339.         fputs("\n",tmp);
  340.     }
  341.     else
  342.     {
  343.         printf("INFO:Current Max Binlog-1 is:%lu\n",max_st_1);
  344.         fprintf(tmp,"%lu",max_st_1);
  345.         fputs("\n",tmp);
  346.     }

  347.     fclose(ftp);
  348.     fclose(tmp);
  349. }

  350. int get_max_st(F_NODE* const frs_nd)
  351. {
  352.     F_NODE* scan_nd = frs_nd;    
  353.     ulong max_st=0;
  354.     do {
  355.         if(!scan_nd->next)
  356.         {
  357.             break;
  358.         }
  359.         if(scan_nd->data->file_st > max_st)
  360.         {
  361.             max_st = scan_nd->data->file_st;
  362.         }
  363.         scan_nd = scan_nd->next;
  364.     }while(scan_nd->next);
  365.     if(scan_nd->data->file_st > max_st)
  366.     {
  367.         max_st = scan_nd->data->file_st;
  368.     }
  369.     return max_st;
  370. }




  371. ulong readtmp(FILE *fd,const char* tmpdir)
  372. {
  373.     struct stat buf;
  374.     ulong max_st = 0;

  375.     if(lstat(tmpdir, &buf) < 0)
  376.     {
  377.         perror("ERROR(16):Lstat Error:");
  378.         exit(16);
  379.     }
  380.     if(buf.st_size == 0)
  381.     {
  382.         max_st = 0;
  383.     }
  384.     else
  385.     {
  386.         fscanf(fd,"%lu",&max_st);
  387.         /*
  388.          if(max_st == 0)
  389.          {
  390.          printf("Tmp File Is Bad ?\n");
  391.          exit(17);
  392.          }
  393.          */
  394.     }
  395.     return max_st;
  396. }



  397. int myfree(F_NODE* const frs_nd)
  398. {

  399.     F_NODE* scan_nd = frs_nd;
  400.     F_NODE* cur_nd = 0;
  401.     int i = 0;
  402.     do{
  403.         cur_nd = scan_nd;
  404.         if(!scan_nd->next)
  405.         {
  406.             free(cur_nd->data->file_name);
  407.             free(cur_nd->data->path_name);
  408.             free(cur_nd->data->full_name);
  409.             free(cur_nd->data);
  410.             free(cur_nd);
  411.             i++;
  412.             return i;
  413.         }
  414.         scan_nd = scan_nd->next;
  415.         free(cur_nd->data->file_name);
  416.         free(cur_nd->data->path_name);
  417.         free(cur_nd->data->full_name);
  418.         free(cur_nd->data);
  419.         free(cur_nd);
  420.         i++;
  421.     }while(scan_nd->next);
  422.     free(scan_nd->data->file_name);
  423.     free(scan_nd->data->path_name);
  424.     free(scan_nd->data->full_name);
  425.     free(scan_nd->data);
  426.     free(scan_nd);
  427.     i++;
  428.     return i;
  429. }

  430. uint checkdir(const char* mychar)
  431. {
  432.     uint len = strlen(mychar);
  433.     if(mychar[len-1] == '/' )
  434.     {
  435.         return 0;
  436.     }
  437.     else
  438.     {
  439.         return 1;
  440.     }
  441. }


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7728585/viewspace-2121960/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/7728585/viewspace-2121960/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值