亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1669 | 回復: 4
打印 上一主題 下一主題

[函數(shù)] 尋找關(guān)于db library 函數(shù)的資料,謝謝 [復制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2004-10-13 09:41 |只看該作者 |倒序瀏覽
小弟,最近在學習基于數(shù)據(jù)庫的C程序設(shè)計,在學習別人的代碼時遇到一些函數(shù),如:dbcmd,dbsettime,dbsqlexec,不知在那能找到有關(guān)這類函數(shù)的介紹,請高手推薦些資料,謝謝

論壇徽章:
0
2 [報告]
發(fā)表于 2004-10-13 12:52 |只看該作者

尋找關(guān)于db library 函數(shù)的資料,謝謝

幫幫小弟呀

論壇徽章:
1
2015年辭舊歲徽章
日期:2015-03-03 16:54:15
3 [報告]
發(fā)表于 2004-10-13 12:57 |只看該作者

尋找關(guān)于db library 函數(shù)的資料,謝謝

看 MS SQL SERVER 或者 SYBASE SQL SERVER 的 samples

論壇徽章:
1
2015年辭舊歲徽章
日期:2015-03-03 16:54:15
4 [報告]
發(fā)表于 2004-10-13 13:00 |只看該作者

尋找關(guān)于db library 函數(shù)的資料,謝謝

  1. D:\MSSQL7\DevTools\Samples\dblib\c\example8\examples.c
復制代碼

  1. /* ** The example uses the following stored procedure,
  2. ** named "rpctest", which it assumes is located in the
  3. ** user's default database. Before running this example,
  4. ** you must create "rpctest" in your default database.
  5. **
  6. **     create procedure rpctest
  7. **         (@param1 int out,
  8. **          @param2 int out,
  9. **          @param3 int out,
  10. **          @param4 int)
  11. **     as
  12. **     begin
  13. **         select "rpctest is running."
  14. **         select @param1 = 11
  15. **         select @param2 = 22
  16. **         select @param3 = 33
  17. **         select @param1
  18. **
  19. **         return 123
  20. **     end
  21. **
  22. */

  23. #if defined(DBNTWIN32)
  24. #include <windows.h>;
  25. #endif

  26. #include <stdio.h>;
  27. #include <stdlib.h>;
  28. #include <sqlfront.h>;
  29. #include <sqldb.h>;
  30. #define FMTSTR    "%-8.8s %-8.8s %-8.8s %-8.8s\n"
  31. #define FMTSTR1    "%-8.8s %-8.8s %8.8ld %8.8ld\n"

  32. /* Forward declarations of the error handler and message handler routines. */
  33. int err_handler(DBPROCESS*, int, int, int, char*, char*);
  34. int msg_handler(DBPROCESS*, DBINT, int, int, char*, char*, char*, DBUSMALLINT);

  35. void main()
  36. {
  37.         LOGINREC         *login;
  38.         DBPROCESS        *dbproc;
  39.        
  40.         int              i;
  41.         int              numrets;
  42.         DBINT            param1 = 1;
  43.         DBINT            param2 = 2;
  44.         DBINT            param3 = 3;
  45.         DBINT            param4 = 4;
  46.         RETCODE          return_code;

  47.           /* Initialize private DB Library structures. */
  48.         dbinit();


  49.         /* Install the user-supplied error-handling and message-handling
  50.          * routines. They are defined at the bottom of this source file.
  51.          */

  52.         dbmsghandle((DBMSGHANDLE_PROC)msg_handler);
  53.         dberrhandle((DBERRHANDLE_PROC)err_handler);

  54.         /* Allocate and initialize the LOGINREC structure to be used
  55.          * to open a connection to SQL Server.
  56.          */

  57.         login = dblogin( );
  58.         DBSETLUSER(login, "user");
  59.         DBSETLPWD(login, "my_passwd");
  60.         DBSETLAPP(login, "rpcexample");
  61.         DBSETLVERSION(login, DBVER60);

  62.         dbproc = dbopen(login, (char *)"my_server");

  63.         /* Make the rpc. */
  64.         if (dbrpcinit(dbproc, "rpctest", (DBSMALLINT)0) == FAIL)
  65.         {
  66.                 printf("dbrpcinit failed.\n");
  67.                 dbexit();
  68.                 exit(ERREXIT);
  69.         }
  70.         if (dbrpcparam(dbproc, "@param1", (BYTE)DBRPCRETURN, SQLINT4,
  71.                 -1, -1, (BYTE *)&param1)
  72.            == FAIL)
  73.         {
  74.                 printf("dbrpcparam failed.\n");
  75.                 dbexit();
  76.                 exit(ERREXIT);
  77.         }

  78.         if (dbrpcparam(dbproc, "@param2", (BYTE)DBRPCRETURN, SQLINT4,
  79.                 -1, -1,         (BYTE *)&param2)
  80.            == FAIL)
  81.         {
  82.                 printf("dbrpcparam failed.\n");
  83.                 dbexit();
  84.                 exit(ERREXIT);
  85.         }

  86.         if (dbrpcparam(dbproc, "@param3", (BYTE)DBRPCRETURN, SQLINT4,
  87.                         -1, -1, (BYTE *)&param3)
  88.            == FAIL)
  89.         {
  90.                 printf("dbrpcparam failed.\n");
  91.                 dbexit();
  92.                 exit(ERREXIT);
  93.         }

  94.         if (dbrpcparam(dbproc, "@param4", (BYTE)NULL, SQLINT4,
  95.                 -1, -1, (BYTE *)&param4)
  96.            == FAIL)
  97.         {
  98.                 printf("dbrpcparam failed.\n");
  99.                 dbexit();
  100.                 exit(ERREXIT);
  101.         }

  102.         if (dbrpcsend(dbproc) == FAIL)
  103.         {
  104.                 printf("dbrpcsend failed.\n");
  105.                 dbexit();
  106.                 exit(ERREXIT);
  107.         }

  108.         if (dbsqlok(dbproc) == FAIL)
  109.         {
  110.                 printf("dbsqlok failed.\n");
  111.                 dbexit();
  112.                 exit(ERREXIT);
  113.         }
  114.         while ((return_code = dbresults(dbproc)) != NO_MORE_RESULTS)
  115.         {
  116.                 if (return_code == FAIL)
  117.                 {
  118.                         printf("dbresults failed.\n");
  119.                         dbexit();
  120.                         exit(ERREXIT);
  121.                 }

  122.                 /* Print any rows that may have been returned. */
  123.                 dbprrow(dbproc);

  124.                 /* Examine any return parameters that may have arrived. */

  125.                 numrets = dbnumrets(dbproc);
  126.                 printf("%d return values received.\n\n", numrets);

  127.                 if (numrets != 0)
  128.                 {
  129.                         printf
  130.                          (FMTSTR, "Name", "Type", "Length", "Value");
  131.                         printf
  132.                          (FMTSTR,
  133.                                  "------------", "------------",
  134.                                  "------------", "------------");

  135.                    for (i = 1; i <= numrets; i++)
  136.                    {
  137.                            printf
  138.                                    (FMTSTR1, dbretname(dbproc, i),
  139.                                    dbprtype(dbrettype(dbproc, i)), dbretlen(dbproc, i),
  140.                                    *((DBINT *)(dbretdata(dbproc, i))));
  141.                    }

  142.                 }
  143.                 if (dbhasretstat(dbproc))
  144.                         printf("Return status = %ld\n", dbretstatus(dbproc));
  145.                 else
  146.                         printf("No return status for this command.\n");
  147.         }
  148.        
  149.         dbexit();
  150. }
  151. int err_handler(dbproc, severity, dberr, oserr, dberrstr, oserrstr)
  152. DBPROCESS       *dbproc;
  153. int             severity;
  154. int             dberr;
  155. int             oserr;
  156. char            *dberrstr;
  157. char            *oserrstr;
  158. {
  159.         if (dberrstr != NULL)         printf("DB-Library error:\n\t%s\n", dberrstr);

  160.         if (oserr != DBNOERR)
  161.                 printf("Operating-system error:\n\t%s\n", oserrstr);
  162.         if ((dbproc == NULL) || (DBDEAD(dbproc)))
  163.                 return(INT_EXIT);
  164.         else
  165. {

  166.         return(INT_CANCEL);
  167. }
  168. }

  169. int msg_handler(dbproc, msgno, msgstate, severity, msgtext,
  170. srvname, procname, line)
  171. DBPROCESS        *dbproc;
  172. DBINT                msgno;
  173. int                        msgstate;
  174. int                        severity;
  175. char                *msgtext;
  176. char                *srvname;
  177. char                *procname;
  178. DBUSMALLINT        line;

  179. {
  180.         printf ("Msg %ld, Level %d, State %d\n",
  181.                 msgno, severity, msgstate);

  182.         if (srvname !=  NULL)
  183.                 printf ("Server '%s', ", srvname);
  184.         if (procname !=  NULL)
  185.                 printf ("Procedure '%s', ", procname);
  186.         if (line !=  0)
  187.                 printf ("Line %d", line);

  188.         printf("\n\t%s\n", msgtext);

  189.         return(0);
  190. }
復制代碼

論壇徽章:
0
5 [報告]
發(fā)表于 2004-10-13 15:13 |只看該作者

尋找關(guān)于db library 函數(shù)的資料,謝謝

謝謝斑竹
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP