Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1176819
  • 博文数量: 573
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 66
  • 用 户 组: 普通用户
  • 注册时间: 2016-06-28 16:21
文章分类

全部博文(573)

文章存档

2018年(3)

2016年(48)

2015年(522)

分类: C/C++

2015-12-02 19:49:07

makefile文件

点击(此处)折叠或打开

  1. CC=esql
  2. all:test clean
  3. test:test.ec
  4.     $(CC) test.ec
  5. clean:
  6.     rm -f *.o *.c
test.ec文件

点击(此处)折叠或打开

  1. #include <string.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <malloc.h>
  5. #include <time.h>

  6. EXEC SQL INCLUDE SQLCA;
  7. EXEC SQL BEGIN DECLARE SECTION;
  8. typedef struct TSAccInfo /*个人帐户信息表*/
  9. {
  10.     char fs_idtype[1+1]; /*证件类型 1:身份证,2:军人证,3:其他*/
  11.     char fs_idnum[18+1]; /*证件号码*/
  12.     char fs_name[20+1]; /*姓名*/
  13.     char fs_addr[40+1]; /*家庭住址*/
  14.     char fs_phone[12+1]; /*家庭电话*/
  15.     char fs_cellno[11+1]; /*移动电话*/
  16.     char fs_pwd[6+1]; /*帐户密码*/
  17.     char fs_accno[9+1]; /*帐号*/
  18.     float fs_bal; /*余额*/
  19.     char fs_astate[1+1]; /*帐号状态*/
  20. }ACCINFO;

  21. typedef struct TSTrade /*交易明细表*/
  22. {
  23.     char fs_trdate[8+1]; /*交易日期*/
  24.     char fs_trtime[6+1]; /*交易时间*/
  25.     char fs_accno[9+1]; /*账户号*/
  26.     char fs_tradetype[1+1];/*交易类型(1:用户开户,2:用户销户,3:存款,4:取款)*/
  27.     float fs_amt; /*发生额*/
  28.     char fs_sqno[32+1]; /*交易流水号*/
  29.     float fs_bal; /*余额*/
  30. }TRADE;

  31. typedef struct TsysPara /*流水号分配表*/
  32. {
  33.     char fs_date[8+1]; /*日期*/
  34.     int fs_seqno; /*交易流水号*/
  35. }YSPARA;
  36. int accno; /*自动生成的账号*/
  37. EXEC SQL END DECLARE SECTION;

  38. void main_menu(); /*系统主菜单*/
  39. void save_draw_menu(); /*存取款菜单*/
  40. void create_drop_menu(); /*开销户菜单*/
  41. void main_login(); /*系统主登录*/
  42. void create_drop_login(); /*开销户登录*/
  43. void save_draw_login(); /*存取款登录*/

  44. int create_acct(); /*用户开户*/
  45. int drop_acct(); /*用户销户*/
  46. int save_acct(); /*用户存款*/
  47. int draw_acct(); /*用户取款*/
  48. int query_acct(); /*查询明细*/

  49. int connect_db(); /*数据库连接*/
  50. int systeminit(); /*系统初始化*/
  51. int number_test(); /*输入编号测试*/
  52. char * myTrim(char * str); /*去掉字符串首位空格*/
  53. int GetFormatTime( char *FormatTime, int iLen, const char *Format ); /*获取格式化时间*/
  54. int getSeqno(char * chseqno); /*生成流水号*/

  55. int main(int argc, char ** argv)
  56. {
  57.     systeminit(); /*系统初始化*/
  58.     main_login(); /*系统主菜单登录*/
  59.     return 0;
  60. }

  61. void main_menu() /*系统主菜单*/
  62. {
  63.     printf(" -------1,开销账户--------\n");
  64.     printf(" -------2,存取款----------\n");
  65.     printf(" -------3,查询明细--------\n");
  66.     printf(" -------4,退出系统--------\n");
  67.     fflush(stdin);
  68. }

  69. void create_drop_menu() /*开销户菜单*/
  70. {
  71.     printf(" -------1,用户开户--------\n");
  72.     printf(" -------2,用户销户--------\n");
  73.     printf(" -------3,返回上一级菜单--\n");
  74.     fflush(stdin);
  75. }

  76. void save_draw_menu() /*存取款菜单*/
  77. {
  78.     printf(" -------1,用户存款--------\n");
  79.     printf(" -------2,用户取款--------\n");
  80.     printf(" -------3,返回上一级菜单--\n");
  81.     fflush(stdin);
  82. }

  83. void main_login() /*系统主菜单登录*/
  84. {
  85.     int num; /*存放菜单编号*/
  86.     int flag = 1;
  87.     main_menu(); /*系统主菜单*/
  88.     printf("请选择菜单:");
  89.     fflush(stdin);
  90.     do
  91.     {
  92.         num = number_test(); /*输入编号测试*/
  93.         printf("\n");
  94.         switch ((int)num)
  95.         {
  96.             case 1:
  97.             {
  98.                 create_drop_login(); /*用户开销户登录*/
  99.                 flag=0;
  100.                 break;
  101.             }
  102.             case 2:
  103.             {
  104.                 save_draw_login(); /*用户存取款登录*/
  105.                 flag=0;
  106.                 break;
  107.             }
  108.             case 3:
  109.             {
  110.                 printf("账户查询明细\n");
  111.                 query_acct(); /*查询明细*/
  112.                 main_login(); /*系统主菜单登录*/
  113.                 flag=0;
  114.                 break;
  115.             }
  116.             case 4:
  117.             {
  118.                 printf("退出系统!\n");
  119.                 exit(0);
  120.             }
  121.             default :
  122.             {
  123.                 printf("输入有误,请重新输入菜单编号:");
  124.                 break;
  125.             }
  126.         }
  127.     }
  128.     while(flag);
  129. }
  130.  

  131. void create_drop_login() /*用户开销户登录*/
  132. {
  133.     int num; /*存放菜单编号*/
  134.     int flag = 1;
  135.     create_drop_menu(); /*开销户菜单*/
  136.     printf("请选择菜单:");
  137.     fflush(stdin);
  138.     do
  139.     {
  140.         num = number_test(); /*输入编号测试*/
  141.         printf("\n");
  142.         switch ((int)num)
  143.         {
  144.             case 1:
  145.             {
  146.                 printf("用户开户\n");
  147.                 create_acct(); /*用户开户*/
  148.                 create_drop_login(); /*返回到用户开销户登录菜单*/
  149.                 flag=0;
  150.                 break;
  151.             }
  152.             case 2:
  153.             {
  154.                 printf("用户销户\n");
  155.                 drop_acct(); /*用户销户*/
  156.                 flag=0;
  157.                 break;
  158.             }
  159.             case 3:
  160.             {
  161.                 main_login(); /*返回上一级:系统主菜单登录*/
  162.                 flag=0;
  163.                 break;
  164.             }
  165.             default :
  166.             {
  167.                 printf("输入有误,请重新输入菜单编号:");
  168.                 break;
  169.             }
  170.         }
  171.     }
  172.     while(flag);
  173. }

  174. void save_draw_login() /*存取款登录*/
  175. {
  176.     int num; /*存放菜单编号*/
  177.     int flag = 1;
  178.     save_draw_menu();/*存取款菜单*/    
  179.     printf("请选择菜单:");
  180.     fflush(stdin);
  181.     do
  182.     {
  183.         num = number_test(); /*输入编号测试*/
  184.         printf("\n");
  185.         switch ((int)num)
  186.         {
  187.             case 1:
  188.             {
  189.                 printf("用户存款!\n");
  190.                 save_acct(); /*用户存款*/
  191.                 main_login(); /*返回上一级登录主菜单*/
  192.                 flag=0;
  193.                 break;
  194.             }
  195.             case 2:
  196.             {
  197.                 printf("用户取款\n");
  198.                 draw_acct(); /*用户取款*/
  199.                 main_login(); /*返回上一级登录主菜单*/
  200.                 flag=0;
  201.                 break;
  202.             }
  203.             case 3:
  204.             {
  205.                 main_login(); /*返回上一级登录主菜单*/
  206.                 flag=0;
  207.                 break;
  208.             }
  209.             default :
  210.             {
  211.                 printf("输入有误,请重新输入菜单编号:");
  212.                 break;
  213.             }
  214.         }
  215.     }
  216.     while(flag);
  217. }

  218. int connect_db() /*连接数据库*/
  219. {
  220.     EXEC SQL BEGIN DECLARE SECTION;
  221.     char dbname[32];
  222.     EXEC SQL END DECLARE SECTION;
  223.     memset(dbname, 0, sizeof(dbname));
  224.     sprintf(dbname,"%s","dbtbank");
  225.     EXEC SQL CONNECT TO :dbname;
  226.     if(0!=sqlca.sqlcode)
  227.     {
  228.         printf("connect error! sqlcode=[%d]\n",sqlca.sqlcode);
  229.         return -1;
  230.     }
  231.     else
  232.     {
  233.         printf("connect success!\n");
  234.         return 1;
  235.     }
  236.     EXEC SQL execute immediate "SET LOCK MODE TO WAIT 1";
  237. }
  238. int systeminit() /*系统初始化*/
  239. {
  240.     printf("\n");
  241.     printf("\n");
  242.     printf("\n");
  243.     printf("\n");
  244.     printf("\n");
  245.     printf(" **********************\n");
  246.     printf(" 欢迎使用资金管理系统\n");
  247.     printf(" 王贤才\n");
  248.     printf(" 20130123\n");
  249.     printf(" **********************\n");
  250.     printf("\n");
  251.     printf("\n");
  252.     printf("\n");
  253.     printf("\n");
  254.     printf("\n");
  255.     fflush(stdout);
  256.     connect_db();
  257.     EXEC SQL SELECT accno into :accno FROM tsaccnoinfo;
  258.     if(0 != sqlca.sqlcode)
  259.     {
  260.         printf("查询账号表失败,sqlcode = [%d]\n", sqlca.sqlcode);
  261.         EXEC SQL DISCONNECT CURRENT;
  262.         return -1;
  263.     }
  264.     return 0;
  265. }

  266. int number_test() /*输入编号测试*/
  267. {
  268.     int number = 0;
  269.     char num[20];
  270.     scanf("%s",num);
  271.     if(num[1] != '\0') /*不为空*/
  272.     {
  273.         number = 0;
  274.     }
  275.     else if((num[0]>=49) && (num[0]<=57))
  276.     {
  277.         number = num[0]-48;
  278.     }
  279.     return number;    
  280. }

  281. int GetFormatTime( char *FormatTime, int iLen, const char *Format ) /*获取格式化时间*/
  282. {
  283.     time_t clock;
  284.     int iRc;

  285.     clock = time ( (time_t *) 0 );
  286.     iRc= strftime ( FormatTime, iLen , Format , localtime ( &clock ) );
  287.     return ( iRc );
  288. }

  289. char * myTrim(char * str) /*去掉字符串首尾*/
  290. {
  291.     if(NULL == str)
  292.     {
  293.         return NULL;
  294.     }
  295.     char * head = str;
  296.     char * tail = str + strlen(str) -1;
  297.     while((*head == ' ')&&(head < tail))head++;
  298.     while((*tail == ' ')&&(tail > head))tail--;
  299.     *(tail + 1) = '\0';
  300.     memcpy(str, head, sizeof(char) * (tail - head + 2));
  301.     return str;
  302. }

  303. int getSeqno(char * chseqno) /*生成流水号*/
  304. {
  305.     EXEC SQL BEGIN DECLARE SECTION;
  306.     char trdate[8+1];
  307.     int fs_seqno; /*从数据库读取出来的*/
  308.     char fs_date[8+1]; /*从数据库读取出来的*/
  309.     EXEC SQL END DECLARE SECTION;
  310.     char temp[32];
  311.     fs_seqno = 0;
  312.     memset(trdate, 0, sizeof(trdate));
  313.     memset(temp, 0x00, sizeof(temp));
  314.     GetFormatTime(temp, 9, "%Y%m%d"); /*日期*/
  315.     strncpy(trdate, temp, 8);
  316.     myTrim(trdate);
  317.     EXEC SQL SELECT fs_date, fs_seqno INTO :fs_date, :fs_seqno FROM tsyspara;
  318.     if(0 != sqlca.sqlcode)
  319.     {
  320.         printf("查询表tsyspara失败,sqlcode = [%d]\n", sqlca.sqlcode);
  321.         EXEC SQL DISCONNECT CURRENT;
  322.         return -1;
  323.     }
  324.     myTrim(fs_date);
  325.     if(strncmp(fs_date, trdate, strlen(trdate)) != 0) /*不是同一天,更新日期,流水号也从0开始计*/
  326.     {
  327.         EXEC SQL UPDATE tsyspara SET fs_date = :trdate, fs_seqno = 0;
  328.         if(0 != sqlca.sqlcode)
  329.         {
  330.             printf("更新表tsyspara失败,sqlcode = [%d]\n", sqlca.sqlcode);
  331.             EXEC SQL DISCONNECT CURRENT;
  332.             return -2;
  333.         }
  334.     }
  335.     fs_seqno++;
  336.     sprintf(chseqno, "%018d", fs_seqno);
  337.     printf("获取的流水号是:[%s]\n", chseqno);
  338.     return fs_seqno;
  339. }

  340. int create_acct() /*用户开户*/
  341. {
  342.     char temp[32];
  343.     EXEC SQL BEGIN DECLARE SECTION;
  344.     ACCINFO accinfo;
  345.     TRADE trade;
  346.     char idtype[18+1];
  347.     char chseqno[18+1]; /*流水号*/
  348.     int seqno;
  349.     EXEC SQL END DECLARE SECTION;
  350.     seqno = 0;
  351.     memset(&accinfo, 0, sizeof(accinfo));
  352.     printf("请输入用户信息:\n");
  353.     printf("证件类型:(1?:身份证,2:军人证,3其他)\n");
  354.     scanf("%s", accinfo.fs_idtype);
  355.     memset(idtype, 0 ,sizeof(idtype));
  356.     if(strncmp(accinfo.fs_idtype, "1", sizeof(char)) == 0)
  357.     {
  358.         strncpy(idtype, "身份证", strlen("身份证"));
  359.     }
  360.     else if(strncmp(accinfo.fs_idtype, "2", sizeof(char)) == 0)
  361.     {
  362.         strncpy(idtype, "军人证", strlen("军人证"));
  363.     }
  364.     else
  365.     {
  366.         strncpy(idtype, "其他", strlen("其他"));
  367.     }
  368.     printf("证件号码:\n");
  369.     scanf("%s", accinfo.fs_idnum);
  370.     fflush(stdin);
  371.     printf("姓名:\n");
  372.     scanf("%s", accinfo.fs_name);
  373.     fflush(stdin);
  374.     printf("家庭地址:\n");
  375.     scanf("%s", accinfo.fs_addr);
  376.     fflush(stdin);
  377.     printf("家庭电话:\n");
  378.     scanf("%s", accinfo.fs_phone);
  379.     fflush(stdin);
  380.     printf("移动电话:\n");
  381.     scanf("%s", accinfo.fs_cellno);
  382.     fflush(stdin);
  383.     printf("帐户密码(6位):\n");
  384.     scanf("%s", accinfo.fs_pwd);
  385.     fflush(stdin);

  386.     accno++;
  387.     printf("自动生成的账户号:[%d]\n", accno);
  388.     sprintf(accinfo.fs_accno, "%09d", accno);
  389.     accinfo.fs_bal=0.00; /*余额*/
  390.     strncpy(accinfo.fs_astate, "1", sizeof(char));
  391.     printf("是否确认保存用户信息?(y/n)\n");

  392.     EXEC SQL UPDATE tsaccnoinfo SET accno = :accno;
  393.     if(0 != sqlca.sqlcode)
  394.     {
  395.         printf("更新表tsaccnoinfo失败,sqlcode = [%d]\n", sqlca.sqlcode);
  396.         EXEC SQL DISCONNECT current;
  397.         return -1;
  398.     }
  399.     
  400.     myTrim(accinfo.fs_idtype);
  401.     myTrim(accinfo.fs_idnum);
  402.     myTrim(accinfo.fs_name);
  403.     myTrim(accinfo.fs_addr);
  404.     myTrim(accinfo.fs_phone);
  405.     myTrim(accinfo.fs_cellno);
  406.     myTrim(accinfo.fs_pwd);
  407.     myTrim(accinfo.fs_accno);
  408.     myTrim(accinfo.fs_astate);

  409.     printf("\n用户开户信息如下:\n");
  410.     printf("证件类型:[%s]\n", idtype);
  411.     printf("证件号码: [%s]\n", accinfo.fs_idnum);
  412.     printf("姓名:[%s]\n", accinfo.fs_name);
  413.     printf("家庭住址:[%s]\n", accinfo.fs_addr);
  414.     printf("家庭电话:[%s]\n", accinfo.fs_phone);
  415.     printf("移动电话:[%s]\n", accinfo.fs_cellno);
  416.     printf("账户密码:[%s]\n", accinfo.fs_pwd);
  417.     printf("账号:[%s]\n", accinfo.fs_accno);
  418.     printf("余额:[%f]\n", accinfo.fs_bal);
  419.     printf("账号状态:[%s]\n", "正常");

  420.     EXEC SQL SET LOCK MODE TO WAIT 3; /*最长等待3秒*/
  421.     EXEC SQL BEGIN WORK; /*开启事务*/
  422.     EXEC SQL insert into tsaccinfo values(:accinfo); /*插入个人账户信息表*/
  423.     if(0 != sqlca.sqlcode) /*exec sql插入语句执行失败*/
  424.     {
  425.         printf("信息保存到个人账户信息表失败!sqlcode = [%d]\n", sqlca.sqlcode);
  426.         EXEC SQL DISCONNECT current;
  427.         EXEC SQL ROLLBACK WORK;
  428.         return -2;
  429.     }
  430.     printf("信息已保存到个人账户信息表!\n");
  431.     
  432.     memset(&trade, 0, sizeof(trade)); /*初始化交易明细表结构体*/
  433.     memset(temp, 0, sizeof(temp));
  434.     GetFormatTime(temp, 7, "%H%M%S");
  435.     strncpy(trade.fs_trtime, temp, 6); /*时间*/
  436.     memset(temp, 0x00, sizeof(temp));
  437.     GetFormatTime(temp, 9, "%Y%m%d"); /*日期*/
  438.     strncpy(trade.fs_trdate, temp, 8);
  439.     strncpy(trade.fs_accno, accinfo.fs_accno, sizeof(accinfo.fs_accno)); /*账户号*/
  440.     strncpy(trade.fs_tradetype, "1", sizeof("1")); /*交易类型:1:用户开户*/
  441.     trade.fs_amt = 0; /*发生额*/
  442.     trade.fs_bal = 0; /*余额*/
  443.     memset(chseqno, 0, sizeof(chseqno));
  444.     seqno = getSeqno(chseqno); /*获取流水号*/
  445. /*    strcat(trade.fs_sqno, trade.fs_trdate);
  446.     myTrim(trade.fs_sqno);
  447.     strcat(trade.fs_sqno, trade.fs_trtime);
  448.     myTrim(trade.fs_sqno); */
  449.     strcat(trade.fs_sqno, chseqno); /*交易流水号*/

  450.     myTrim(trade.fs_trtime);
  451.     myTrim(trade.fs_trdate);
  452.     myTrim(trade.fs_tradetype);
  453.     myTrim(trade.fs_accno);
  454.     myTrim(trade.fs_sqno);

  455.     printf("\n交易明细表数据:\n");
  456.     printf("时间:[%s]\n",trade.fs_trtime);
  457.     printf("日期:[%s]\n", trade.fs_trdate);
  458.     printf("账户号:[%s]\n", trade.fs_accno);
  459.     printf("交易类型:[%s]\n", trade.fs_tradetype);
  460.     printf("发生额:[%f]\n", trade.fs_amt);
  461.     printf("余额:[%f]\n", trade.fs_bal);
  462.     printf("交易流水号:[%s]\n", trade.fs_sqno);

  463.     EXEC SQL insert into TSTrade values( :trade); /*插入交易明细表*/
  464.     if(0 != sqlca.sqlcode)
  465.     {
  466.         printf("信息保存到交易明细表失败!sqlcode = [%d]\n", sqlca.sqlcode);
  467.         EXEC SQL DISCONNECT current;
  468.         EXEC SQL ROLLBACK WORK;
  469.         return -3;
  470.     }
  471.     printf("信息已保存到交易明细表!\n");
  472.     EXEC SQL UPDATE tsyspara SET fs_seqno = :seqno; /*更新最大号流水表*/
  473.     if(0 != sqlca.sqlcode)
  474.     {
  475.         printf("更新最大号流水表失败!sqlcode = [%d]\n", sqlca.sqlcode);
  476.         EXEC SQL ROLLBACK WORK;
  477.         return -4;
  478.     }
  479.     EXEC SQL COMMIT WORK;
  480.     return 0;
  481. }

  482. int drop_acct() /*用户销户*/
  483. {
  484.     int ret = -1;
  485.     char temp[32];
  486.     EXEC SQL BEGIN DECLARE SECTION;
  487.     char accno[9+1]; /*用户输入的账号*/
  488.     char passwd[6+1]; /*用户输入的账号密码*/
  489.     ACCINFO accinfo; /*个人帐户信息表*/
  490.     TRADE trade; /*交易明细表*/
  491.     char chseqno[18+1]; /*流水号*/
  492.     int seqno;
  493.     EXEC SQL END DECLARE SECTION;
  494.     seqno = 0;

  495.     do
  496.     {
  497.         do
  498.         {
  499.             printf("请输入账号:");
  500.             fflush(stdout);
  501.             memset(accno, 0, sizeof(accno));
  502.             ret = read(0, accno, sizeof(accno)); /*从键盘接受数据*/
  503.             if(ret < 0)
  504.             {
  505.                 printf("接受账号失败!\n");
  506.                 continue;
  507.             }
  508.             if (accno[0] == '\n') /*键盘输入异常判断*/
  509.             {
  510.                 continue;
  511.             }
  512.             else
  513.             {
  514.                 accno[ret -1] = '\0';
  515.                 myTrim(accno);    
  516.                 break;
  517.             }
  518.         }
  519.         while(1);

  520.         do
  521.         {
  522.             printf("请输入账号密码:");
  523.             fflush(stdout);
  524.             ret = read(0, passwd, sizeof(passwd));
  525.             if(ret < 0)
  526.             {
  527.                 printf("接受账号密码失败!\n");
  528.                 continue;
  529.             }
  530.             if (passwd[0] == '\n') /*键盘输入异常判断*/
  531.             {
  532.                 continue;
  533.             }
  534.             else
  535.             {
  536.                 passwd[ret - 1] = '\0';
  537.                 myTrim(passwd);
  538.                 break;
  539.             }
  540.         }
  541.         while(1);

  542.         memset(&accinfo, 0, sizeof(accinfo));
  543.         EXEC SQL SELECT * INTO :accinfo FROM tsaccinfo WHERE fs_accno = :accno;
  544.         if(0 != sqlca.sqlcode)
  545.         {
  546.             if(100 == sqlca.sqlcode) /*查询结果为空*/
  547.             {
  548.                 printf("您输入的账号不存在,请重新输入!\n");
  549.                 continue;
  550.             }
  551.             printf("查询表tsaccinfo账号密码和状态失败,sqlcode = [%d]\n", sqlca.sqlcode);
  552.             EXEC SQL DISCONNECT current;
  553.         }
  554.         myTrim(accinfo.fs_pwd);
  555.         myTrim(accinfo.fs_astate);
  556.         myTrim(accinfo.fs_name);
  557.         if(strncmp(accinfo.fs_pwd, passwd, strlen(accinfo.fs_pwd)) != 0) /*判断密码是否正确*/
  558.         {
  559.             printf("您输入的密码不正确,请重新输入!\n");
  560.             continue;
  561.         }
  562.         break;
  563.     }
  564.     while(1);

  565.     printf("账号和密码有效,可以继续下一步操作!\n");
  566.     if(strncmp(accinfo.fs_astate, "0", strlen(accinfo.fs_astate)) == 0) /*判断账户状态*/
  567.     {
  568.         printf("账号状态已经为注销状态!\n");
  569.         return -1;
  570.     }

  571.     EXEC SQL SET LOCK MODE TO WAIT 3; /*最长等待3秒*/
  572.     EXEC SQL BEGIN WORK;
  573.     EXEC SQL UPDATE tsaccinfo SET fs_bal = 0, fs_astate = '0' WHERE fs_accno = :accno;
  574.     if(0 != sqlca.sqlcode)
  575.     {
  576.         printf("更新表tsaccinfo余额和账号状态失败,sqlcode = [%d]\n", sqlca.sqlcode);
  577.         EXEC SQL DISCONNECT current;
  578.         EXEC SQL ROLLBACK WORK;
  579.         return -2;
  580.     }
  581.     printf("\n账户注销已成功!\n");

  582.     memset(&trade, 0, sizeof(trade));
  583.     memset(temp, 0, sizeof(temp));
  584.     GetFormatTime(temp, 7, "%H%M%S");
  585.     strncpy(trade.fs_trtime, temp, 6); /*时间*/
  586.     memset(temp, 0x00, sizeof(temp));
  587.     GetFormatTime(temp, 9, "%Y%m%d"); /*日期*/
  588.     strncpy(trade.fs_trdate, temp, 8);
  589.     strncpy(trade.fs_tradetype, "2", sizeof("2")); /*交易类型,2:用户注销账户*/
  590.     trade.fs_amt = accinfo.fs_bal; /*发生额 = 余额*/
  591.     trade.fs_bal = 0; /*余额为0*/
  592.     strncpy(trade.fs_accno, accinfo.fs_accno, sizeof(accinfo.fs_accno)); /*账户号*/
  593.     memset(chseqno, 0, sizeof(chseqno));
  594.     seqno = getSeqno(chseqno); /*获取流水号*/
  595. /*    strcat(trade.fs_sqno, trade.fs_trdate);
  596.     myTrim(trade.fs_sqno);
  597.     strcat(trade.fs_sqno, trade.fs_trtime);
  598.     myTrim(trade.fs_sqno);
  599.     */
  600.     strcat(trade.fs_sqno, chseqno); /*交易流水号*/

  601.     myTrim(trade.fs_trtime);
  602.     myTrim(trade.fs_trdate);
  603.     myTrim(trade.fs_tradetype);
  604.     myTrim(trade.fs_accno);
  605.     myTrim(trade.fs_sqno);

  606.     printf("\n交易明细表数据如下:\n");
  607.     printf("时间:[%s]\n",trade.fs_trtime);
  608.     printf("日期:[%s]\n", trade.fs_trdate);
  609.     printf("交易类型:[%s]\n", trade.fs_tradetype);
  610.     printf("发生额:[%f]\n", trade.fs_amt);
  611.     printf("余额:[%f]\n", trade.fs_bal);
  612.     printf("账户号:[%s]\n", trade.fs_accno);
  613.     printf("交易流水号:[%s]\n", trade.fs_sqno);

  614.     EXEC SQL INSERT INTO TSTrade VALUES( :trade); /*插入交易明细表*/
  615.     if(0 != sqlca.sqlcode)
  616.     {
  617.         printf("信息保存到交易明细表失败!sqlcode = [%d]\n", sqlca.sqlcode);
  618.         EXEC SQL DISCONNECT current;
  619.         EXEC SQL ROLLBACK WORK;
  620.         return -3;
  621.     }
  622.     printf("信息已保存到交易明细表!\n");
  623.     
  624.     EXEC SQL UPDATE tsyspara SET fs_seqno = :seqno; /*更新最大号流水表*/
  625.     if(0 != sqlca.sqlcode)
  626.     {
  627.         printf("更新最大号流水表失败!sqlcode = [%d]\n", sqlca.sqlcode);
  628.         EXEC SQL ROLLBACK WORK;
  629.         return -4;
  630.     }
  631.     EXEC SQL COMMIT WORK;
  632. }

  633. int save_acct() /*用户存款*/
  634. {
  635.     int ret = -1;
  636.     char temp[32];
  637.     EXEC SQL BEGIN DECLARE SECTION;
  638.     char accno[9+1]; /*用户输入的账号*/
  639.     char passwd[6+1]; /*用户输入的账号密码*/
  640.     float amt; /*用户输入的存款金额*/
  641.     ACCINFO accinfo; /*个人帐户信息表*/
  642.     TRADE trade; /*交易明细表*/
  643.     char chseqno[18+1]; /*流水号*/
  644.     int seqno;
  645.     EXEC SQL END DECLARE SECTION;
  646.     seqno = 0;
  647.     do
  648.     {
  649.         do
  650.         {
  651.             printf("请输入账号:");
  652.             fflush(stdout);
  653.             memset(accno, 0, sizeof(accno));
  654.             ret = read(0, accno, sizeof(accno)); /*从键盘接受数据*/
  655.             if(ret < 0)
  656.             {
  657.                 printf("接受账号失败!\n");
  658.                 continue;
  659.             }
  660.             if (accno[0] == '\n') /*键盘输入异常判断*/
  661.             {
  662.                 continue;
  663.             }
  664.             else
  665.             {
  666.                 accno[ret -1] = '\0';
  667.                 myTrim(accno);    
  668.                 break;
  669.             }
  670.         }
  671.         while(1);

  672.         do
  673.         {
  674.             printf("请输入账号密码:");
  675.             fflush(stdout);
  676.             ret = read(0, passwd, sizeof(passwd));
  677.             if(ret < 0)
  678.             {
  679.                 printf("接受账号密码失败!\n");
  680.                 continue;
  681.             }
  682.             if (passwd[0] == '\n') /*键盘输入异常判断*/
  683.             {
  684.                 continue;
  685.             }
  686.             else
  687.             {
  688.                 passwd[ret - 1] = '\0';
  689.                 myTrim(passwd);
  690.                 break;
  691.             }
  692.         }
  693.         while(1);

  694.         memset(&accinfo, 0, sizeof(accinfo));
  695.         EXEC SQL SELECT * INTO :accinfo FROM tsaccinfo WHERE fs_accno = :accno;
  696.         if(0 != sqlca.sqlcode)
  697.         {
  698.             if(100 == sqlca.sqlcode) /*查询结果为空*/
  699.             {
  700.                 printf("您输入的账号不存在,请重新输入!\n");
  701.                 continue;
  702.             }
  703.             printf("查询表tsaccinfo账号密码和状态失败,sqlcode = [%d]\n", sqlca.sqlcode);
  704.             EXEC SQL DISCONNECT current;
  705.         }
  706.         myTrim(accinfo.fs_pwd);
  707.         myTrim(accinfo.fs_astate);
  708.         myTrim(accinfo.fs_name);
  709.         if(strncmp(accinfo.fs_pwd, passwd, strlen(accinfo.fs_pwd)) != 0) /*判断密码是否正确*/
  710.         {
  711.             printf("您输入的密码不正确,请重新输入!\n");
  712.             continue;
  713.         }
  714.         break;
  715.     }
  716.     while(1);
  717.     printf("账号和密码有效,可以继续下一步操作!\n");

  718.     if(strncmp(accinfo.fs_astate, "1", strlen(accinfo.fs_astate)) != 0) /*判断账户状态*/
  719.     {
  720.         printf("账号状态为注销状态,不能使用!\n");
  721.         return -1;
  722.     }
  723.     printf("请输入存款金额:");
  724.     fflush(stdout);
  725.     scanf("%f", &amt);
  726.     printf("账户名为:[%s], 存款金额为:[%f]元\n", accinfo.fs_name, amt);
  727.     printf("确认请按(1),取消请按(2)!\n\n");

  728.     accinfo.fs_bal = accinfo.fs_bal + amt;

  729.     EXEC SQL SET LOCK MODE TO WAIT 3; /*最长等待3秒*/
  730.     EXEC SQL BEGIN WORK;
  731.     EXEC SQL UPDATE tsaccinfo SET fs_bal = :accinfo.fs_bal WHERE fs_accno = :accno;
  732.     if(0 != sqlca.sqlcode)
  733.     {
  734.         printf("更新表tsaccinfo余额失败,sqlcode = [%d]\n", sqlca.sqlcode);
  735.         EXEC SQL ROLLBACK WORK;
  736.         EXEC SQL DISCONNECT current;
  737.         return -2;
  738.     }
  739.     printf("存款已成功!\n");

  740.     memset(&trade, 0, sizeof(trade)); /*初始化交易明细表结构体*/
  741.     memset(temp, 0, sizeof(temp));
  742.     GetFormatTime(temp, 7, "%H%M%S");
  743.     strncpy(trade.fs_trtime, temp, 6); /*时间*/
  744.     memset(temp, 0, sizeof(temp));
  745.     GetFormatTime(temp, 9, "%Y%m%d"); /*日期*/
  746.     strncpy(trade.fs_trdate, temp, 8);
  747.     strncpy(trade.fs_tradetype, "3", sizeof("3")); /*交易类型,3:用户存款*/
  748.     trade.fs_amt = amt; /*发生额*/
  749.     trade.fs_bal = accinfo.fs_bal; /*余额*/
  750.     strncpy(trade.fs_accno, accinfo.fs_accno, sizeof(accinfo.fs_accno)); /*账户号*/
  751.     memset(chseqno, 0, sizeof(chseqno));
  752.     seqno = getSeqno(chseqno); /*获取流水号*/
  753. /*    strcat(trade.fs_sqno, trade.fs_trdate);
  754.     myTrim(trade.fs_sqno);
  755.     strcat(trade.fs_sqno, trade.fs_trtime);
  756.     myTrim(trade.fs_sqno);
  757.     */
  758.     strcat(trade.fs_sqno, chseqno);

  759.     myTrim(trade.fs_trtime);
  760.     myTrim(trade.fs_trdate);
  761.     myTrim(trade.fs_tradetype);
  762.     myTrim(trade.fs_accno);
  763.     myTrim(trade.fs_sqno);

  764.     printf("\n交易明细表数据如下:\n");
  765.     printf("时间:[%s]\n",trade.fs_trtime);
  766.     printf("日期:[%s]\n",trade.fs_trdate);
  767.     printf("交易类型:[%s]\n", trade.fs_tradetype);
  768.     printf("发生额:[%f]\n", trade.fs_amt);
  769.     printf("余额:[%f]\n", trade.fs_bal);
  770.     printf("账户号:[%s]\n", trade.fs_accno);
  771.     printf("交易流水号:[%s]\n", trade.fs_sqno);

  772.     EXEC SQL INSERT INTO TSTrade VALUES( :trade); /*插入交易明细表*/
  773.     if(0 != sqlca.sqlcode)
  774.     {
  775.         printf("信息保存到交易明细表失败!sqlcode = [%d]\n", sqlca.sqlcode);
  776.         EXEC SQL ROLLBACK WORK;
  777.         EXEC SQL DISCONNECT current;
  778.         return -3;
  779.     }
  780.     printf("信息已保存到交易明细表!\n");

  781.     EXEC SQL UPDATE tsyspara SET fs_seqno = :seqno; /*更新最大号流水表*/
  782.     if(0 != sqlca.sqlcode)
  783.     {
  784.         printf("更新最大号流水表失败!sqlcode = [%d]\n", sqlca.sqlcode);
  785.         EXEC SQL ROLLBACK WORK;
  786.         EXEC SQL DISCONNECT current;
  787.         return -4;
  788.     }
  789.     EXEC SQL COMMIT WORK;
  790.     return 0;
  791. }

  792. int draw_acct() /*用户取款*/
  793. {
  794.     int ret = -1;
  795.     char temp[32];
  796.     EXEC SQL BEGIN DECLARE SECTION;
  797.     char accno[9+1]; /*用户输入的账号*/
  798.     char passwd[6+1]; /*用户输入的账号密码*/
  799.     float amt; /*用户输入的存款金额*/
  800.     ACCINFO accinfo; /*个人帐户信息表*/
  801.     TRADE trade; /*交易明细表*/
  802.     char chseqno[18+1]; /*流水号*/
  803.     int seqno;
  804.     EXEC SQL END DECLARE SECTION;
  805.     seqno = 0;
  806.     do
  807.     {
  808.         do
  809.         {
  810.             printf("请输入账号:");
  811.             fflush(stdout);
  812.             memset(accno, 0, sizeof(accno));
  813.             ret = read(0, accno, sizeof(accno)); /*从键盘接受数据*/
  814.             if(ret < 0)
  815.             {
  816.                 printf("接受账号失败!\n");
  817.                 continue;
  818.             }
  819.             if (accno[0] == '\n') /*键盘输入异常判断*/
  820.             {
  821.                 continue;
  822.             }
  823.             else
  824.             {
  825.                 accno[ret -1] = '\0';
  826.                 myTrim(accno);    
  827.                 break;
  828.             }
  829.         }
  830.         while(1);

  831.         do
  832.         {
  833.             printf("请输入账号密码:");
  834.             fflush(stdout);
  835.             ret = read(0, passwd, sizeof(passwd));
  836.             if(ret < 0)
  837.             {
  838.                 printf("接受账号密码失败!\n");
  839.                 continue;
  840.             }
  841.             if (passwd[0] == '\n') /*键盘输入异常判断*/
  842.             {
  843.                 continue;
  844.             }
  845.             else
  846.             {
  847.                 passwd[ret - 1] = '\0';
  848.                 myTrim(passwd);
  849.                 break;
  850.             }
  851.         }
  852.         while(1);

  853.         memset(&accinfo, 0, sizeof(accinfo));
  854.         EXEC SQL SELECT * INTO :accinfo FROM tsaccinfo WHERE fs_accno = :accno;
  855.         if(0 != sqlca.sqlcode)
  856.         {
  857.             if(100 == sqlca.sqlcode) /*查询结果为空*/
  858.             {
  859.                 printf("您输入的账号不存在,请重新输入!\n");
  860.                 continue;
  861.             }
  862.             printf("查询表tsaccinfo账号密码和状态失败,sqlcode = [%d]\n", sqlca.sqlcode);
  863.             EXEC SQL DISCONNECT current;
  864.         }
  865.         myTrim(accinfo.fs_pwd);
  866.         myTrim(accinfo.fs_astate);
  867.         myTrim(accinfo.fs_name);
  868.         if(strncmp(accinfo.fs_pwd, passwd, strlen(accinfo.fs_pwd)) != 0) /*判断密码是否正确*/
  869.         {
  870.             printf("您输入的密码不正确,请重新输入!\n");
  871.             continue;
  872.         }
  873.         break;
  874.     }
  875.     while(1);
  876.     printf("账号和密码有效,可以继续下一步操作!\n");

  877.     if(strncmp(accinfo.fs_astate, "1", strlen(accinfo.fs_astate)) != 0) /*判断账户状态*/
  878.     {
  879.         printf("账号状态为注销状态,不能使用!\n");
  880.         return -1;
  881.     }
  882.     printf("请输入取款金额(最低可取1元):");
  883.     fflush(stdout);
  884.     scanf("%f", &amt);
  885.     printf("账户名为:[%s],取款金额为:[%f]\n", accinfo.fs_name, amt);
  886.     printf("确认请按(1),取消请按(2)!\n");
  887.     accinfo.fs_bal = accinfo.fs_bal - amt;

  888.     EXEC SQL SET LOCK MODE TO WAIT 3; /*最长等待3秒*/
  889.     EXEC SQL BEGIN WORK;
  890.     EXEC SQL UPDATE tsaccinfo SET fs_bal = :accinfo.fs_bal WHERE fs_accno = :accno;
  891.     if(0 != sqlca.sqlcode)
  892.     {
  893.         printf("更新表tsaccinfo余额失败,sqlcode = [%d]\n", sqlca.sqlcode);
  894.         EXEC SQL DISCONNECT current;
  895.         EXEC SQL ROLLBACK WORK;
  896.         return -2;
  897.     }
  898.     printf("取款已成功!\n");    

  899.     memset(&trade, 0, sizeof(trade)); /*初始化交易明细表结构体*/
  900.     memset(temp, 0, sizeof(temp));
  901.     GetFormatTime(temp, 7, "%H%M%S");
  902.     strncpy(trade.fs_trtime, temp, 6); /*时间*/
  903.     memset(temp, 0x00, sizeof(temp));
  904.     GetFormatTime(temp, 9, "%Y%m%d"); /*日期*/
  905.     strncpy(trade.fs_trdate, temp, 8);
  906.     strncpy(trade.fs_tradetype, "4", sizeof("4")); /*交易类型,4:用户取款*/
  907.     trade.fs_amt = amt; /*发生额*/
  908.     trade.fs_bal = accinfo.fs_bal; /*余额*/
  909.     strncpy(trade.fs_accno, accinfo.fs_accno, sizeof(accinfo.fs_accno)); /*账户号*/
  910.     memset(chseqno, 0, sizeof(chseqno));
  911.     seqno = getSeqno(chseqno); /*获取流水号后面部分*/
  912. /*    strcat(trade.fs_sqno, trade.fs_trdate);
  913.     myTrim(trade.fs_sqno);
  914.     strcat(trade.fs_sqno, trade.fs_trtime);
  915.     myTrim(trade.fs_sqno);
  916.     */
  917.     strcat(trade.fs_sqno, chseqno); /*交易流水号*/

  918.     myTrim(trade.fs_trtime);
  919.     myTrim(trade.fs_trdate);
  920.     myTrim(trade.fs_tradetype);
  921.     myTrim(trade.fs_accno);
  922.     myTrim(trade.fs_sqno);

  923.     printf("\n交易明细表数据如下:\n");
  924.     printf("时间:[%s]\n",trade.fs_trtime);
  925.     printf("日期:[%s]\n", trade.fs_trdate);
  926.     printf("交易类型:[%s]\n", trade.fs_tradetype);
  927.     printf("发生额:[%f]\n", trade.fs_amt);
  928.     printf("余额:[%f]\n", trade.fs_bal);
  929.     printf("账户号:[%s]\n", trade.fs_accno);
  930.     printf("交易流水号:[%s]\n", trade.fs_sqno);

  931.     EXEC SQL INSERT INTO TSTrade VALUES( :trade); /*插入交易明细表*/
  932.     if(0 != sqlca.sqlcode)
  933.     {
  934.         printf("信息保存到交易明细表失败!sqlcode = [%d]\n", sqlca.sqlcode);
  935.         EXEC SQL DISCONNECT current;
  936.         EXEC SQL ROLLBACK WORK;
  937.         return -3;
  938.     }
  939.     printf("信息已保存到交易明细表!\n");

  940.     EXEC SQL UPDATE tsyspara SET fs_seqno = :seqno; /*更新最大号流水表*/
  941.     if(0 != sqlca.sqlcode)
  942.     {
  943.         printf("更新最大号流水表失败!sqlcode = [%d]\n", sqlca.sqlcode);
  944.         EXEC SQL ROLLBACK WORK;
  945.         return -4;
  946.     }
  947.     EXEC SQL COMMIT WORK;
  948.     return 0;
  949. }

  950. int query_acct() /*查询明细*/
  951. {
  952.     EXEC SQL BEGIN DECLARE SECTION;
  953.     char accno[9+1]; /*用户输入的账号*/
  954.     char passwd[6+1]; /*用户输入的账号密码*/
  955.     char pwd[6+1]; /*查询出的账户密码*/
  956.     char sqlStmt[128]; /**/
  957.     char sqlStr[128];
  958.     float amt; /*用户输入的存款金额*/
  959.     TRADE trade; /*交易明细表*/
  960.     int iCount; /*满足条件的记录数*/
  961.     EXEC SQL END DECLARE SECTION;
  962.     int iNum = 0;
  963.     int ret = -1;
  964.     do
  965.     {
  966.         do
  967.         {
  968.             printf("请输入账号:");
  969.             fflush(stdout);
  970.             memset(accno, 0, sizeof(accno));
  971.             ret = read(0, accno, sizeof(accno)); /*从键盘接受数据*/
  972.             if(ret < 0)
  973.             {
  974.                 printf("接受账号失败!\n");
  975.                 continue;
  976.             }
  977.             if (accno[0] == '\n') /*键盘输入异常判断*/
  978.             {
  979.                 continue;
  980.             }
  981.             else
  982.             {
  983.                 accno[ret -1] = '\0';
  984.                 myTrim(accno);    
  985.                 break;
  986.             }
  987.         }
  988.         while(1);

  989.         do
  990.         {
  991.             printf("请输入账号密码:");
  992.             fflush(stdout);
  993.             ret = read(0, passwd, sizeof(passwd));
  994.             if(ret < 0)
  995.             {
  996.                 printf("接受账号密码失败!\n");
  997.                 continue;
  998.             }
  999.             if (passwd[0] == '\n') /*键盘输入异常判断*/
  1000.             {
  1001.             continue;
  1002.             }
  1003.             else
  1004.             {
  1005.                 passwd[ret - 1] = '\0';
  1006.                 myTrim(passwd);
  1007.                 break;
  1008.             }
  1009.         }
  1010.         while(1);

  1011.         EXEC SQL SELECT fs_pwd INTO :pwd FROM tsaccinfo WHERE fs_accno = :accno;
  1012.         if(0 != sqlca.sqlcode)
  1013.         {
  1014.             if(100 == sqlca.sqlcode) /*查询结果为空*/
  1015.             {
  1016.                 printf("您输入的账号不存在,请重新输入!\n");
  1017.                 continue;
  1018.             }
  1019.             printf("查询表tsaccinfo账号密码和状态失败,sqlcode = [%d]\n", sqlca.sqlcode);
  1020.             EXEC SQL DISCONNECT current;
  1021.         }
  1022.         myTrim(pwd);
  1023.         if(strncmp(pwd, passwd, strlen(pwd)) != 0)
  1024.         {
  1025.             printf("您输入的密码不正确,请重新输入!\n");
  1026.             continue;
  1027.         }
  1028.         break;
  1029.     }
  1030.     while(1);
  1031.     printf("账号和密码有效,可以继续下一步操作!\n");

  1032.     iCount = 0;
  1033.     EXEC SQL SELECT COUNT(*) INTO :iCount FROM tstrade WHERE fs_accno = :accno;
  1034.     if(0 != sqlca.sqlcode)
  1035.     {
  1036.         printf("查询记录条数失败, sqlcode = [%d]\n", sqlca.sqlcode);
  1037.         return -1;
  1038.     }
  1039.     printf("查询明细表,满足条件的记录数为:%d\n", iCount);
  1040.     memset(sqlStmt, 0, sizeof(sqlStmt));
  1041.     memset(sqlStr, 0, sizeof(sqlStr));
  1042.     sprintf(sqlStr, "SELECT * FROM tstrade WHERE fs_accno = %s", accno);
  1043.     myTrim(sqlStr);
  1044.     printf("sqlStr = (%s)\n", sqlStr);
  1045.     EXEC SQL PREPARE sqlStmt FROM :sqlStr;
  1046.     if(0 != sqlca.sqlcode)
  1047.     {
  1048.         printf("prepare err! sqlcode = [%d]\n", sqlca.sqlcode);
  1049.         EXEC SQL DISCONNECT CURRENT;
  1050.         return -2;
  1051.     }
  1052.     EXEC SQL DECLARE cur CURSOR for sqlStmt;
  1053.     if(0 != sqlca.sqlcode)
  1054.     {
  1055.         printf("declare cur err! sqlcode = [%d]\n", sqlca.sqlcode);
  1056.         EXEC SQL DISCONNECT CURRENT;
  1057.         return -3;
  1058.     }
  1059.     EXEC SQL OPEN cur;
  1060.     if(0 != sqlca.sqlcode)
  1061.     {
  1062.         if(100 == sqlca.sqlcode)
  1063.         {
  1064.             printf("查询的记录数为0!\n");
  1065.             return -4;
  1066.         }
  1067.         printf("open cur err! sqlcode = [%d]\n", sqlca.sqlcode);
  1068.         EXEC SQL CLOSE cur;
  1069.         EXEC SQL FREE cur;
  1070.         EXEC SQL DISCONNECT CURRENT;
  1071.         return -5;
  1072.     }
  1073.     printf("\n查询明细表的结果如下:\n");
  1074.     while(1)
  1075.     {
  1076.         memset(&trade, 0, sizeof(trade));
  1077.         EXEC SQL FETCH cur INTO :trade;
  1078.         if(0 != sqlca.sqlcode)
  1079.         {
  1080.             if(100 == sqlca.sqlcode)
  1081.             {
  1082.                 printf("数据已取完\n");
  1083.                 break;
  1084.             }
  1085.             printf("fetch cur err! sqlcode = [%d]\n", sqlca.sqlcode);
  1086.             EXEC SQL CLOSE cur;
  1087.             EXEC SQL FREE cur;
  1088.             EXEC SQL DISCONNECT CURRENT;
  1089.             return -6;
  1090.         }
  1091.         iNum++;

  1092.         myTrim(trade.fs_trdate);
  1093.         myTrim(trade.fs_trtime);
  1094.         myTrim(trade.fs_accno);
  1095.         myTrim(trade.fs_tradetype);
  1096.         myTrim(trade.fs_sqno);

  1097.         printf("\n查询的第[%d]条记录如下:\n", iNum);
  1098.         printf("交易日期:[%s]\n", trade.fs_trdate);
  1099.         printf("交易时间:[%s]\n", trade.fs_trtime);
  1100.         printf("帐户号:[%s]\n", trade.fs_accno);
  1101.         printf("交易类型:[%s]\n", trade.fs_tradetype);
  1102.         printf("发生额:[%f]\n", trade.fs_amt);
  1103.         printf("交易流水号:[%s]\n", trade.fs_sqno);
  1104.         printf("余额:[%f]\n", trade.fs_bal);
  1105.     }
  1106.     return 0;
  1107. }
