sqltableprivileges.c

来自「这个是内存数据库的客户端」· C语言 代码 · 共 130 行

C
130
字号
/* * The contents of this file are subject to the MonetDB Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * * The Original Code is the MonetDB Database System. * * The Initial Developer of the Original Code is CWI. * Portions created by CWI are Copyright (C) 1997-2007 CWI. * All Rights Reserved. *//* * This code was created by Peter Harvey (mostly during Christmas 98/99). * This code is LGPL. Please ensure that this message remains in future * distributions and uses of this code (thats about all I get out of it). * - Peter Harvey pharvey@codebydesign.com *  * This file has been modified for the MonetDB project.  See the file * Copyright in this directory for more information. *//********************************************************************** * SQLTablePrivileges() * CLI Compliance: ODBC (Microsoft) * * Note: this function is not implemented (it only sets an error), * because MonetDB SQL frontend does not support table based authorization. * * Author: Martin van Dinther * Date  : 30 aug 2002 * **********************************************************************/#include "ODBCGlobal.h"#include "ODBCStmt.h"#include "ODBCUtil.h"static SQLRETURNSQLTablePrivileges_(ODBCStmt *stmt, SQLCHAR *szCatalogName, SQLSMALLINT nCatalogNameLength, SQLCHAR *szSchemaName, SQLSMALLINT nSchemaNameLength, SQLCHAR *szTableName, SQLSMALLINT nTableNameLength){	fixODBCstring(szCatalogName, nCatalogNameLength, SQLSMALLINT, addStmtError, stmt);	fixODBCstring(szSchemaName, nSchemaNameLength, SQLSMALLINT, addStmtError, stmt);	fixODBCstring(szTableName, nTableNameLength, SQLSMALLINT, addStmtError, stmt);#ifdef ODBCDEBUG	ODBCLOG("\"%.*s\" \"%.*s\" \"%.*s\"\n", nCatalogNameLength, (char*)szCatalogName, nSchemaNameLength, (char*)szSchemaName, nTableNameLength, (char*)szTableName);#endif	/* SQLTablePrivileges returns a table with the following columns:	   VARCHAR      table_cat	   VARCHAR      table_schem	   VARCHAR      table_name NOT NULL	   VARCHAR      grantor	   VARCHAR      grantee NOT NULL	   VARCHAR      privilege NOT NULL	   VARCHAR      is_grantable	 */	/* Driver does not support this function */	addStmtError(stmt, "IM001", NULL, 0);	return SQL_ERROR;}SQLRETURN SQL_APISQLTablePrivileges(SQLHSTMT hStmt, SQLCHAR *szCatalogName, SQLSMALLINT nCatalogNameLength, SQLCHAR *szSchemaName, SQLSMALLINT nSchemaNameLength, SQLCHAR *szTableName, SQLSMALLINT nTableNameLength){	ODBCStmt *stmt = (ODBCStmt *) hStmt;#ifdef ODBCDEBUG	ODBCLOG("SQLTablePrivileges " PTRFMT " ", PTRFMTCAST hStmt);#endif	if (!isValidStmt(stmt))		 return SQL_INVALID_HANDLE;	clearStmtErrors(stmt);	return SQLTablePrivileges_(stmt, szCatalogName, nCatalogNameLength, szSchemaName, nSchemaNameLength, szTableName, nTableNameLength);}#ifdef WITH_WCHARSQLRETURN SQL_APISQLTablePrivilegesA(SQLHSTMT hStmt, SQLCHAR *szCatalogName, SQLSMALLINT nCatalogNameLength, SQLCHAR *szSchemaName, SQLSMALLINT nSchemaNameLength, SQLCHAR *szTableName, SQLSMALLINT nTableNameLength){	return SQLTablePrivileges(hStmt, szCatalogName, nCatalogNameLength, szSchemaName, nSchemaNameLength, szTableName, nTableNameLength);}SQLRETURN SQL_APISQLTablePrivilegesW(SQLHSTMT hStmt, SQLWCHAR * szCatalogName, SQLSMALLINT nCatalogNameLength, SQLWCHAR * szSchemaName, SQLSMALLINT nSchemaNameLength, SQLWCHAR * szTableName, SQLSMALLINT nTableNameLength){	ODBCStmt *stmt = (ODBCStmt *) hStmt;	SQLRETURN rc = SQL_ERROR;	SQLCHAR *catalog = NULL, *schema = NULL, *table = NULL;#ifdef ODBCDEBUG	ODBCLOG("SQLTablePrivilegesW " PTRFMT " ", PTRFMTCAST hStmt);#endif	if (!isValidStmt(stmt))		 return SQL_INVALID_HANDLE;	clearStmtErrors(stmt);	fixWcharIn(szCatalogName, nCatalogNameLength, SQLCHAR, catalog, addStmtError, stmt, goto exit);	fixWcharIn(szSchemaName, nSchemaNameLength, SQLCHAR, schema, addStmtError, stmt, goto exit);	fixWcharIn(szTableName, nTableNameLength, SQLCHAR, table, addStmtError, stmt, goto exit);	rc = SQLTablePrivileges_(stmt, catalog, SQL_NTS, schema, SQL_NTS, table, SQL_NTS);      exit:	if (catalog)		free(catalog);	if (schema)		free(schema);	if (table)		free(table);	return rc;}#endif /* WITH_WCHAR */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?