std::wstring SpeechRecognition::GetText()
{
	const ULONG maxEvents = 10;
	SPEVENT events[maxEvents];

	ULONG eventCount;
	HRESULT hr;
	hr = recoContext->GetEvents(maxEvents, events, &eventCount);
	if (eventCount == 0)
		return std::wstring();

	if(!(hr == S_OK || hr == S_FALSE)) {
		CheckReturn(hr);
	}

	ISpRecoResult* recoResult;
	recoResult = reinterpret_cast<ISpRecoResult*>(events[0].lParam);

	wchar_t* text;
	hr = recoResult->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, FALSE, &text, NULL);
	CheckReturn(hr);

	std::wstring outText(text);

	CoTaskMemFree(text);

	return outText;
}
Beispiel #2
0
int
main(int argc, char *argv[])
{
	char buf[16];

	Connect();

	/* TODO test with VARCHAR too */
	Command(Statement, "SELECT CONVERT(TEXT,'Prova')");

	if (SQLFetch(Statement) != SQL_SUCCESS) {
		printf("Unable to fetch row\n");
		CheckReturn();
		exit(1);
	}

	/* these 2 tests test an old severe BUG in FreeTDS */
	if (SQLGetData(Statement, 1, SQL_C_CHAR, buf, 0, NULL) != SQL_SUCCESS_WITH_INFO) {
		printf("Unable to get data 1\n");
		CheckReturn();
		exit(1);
	}

	if (SQLGetData(Statement, 1, SQL_C_CHAR, buf, 0, NULL) != SQL_SUCCESS_WITH_INFO) {
		printf("Unable to get data 2\n");
		CheckReturn();
		exit(1);
	}

	if (SQLGetData(Statement, 1, SQL_C_CHAR, buf, 3, NULL) != SQL_SUCCESS_WITH_INFO) {
		printf("Unable to get data \n");
		CheckReturn();
		exit(1);
	}
	if (strcmp(buf, "Pr") != 0) {
		printf("Wrong data result 1\n");
		exit(1);
	}

	if (SQLGetData(Statement, 1, SQL_C_CHAR, buf, 16, NULL) != SQL_SUCCESS) {
		printf("Unable to get data \n");
		CheckReturn();
		exit(1);
	}
	if (strcmp(buf, "ova") != 0) {
		printf("Wrong data result 2 res = '%s'\n", buf);
		exit(1);
	}

	Disconnect();

	printf("Done.\n");
	return 0;
}
Beispiel #3
0
void KAIBase::OnReturn(void)
{
	int nRetCode = cmsInvalid;
	BOOL bRetCode = FALSE;

	bRetCode = CheckReturn();
	KG_PROCESS_SUCCESS(bRetCode);

	nRetCode = m_pSelf->m_eMoveState;

	if (nRetCode == cmsOnStand)
	{
		int nDir = g_GetDirection(m_pSelf->m_nX, m_pSelf->m_nY, m_nReturnX, m_nReturnY);
		m_pSelf->Turn(nDir, true, true);

		// 跑回ReturnPoint
		//KGLogPrintf(KGLOG_DEBUG, "[AI] Return Run to (%d, %d)\n", m_nReturnX, m_nReturnY);
		m_pSelf->RunTo(m_nReturnX, m_nReturnY);
	}

	return;
Exit1:
	//返回原点了,停一秒
	if (m_pNpcTeam)
		DoWait();
	else
		DoIdle(GAME_FPS);

	return;
}
Beispiel #4
0
static void MethodDefinition(void)
{
	Pointer name;
	SymPtr sym;
	Int32 l1,shift;
	
	SkipToken(tDEF);
	/* MatchToken(tVARIABLE); */

	name = GetIdent();
	/* maybe check for duplicates here? */
	sym = SymAdd(name);
	sym->kind = FUNCTION_KIND;
	sym->object.u.ival = vm_addr();
	sym->flags |= cur_scope;
	if( in_class && base_class!=NULL ) sym->clas=base_class;
    if( in_class && super_class!=NULL ) sym->super=super_class;
    
	NextToken();
	SymEnterScope();
	in_method=TRUE;
	l1 = vm_genI(op_link,0);
		
	/* check for any formal parameters */
	if( Token==tLPAREN )
	{
		FormalParamList(sym);
	}
	
	/* function statements */
	local_num=0;
	StatementList();
	sym->nlocs = local_num;

	/* backpatch any return statements */
	CheckReturn(sym);

	/* implicit return */
	shift = in_class ? 2 : 1;
	vm_genI(op_rts,sym->nlocs+sym->nargs+shift);
	
	/* reserve space for locals */
	vm_patch(l1,sym->nlocs);	
	
	SymExitScope(sym);
	in_method=FALSE;
	/* end of function */
	SkipToken(tEND);
	if( Token==tSEMI ) NextToken();
}
Beispiel #5
0
static void
Test(const char *query)
{
	int res;

	if (SQLPrepare(Statement, (SQLCHAR *) query, SQL_NTS) != SQL_SUCCESS) {
		fprintf(stderr, "Unable to prepare statement\n");
		exit(1);
	}

	if (SQLExecute(Statement) != SQL_SUCCESS) {
		fprintf(stderr, "Unable to execute statement\n");
		exit(1);
	}

	res = SQLFetch(Statement);
	if (res != SQL_SUCCESS && res != SQL_SUCCESS_WITH_INFO) {
		fprintf(stderr, "Unable to fetch row.\n");
		CheckReturn();
		exit(1);
	}

	if (SQLFetch(Statement) != SQL_NO_DATA) {
		fprintf(stderr, "Warning was returned as a result row -- bad!\n");
		exit(1);
	}

	/*
	 * Microsoft SQL Server 2000 provides a diagnostic record
	 * associated with the second SQLFetch (which returns
	 * SQL_NO_DATA) saying "Warning: Null value is eliminated by
	 * an aggregate or other SET operation."
	 * We check for "NO DM" cause unixODBC till 2.2.11 do not read
	 * errors on SQL_NO_DATA
	 */
	if (db_is_microsoft() && tds_no_dm) {
		SQLCHAR output[256];

		if (!SQL_SUCCEEDED(SQLGetDiagRec(SQL_HANDLE_STMT, Statement, 1, NULL, NULL, output, sizeof(output), NULL))) {
			fprintf(stderr, "SQLGetDiagRec should not fail\n");
			exit(1);
		}
		printf("Message: %s\n", (char *) output);
	}

	ResetStatement();
}
void SpeechRecognition::InitContext()
{
	//init com
	if (FAILED(::CoInitialize(nullptr))) 	{
		Log("Failed to initialize com library", LogEntry::Error);
		return;
	}

	HRESULT hr;
	ISpRecognizer* recognizer;
	hr = CoCreateInstance(CLSID_SpSharedRecognizer, nullptr, CLSCTX_ALL, IID_ISpRecognizer, reinterpret_cast<void**>(&recognizer));
	CheckReturn(hr);

	hr = recognizer->CreateRecoContext(&recoContext);
	CheckReturn(hr);
	
	//pause context
	hr = recoContext->Pause(0);
	CheckReturn(hr);

	//make grammar library
	ISpRecoGrammar* recoGrammar = InitGrammar();

	handleEvent = recoContext->GetNotifyEventHandle();
	if (handleEvent == INVALID_HANDLE_VALUE)
		CheckReturn(E_FAIL);

	ULONGLONG interest = SPFEI(SPEI_RECOGNITION);
	hr = recoContext->SetInterest(interest, interest);
	CheckReturn(hr);

	//Activate grammar
	hr = recoGrammar->SetRuleState(RULENAME, 0, SPRS_ACTIVE);
	CheckReturn(hr);

	//enable context again
	hr = recoContext->Resume(0);
	CheckReturn(hr);
	
	std::cout << "Waiting for mocha...." << std::endl;

	Update();	

	std::cout << "Hello!" << std::endl;

}
/**************************************************************************
* mexFunction: gateway routine for MATLAB interface.
***************************************************************************/
void mexFunction
(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
    
    // Argument checking
    if (nrhs != 9)
        mexErrMsgIdAndTxt(FUNC_NAME, "Wrong input.");
    if (nlhs != 3)
        mexErrMsgIdAndTxt(FUNC_NAME, "Wrong output.");
    
    // Input and output variables
    idx_t ne = (idx_t) mxGetScalar(ne_in);
    idx_t nn = (idx_t) mxGetScalar(nn_in);
    idx_t *eptr; GetIdxArray(eptr_in,&eptr);
    idx_t *eind; GetIdxArray(eind_in,&eind);
    idx_t *vwgt; GetIdxArray(vwgt_in,&vwgt);
    idx_t *vsize; GetIdxArray(vsize_in,&vsize);
    idx_t nparts = (idx_t) mxGetScalar(nparts_in);
    real_t *tpwgts; GetRealArray(tpwgts_in,&tpwgts);
    idx_t options[METIS_NOPTIONS];
    GetOptions(options_in, options);
    idx_t objval;
    idx_t *epart = (idx_t*) mxCalloc (ne, sizeof(idx_t));
    idx_t *npart = (idx_t*) mxCalloc (nn, sizeof(idx_t));
    
    // Metis main function
    int info = METIS_PartMeshNodal( &ne, &nn, eptr, eind, vwgt, vsize,
                    &nparts, tpwgts, options, &objval, epart, npart);
    CheckReturn(info, FUNC_NAME);
    
    // Output
    objval_out = mxCreateDoubleScalar( (double) objval );
    epart_out = mxCreateDoubleMatrix(1,ne,mxREAL);
    mxSetData(epart_out,mxMalloc(sizeof(double)*ne));
    double *epart_out_pr = mxGetPr(epart_out);
    for(idx_t i=0; i<ne; i++)
        epart_out_pr[i] = (double) epart[i];
    npart_out = mxCreateDoubleMatrix(1,nn,mxREAL);
    mxSetData(npart_out,mxMalloc(sizeof(double)*nn));
    double *npart_out_pr = mxGetPr(npart_out);
    for(idx_t i=0; i<nn; i++)
        npart_out_pr[i] = (double) npart[i];
}
/**************************************************************************
* mexFunction: gateway routine for MATLAB interface.
***************************************************************************/
void mexFunction
(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
    
    // Argument checking
    if (nrhs != 4)
        mexErrMsgIdAndTxt(FUNC_NAME, "Wrong input.");
    if (nlhs != 2)
        mexErrMsgIdAndTxt(FUNC_NAME, "Wrong output.");
    
    // Input and output variables
    idx_t ne = (idx_t) mxGetScalar(ne_in);
    idx_t nn = (idx_t) mxGetScalar(nn_in);
    idx_t *eptr; GetIdxArray(eptr_in,&eptr);
    idx_t *eind; GetIdxArray(eind_in,&eind);
    idx_t numflag = 0;
    idx_t *xadj = NULL;
    idx_t *adjncy = NULL;
    
    // Metis main function
    int info = METIS_MeshToNodal( &ne, &nn, eptr, eind, &numflag,
                    &xadj, &adjncy);
    CheckReturn(info, FUNC_NAME);
    
    // Output
    idx_t nvtxs = (idx_t) (sizeof(xadj)/sizeof(idx_t));
    xadj_out = mxCreateDoubleMatrix(1,nvtxs+1,mxREAL);
    mxSetData(xadj_out,mxMalloc(sizeof(double)*(nvtxs+1)));
    double *xadj_out_pr = mxGetPr(xadj_out);
    for(idx_t i=0; i<nvtxs+1; i++)
        xadj_out_pr[i] = (double) xadj[i];
    idx_t n = (idx_t) xadj[nvtxs];
    adjncy_out = mxCreateDoubleMatrix(1,n,mxREAL);
    mxSetData(adjncy_out,mxMalloc(sizeof(double)*n));
    double *adjncy_out_pr = mxGetPr(adjncy_out);
    for(idx_t i=0; i<n; i++)
        adjncy_out_pr[i] = (double) adjncy[i];
}
ISpRecoGrammar* SpeechRecognition::InitGrammar()
{
	HRESULT hr;
	SPSTATEHANDLE sate;

	ISpRecoGrammar* recoGrammar;
	hr = recoContext->CreateGrammar(GRAMMARID, &recoGrammar);
	CheckReturn(hr);

	WORD langID = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US);
	hr = recoGrammar->ResetGrammar(langID);
	CheckReturn(hr);

	//create rules
	hr = recoGrammar->GetRule(RULENAME, 0, SPRAF_TopLevel | SPRAF_Active, true, &sate);
	CheckReturn(hr);

	//add words
	const std::wstring commandWstr = std::wstring(L"Mocha");
	hr = recoGrammar->AddWordTransition(sate, NULL, commandWstr.c_str(), L" ", SPWT_LEXICAL, 1, nullptr);
	CheckReturn(hr);

	for (std::wstring& ws : wordList)
	{
		std::string sentence(ws.begin(), ws.end());
		std::vector<std::string> words = split(sentence, ' ');
		for (std::string& w : words)
		{
			std::wstring wsword(w.begin(), w.end());
			hr = recoGrammar->AddWordTransition(sate, NULL, wsword.c_str(), L" ", SPWT_LEXICAL, 1, nullptr);
		}
		CheckReturn(hr);
	}
	
	hr = recoGrammar->Commit(0);
	CheckReturn(hr);

	return recoGrammar;
}
Beispiel #10
0
//****************************************************************** 
float fatan2(float y, float x) 
{ 
    #if ASSERTS_ENABLED 
        float Angle = (float)atan2(y,x); 
    #endif 
    
    if(y == 0.f) // the line is horizontal 
    { 
      if( x > 0.f) // towards the right 
      { 
          // the angle is 0 
          CheckReturn(0.f); 
      } 
      // toward the left 
      //CheckReturn(PI); 
      return float(PI); 
    } 
    
    // we now know that y is not 0 check x 
    if(x == 0.f) // the line is vertical 
    { 
        if( y > 0.f) 
        { 
            CheckReturn(PI/2.f); 
        } 
        CheckReturn(-PI/2.f); 
    } 
    
    // from here on we know that niether x nor y is 0 
    if( x > 0.f) 
    { 
        // we are in quadrant 1 or 4 
        if (y > 0.f) 
        { 
            // we are in quadrant 1 
            // now figure out which side of the 45 degree line 
            if(x > y) 
            { 
                CheckReturn(calcAngle(x,y)); 
            } 
            CheckReturn((PI/2.f) - calcAngle(y,x)); 
        } 
        // we are in quadrant 4 
        y = -y; 
        // now figure out which side of the 45 degree line 
        if( x > y) 
        { 
                CheckReturn(-calcAngle(x,y)); 
        } 
        CheckReturn(-(PI/2.f) + calcAngle(y,x)); 
    } 
    
    // we are in quadrant 2 or 3 
    x = -x; // flip x so we can use it as a positive 
    if ( y > 0) 
    { 
        // we are in quadrant 2 
        // now figure out which side of the 45 degree line 
        if ( x > y) 
        { 
                CheckReturn(PI - calcAngle(x,y)); 
        } 
        CheckReturn(PI/2.f + calcAngle(y,x)); 
    } 
    // we are in quadrant 3 
    y = -y; // flip y so we can use it as a positve 
    // now figure out which side of the 45 degree line 
    if( x > y) 
    { 
        CheckReturn(-PI + calcAngle(x,y)); 
    } 
    CheckReturn(-(PI/2.f) - calcAngle(y,x)); 
}
/**************************************************************************
* mexFunction: gateway routine for MATLAB interface.
***************************************************************************/
void mexFunction
(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
    
    // Argument checking
    if (nrhs != 5)
        mexErrMsgIdAndTxt(FUNC_NAME, "Wrong input.");
    if (nlhs != 3)
        mexErrMsgIdAndTxt(FUNC_NAME, "Wrong output.");
    
    // Input and output variables
    idx_t nvtxs = (idx_t) mxGetScalar(nvtxs_in);
    idx_t *xadj; GetIdxArray(xadj_in,&xadj);
    idx_t *adjncy; GetIdxArray(adjncy_in,&adjncy);
    idx_t *vwgt; GetIdxArray(vwgt_in,&vwgt);
    idx_t options[METIS_NOPTIONS];
    GetOptions(options_in, options);
    idx_t *sepidx;
    idx_t *lgraphidx;
    idx_t *rgraphidx;
    
    // Metis main function
    idx_t i, nnvtxs=0;
    idx_t ptlgraph, ptrgraph, ptsep;
    graph_t *graph=NULL;
    ctrl_t *ctrl;
    idx_t *piperm;
    idx_t snvtxs[3];
    idx_t *where;

    /* set up malloc cleaning code and signal catchers */
    if (!gk_malloc_init()) 
        CheckReturn( METIS_ERROR_MEMORY, FUNC_NAME );

    // set up the run time parameters
    ctrl = SetupCtrl(METIS_OP_OMETIS, options, 1, 3, NULL, NULL);

    // prune the dense columns
    if (ctrl->pfactor > 0.0)
    { 
        piperm = imalloc(nvtxs, "OMETIS: piperm");

        graph = PruneGraph(ctrl, nvtxs, xadj, adjncy, vwgt,
                piperm, ctrl->pfactor);
        if (graph == NULL)
        {
            // if there was no prunning, cleanup the pfactor
            gk_free((void **)&piperm, LTERM);
            ctrl->pfactor = 0.0;
        }
        else
        {
            nnvtxs = graph->nvtxs;
            // disable compression if prunning took place
            ctrl->compress = 0;
        }
    }

    // compress the graph
    if (ctrl->compress)
        ctrl->compress = 0; 

    // if no prunning and no compression, setup the graph in the normal way.
    if (ctrl->pfactor == 0.0 && ctrl->compress == 0) 
        graph = SetupGraph(ctrl, nvtxs, 1, xadj, adjncy, vwgt, NULL, NULL);

    ASSERT(CheckGraph(graph, ctrl->numflag, 1));

    /* allocate workspace memory */
    AllocateWorkSpace(ctrl, graph);

    MlevelNodeBisectionMultiple(ctrl, graph);

    snvtxs[0] = 0;
    snvtxs[1] = 0;
    snvtxs[2] = 0;

    if (ctrl->pfactor > 0.0)
        snvtxs[2] += nvtxs-nnvtxs;

    where = graph->where;
    for (i=0; i<graph->nvtxs; i++)
        snvtxs[where[i]]++;

    lgraphidx = (idx_t*) mxCalloc (snvtxs[0], sizeof(idx_t));
    rgraphidx = (idx_t*) mxCalloc (snvtxs[1], sizeof(idx_t));
    sepidx    = (idx_t*) mxCalloc (snvtxs[2], sizeof(idx_t));

    ptlgraph = 0;
    ptrgraph = 0;
    ptsep    = 0;

    if (ctrl->pfactor > 0.0)
    {
        for (i=0; i<graph->nvtxs; i++)
            if (where[i] == 0)
                lgraphidx[ptlgraph++] = piperm[i];
            else if (where[i] == 1)
                rgraphidx[ptrgraph++] = piperm[i];
            else
                sepidx[ptsep++] = piperm[i];

        for (i=nnvtxs; i<nvtxs; i++)
            sepidx[ptsep++] = piperm[i];

        gk_free((void **)&piperm, LTERM);
    }
    else
    {
        for (i=0; i<graph->nvtxs; i++)
            if (where[i] == 0)
                lgraphidx[ptlgraph++] = i;
            else if (where[i] == 1)
                rgraphidx[ptrgraph++] = i;
            else
                sepidx[ptsep++] = i;
    }

    /* clean up */
    FreeCtrl(&ctrl);

    // Output
    lgraphidx_out = mxCreateDoubleMatrix(1,ptlgraph,mxREAL);
    mxSetData(lgraphidx_out,mxMalloc(sizeof(double)*ptlgraph));
    double *lgraphidx_out_pr = mxGetPr(lgraphidx_out);
    for(idx_t i=0; i<ptlgraph; i++)
        lgraphidx_out_pr[i] = (double) lgraphidx[i];
    rgraphidx_out = mxCreateDoubleMatrix(1,ptrgraph,mxREAL);
    mxSetData(rgraphidx_out,mxMalloc(sizeof(double)*ptrgraph));
    double *rgraphidx_out_pr = mxGetPr(rgraphidx_out);
    for(idx_t i=0; i<ptrgraph; i++)
        rgraphidx_out_pr[i] = (double) rgraphidx[i];
    sepidx_out = mxCreateDoubleMatrix(1,ptsep,mxREAL);
    mxSetData(sepidx_out,mxMalloc(sizeof(double)*ptsep));
    double *sepidx_out_pr = mxGetPr(sepidx_out);
    for(idx_t i=0; i<ptsep; i++)
        sepidx_out_pr[i] = (double) sepidx[i];
}
Beispiel #12
0
ExprNode* Parser  :: ParseDeclaration(SymbolType* sym_type){
    if (isEq(scan.Get(), _SEPARATION, ";")){
        scan.Next();
        return nullptr;
    }


    SymbolType* t_symbol;
    if (!sym_type) {
        t_symbol = ParseType();
    }else
        t_symbol = sym_type;

    VarSymbol* var = nullptr;
    BinOpNode *node = nullptr;
    while(true){
        Token *token;

        token = scan.Get();
        
        if(isEq(token, _SEPARATION, ";" )&& (t_symbol->isStruct() || dynamic_cast<TypedefSymbol*>(t_symbol)))
            break;

        if (isEq(scan.Get(), _SEPARATION,"("))
            var =  ParseComplexDeclaration(t_symbol);
        else
            var = ParseIdentifier(t_symbol);

        if(symStack->tables.back()->find_symbol(var->name) == 0)
            symStack->add_symbol(var);


        if(isEq(scan.Get(), _OPERATION, "=")){
            Token *asgn = scan.Get();
            scan.Next();
            ExprNode* Assing_operand = ParseExpr(priorityTable[","] + 1);

            node = new BinOpNode(asgn, new IdentifierNode(token, var), Assing_operand);
            if(dynamic_cast<ConstSymbolType*> (var->getType()))
                errorIf(!var->getType()->getType()->canConvertTo(node->right->getType()),"Cannot perform conversion",scan.Get() );
            else
                node->getType();
            blocks.top()->AddStatement(node);

        }
        if(isEq(scan.Get() ,_SEPARATION, ";") || isEq(scan.Get() ,_SEPARATION, "{"))
            break;
        
        errorIf(!isEq(scan.Get(), _OPERATION, ","), "Comma Expected");
        scan.Next();
    }
    if(isEq (scan.Get(),_SEPARATION,"{")){

        FuncSymbol *func = dynamic_cast<FuncSymbol*>(var->type);
        errorIf(!func, "Unexpected brace", scan.Get());
        errorIf((symStack->tables.size() != 1), "Can not define the function in the block", scan.Get());
        parsingFunc = func;
        func->body = ParseBlock();
        parsingFunc = 0;
        CheckReturn(func);

        if(func->name == "main")
            main_func = func;
        scan.Next();

    }
    else
        scan.Next();
    return node;
}
Beispiel #13
-1
static void
DoTest(int n)
{
	int res;

	SQLCHAR output[256];

	SQLSMALLINT colType;
	SQLULEN colSize;
	SQLSMALLINT colScale, colNullable;
	SQLLEN dataSize;

	TIMESTAMP_STRUCT ts;

	if (CommandWithResult(Statement, "select convert(datetime, '2002-12-27 18:43:21')") != SQL_SUCCESS)
		ODBC_REPORT_ERROR("Unable to execute statement");

	res = SQLFetch(Statement);
	if (res != SQL_SUCCESS && res != SQL_SUCCESS_WITH_INFO)
		ODBC_REPORT_ERROR("Unable to fetch row");

	if (SQLDescribeCol(Statement, 1, output, sizeof(output), NULL, &colType, &colSize, &colScale, &colNullable) != SQL_SUCCESS)
		ODBC_REPORT_ERROR("Error getting data");

	if (n == 0) {
		memset(&ts, 0, sizeof(ts));
		if (SQLGetData(Statement, 1, SQL_C_TIMESTAMP, &ts, sizeof(ts), &dataSize) != SQL_SUCCESS) {
			printf("Unable to get data col %d\n", 1);
			CheckReturn();
			exit(1);
		}
		sprintf((char *) output, "%04d-%02d-%02d %02d:%02d:%02d.000", ts.year, ts.month, ts.day, ts.hour, ts.minute, ts.second);
	} else {
		if (SQLGetData(Statement, 1, SQL_C_CHAR, output, sizeof(output), &dataSize) != SQL_SUCCESS) {
			printf("Unable to get data col %d\n", 1);
			CheckReturn();
			exit(1);
		}
	}

	printf("Date returned: %s\n", output);
	if (strcmp((char *) output, "2002-12-27 18:43:21.000") != 0) {
		printf("Invalid returned date\n");
		exit(1);
	}

	res = SQLFetch(Statement);
	if (res != SQL_NO_DATA)
		ODBC_REPORT_ERROR("Unable to fetch row");

	res = SQLCloseCursor(Statement);
	if (!SQL_SUCCEEDED(res))
		ODBC_REPORT_ERROR("Unable to close cursor");
}