accno_create.sql文件

点击(此处)折叠或打开

  1. dbaccess dbtbank <<!
  2. DROP table TSAccNoInfo;
  3. create table TSAccNoInfo
  4. (accno integer not null
  5.  )lock mode row;
  6. !
accno_init.sql文件

点击(此处)折叠或打开

  1. dbaccess dbtbank <<!
  2. delete from tsaccnoinfo;
  3. insert into tsaccnoinfo values(0);
  4. select * from tsaccnoinfo;
  5. !
database.sql文件

点击(此处)折叠或打开

  1. dbaccess dbtbank <<!
  2. --create database zjglsystem;
  3. drop database zjglsystem;
  4. !
TSAcctInfo_create.sql文件

点击(此处)折叠或打开

  1. dbaccess dbtbank <<!
  2. DROP table TSAccInfo;
  3. create table TSAccInfo
  4. (fs_Idtype char(1) not null,
  5.  fs_Idnum char(18) not null,
  6.  fs_Name char(20) not null,
  7.  fs_Addr char(40),
  8.  fs_Phone char(12),
  9.  fs_Cellno char(11),
  10.  fs_Pwd char(6) not null,
  11.  fs_Accno char(9) not null,
  12.  fs_Bal decimal(16,2) not null,
  13.  fs_Astate char(1) not null,
  14.  primary key(fs_Accno)
  15.  )lock mode row;
  16. !
