Click here to Skip to main content
15,896,448 members
Articles / Database Development / SQL Server

SQL Syntax Validator

Rate me:
Please Sign up or sign in to vote.
4.36/5 (9 votes)
7 Aug 2001CPOL2 min read 175K   3.1K   38  
How to validate SQL Queries Prior to executing them
// SQLSynVal.h: interface for the CSQLSyntaxValidator class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SQLSYNVAL_H__C53593A6_4640_4C2C_A158_1A20BF03223A__INCLUDED_)
#define AFX_SQLSYNVAL_H__C53593A6_4640_4C2C_A158_1A20BF03223A__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <afxdb.h>
#include <atlbase.h>

class CSQLSyntaxValidator  
{
public:
	CSQLSyntaxValidator();
	virtual ~CSQLSyntaxValidator();
protected:
	static BOOL Check(CDatabase *pDb,HSTMT &hstmt,RETCODE nRetCode);
public:
	static BOOL VerifySQL(CDatabase *pDb,CString szSQL,CString &szError);
};

#endif // !defined(AFX_SQLSYNVAL_H__C53593A6_4640_4C2C_A158_1A20BF03223A__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
India India
1993 started with Computers

BE(Computer Science) and MS (Software Systems)

Industry Experience: 10 Years

C, C++, VC++(MFC), .NET, C#, MTS, Queuing, ASP.NET, AJAX, Java, J2EE, SunOne, JMS

Banking, Insurance & Pension,Health Care

Comments and Discussions