/proc/net/tcp中各项参数说明

/proc/net/tcp中各项参数说明

/proc/net/tcp中的内容由tcp4_seq_show()函数打印,该函数中有三种打印形式,我们这里这只列出状态是TCP_SEQ_STATE_LISTENING或TCP_SEQ_STATE_ESTABLISHED的情况,如下所示:

在这里插入图片描述

展开阅读全文

proC的游标

11-17

[code=C/C++]rnEXEC SQL BEGIN DECLARE SECTION;rn EXEC SQL TYPE mystr IS STRING(20);rn rn mystr username[20];rn mystr password[20];rn rn mystr colname[20];rn mystr coltype[20]; rnEXEC SQL END DECLARE SECTION;rnrnexec sql include sqlca;rnrnint main() rn int i = 0;rn EXEC SQL WHENEVER SQLERROR DO error_proc();rn rn rn rn strcpy(username,"SCOTT");rn strcpy(password,"scott");rn rn if(connect() != 0)rn exit(-1);//若数据库连接失败,则直接退出程序rn rn rn rn EXEC SQL DECLARE col_cursor CURSOR FOR SELECT CNAME,COLTYPE FROM COL WHERE TNAME='EMP';rn rn rn EXEC SQL OPEN col_cursor;rn rn for(;;)rn EXEC SQL WHENEVER NOT FOUND DO break;rn EXEC SQL FETCH col_cursor INTO :colname,:coltype;rn printf("%s %s",colname,coltype); rn rn EXEC SQL WHENEVER NOT FOUND DO continue;rn EXEC SQL CLOSE col_cursor;rnrn[/code]rnrn上面这段代码运行会导致没有结果输出,而实际上如果在SQLPLUS中输入SELECT CNAME,COLTYPE FROM COL WHERE TNAME='EMP';是有结果的。rnrn而下面这段代码与上面的代码非常类似,但却是有结果的。rn[code=C/C++]rnEXEC SQL BEGIN DECLARE SECTION;rn EXEC SQL TYPE mystr IS STRING(20);rn rn mystr username[20];rn mystr password[20];rnrn int empno;rn mystr ename[20];rn mystr job[20];rn int mgr;rn mystr hireDate[20];rn float sal;rn float comm;rn int deptno;rn short ind_comm;rn short ind_mgr;rn rnEXEC SQL END DECLARE SECTION;rnrnexec sql include sqlca;rnrnint main() rn int i = 0;rn EXEC SQL WHENEVER SQLERROR DO error_proc();rn rn rn rn strcpy(username,"SCOTT");rn strcpy(password,"scott");rn rn if(connect() != 0)rn exit(-1);//若数据库连接失败,则直接退出程序rn rn rn EXEC SQL DECLARE emp_cursor CURSOR FOR SELECT EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO FROM EMP;rn rn EXEC SQL OPEN emp_cursor;rn rn for(;;)rn EXEC SQL WHENEVER NOT FOUND DO break;rn EXEC SQL FETCH emp_cursor INTO :empno,:ename,:job,:mgr INDICATOR:ind_mgr,:hireDate,:sal,:comm INDICATOR :ind_comm,:deptno;rn if(ind_comm < 0)rn if(ind_mgr < 0)rn printf("%-11d%-11s%-11s%-11s%-11s%-11.2f%-11s%-11d\n",empno,ename,job,"NULL",hireDate,sal,"NULL",deptno);rn rn elsern printf("%-11d%-11s%-11s%-11d%-11s%-11.2f%-11s%-11d\n",empno,ename,job,mgr,hireDate,sal,"NULL",deptno);rn rn rn elsern if(ind_mgr < 0)rn printf("%-11d%-11s%-11s%-11s%-11s%-11.2f%-11.2f%-11d\n",empno,ename,job,"NULL",hireDate,sal,comm,deptno);rn rn elsern printf("%-11d%-11s%-11s%-11d%-11s%-11.2f%-11.2f%-11d\n",empno,ename,job,mgr,hireDate,sal,comm,deptno);rn rn rn rn rn EXEC SQL WHENEVER NOT FOUND DO continue;rn EXEC SQL CLOSE emp_cursor; rn rn rn[/code]rnrn这两段代码非常非常相似,但下面的正常,而上面的代码不能输出任何结果,不知道是什么原因,两段代码运行没有出现错误,只是前面那段代码没有结果,请大牛不吝赐教。。。 论坛

没有更多推荐了,返回首页