#include <stdio.h>
#include <stdlib.h>
#include "sqlite3.h"
voID main()
{
printf("Content-type: text/HTML\r\n");
printf("\r\n");
printf("<HTML><head><Title>CGI TEST</Title></head>");
printf("<body>");
printf("<h1>BOA CGI TEST</h1>");
printf("<h2>huyi</h2>");
printf("Hello\n");
char *data;
long m,n;
//´òTMLͷ
printf("<Title>Multiplication results</Title>\n");
printf("<h3>Multiplication results</h3>\n");
data=getenv("query_STRING");
//ȡµû·¾³±ä
if(data==NulL)
printf("<p>Error!Error in passing data to script");
else if(sscanf(data,"m=%ld&n=%ld",&m,&n)!=2)
printf("<P>Error! InvalID data. Data must be numeric.");
else
printf("<P>The product of %ld and %ld is %ld.",m,n,m*n);
sqlite3 *db =NulL;
char *zErrMsg = 0;
int rc;
rc = sqlite3_open("zIEckey.db",&db);
if( rc )
{
fprintf(stderr,"Can't open database: %s\n",sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
}
else
printf("You have opened a sqlite3 database named zIEckey.db successfully! \n");
char *sql ;
int nrow = 0,ncolumn = 0;
char **azResult;
sql = "SELECT * FROM SensorData ";
sqlite3_get_table( db,sql,&azResult,&nrow,&ncolumn,&zErrMsg );
int i = 0 ;
printf( "row:%d column=%d \n",nrow,ncolumn );
printf( "\nThe result of querying is : \n" );
for( i=0 ; i<( nrow + 1 ) * ncolumn ; i++ )
printf( "azResult[%d] = %s\n",i,azResult[i] );
sqlite3_free_table( azResult );
#ifdef _DEBUG_
printf("zErrMsg = %s \n",zErrMsg);
#endif
sqlite3_close(db);
return 0;
printf("</body></HTML>"); printf("\r\n"); printf("\r\n"); }
总结以上是内存溢出为你收集整理的sqlite+goahead+cgi全部内容,希望文章能够帮你解决sqlite+goahead+cgi所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)