TSAcctInfo_delete.sql文件

点击(此处)折叠或打开

  1. dbaccess dbtbank <<!
  2. delete from TSAccInfo;
  3. !
TSAcctInfo_select.sql文件

点击(此处)折叠或打开

  1. dbaccess dbtbank <<!
  2. select * from TSAccInfo;
  3. !
TSTrade_create.sql文件

点击(此处)折叠或打开

  1. dbaccess dbtbank <<!
  2. DROP table TSTrade;
  3. create table TSTrade
  4. (fs_TrDate char(8) not null,
  5.  fs_TrTime char(6) not null,
  6.  fs_Accno char(9) not null,
  7.  fs_Tradetype char(1) not null,
  8.  fs_Amt decimal(16,2) not null,
  9.  fs_Sqno char(32) not null,
  10.  fs_Bal decimal(16,2) not null,
  11.  primary key(fs_Accno,fs_TrTime)
  12.  )lock mode row
TSTrade_delete.sql文件

点击(此处)折叠或打开

  1. dbaccess dbtbank <<!
  2. delete from TSTrade;
  3. !
TSTrade_select.sql文件

点击(此处)折叠或打开

  1. dbaccess dbtbank <<!
  2. select * from TSTrade;
  3. !
TSYspara_create.sql文件

点击(此处)折叠或打开

  1. dbaccess dbtbank <<!
  2. DROP table TSYsPara;
  3. create table TSYsPara
  4. (fs_date char(8) not null,
  5.  fs_seqno integer not null,
  6.  primary key(fs_date, fs_seqno)
  7. )lock mode row;
  8. !
TSYspara_delete.sql文件

点击(此处)折叠或打开

  1. dbaccess dbtbank <<!
  2. delete from tsyspara;
  3. insert into tsyspara values('20130224',0);
  4. select * from tsyspara;
  5. !
TSYspara_select.sql文件

点击(此处)折叠或打开

  1. dbaccess dbtbank <<!
  2. select * from tsyspara;
  3. !






阅读(866) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~