zoukankan      html  css  js  c++  java
  • InfiniBand

    Mellanox InfiniBand卡线缆性能延迟性测试程序源码,C源码实现操作mysql库,实现简单的增删改查,代码当前用的是增插入20000条数据

    具体见源码

     1 #include <mysql/mysql.h>
     2 #include <time.h>
     3 #include <stdio.h>
     4 //gcc $0 -L /usr/lib64/mysql/ -lmysqlclient -o outputname
     5 //Mellanox InfiniBand Card Perforce test,By yodoo ruiy
     6 //
     7 
     8 void insert() {
     9 MYSQL      *conn;
    10 MYSQL_RES  *res;
    11 MYSQL_ROW  row;
    12 
    13 char *server = "192.168.3.205";
    14 char *user = "root";
    15 char *password = "123"; /* set me first */
    16 char *database = "ruiy";
    17 //char *query = "select * from user";
    18 //char *query = "insert into perforce values("rui_C","rui_S","rui_N","rui_v","rui_O","rui_U","rui_T","rui_S","rui_CO","rui_All");";
    19 //char *query = "insert into perforce values('rui_C','rui_S','rui_N','rui_v','rui_O','rui_U','rui_T','rui_S','rui_CO','rui_All');"
    20 char *query = "insert into perforce values("rui_C","rui_S","rui_N","rui_v","rui_O","rui_U","rui_T","rui_S","rui_CO","rui_All")";
    21 int t,r;
    22 
    23 conn = mysql_init(NULL);
    24 
    25 if(!mysql_real_connect(conn,server,user,password,database,0,NULL,0))
    26 {
    27 printf("Error connecting to database: %s
    ", mysql_error(conn));
    28 }
    29 else
    30 {
    31 printf("Connected....
    ");
    32 }
    33 
    34 t = mysql_query(conn, query);
    35 
    36 if(t)
    37 {
    38 printf("Error making query: %s
    ", mysql_error(conn));
    39 }
    40 else
    41 {
    42 printf("Query made...
    ");
    43 res = mysql_use_result(conn);
    44 if(res)
    45 {
    46 for(r=0; r<=mysql_field_count(conn); r++)
    47 {
    48 row = mysql_fetch_row(res);
    49 if(row<0) break;
    50 for(t=0; t<mysql_num_fields(res); t++)
    51 printf("%s", row[t]);
    52 printf("
    ");
    53 }
    54 }
    55 mysql_free_result(res);
    56 }
    57 mysql_close(conn);
    58 }
    59 
    60 void Ptime()
    61 {
    62 FILE *fp;
    63 time_t now;
    64 struct tm *timenow;
    65 time(&now);
    66 timenow = localtime(&now);
    67 fp = fopen("time.xml","a+");
    68 fprintf(fp,"%s",asctime(timenow));
    69 fclose(fp);
    70 }
    71 
    72 
    73 main()
    74 {   Ptime();
    75     int i;
    76     for (i=0;i<20000;i++)
    77     insert();
    78     Ptime();
    79     return 0;
    80 }
  • 相关阅读:
    IfcIndexedColourMap ——Example
    IfcIndexedColourMap
    IfcImageTexture
    IfcFillAreaStyleTiles
    IfcFillAreaStyleHatching
    IfcFillAreaStyle
    IfcExternallyDefinedTextFont
    IfcExternallyDefinedSurfaceStyle
    IfcExternallyDefinedHatchStyle
    IfcDraughtingPreDefinedCurveFont
  • 原文地址:https://www.cnblogs.com/ruiy/p/Mellanox.html
Copyright © 2011-2022 走看看