/* Master only */
/* Sccsid = "%Z% generic/sproc/%M% %I% %G%" */
/*
** OLEDB_INSTALL
** This file contains the metadata Stored Procedures used by the OLEDB drivers.
**
*/
/*
** Stored procedures created:
**
** Name Default Location Comments
** --------------------------------------------------------------------------------------------------
** 1> sp_oledb_server_info sybsystemprocs
** 2> sp_oledb_databases sybsystemprocs
** 3> sp_oledb_columns sybsystemprocs
** 4> sp_oledb_datatype_info sybsystemprocs
** 5> sp_oledb_getversioncolumns sybsystemprocs
** 6> sp_oledb_getcolumnprivileges sybsystemprocs
** 7> sp_oledb_tables sybsystemprocs
** 8> sp_oledb_gettableprivileges sybsystemprocs
** 9> sp_oledb_getindexinfo sybsystemprocs
** 10> sp_oledb_primarykey sybsystemprocs
** 11> sp_oledb_fkeys sybsystemprocs
** 12> sp_oledb_stored_procedures sybsystemprocs
** 13> sp_oledb_getprocedurecolumns sybsystemprocs
** 14> sp_oledb_computeprivs sybsystemprocs added to support
** 15> sp_oledb_gettableprivileges
** 16> sp_oledb_getcolumnprivileges
** 17> sp_oledb_views
** 18> sp_version sybsystemprocs
*/
set flushmessage on
go
print ""
go
-- select @version_string = "@oledbMajorVersion@.@oledbMinorVersion1@.@oledbMinorVersion2@.@BuildNumber@"
declare @version_string varchar(255)
select @version_string = '15.0.0.325/'+ 'Thu 08-14-2008 14:58:04.98'
print "OLEDB - Build Version : %1!", @version_string
declare @retval int
exec @retval = sp_version 'OLEDB MDA Scripts', NULL, @version_string, 'start'
if (@retval != 0) select syb_quit()
go
use sybsystemprocs
go
if exists (select * from sysobjects where name = 'spt_sybdrv')
begin
drop table spt_sybdrv
end
go
print "Creating spt_sybdrv"
go
create table spt_sybdrv
(type_name varchar(20) Primary Key,
data_type int, tds_type int null)
go
begin
insert into spt_sybdrv values("smallint",2,52)
insert into spt_sybdrv values("int",3, 56)
insert into spt_sybdrv values("real",4, 59)
insert into spt_sybdrv values("float",5, 62)
insert into spt_sybdrv values("money",6, 60)
insert into spt_sybdrv values("smallmoney",6,122)
insert into spt_sybdrv values("bit",11, 50)
insert into spt_sybdrv values("tinyint",17,48)
insert into spt_sybdrv values("binary",128,45)
insert into spt_sybdrv values("image",128,34)
insert into spt_sybdrv values("varbinary",128,37)
insert into spt_sybdrv values("char",129, 47)
insert into spt_sybdrv values("varchar",129,39)
insert into spt_sybdrv values("text",129,35)
insert into spt_sybdrv values("nchar",129,47)
insert into spt_sybdrv values("nvarchar",129,39)
insert into spt_sybdrv values("unitext",130,174)
insert into spt_sybdrv values("unichar",130, 135)
insert into spt_sybdrv values("univarchar",130, 155)
insert into spt_sybdrv values("numeric",131,63)
insert into spt_sybdrv values("decimal",131,55)
insert into spt_sybdrv values("date",133,49)
insert into spt_sybdrv values("time",134,51)
insert into spt_sybdrv values("datetime",135,61)
insert into spt_sybdrv values("smalldatetime",135,58)
insert into spt_sybdrv values("bigint",20,191)
insert into spt_sybdrv values("unsigned smallint",18,65)
insert into spt_sybdrv values("unsigned int",19,66)
insert into spt_sybdrv values("unsigned bigint",21,67)
end
print "spt_sybdrv created!"
go
grant select on spt_sybdrv to public
go
if exists (select * from sysobjects where name = 'sp_oledb_computeprivs')
begin
drop procedure sp_oledb_computeprivs
end
go
/*
** Results Table needs to be created so that sp_oledb_computeprivs has a temp
** table to reference when the procedure is compiled. Otherwise, the calling
** stored procedure will create the temp table for sp_oledb_computeprivs.
*/
create table #results_table
(table_qualifier varchar (32),
table_owner varchar (32),
table_name varchar (255),
column_name varchar (255) NULL,
grantor varchar (32),
grantee varchar (32),
privilege varchar (32),
is_grantable varchar (3))
go
create procedure sp_oledb_computeprivs (
@table_name varchar(255),
@table_owner varchar(32),
@table_qualifier varchar(32),
@column_name varchar(255),
@calledfrom_colpriv tinyint,
@tab_id int)
AS
/* Don't delete the following line. It is the checkpoint for sed */
/* Server dependent stored procedure add here ad ADDPOINT_COMPUTE_PRIVS */
-- declare @low int /* range of userids to check */
-- declare @high int
-- declare @max_uid smallint /* max uid allowed for a user */
declare @grantor_name varchar (32) /* the ascii name of grantor.
used for output */
declare @grantee_name varchar (32) /* the ascii name of grantee.
used for output */
declare @col_count smallint /* number of columns in
@table_name */
declare @grantee int /* id of the grantee */
declare @action smallint /* action refers to select,
update...*/
declare @columns varbinary (133) /* bit map of column
privileges */
declare @protecttype tinyint /* grant/revoke or grant with
grant option */
declare @grantor int /* id of the grantor of the
privilege */
declare @grp_id int /* the group a user belongs
to */
declare @grant_type tinyint /* used as a constant */
declare @revoke_type tinyint /* used as a constant */
declare @select_action smallint /* used as a constant */
declare @update_action smallint /* used as a constant */
declare @reference_action smallint /* used as a constant */
declare @insert_action smallint /* used as a constant */
declare @delete_action smallint /* used as a constant */
declare @public_select varbinary (133) /* stores select column bit map
for public */
declare @public_reference varbinary (133) /* stores reference column bit
map for public */
declare @public_update varbinary (133) /* stores update column bit map
for public */
declare @public_insert tinyint /* stores if insert has been
granted to public */
declare @public_delete tinyint /* store if delete has been
granted to public */
declare @grp_select varbinary (133) /* stores select column bit map
for group */
declare @grp_update varbinary (133) /* stores update column bit map
for group */
declare @grp_reference varbinary (133) /* stores reference column bit
map for group */
declare @grp_delete tinyint /* if group hs been granted
- 1
- 2
- 3
- 4
- 5
- 6
前往页