From: <asf...@us...> - 2010-06-04 23:15:50
|
Revision: 51203 http://firebird.svn.sourceforge.net/firebird/?rev=51203&view=rev Author: asfernandes Date: 2010-06-04 23:14:48 +0000 (Fri, 04 Jun 2010) Log Message: ----------- Set svn:eol-style to native Modified Paths: -------------- firebird/trunk/ChangeLog firebird/trunk/builds/install/arch-specific/darwin/License.txt firebird/trunk/extern/editline/configure firebird/trunk/extern/icu/as_is/os390/unpax-icu.sh firebird/trunk/extern/icu/source/extra/uconv/samples/iso8859-1.txt firebird/trunk/extern/icu/source/extra/uconv/samples/utf8/greek.txt firebird/trunk/extern/icu/source/test/unalignedtest/unaligned.c Property Changed: ---------------- firebird/trunk/ChangeLog firebird/trunk/Makefile.in firebird/trunk/acx_pthread.m4 firebird/trunk/autogen.sh firebird/trunk/binreloc.m4 firebird/trunk/builds/install/arch-specific/aix/Makefile.in firebird/trunk/builds/install/arch-specific/aix/classic/makeInstallImage.sh.in firebird/trunk/builds/install/arch-specific/aix/classic/rpmfiles.txt.in firebird/trunk/builds/install/arch-specific/aix/classic/rpmheader.txt.in firebird/trunk/builds/install/arch-specific/aix/misc/aixLibrary.sh.in firebird/trunk/builds/install/arch-specific/aix/misc/firebird.init.d.aix.in firebird/trunk/builds/install/arch-specific/aix/misc/postinstall.sh.in firebird/trunk/builds/install/arch-specific/aix/misc/postuninstall.sh.in firebird/trunk/builds/install/arch-specific/aix/misc/preinstall.sh.in firebird/trunk/builds/install/arch-specific/aix/misc/preuninstall.sh.in firebird/trunk/builds/install/arch-specific/aix/misc/rc.config.firebird.aix.in firebird/trunk/builds/install/arch-specific/aix/misc/tarinstall.sh.in firebird/trunk/builds/install/arch-specific/aix/misc/tarmaininstall.sh.in firebird/trunk/builds/install/arch-specific/aix/misc/tarmainuninstall.sh.in firebird/trunk/builds/install/arch-specific/aix/misc/taruninstall.sh.in firebird/trunk/builds/install/arch-specific/darwin/Description.plist firebird/trunk/builds/install/arch-specific/darwin/FB.info firebird/trunk/builds/install/arch-specific/darwin/Firebird.startupitem/Firebird firebird/trunk/builds/install/arch-specific/darwin/Firebird.startupitem/Resources/English.lproj/Localizable.strings firebird/trunk/builds/install/arch-specific/darwin/Firebird.startupitem/StartupParameters.plist firebird/trunk/builds/install/arch-specific/darwin/FrameworkInfo.plist firebird/trunk/builds/install/arch-specific/darwin/Info.plist firebird/trunk/builds/install/arch-specific/darwin/License.txt firebird/trunk/builds/install/arch-specific/darwin/Makefile.in firebird/trunk/builds/install/arch-specific/darwin/PkgInfo firebird/trunk/builds/install/arch-specific/darwin/Readme.txt firebird/trunk/builds/install/arch-specific/darwin/Welcome.txt firebird/trunk/builds/install/arch-specific/darwin/aliases.conf.in firebird/trunk/builds/install/arch-specific/darwin/buildno.c firebird/trunk/builds/install/arch-specific/darwin/buildsuffix.c firebird/trunk/builds/install/arch-specific/darwin/changeMultiConnectMode firebird/trunk/builds/install/arch-specific/darwin/fullvers.c firebird/trunk/builds/install/arch-specific/darwin/install-script firebird/trunk/builds/install/arch-specific/darwin/launchd.org.firebird.gds.plist firebird/trunk/builds/install/arch-specific/darwin/majorvers.c firebird/trunk/builds/install/arch-specific/darwin/minorvers.c firebird/trunk/builds/install/arch-specific/darwin/preinstall-script firebird/trunk/builds/install/arch-specific/darwin/preupgrade-script firebird/trunk/builds/install/arch-specific/darwin/revno.c firebird/trunk/builds/install/arch-specific/freebsd/Makefile.in firebird/trunk/builds/install/arch-specific/freebsd/freebsdLibrary.sh.in firebird/trunk/builds/install/arch-specific/freebsd/install.sh.in firebird/trunk/builds/install/arch-specific/hpux/Makefile.in firebird/trunk/builds/install/arch-specific/hpux/classic/firebirdCS.psf.in firebird/trunk/builds/install/arch-specific/hpux/classic/makeinstallImage.sh.in firebird/trunk/builds/install/arch-specific/hpux/classic/postInstall.sh.in firebird/trunk/builds/install/arch-specific/hpux/classic/postUninstall.sh.in firebird/trunk/builds/install/arch-specific/hpux/classic/preInstall.sh.in firebird/trunk/builds/install/arch-specific/hpux/classic/preUninstall.sh.in firebird/trunk/builds/install/arch-specific/hpux/classic/tarInstall.sh.in firebird/trunk/builds/install/arch-specific/hpux/classic/tarUninstall.sh.in firebird/trunk/builds/install/arch-specific/hpux/classic/tarmainInstall.sh.in firebird/trunk/builds/install/arch-specific/hpux/classic/tarmainUninstall.sh.in firebird/trunk/builds/install/arch-specific/hpux/misc/changedbaPassword.sh.in firebird/trunk/builds/install/arch-specific/hpux/misc/changegdslibrarycompatibleLink.sh.in firebird/trunk/builds/install/arch-specific/hpux/misc/createaliasDB.sh.in firebird/trunk/builds/install/arch-specific/hpux/misc/firebird.init.d.hpux.in firebird/trunk/builds/install/arch-specific/hpux/misc/hpuxLibrary.sh.in firebird/trunk/builds/install/arch-specific/hpux/misc/rc.config.firebird.hpux.in firebird/trunk/builds/install/arch-specific/hpux/super/makeinstallImage.sh.in firebird/trunk/builds/install/arch-specific/hpux/super/postInstall.sh.in firebird/trunk/builds/install/arch-specific/hpux/super/postUninstall.sh.in firebird/trunk/builds/install/arch-specific/hpux/super/preInstall.sh.in firebird/trunk/builds/install/arch-specific/hpux/super/preUninstall.sh.in firebird/trunk/builds/install/arch-specific/hpux/super/tarInstall.sh.in firebird/trunk/builds/install/arch-specific/hpux/super/tarUninstall.sh.in firebird/trunk/builds/install/arch-specific/hpux/super/tarmainInstall.sh.in firebird/trunk/builds/install/arch-specific/hpux/super/tarmainUninstall.sh.in firebird/trunk/builds/install/arch-specific/linux/Makefile.in firebird/trunk/builds/install/arch-specific/linux/classic/rpmfiles.txt.in firebird/trunk/builds/install/arch-specific/linux/classic/rpmheader.txt.in firebird/trunk/builds/install/arch-specific/linux/misc/README firebird/trunk/builds/install/arch-specific/linux/misc/firebird.init.d.debian.in firebird/trunk/builds/install/arch-specific/linux/misc/firebird.init.d.generic.in firebird/trunk/builds/install/arch-specific/linux/misc/firebird.init.d.gentoo.in firebird/trunk/builds/install/arch-specific/linux/misc/firebird.init.d.mandrake.in firebird/trunk/builds/install/arch-specific/linux/misc/firebird.init.d.slackware.in firebird/trunk/builds/install/arch-specific/linux/misc/firebird.init.d.suse.in firebird/trunk/builds/install/arch-specific/linux/misc/firebird.xinetd.in firebird/trunk/builds/install/arch-specific/linux/misc/linuxLibrary.sh.in firebird/trunk/builds/install/arch-specific/linux/misc/makeInstallImage.sh.in firebird/trunk/builds/install/arch-specific/linux/misc/postinstall.sh.in firebird/trunk/builds/install/arch-specific/linux/misc/postuninstall.sh.in firebird/trunk/builds/install/arch-specific/linux/misc/preinstall.sh.in firebird/trunk/builds/install/arch-specific/linux/misc/preuninstall.sh.in firebird/trunk/builds/install/arch-specific/linux/misc/rc.config.firebird.in firebird/trunk/builds/install/arch-specific/linux/misc/tarMainInstall.sh.in firebird/trunk/builds/install/arch-specific/linux/misc/tarMainUninstall.sh.in firebird/trunk/builds/install/arch-specific/linux/misc/tarinstall.sh.in firebird/trunk/builds/install/arch-specific/linux/misc/taruninstall.sh.in firebird/trunk/builds/install/arch-specific/linux/super/rpmfiles.txt.in firebird/trunk/builds/install/arch-specific/linux/super/rpmheader.txt.in firebird/trunk/builds/install/arch-specific/mingw/Makefile.in firebird/trunk/builds/install/arch-specific/mingw/super/Readme.txt firebird/trunk/builds/install/arch-specific/netbsd/Makefile.in firebird/trunk/builds/install/arch-specific/netbsd/install.sh.in firebird/trunk/builds/install/arch-specific/solaris/CS/gds_db-tcp.xml firebird/trunk/builds/install/arch-specific/solaris/CS/pkginfo.in firebird/trunk/builds/install/arch-specific/solaris/CS/postinstall.in firebird/trunk/builds/install/arch-specific/solaris/CS/postremove.in firebird/trunk/builds/install/arch-specific/solaris/CS/preinstall.in firebird/trunk/builds/install/arch-specific/solaris/CS/prototype.icu.in firebird/trunk/builds/install/arch-specific/solaris/CS/prototype.in firebird/trunk/builds/install/arch-specific/solaris/Makefile.in firebird/trunk/builds/install/arch-specific/solaris/SS/gds_db-tcp.xml firebird/trunk/builds/install/arch-specific/solaris/SS/pkginfo.in firebird/trunk/builds/install/arch-specific/solaris/SS/postinstall.in firebird/trunk/builds/install/arch-specific/solaris/SS/postremove.in firebird/trunk/builds/install/arch-specific/solaris/SS/preinstall.in firebird/trunk/builds/install/arch-specific/solaris/SS/prototype.icu.in firebird/trunk/builds/install/arch-specific/solaris/SS/prototype.in firebird/trunk/builds/install/arch-specific/solaris/libgcc/pkginfolg.in firebird/trunk/builds/install/arch-specific/solaris/libgcc/prototypelg.in firebird/trunk/builds/install/arch-specific/solx86/Makefile.in firebird/trunk/builds/install/arch-specific/win32/After_Installation.url firebird/trunk/builds/install/arch-specific/win32/BuildExecutableInstall.bat firebird/trunk/builds/install/arch-specific/win32/FirebirdInstallEnvironmentChecks.inc firebird/trunk/builds/install/arch-specific/win32/FirebirdInstallSupportFunctions.inc firebird/trunk/builds/install/arch-specific/win32/FirebirdInstall_20.iss firebird/trunk/builds/install/arch-specific/win32/Readme.txt firebird/trunk/builds/install/arch-specific/win32/ba/Instalacija_ProcitajMe.txt firebird/trunk/builds/install/arch-specific/win32/ba/ProcitajMe.txt firebird/trunk/builds/install/arch-specific/win32/ba/custom_messages_ba.inc firebird/trunk/builds/install/arch-specific/win32/custom_messages.inc firebird/trunk/builds/install/arch-specific/win32/de/custom_messages_de.inc firebird/trunk/builds/install/arch-specific/win32/de/installation_liesmich.txt firebird/trunk/builds/install/arch-specific/win32/de/liesmich.txt firebird/trunk/builds/install/arch-specific/win32/es/custom_messages_es.inc firebird/trunk/builds/install/arch-specific/win32/es/leame.txt firebird/trunk/builds/install/arch-specific/win32/es/leame_instalacion.txt firebird/trunk/builds/install/arch-specific/win32/firebirdsql.org.url firebird/trunk/builds/install/arch-specific/win32/fr/custom_messages_fr.inc firebird/trunk/builds/install/arch-specific/win32/fr/documents-en-francais.txt firebird/trunk/builds/install/arch-specific/win32/fr/installation_lisezmoi.txt firebird/trunk/builds/install/arch-specific/win32/fr/lisezmoi.txt firebird/trunk/builds/install/arch-specific/win32/hu/custom_messages_hu.inc firebird/trunk/builds/install/arch-specific/win32/hu/olvass_el.txt firebird/trunk/builds/install/arch-specific/win32/hu/telepitesi_segedlet.txt firebird/trunk/builds/install/arch-specific/win32/i18n_readme.txt firebird/trunk/builds/install/arch-specific/win32/install_classic.bat firebird/trunk/builds/install/arch-specific/win32/install_super.bat firebird/trunk/builds/install/arch-specific/win32/installation_readme.txt firebird/trunk/builds/install/arch-specific/win32/installation_scripted.txt firebird/trunk/builds/install/arch-specific/win32/it/custom_messages_it.inc firebird/trunk/builds/install/arch-specific/win32/it/leggimi.txt firebird/trunk/builds/install/arch-specific/win32/it/leggimi_installazione.txt firebird/trunk/builds/install/arch-specific/win32/pl/custom_messages_pl.inc firebird/trunk/builds/install/arch-specific/win32/pl/czytajto.txt firebird/trunk/builds/install/arch-specific/win32/pl/instalacja_czytajto.txt firebird/trunk/builds/install/arch-specific/win32/pt/custom_messages_pt.inc firebird/trunk/builds/install/arch-specific/win32/pt/instalacao_leia-me.txt firebird/trunk/builds/install/arch-specific/win32/pt/leia-me.txt firebird/trunk/builds/install/arch-specific/win32/readme_snapshot.txt firebird/trunk/builds/install/arch-specific/win32/si/custom_messages_si.inc firebird/trunk/builds/install/arch-specific/win32/si/instalacija_precitajMe.txt firebird/trunk/builds/install/arch-specific/win32/strip_comments.sed firebird/trunk/builds/install/arch-specific/win32/uninstall.bat firebird/trunk/builds/install/misc/IDPLicense.txt firebird/trunk/builds/install/misc/IPLicense.txt firebird/trunk/builds/install/misc/aliases.conf.in firebird/trunk/builds/install/misc/changeDBAPassword.sh.in firebird/trunk/builds/install/misc/changeGdsLibraryCompatibleLink.sh.in firebird/trunk/builds/install/misc/changeMultiConnectMode.sh.in firebird/trunk/builds/install/misc/changeRunUser.sh.in firebird/trunk/builds/install/misc/classicLibrary.sh.in firebird/trunk/builds/install/misc/createAliasDB.sh.in firebird/trunk/builds/install/misc/fb_config.in firebird/trunk/builds/install/misc/fbintl.conf firebird/trunk/builds/install/misc/firebird.conf.in firebird/trunk/builds/install/misc/firebird.init.d.Solaris.in firebird/trunk/builds/install/misc/firebird.init.d.generic.in firebird/trunk/builds/install/misc/firebird.init.d.mandrake.in firebird/trunk/builds/install/misc/posixLibrary.sh.in firebird/trunk/builds/install/misc/restoreRootRunUser.sh.in firebird/trunk/builds/install/misc/superLibrary.sh.in firebird/trunk/builds/mac_os_x/CS/CS.pbproj/project.pbxproj firebird/trunk/builds/mac_os_x/CS/Helpers.make firebird/trunk/builds/mac_os_x/CS/gpre_wrapper.sh firebird/trunk/builds/mac_os_x/CS/make_wrapper.sh firebird/trunk/builds/mac_os_x/CS/stlport_vars.cpp firebird/trunk/builds/mac_os_x/CS/stub.c firebird/trunk/builds/make.new/config/install-sh firebird/trunk/builds/old_prefixes/README.txt firebird/trunk/builds/old_prefixes/prefix.aix firebird/trunk/builds/old_prefixes/prefix.aix_ppc firebird/trunk/builds/old_prefixes/prefix.darwin firebird/trunk/builds/old_prefixes/prefix.freebsd firebird/trunk/builds/old_prefixes/prefix.hp10 firebird/trunk/builds/old_prefixes/prefix.hp9.0 firebird/trunk/builds/old_prefixes/prefix.linux firebird/trunk/builds/old_prefixes/prefix.mu firebird/trunk/builds/old_prefixes/prefix.ncr3000 firebird/trunk/builds/old_prefixes/prefix.netbsd firebird/trunk/builds/old_prefixes/prefix.sco firebird/trunk/builds/old_prefixes/prefix.sco_ev firebird/trunk/builds/old_prefixes/prefix.solaris firebird/trunk/builds/old_prefixes/prefix.solaris_mt firebird/trunk/builds/old_prefixes/prefix.solx86 firebird/trunk/builds/old_prefixes/prefix.sun4 firebird/trunk/builds/old_prefixes/prefix.sun4_acc firebird/trunk/builds/old_prefixes/prefix.win_nt firebird/trunk/builds/old_prefixes/prefix.win_nts firebird/trunk/builds/posix/Makefile.in.boot.gpre firebird/trunk/builds/posix/Makefile.in.client.fbudf firebird/trunk/builds/posix/Makefile.in.client.gbak firebird/trunk/builds/posix/Makefile.in.client.gfix firebird/trunk/builds/posix/Makefile.in.client.gpre firebird/trunk/builds/posix/Makefile.in.client.gsec firebird/trunk/builds/posix/Makefile.in.client.isql firebird/trunk/builds/posix/Makefile.in.client.qli firebird/trunk/builds/posix/Makefile.in.client.util firebird/trunk/builds/posix/Makefile.in.codes firebird/trunk/builds/posix/Makefile.in.embed.fbudf firebird/trunk/builds/posix/Makefile.in.embed.gbak firebird/trunk/builds/posix/Makefile.in.embed.gfix firebird/trunk/builds/posix/Makefile.in.embed.gpre firebird/trunk/builds/posix/Makefile.in.embed.isql firebird/trunk/builds/posix/Makefile.in.embed.qli firebird/trunk/builds/posix/Makefile.in.embed.util firebird/trunk/builds/posix/Makefile.in.examples firebird/trunk/builds/posix/Makefile.in.extern.editline firebird/trunk/builds/posix/Makefile.in.extern.icu firebird/trunk/builds/posix/Makefile.in.extlib firebird/trunk/builds/posix/Makefile.in.fbserver firebird/trunk/builds/posix/Makefile.in.fbtrace firebird/trunk/builds/posix/Makefile.in.firebird firebird/trunk/builds/posix/Makefile.in.intl firebird/trunk/builds/posix/Makefile.in.libfbclient firebird/trunk/builds/posix/Makefile.in.libfbembed firebird/trunk/builds/posix/Makefile.in.libfbstatic firebird/trunk/builds/posix/Makefile.in.msgs firebird/trunk/builds/posix/Makefile.in.plugins firebird/trunk/builds/posix/Makefile.in.plugins_examples firebird/trunk/builds/posix/Makefile.in.refDatabases firebird/trunk/builds/posix/Makefile.in.smp_server firebird/trunk/builds/posix/Makefile.in.static.gbak firebird/trunk/builds/posix/Makefile.in.static.gpre firebird/trunk/builds/posix/Makefile.in.static.isql firebird/trunk/builds/posix/darwin.defaults firebird/trunk/builds/posix/empty.vers firebird/trunk/builds/posix/fbintl.vers firebird/trunk/builds/posix/fbtrace.vers firebird/trunk/builds/posix/firebird.vers firebird/trunk/builds/posix/ib_util.vers firebird/trunk/builds/posix/make.defaults firebird/trunk/builds/posix/make.platform.solaris.examples firebird/trunk/builds/posix/make.rules firebird/trunk/builds/posix/make.shared.targets firebird/trunk/builds/posix/make.shared.variables firebird/trunk/builds/posix/postfix.darwin firebird/trunk/builds/posix/prefix.aix_powerpc firebird/trunk/builds/posix/prefix.aix_powerpc_xlc firebird/trunk/builds/posix/prefix.darwin_i386 firebird/trunk/builds/posix/prefix.darwin_powerpc firebird/trunk/builds/posix/prefix.darwin_ppc64 firebird/trunk/builds/posix/prefix.darwin_x86_64 firebird/trunk/builds/posix/prefix.example firebird/trunk/builds/posix/prefix.freebsd firebird/trunk/builds/posix/prefix.freebsd_amd64 firebird/trunk/builds/posix/prefix.hpux firebird/trunk/builds/posix/prefix.hpux_aCC firebird/trunk/builds/posix/prefix.hpux_ia64 firebird/trunk/builds/posix/prefix.linux firebird/trunk/builds/posix/prefix.linux_amd64 firebird/trunk/builds/posix/prefix.linux_arm firebird/trunk/builds/posix/prefix.linux_generic firebird/trunk/builds/posix/prefix.linux_ia64 firebird/trunk/builds/posix/prefix.linux_mips firebird/trunk/builds/posix/prefix.linux_mipsel firebird/trunk/builds/posix/prefix.linux_powerpc firebird/trunk/builds/posix/prefix.linux_s390x firebird/trunk/builds/posix/prefix.linux_sparc32 firebird/trunk/builds/posix/prefix.mingw firebird/trunk/builds/posix/prefix.netbsd firebird/trunk/builds/posix/prefix.solaris firebird/trunk/builds/posix/prefix.solaris-64gcc firebird/trunk/builds/posix/prefix.solx86 firebird/trunk/builds/posix/prefix.solx86gcc firebird/trunk/builds/posix/prefix.solx86gcc_64 firebird/trunk/builds/posix/udr_engine.hpux.vers firebird/trunk/builds/posix/udr_engine.vers firebird/trunk/builds/posix/vers.sh.in firebird/trunk/builds/win32/adjust_vc7_files.cmd firebird/trunk/builds/win32/blrtable.bat firebird/trunk/builds/win32/clean_all.bat firebird/trunk/builds/win32/compile.bat firebird/trunk/builds/win32/create_msgs.bat firebird/trunk/builds/win32/defs/build.def firebird/trunk/builds/win32/defs/burp.def firebird/trunk/builds/win32/defs/burp32.def firebird/trunk/builds/win32/defs/dsql.def firebird/trunk/builds/win32/defs/fbclient.def firebird/trunk/builds/win32/defs/fbclient_s.def firebird/trunk/builds/win32/defs/fbrmclib.def firebird/trunk/builds/win32/defs/gds32.def firebird/trunk/builds/win32/defs/ib_udf.def firebird/trunk/builds/win32/defs/ib_util.def firebird/trunk/builds/win32/defs/intl.def firebird/trunk/builds/win32/defs/isql.def firebird/trunk/builds/win32/defs/iutls.def firebird/trunk/builds/win32/defs/jrd.def firebird/trunk/builds/win32/defs/remote.def firebird/trunk/builds/win32/defs/udr_engine.def firebird/trunk/builds/win32/defs/utls.def firebird/trunk/builds/win32/make_all.bat firebird/trunk/builds/win32/make_boot.bat firebird/trunk/builds/win32/make_examples.bat firebird/trunk/builds/win32/make_icu.bat firebird/trunk/builds/win32/msvc7/Firebird2.sln firebird/trunk/builds/win32/msvc7/Firebird2Boot.sln firebird/trunk/builds/win32/msvc7/Firebird2_Examples.sln firebird/trunk/builds/win32/msvc7/alice.vcproj firebird/trunk/builds/win32/msvc7/btyacc.vcproj firebird/trunk/builds/win32/msvc7/build_msg.vcproj firebird/trunk/builds/win32/msvc7/burp.vcproj firebird/trunk/builds/win32/msvc7/codes.vcproj firebird/trunk/builds/win32/msvc7/common.vcproj firebird/trunk/builds/win32/msvc7/common_classic.vcproj firebird/trunk/builds/win32/msvc7/common_static.vcproj firebird/trunk/builds/win32/msvc7/config.vcproj firebird/trunk/builds/win32/msvc7/dsql_server.vcproj firebird/trunk/builds/win32/msvc7/dsql_server_classic.vcproj firebird/trunk/builds/win32/msvc7/empbuild.vcproj firebird/trunk/builds/win32/msvc7/engine.vcproj firebird/trunk/builds/win32/msvc7/engine_classic.vcproj firebird/trunk/builds/win32/msvc7/engine_embed.vcproj firebird/trunk/builds/win32/msvc7/fb2control.vcproj firebird/trunk/builds/win32/msvc7/fb_inet_server.vcproj firebird/trunk/builds/win32/msvc7/fb_lock_print.vcproj firebird/trunk/builds/win32/msvc7/fbclient.vcproj firebird/trunk/builds/win32/msvc7/fbclient_static.vcproj firebird/trunk/builds/win32/msvc7/fbembed.vcproj firebird/trunk/builds/win32/msvc7/fbguard.vcproj firebird/trunk/builds/win32/msvc7/fbrmclib.vcproj firebird/trunk/builds/win32/msvc7/fbserver.vcproj firebird/trunk/builds/win32/msvc7/fbsvcmgr.vcproj firebird/trunk/builds/win32/msvc7/fbtrace.vcproj firebird/trunk/builds/win32/msvc7/fbtracemgr.vcproj firebird/trunk/builds/win32/msvc7/fbudf.vcproj firebird/trunk/builds/win32/msvc7/gbak.vcproj firebird/trunk/builds/win32/msvc7/gbak_embed.vcproj firebird/trunk/builds/win32/msvc7/gds32.vcproj firebird/trunk/builds/win32/msvc7/gfix.vcproj firebird/trunk/builds/win32/msvc7/gpre.vcproj firebird/trunk/builds/win32/msvc7/gpre_boot.vcproj firebird/trunk/builds/win32/msvc7/gpre_embed.vcproj firebird/trunk/builds/win32/msvc7/gpre_static.vcproj firebird/trunk/builds/win32/msvc7/gsec.vcproj firebird/trunk/builds/win32/msvc7/gsplit.vcproj firebird/trunk/builds/win32/msvc7/gstat.vcproj firebird/trunk/builds/win32/msvc7/ib_udf.vcproj firebird/trunk/builds/win32/msvc7/ib_util.vcproj firebird/trunk/builds/win32/msvc7/instclient.vcproj firebird/trunk/builds/win32/msvc7/instreg.vcproj firebird/trunk/builds/win32/msvc7/instsvc.vcproj firebird/trunk/builds/win32/msvc7/intl.vcproj firebird/trunk/builds/win32/msvc7/intlbuild.vcproj firebird/trunk/builds/win32/msvc7/isql.vcproj firebird/trunk/builds/win32/msvc7/isql_embed.vcproj firebird/trunk/builds/win32/msvc7/lock.vcproj firebird/trunk/builds/win32/msvc7/lock_classic.vcproj firebird/trunk/builds/win32/msvc7/nbackup.vcproj firebird/trunk/builds/win32/msvc7/qli.vcproj firebird/trunk/builds/win32/msvc7/remote.vcproj firebird/trunk/builds/win32/msvc7/remote_classic.vcproj firebird/trunk/builds/win32/msvc7/utilities.vcproj firebird/trunk/builds/win32/msvc7/utilities_embed.vcproj firebird/trunk/builds/win32/msvc7/v5_examples.vcproj firebird/trunk/builds/win32/msvc8/DllNoEmbedManifest.vsprops firebird/trunk/builds/win32/msvc8/Firebird2.sln firebird/trunk/builds/win32/msvc8/Firebird2Boot.sln firebird/trunk/builds/win32/msvc8/Firebird2_Examples.sln firebird/trunk/builds/win32/msvc8/VCCRT_Shared_Body.wxi firebird/trunk/builds/win32/msvc8/VCCRT_Shared_Header.wxi firebird/trunk/builds/win32/msvc8/VCCRT_Win32.wxi firebird/trunk/builds/win32/msvc8/VCCRT_Win32.wxs firebird/trunk/builds/win32/msvc8/VCCRT_x64.wxi firebird/trunk/builds/win32/msvc8/VCCRT_x64.wxs firebird/trunk/builds/win32/msvc8/alice.vcproj firebird/trunk/builds/win32/msvc8/asInvoker.manifest firebird/trunk/builds/win32/msvc8/asInvokerManifest.vsprops firebird/trunk/builds/win32/msvc8/btyacc.vcproj firebird/trunk/builds/win32/msvc8/build_msg.vcproj firebird/trunk/builds/win32/msvc8/burp.vcproj firebird/trunk/builds/win32/msvc8/codes.vcproj firebird/trunk/builds/win32/msvc8/common.vcproj firebird/trunk/builds/win32/msvc8/common_classic.vcproj firebird/trunk/builds/win32/msvc8/common_static.vcproj firebird/trunk/builds/win32/msvc8/config.vcproj firebird/trunk/builds/win32/msvc8/dsql_server.vcproj firebird/trunk/builds/win32/msvc8/dsql_server_classic.vcproj firebird/trunk/builds/win32/msvc8/empbuild.vcproj firebird/trunk/builds/win32/msvc8/engine.vcproj firebird/trunk/builds/win32/msvc8/engine_classic.vcproj firebird/trunk/builds/win32/msvc8/engine_embed.vcproj firebird/trunk/builds/win32/msvc8/fb2control.vcproj firebird/trunk/builds/win32/msvc8/fb_inet_server.vcproj firebird/trunk/builds/win32/msvc8/fb_lock_print.vcproj firebird/trunk/builds/win32/msvc8/fbclient.vcproj firebird/trunk/builds/win32/msvc8/fbclient_static.vcproj firebird/trunk/builds/win32/msvc8/fbembed.vcproj firebird/trunk/builds/win32/msvc8/fbguard.vcproj firebird/trunk/builds/win32/msvc8/fbrmclib.vcproj firebird/trunk/builds/win32/msvc8/fbserver.vcproj firebird/trunk/builds/win32/msvc8/fbsvcmgr.vcproj firebird/trunk/builds/win32/msvc8/fbtrace.vcproj firebird/trunk/builds/win32/msvc8/fbtracemgr.vcproj firebird/trunk/builds/win32/msvc8/fbudf.vcproj firebird/trunk/builds/win32/msvc8/firebird2.vsprops firebird/trunk/builds/win32/msvc8/firebird2debug.vsprops firebird/trunk/builds/win32/msvc8/firebird2release.vsprops firebird/trunk/builds/win32/msvc8/gbak.vcproj firebird/trunk/builds/win32/msvc8/gbak_embed.vcproj firebird/trunk/builds/win32/msvc8/gds32.vcproj firebird/trunk/builds/win32/msvc8/gfix.vcproj firebird/trunk/builds/win32/msvc8/gpre.vcproj firebird/trunk/builds/win32/msvc8/gpre_boot.vcproj firebird/trunk/builds/win32/msvc8/gpre_embed.vcproj firebird/trunk/builds/win32/msvc8/gpre_static.vcproj firebird/trunk/builds/win32/msvc8/gsec.vcproj firebird/trunk/builds/win32/msvc8/gsplit.vcproj firebird/trunk/builds/win32/msvc8/gstat.vcproj firebird/trunk/builds/win32/msvc8/ib_udf.vcproj firebird/trunk/builds/win32/msvc8/ib_util.vcproj firebird/trunk/builds/win32/msvc8/instclient.vcproj firebird/trunk/builds/win32/msvc8/instreg.vcproj firebird/trunk/builds/win32/msvc8/instsvc.vcproj firebird/trunk/builds/win32/msvc8/intl.vcproj firebird/trunk/builds/win32/msvc8/intlbuild.vcproj firebird/trunk/builds/win32/msvc8/isql.vcproj firebird/trunk/builds/win32/msvc8/isql_embed.vcproj firebird/trunk/builds/win32/msvc8/lock.vcproj firebird/trunk/builds/win32/msvc8/lock_classic.vcproj firebird/trunk/builds/win32/msvc8/nbackup.vcproj firebird/trunk/builds/win32/msvc8/qli.vcproj firebird/trunk/builds/win32/msvc8/remote.vcproj firebird/trunk/builds/win32/msvc8/remote_classic.vcproj firebird/trunk/builds/win32/msvc8/requireAdministrator.manifest firebird/trunk/builds/win32/msvc8/requireAdministratorManifest.vsprops firebird/trunk/builds/win32/msvc8/udr_engine.vcproj firebird/trunk/builds/win32/msvc8/udrcpp_example.vcproj firebird/trunk/builds/win32/msvc8/utilities.vcproj firebird/trunk/builds/win32/msvc8/utilities_embed.vcproj firebird/trunk/builds/win32/msvc8/v5_examples.vcproj firebird/trunk/builds/win32/msvc9/DllNoEmbedManifest.vsprops firebird/trunk/builds/win32/msvc9/Firebird2.sln firebird/trunk/builds/win32/msvc9/Firebird2Boot.sln firebird/trunk/builds/win32/msvc9/Firebird2_Examples.sln firebird/trunk/builds/win32/msvc9/alice.vcproj firebird/trunk/builds/win32/msvc9/btyacc.vcproj firebird/trunk/builds/win32/msvc9/build_msg.vcproj firebird/trunk/builds/win32/msvc9/burp.vcproj firebird/trunk/builds/win32/msvc9/codes.vcproj firebird/trunk/builds/win32/msvc9/common.vcproj firebird/trunk/builds/win32/msvc9/common_classic.vcproj firebird/trunk/builds/win32/msvc9/common_static.vcproj firebird/trunk/builds/win32/msvc9/config.vcproj firebird/trunk/builds/win32/msvc9/dsql_server.vcproj firebird/trunk/builds/win32/msvc9/dsql_server_classic.vcproj firebird/trunk/builds/win32/msvc9/empbuild.vcproj firebird/trunk/builds/win32/msvc9/engine.vcproj firebird/trunk/builds/win32/msvc9/engine_classic.vcproj firebird/trunk/builds/win32/msvc9/engine_embed.vcproj firebird/trunk/builds/win32/msvc9/fb2control.vcproj firebird/trunk/builds/win32/msvc9/fb_inet_server.vcproj firebird/trunk/builds/win32/msvc9/fb_lock_print.vcproj firebird/trunk/builds/win32/msvc9/fbclient.vcproj firebird/trunk/builds/win32/msvc9/fbembed.vcproj firebird/trunk/builds/win32/msvc9/fbguard.vcproj firebird/trunk/builds/win32/msvc9/fbrmclib.vcproj firebird/trunk/builds/win32/msvc9/fbserver.vcproj firebird/trunk/builds/win32/msvc9/fbsvcmgr.vcproj firebird/trunk/builds/win32/msvc9/fbtrace.vcproj firebird/trunk/builds/win32/msvc9/fbtracemgr.vcproj firebird/trunk/builds/win32/msvc9/fbudf.vcproj firebird/trunk/builds/win32/msvc9/firebird2.vsprops firebird/trunk/builds/win32/msvc9/firebird2debug.vsprops firebird/trunk/builds/win32/msvc9/firebird2release.vsprops firebird/trunk/builds/win32/msvc9/gbak.vcproj firebird/trunk/builds/win32/msvc9/gbak_embed.vcproj firebird/trunk/builds/win32/msvc9/gfix.vcproj firebird/trunk/builds/win32/msvc9/gpre.vcproj firebird/trunk/builds/win32/msvc9/gpre_boot.vcproj firebird/trunk/builds/win32/msvc9/gpre_embed.vcproj firebird/trunk/builds/win32/msvc9/gsec.vcproj firebird/trunk/builds/win32/msvc9/gsplit.vcproj firebird/trunk/builds/win32/msvc9/gstat.vcproj firebird/trunk/builds/win32/msvc9/ib_udf.vcproj firebird/trunk/builds/win32/msvc9/ib_util.vcproj firebird/trunk/builds/win32/msvc9/instclient.vcproj firebird/trunk/builds/win32/msvc9/instreg.vcproj firebird/trunk/builds/win32/msvc9/instsvc.vcproj firebird/trunk/builds/win32/msvc9/intl.vcproj firebird/trunk/builds/win32/msvc9/intlbuild.vcproj firebird/trunk/builds/win32/msvc9/isql.vcproj firebird/trunk/builds/win32/msvc9/isql_embed.vcproj firebird/trunk/builds/win32/msvc9/lock.vcproj firebird/trunk/builds/win32/msvc9/lock_classic.vcproj firebird/trunk/builds/win32/msvc9/nbackup.vcproj firebird/trunk/builds/win32/msvc9/qli.vcproj firebird/trunk/builds/win32/msvc9/remote.vcproj firebird/trunk/builds/win32/msvc9/udr_engine.vcproj firebird/trunk/builds/win32/msvc9/udrcpp_example.vcproj firebird/trunk/builds/win32/parse.bat firebird/trunk/builds/win32/preprocess.bat firebird/trunk/builds/win32/run_all.bat firebird/trunk/builds/win32/set_build_target.bat firebird/trunk/builds/win32/setenvvar.bat firebird/trunk/configure.in firebird/trunk/doc/Firebird_conf.txt firebird/trunk/doc/README.DiskSpaceAllocation firebird/trunk/doc/README.NTSecurity firebird/trunk/doc/README.Optimizer.txt firebird/trunk/doc/README.UserSql firebird/trunk/doc/README.Win32LibraryInstallation.txt firebird/trunk/doc/README.Win9X_NT_embedding firebird/trunk/doc/README.build.mingw.html firebird/trunk/doc/README.build.msvc.html firebird/trunk/doc/README.build.posix.html firebird/trunk/doc/README.coding.style firebird/trunk/doc/README.connection_string_charset.txt firebird/trunk/doc/README.external_routines.txt firebird/trunk/doc/README.fb_cancel_operation firebird/trunk/doc/README.fb_shutdown firebird/trunk/doc/README.fbsvcmgr firebird/trunk/doc/README.garbage_collector firebird/trunk/doc/README.incompatibilities.txt firebird/trunk/doc/README.instsvc firebird/trunk/doc/README.intl firebird/trunk/doc/README.isql_enhancements.txt firebird/trunk/doc/README.makefiles firebird/trunk/doc/README.monitoring_tables firebird/trunk/doc/README.performance_monitoring firebird/trunk/doc/README.raw_devices firebird/trunk/doc/README.read_password_from_file firebird/trunk/doc/README.services_extension firebird/trunk/doc/README.sha1 firebird/trunk/doc/README.superclassic firebird/trunk/doc/README.trace_services firebird/trunk/doc/README.trusted_authentication firebird/trunk/doc/README.user firebird/trunk/doc/README.user.embedded firebird/trunk/doc/README.user.troubleshooting firebird/trunk/doc/README.xnet firebird/trunk/doc/WhatsNew firebird/trunk/doc/ambiguity.txt firebird/trunk/doc/cleaning-todo.txt firebird/trunk/doc/emacros-cross_ref.html firebird/trunk/doc/fb2-todo.txt firebird/trunk/doc/install_win32.txt firebird/trunk/doc/install_windows_manually.txt firebird/trunk/doc/license/IDPL.txt firebird/trunk/doc/license/README.license.usage.txt firebird/trunk/doc/ods11-index-structure.html firebird/trunk/doc/sql.extensions/README.PSQL_stack_trace.txt firebird/trunk/doc/sql.extensions/README.aggregate_tracking firebird/trunk/doc/sql.extensions/README.alternate_string_quoting.txt firebird/trunk/doc/sql.extensions/README.autonomous_transactions.txt firebird/trunk/doc/sql.extensions/README.builtin_functions.txt firebird/trunk/doc/sql.extensions/README.case firebird/trunk/doc/sql.extensions/README.coalesce firebird/trunk/doc/sql.extensions/README.column_type_psql.txt firebird/trunk/doc/sql.extensions/README.common_table_expressions firebird/trunk/doc/sql.extensions/README.context_variables firebird/trunk/doc/sql.extensions/README.context_variables2 firebird/trunk/doc/sql.extensions/README.current_time firebird/trunk/doc/sql.extensions/README.cursors firebird/trunk/doc/sql.extensions/README.data_type_results_of_aggregations.txt firebird/trunk/doc/sql.extensions/README.data_types firebird/trunk/doc/sql.extensions/README.db_triggers.txt firebird/trunk/doc/sql.extensions/README.ddl.txt firebird/trunk/doc/sql.extensions/README.ddl_triggers.txt firebird/trunk/doc/sql.extensions/README.default_parameters firebird/trunk/doc/sql.extensions/README.derived_tables.txt firebird/trunk/doc/sql.extensions/README.distinct firebird/trunk/doc/sql.extensions/README.domains_psql.txt firebird/trunk/doc/sql.extensions/README.exception_handling firebird/trunk/doc/sql.extensions/README.execute_block firebird/trunk/doc/sql.extensions/README.execute_statement firebird/trunk/doc/sql.extensions/README.execute_statement2 firebird/trunk/doc/sql.extensions/README.explicit_locks firebird/trunk/doc/sql.extensions/README.expression_indices firebird/trunk/doc/sql.extensions/README.global_temporary_tables firebird/trunk/doc/sql.extensions/README.hex_literals.txt firebird/trunk/doc/sql.extensions/README.identity_columns.txt firebird/trunk/doc/sql.extensions/README.iif firebird/trunk/doc/sql.extensions/README.isc_info_xxx firebird/trunk/doc/sql.extensions/README.joins.txt firebird/trunk/doc/sql.extensions/README.keywords firebird/trunk/doc/sql.extensions/README.leave_labels firebird/trunk/doc/sql.extensions/README.length firebird/trunk/doc/sql.extensions/README.list firebird/trunk/doc/sql.extensions/README.merge.txt firebird/trunk/doc/sql.extensions/README.null_value firebird/trunk/doc/sql.extensions/README.nullif firebird/trunk/doc/sql.extensions/README.order_by_expressions_nulls firebird/trunk/doc/sql.extensions/README.packages.txt firebird/trunk/doc/sql.extensions/README.plan firebird/trunk/doc/sql.extensions/README.returning firebird/trunk/doc/sql.extensions/README.rows firebird/trunk/doc/sql.extensions/README.savepoints firebird/trunk/doc/sql.extensions/README.select_expressions firebird/trunk/doc/sql.extensions/README.sequence_generators firebird/trunk/doc/sql.extensions/README.set_transaction.txt firebird/trunk/doc/sql.extensions/README.similar_to.txt firebird/trunk/doc/sql.extensions/README.trim firebird/trunk/doc/sql.extensions/README.universal_triggers firebird/trunk/doc/sql.extensions/README.update_or_insert firebird/trunk/doc/sql.extensions/README.user_management firebird/trunk/doc/sql.extensions/README.view_updates firebird/trunk/examples/api/api1.c firebird/trunk/examples/api/api10.c firebird/trunk/examples/api/api11.c firebird/trunk/examples/api/api12.c firebird/trunk/examples/api/api13.c firebird/trunk/examples/api/api14.e firebird/trunk/examples/api/api15.c firebird/trunk/examples/api/api16.c firebird/trunk/examples/api/api16t.c firebird/trunk/examples/api/api2.c firebird/trunk/examples/api/api3.c firebird/trunk/examples/api/api4.c firebird/trunk/examples/api/api5.c firebird/trunk/examples/api/api6.c firebird/trunk/examples/api/api7.c firebird/trunk/examples/api/api8.c firebird/trunk/examples/api/api9.c firebird/trunk/examples/api/api9f.c firebird/trunk/examples/api/api9f.def firebird/trunk/examples/api/api9f.sql firebird/trunk/examples/api/apifull.c firebird/trunk/examples/api/example.def firebird/trunk/examples/api/winevent.c firebird/trunk/examples/api/winevent.def firebird/trunk/examples/api/winevent.rc firebird/trunk/examples/build_unix/Makefile.in.example5 firebird/trunk/examples/build_unix/Makefile.in.v5_examples firebird/trunk/examples/build_unix/old/makefile.old firebird/trunk/examples/build_unix/old/prefix.hp10 firebird/trunk/examples/build_unix/old/prefix.linux firebird/trunk/examples/build_unix/old/prefix.sco_ev firebird/trunk/examples/build_unix/old/prefix.solaris firebird/trunk/examples/build_unix/old/sfx.unix_makefile firebird/trunk/examples/build_win32/clean_all.bat firebird/trunk/examples/build_win32/clean_api.bat firebird/trunk/examples/build_win32/clean_dyn.bat firebird/trunk/examples/build_win32/clean_stat.bat firebird/trunk/examples/build_win32/clean_udf.bat firebird/trunk/examples/build_win32/make_all.bat firebird/trunk/examples/build_win32/make_api.bat firebird/trunk/examples/build_win32/make_dyn.bat firebird/trunk/examples/build_win32/make_stat.bat firebird/trunk/examples/build_win32/make_udf.bat firebird/trunk/examples/build_win32/old/example.mak firebird/trunk/examples/build_win32/old/prefix.win32_bc firebird/trunk/examples/build_win32/old/prefix.win32_msc firebird/trunk/examples/build_win32/old/sfx.win32_makefile firebird/trunk/examples/build_win32/setenvvar.bat firebird/trunk/examples/dyn/dyn1.e firebird/trunk/examples/dyn/dyn2.e firebird/trunk/examples/dyn/dyn3.e firebird/trunk/examples/dyn/dyn4.e firebird/trunk/examples/dyn/dyn5.e firebird/trunk/examples/dyn/dynfull.e firebird/trunk/examples/empbuild/empbld.sql firebird/trunk/examples/empbuild/empbuild.e firebird/trunk/examples/empbuild/empddl.sql firebird/trunk/examples/empbuild/empdml.sql firebird/trunk/examples/empbuild/employe2.sql firebird/trunk/examples/empbuild/indexoff.sql firebird/trunk/examples/empbuild/indexon.sql firebird/trunk/examples/empbuild/intlbld.e firebird/trunk/examples/empbuild/intlbld.sql firebird/trunk/examples/empbuild/intlddl.sql firebird/trunk/examples/empbuild/intldml.sql firebird/trunk/examples/empbuild/job.inp firebird/trunk/examples/empbuild/lang.inp firebird/trunk/examples/empbuild/proj.inp firebird/trunk/examples/empbuild/qtr.inp firebird/trunk/examples/functions.c firebird/trunk/examples/include/align.h firebird/trunk/examples/include/example.h firebird/trunk/examples/package/fbout-body.sql firebird/trunk/examples/package/fbout-header.sql firebird/trunk/examples/package/fbout-test.sql firebird/trunk/examples/readme firebird/trunk/examples/stat/stat1.e firebird/trunk/examples/stat/stat10.e firebird/trunk/examples/stat/stat11.e firebird/trunk/examples/stat/stat12.e firebird/trunk/examples/stat/stat12t.e firebird/trunk/examples/stat/stat2.e firebird/trunk/examples/stat/stat3.e firebird/trunk/examples/stat/stat4.e firebird/trunk/examples/stat/stat5.e firebird/trunk/examples/stat/stat6.e firebird/trunk/examples/stat/stat7.e firebird/trunk/examples/stat/stat8.e firebird/trunk/examples/stat/stat9.e firebird/trunk/examples/udf/udf.sql firebird/trunk/examples/udf/udflib.c firebird/trunk/examples/udf/udflib.def firebird/trunk/examples/udr/UdrCppExample.cpp firebird/trunk/extern/SfIO/include/stdio.h firebird/trunk/extern/SfIO/read.me firebird/trunk/extern/binreloc/binreloc.c firebird/trunk/extern/binreloc/binreloc.h firebird/trunk/extern/btyacc/Makefile firebird/trunk/extern/btyacc/README firebird/trunk/extern/btyacc/README.BYACC firebird/trunk/extern/btyacc/btyaccpa.ske firebird/trunk/extern/btyacc/closure.c firebird/trunk/extern/btyacc/defs.h firebird/trunk/extern/btyacc/empty.y firebird/trunk/extern/btyacc/error.c firebird/trunk/extern/btyacc/lalr.c firebird/trunk/extern/btyacc/lr0.c firebird/trunk/extern/btyacc/main.c firebird/trunk/extern/btyacc/makefile.dos firebird/trunk/extern/btyacc/manpage firebird/trunk/extern/btyacc/mkpar.c firebird/trunk/extern/btyacc/mstring.c firebird/trunk/extern/btyacc/mstring.h firebird/trunk/extern/btyacc/output.c firebird/trunk/extern/btyacc/push.skel firebird/trunk/extern/btyacc/reader.c firebird/trunk/extern/btyacc/readskel.c firebird/trunk/extern/btyacc/skel2c firebird/trunk/extern/btyacc/skeleton.c firebird/trunk/extern/btyacc/symtab.c firebird/trunk/extern/btyacc/test/ansiC.y firebird/trunk/extern/btyacc/test/ansiC2.y firebird/trunk/extern/btyacc/test/error.y firebird/trunk/extern/btyacc/test/ftp.y firebird/trunk/extern/btyacc/test/t1.y firebird/trunk/extern/btyacc/test/t2.y firebird/trunk/extern/btyacc/test/test.y firebird/trunk/extern/btyacc/verbose.c firebird/trunk/extern/btyacc/warshall.c firebird/trunk/extern/editline/CHANGELOG firebird/trunk/extern/editline/COPYING firebird/trunk/extern/editline/INSTALL firebird/trunk/extern/editline/Makefile.am firebird/trunk/extern/editline/Makefile.in firebird/trunk/extern/editline/THANKS firebird/trunk/extern/editline/acinclude.m4 firebird/trunk/extern/editline/aclocal.m4 firebird/trunk/extern/editline/config.guess firebird/trunk/extern/editline/config.h.in firebird/trunk/extern/editline/config.sub firebird/trunk/extern/editline/configure firebird/trunk/extern/editline/configure.ac firebird/trunk/extern/editline/depcomp firebird/trunk/extern/editline/install-sh firebird/trunk/extern/editline/ltmain.sh firebird/trunk/extern/editline/missing firebird/trunk/extern/editline/src/Makefile.am firebird/trunk/extern/editline/src/Makefile.in firebird/trunk/extern/editline/src/chared.c firebird/trunk/extern/editline/src/chared.h firebird/trunk/extern/editline/src/common.c firebird/trunk/extern/editline/src/editline/readline.h firebird/trunk/extern/editline/src/el.c firebird/trunk/extern/editline/src/el.h firebird/trunk/extern/editline/src/el_term.h firebird/trunk/extern/editline/src/emacs.c firebird/trunk/extern/editline/src/fgetln.c firebird/trunk/extern/editline/src/filecomplete.c firebird/trunk/extern/editline/src/filecomplete.h firebird/trunk/extern/editline/src/hist.c firebird/trunk/extern/editline/src/hist.h firebird/trunk/extern/editline/src/histedit.h firebird/trunk/extern/editline/src/history.c firebird/trunk/extern/editline/src/key.c firebird/trunk/extern/editline/src/key.h firebird/trunk/extern/editline/src/makelist firebird/trunk/extern/editline/src/map.c firebird/trunk/extern/editline/src/map.h firebird/trunk/extern/editline/src/parse.c firebird/trunk/extern/editline/src/parse.h firebird/trunk/extern/editline/src/prompt.c firebird/trunk/extern/editline/src/prompt.h firebird/trunk/extern/editline/src/read.c firebird/trunk/extern/editline/src/read.h firebird/trunk/extern/editline/src/readline.c firebird/trunk/extern/editline/src/refresh.c firebird/trunk/extern/editline/src/refresh.h firebird/trunk/extern/editline/src/search.c firebird/trunk/extern/editline/src/search.h firebird/trunk/extern/editline/src/shlib_version firebird/trunk/extern/editline/src/sig.c firebird/trunk/extern/editline/src/sig.h firebird/trunk/extern/editline/src/strlcat.c firebird/trunk/extern/editline/src/strlcpy.c firebird/trunk/extern/editline/src/sys.h firebird/trunk/extern/editline/src/term.c firebird/trunk/extern/editline/src/tokenizer.c firebird/trunk/extern/editline/src/tty.c firebird/trunk/extern/editline/src/tty.h firebird/trunk/extern/editline/src/unvis.c firebird/trunk/extern/editline/src/vi.c firebird/trunk/extern/editline/src/vis.c firebird/trunk/extern/editline/src/vis.h firebird/trunk/extern/icu/as_is/os390/unpax-icu.sh firebird/trunk/extern/icu/as_is/os400/configure firebird/trunk/extern/icu/as_is/os400/unpax-icu.sh firebird/trunk/extern/icu/debian/README.Debian.libicu-dev firebird/trunk/extern/icu/debian/changelog firebird/trunk/extern/icu/debian/control firebird/trunk/extern/icu/debian/copyright firebird/trunk/extern/icu/debian/icu-doc.doc-base firebird/trunk/extern/icu/debian/icu.conffiles.in firebird/trunk/extern/icu/debian/icu.postinst.in firebird/trunk/extern/icu/debian/icu.prerm.in firebird/trunk/extern/icu/debian/libicu.postinst firebird/trunk/extern/icu/debian/libicu.prerm.in firebird/trunk/extern/icu/debian/postinst.in firebird/trunk/extern/icu/debian/prerm.in firebird/trunk/extern/icu/debian/rules firebird/trunk/extern/icu/license.html firebird/trunk/extern/icu/packaging/PACKAGES firebird/trunk/extern/icu/packaging/README firebird/trunk/extern/icu/packaging/debian/README firebird/trunk/extern/icu/packaging/rpm/icu.spec firebird/trunk/extern/icu/readme.html firebird/trunk/extern/icu/source/Doxyfile.in firebird/trunk/extern/icu/source/Makefile.in firebird/trunk/extern/icu/source/acconfig.h firebird/trunk/extern/icu/source/aclocal.m4 firebird/trunk/extern/icu/source/allinone/all/all.dsp firebird/trunk/extern/icu/source/allinone/allinone.dsw firebird/trunk/extern/icu/source/allinone/allinone.sln firebird/trunk/extern/icu/source/allinone/allinone_8.sln firebird/trunk/extern/icu/source/allinone/allinone_9.sln firebird/trunk/extern/icu/source/allinone/firebird2debug.vsprops firebird/trunk/extern/icu/source/allinone/firebird2intl.vsprops firebird/trunk/extern/icu/source/allinone/firebird2release.vsprops firebird/trunk/extern/icu/source/common/Makefile.in firebird/trunk/extern/icu/source/common/brkdict.cpp firebird/trunk/extern/icu/source/common/brkdict.h firebird/trunk/extern/icu/source/common/brkiter.cpp firebird/trunk/extern/icu/source/common/caniter.cpp firebird/trunk/extern/icu/source/common/chariter.cpp firebird/trunk/extern/icu/source/common/charstr.h firebird/trunk/extern/icu/source/common/cmemory.c firebird/trunk/extern/icu/source/common/cmemory.h firebird/trunk/extern/icu/source/common/common.dsp firebird/trunk/extern/icu/source/common/common.rc firebird/trunk/extern/icu/source/common/common.vcproj firebird/trunk/extern/icu/source/common/common_8.vcproj firebird/trunk/extern/icu/source/common/common_9.vcproj firebird/trunk/extern/icu/source/common/cpputils.h firebird/trunk/extern/icu/source/common/cstring.c firebird/trunk/extern/icu/source/common/cstring.h firebird/trunk/extern/icu/source/common/cwchar.c firebird/trunk/extern/icu/source/common/cwchar.h firebird/trunk/extern/icu/source/common/dbbi.cpp firebird/trunk/extern/icu/source/common/dbbi_tbl.cpp firebird/trunk/extern/icu/source/common/dbbi_tbl.h firebird/trunk/extern/icu/source/common/filestrm.c firebird/trunk/extern/icu/source/common/filestrm.h firebird/trunk/extern/icu/source/common/hash.h firebird/trunk/extern/icu/source/common/icucfg.h.in firebird/trunk/extern/icu/source/common/iculserv.cpp firebird/trunk/extern/icu/source/common/iculserv.h firebird/trunk/extern/icu/source/common/icunotif.cpp firebird/trunk/extern/icu/source/common/icunotif.h firebird/trunk/extern/icu/source/common/icuserv.cpp firebird/trunk/extern/icu/source/common/icuserv.h firebird/trunk/extern/icu/source/common/locbased.cpp firebird/trunk/extern/icu/source/common/locbased.h firebird/trunk/extern/icu/source/common/locid.cpp firebird/trunk/extern/icu/source/common/locmap.c firebird/trunk/extern/icu/source/common/locmap.h firebird/trunk/extern/icu/source/common/msvcres.h firebird/trunk/extern/icu/source/common/mutex.h firebird/trunk/extern/icu/source/common/normlzr.cpp firebird/trunk/extern/icu/source/common/parsepos.cpp firebird/trunk/extern/icu/source/common/propname.cpp firebird/trunk/extern/icu/source/common/propname.h firebird/trunk/extern/icu/source/common/punycode.c firebird/trunk/extern/icu/source/common/punycode.h firebird/trunk/extern/icu/source/common/putil.c firebird/trunk/extern/icu/source/common/rbbi.cpp firebird/trunk/extern/icu/source/common/rbbicst.pl firebird/trunk/extern/icu/source/common/rbbidata.cpp firebird/trunk/extern/icu/source/common/rbbidata.h firebird/trunk/extern/icu/source/common/rbbinode.cpp firebird/trunk/extern/icu/source/common/rbbinode.h firebird/trunk/extern/icu/source/common/rbbirb.cpp firebird/trunk/extern/icu/source/common/rbbirb.h firebird/trunk/extern/icu/source/common/rbbirpt.h firebird/trunk/extern/icu/source/common/rbbirpt.txt firebird/trunk/extern/icu/source/common/rbbiscan.cpp firebird/trunk/extern/icu/source/common/rbbiscan.h firebird/trunk/extern/icu/source/common/rbbisetb.cpp firebird/trunk/extern/icu/source/common/rbbisetb.h firebird/trunk/extern/icu/source/common/rbbistbl.cpp firebird/trunk/extern/icu/source/common/rbbitblb.cpp firebird/trunk/extern/icu/source/common/rbbitblb.h firebird/trunk/extern/icu/source/common/resbund.cpp firebird/trunk/extern/icu/source/common/ruleiter.cpp firebird/trunk/extern/icu/source/common/ruleiter.h firebird/trunk/extern/icu/source/common/schriter.cpp firebird/trunk/extern/icu/source/common/sprpimpl.h firebird/trunk/extern/icu/source/common/uarrsort.c firebird/trunk/extern/icu/source/common/uarrsort.h firebird/trunk/extern/icu/source/common/uassert.h firebird/trunk/extern/icu/source/common/ubidi.c firebird/trunk/extern/icu/source/common/ubidiimp.h firebird/trunk/extern/icu/source/common/ubidiln.c firebird/trunk/extern/icu/source/common/ubidiwrt.c firebird/trunk/extern/icu/source/common/ubrk.cpp firebird/trunk/extern/icu/source/common/ucat.c firebird/trunk/extern/icu/source/common/uchar.c firebird/trunk/extern/icu/source/common/uchriter.cpp firebird/trunk/extern/icu/source/common/ucln.h firebird/trunk/extern/icu/source/common/ucln_cmn.c firebird/trunk/extern/icu/source/common/ucln_cmn.h firebird/trunk/extern/icu/source/common/ucmndata.c firebird/trunk/extern/icu/source/common/ucmndata.h firebird/trunk/extern/icu/source/common/ucmp8.c firebird/trunk/extern/icu/source/common/ucmp8.h firebird/trunk/extern/icu/source/common/ucnv.c firebird/trunk/extern/icu/source/common/ucnv2022.c firebird/trunk/extern/icu/source/common/ucnv_bld.c firebird/trunk/extern/icu/source/common/ucnv_bld.h firebird/trunk/extern/icu/source/common/ucnv_cb.c firebird/trunk/extern/icu/source/common/ucnv_cnv.c firebird/trunk/extern/icu/source/common/ucnv_cnv.h firebird/trunk/extern/icu/source/common/ucnv_err.c firebird/trunk/extern/icu/source/common/ucnv_ext.c firebird/trunk/extern/icu/source/common/ucnv_ext.h firebird/trunk/extern/icu/source/common/ucnv_imp.h firebird/trunk/extern/icu/source/common/ucnv_io.c firebird/trunk/extern/icu/source/common/ucnv_io.h firebird/trunk/extern/icu/source/common/ucnv_lmb.c firebird/trunk/extern/icu/source/common/ucnv_u16.c firebird/trunk/extern/icu/source/common/ucnv_u32.c firebird/trunk/extern/icu/source/common/ucnv_u7.c firebird/trunk/extern/icu/source/common/ucnv_u8.c firebird/trunk/extern/icu/source/common/ucnvbocu.c firebird/trunk/extern/icu/source/common/ucnvhz.c firebird/trunk/extern/icu/source/common/ucnvisci.c firebird/trunk/extern/icu/source/common/ucnvlat1.c firebird/trunk/extern/icu/source/common/ucnvmbcs.c firebird/trunk/extern/icu/source/common/ucnvmbcs.h firebird/trunk/extern/icu/source/common/ucnvscsu.c firebird/trunk/extern/icu/source/common/ucol_swp.c firebird/trunk/extern/icu/source/common/ucol_swp.h firebird/trunk/extern/icu/source/common/udata.c firebird/trunk/extern/icu/source/common/udatamem.c firebird/trunk/extern/icu/source/common/udatamem.h firebird/trunk/extern/icu/source/common/udataswp.c firebird/trunk/extern/icu/source/common/udataswp.h firebird/trunk/extern/icu/source/common/uenum.c firebird/trunk/extern/icu/source/common/uenumimp.h firebird/trunk/extern/icu/source/common/uhash.c firebird/trunk/extern/icu/source/common/uhash.h firebird/trunk/extern/icu/source/common/uhash_us.cpp firebird/trunk/extern/icu/source/common/uidna.cpp firebird/trunk/extern/icu/source/common/uiter.cpp firebird/trunk/extern/icu/source/common/uloc.c firebird/trunk/extern/icu/source/common/ulocimp.h firebird/trunk/extern/icu/source/common/umapfile.c firebird/trunk/extern/icu/source/common/umapfile.h firebird/trunk/extern/icu/source/common/umemstrm.c firebird/trunk/extern/icu/source/common/umemstrm.h firebird/trunk/extern/icu/source/common/umutex.c firebird/trunk/extern/icu/source/common/umutex.h firebird/trunk/extern/icu/source/common/unames.c firebird/trunk/extern/icu/source/common/unicode/brkiter.h firebird/trunk/extern/icu/source/common/unicode/caniter.h firebird/trunk/extern/icu/source/common/unicode/chariter.h firebird/trunk/extern/icu/source/common/unicode/dbbi.h firebird/trunk/extern/icu/source/common/unicode/docmain.h firebird/trunk/extern/icu/source/common/unicode/locid.h firebird/trunk/extern/icu/source/common/unicode/normlzr.h firebird/trunk/extern/icu/source/common/unicode/parseerr.h firebird/trunk/extern/icu/source/common/unicode/parsepos.h firebird/trunk/extern/icu/source/common/unicode/platform.h.in firebird/trunk/extern/icu/source/common/unicode/pmacos.h firebird/trunk/extern/icu/source/common/unicode/pos400.h firebird/trunk/extern/icu/source/common/unicode/putil.h firebird/trunk/extern/icu/source/common/unicode/pwin32.h firebird/trunk/extern/icu/source/common/unicode/rbbi.h firebird/trunk/extern/icu/source/common/unicode/rep.h firebird/trunk/extern/icu/source/common/unicode/resbund.h firebird/trunk/extern/icu/source/common/unicode/schriter.h firebird/trunk/extern/icu/source/common/unicode/strenum.h firebird/trunk/extern/icu/source/common/unicode/symtable.h firebird/trunk/extern/icu/source/common/unicode/ubidi.h firebird/trunk/extern/icu/source/common/unicode/ubrk.h firebird/trunk/extern/icu/source/common/unicode/ucat.h firebird/trunk/extern/icu/source/common/unicode/uchar.h firebird/trunk/extern/icu/source/common/unicode/uchriter.h firebird/trunk/extern/icu/source/common/unicode/uclean.h firebird/trunk/extern/icu/source/common/unicode/ucnv.h firebird/trunk/extern/icu/source/common/unicode/ucnv_cb.h firebird/trunk/extern/icu/source/common/unicode/ucnv_err.h firebird/trunk/extern/icu/source/common/unicode/uconfig.h firebird/trunk/extern/icu/source/common/unicode/udata.h firebird/trunk/extern/icu/source/common/unicode/udeprctd.h firebird/trunk/extern/icu/source/common/unicode/udraft.h firebird/trunk/extern/icu/source/common/unicode/uenum.h firebird/trunk/extern/icu/source/common/unicode/uidna.h firebird/trunk/extern/icu/source/common/unicode/uiter.h firebird/trunk/extern/icu/source/common/unicode/uloc.h firebird/trunk/extern/icu/source/common/unicode/umachine.h firebird/trunk/extern/icu/source/common/unicode/umisc.h firebird/trunk/extern/icu/source/common/unicode/unifilt.h firebird/trunk/extern/icu/source/common/unicode/unifunct.h firebird/trunk/extern/icu/source/common/unicode/unimatch.h firebird/trunk/extern/icu/source/common/unicode/uniset.h firebird/trunk/extern/icu/source/common/unicode/unistr.h firebird/trunk/extern/icu/source/common/unicode/unorm.h firebird/trunk/extern/icu/source/common/unicode/uobject.h firebird/trunk/extern/icu/source/common/unicode/uobslete.h firebird/trunk/extern/icu/source/common/unicode/urename.h firebird/trunk/extern/icu/source/common/unicode/urep.h firebird/trunk/extern/icu/source/common/unicode/ures.h firebird/trunk/extern/icu/source/common/unicode/uscript.h firebird/trunk/extern/icu/source/common/unicode/uset.h firebird/trunk/extern/icu/source/common/unicode/usetiter.h firebird/trunk/extern/icu/source/common/unicode/ushape.h firebird/trunk/extern/icu/source/common/unicode/usprep.h firebird/trunk/extern/icu/source/common/unicode/ustring.h firebird/trunk/extern/icu/source/common/unicode/utf.h firebird/trunk/extern/icu/source/common/unicode/utf16.h firebird/trunk/extern/icu/source/common/unicode/utf32.h firebird/trunk/extern/icu/source/common/unicode/utf8.h firebird/trunk/extern/icu/source/common/unicode/utf_old.h firebird/trunk/extern/icu/source/common/unicode/utrace.h firebird/trunk/extern/icu/source/common/unicode/utypes.h firebird/trunk/extern/icu/source/common/unicode/uversion.h firebird/trunk/extern/icu/source/common/unifilt.cpp firebird/trunk/extern/icu/source/common/unifunct.cpp firebird/trunk/extern/icu/source/common/uniset.cpp firebird/trunk/extern/icu/source/common/unistr.cpp firebird/trunk/extern/icu/source/common/unorm.cpp firebird/trunk/extern/icu/source/common/unorm_it.c firebird/trunk/extern/icu/source/common/unorm_it.h firebird/trunk/extern/icu/source/common/unormimp.h firebird/trunk/extern/icu/source/common/uobject.cpp firebird/trunk/extern/icu/source/common/uprops.c firebird/trunk/extern/icu/source/common/uprops.h firebird/trunk/extern/icu/source/common/uresbund.c firebird/trunk/extern/icu/source/common/uresdata.c firebird/trunk/extern/icu/source/common/uresdata.h firebird/trunk/extern/icu/source/common/uresimp.h firebird/trunk/extern/icu/source/common/usc_impl.c firebird/trunk/extern/icu/source/common/usc_impl.h firebird/trunk/extern/icu/source/common/uscript.c firebird/trunk/extern/icu/source/common/uset.cpp firebird/trunk/extern/icu/source/common/usetiter.cpp firebird/trunk/extern/icu/source/common/ushape.c firebird/trunk/extern/icu/source/common/usprep.cpp firebird/trunk/extern/icu/source/common/ustack.cpp firebird/trunk/extern/icu/source/common/ustr_imp.h firebird/trunk/extern/icu/source/common/ustrcase.c firebird/trunk/extern/icu/source/common/ustrenum.cpp firebird/trunk/extern/icu/source/common/ustrenum.h firebird/trunk/extern/icu/source/common/ustrfmt.c firebird/trunk/extern/icu/source/common/ustrfmt.h firebird/trunk/extern/icu/source/common/ustring.c firebird/trunk/extern/icu/... [truncated message content] |
From: <pau...@us...> - 2010-06-08 14:44:51
|
Revision: 51232 http://firebird.svn.sourceforge.net/firebird/?rev=51232&view=rev Author: paulbeach Date: 2010-06-08 14:44:45 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Grand Central Dispatch - 10.6 Darwin only Modified Paths: -------------- firebird/trunk/builds/posix/postfix.darwin firebird/trunk/builds/posix/prefix.darwin_i386 firebird/trunk/builds/posix/prefix.darwin_x86_64 firebird/trunk/extern/icu/source/config/mh-darwin Modified: firebird/trunk/builds/posix/postfix.darwin =================================================================== --- firebird/trunk/builds/posix/postfix.darwin 2010-06-08 13:35:46 UTC (rev 51231) +++ firebird/trunk/builds/posix/postfix.darwin 2010-06-08 14:44:45 UTC (rev 51232) @@ -81,7 +81,6 @@ cp ../gen/firebird/bin/gpre $(FB_FW)/Resources/bin cp ../gen/firebird/bin/qli $(FB_FW)/Resources/bin cp ../gen/firebird/bin/fb_lock_print $(FB_FW)/Resources/bin - cp ../gen/firebird/bin/gds_drop $(FB_FW)/Resources/bin cp ../gen/firebird/bin/gsec $(FB_FW)/Resources/bin cp ../gen/firebird/bin/gstat $(FB_FW)/Resources/bin cp ../gen/firebird/bin/nbackup $(FB_FW)/Resources/bin @@ -146,7 +145,6 @@ cp ../gen/firebird/bin/isql $(FB_FW)/Resources/bin cp ../gen/firebird/bin/gpre $(FB_FW)/Resources/bin cp ../gen/firebird/bin/fb_lock_print $(FB_FW)/Resources/bin - #cp ../gen/firebird/bin/gds_drop $(FB_FW)/Resources/bin #cp ../gen/firebird/bin/gds_relay $(FB_FW)/Resources/bin cp ../gen/firebird/bin/gsec $(FB_FW)/Resources/bin cp ../gen/firebird/bin/gstat $(FB_FW)/Resources/bin Modified: firebird/trunk/builds/posix/prefix.darwin_i386 =================================================================== --- firebird/trunk/builds/posix/prefix.darwin_i386 2010-06-08 13:35:46 UTC (rev 51231) +++ firebird/trunk/builds/posix/prefix.darwin_i386 2010-06-08 14:44:45 UTC (rev 51232) @@ -22,27 +22,27 @@ # 2. dnl the CPU_TYPE # 3. edit extern/icu/source/config and set the right 32bit flags (-arch i386) # 4. for CFLAGS, CXXFLAGS. LDFLAGS export '-m32 -arch i386' -# 5. export MACOSX_DEPLOYMENT_TARGET=10.4 +# 5. export MACOSX_DEPLOYMENT_TARGET=10.6 DYLD_LIBRARY_PATH=$(FIREBIRD)/lib export DYLD_LIBRARY_PATH -MACOSX_DEPLOYMENT_TARGET=10.4 +MACOSX_DEPLOYMENT_TARGET=10.6 export MACOSX_DEPLOYMENT_TARGET OS_ServerFiles=inet_server.cpp -PROD_FLAGS=-O3 -DDARWIN -pipe -p -MMD -fPIC -fno-common -arch i386 -mmacosx-version-min=10.4 -DEV_FLAGS=-ggdb -DDARWIN -pipe -p -MMD -fPIC -fno-common -Wall -arch i386 -mmacosx-version-min=10.4 -Wno-non-virtual-dtor +PROD_FLAGS=-O3 -DDARWIN -pipe -p -MMD -fPIC -fno-common -arch i386 -mmacosx-version-min=10.6 +DEV_FLAGS=-ggdb -DDARWIN -pipe -p -MMD -fPIC -fno-common -Wall -arch i386 -mmacosx-version-min=10.6 -Wno-non-virtual-dtor CXXFLAGS:=$(CXXFLAGS) -fvisibility-inlines-hidden -fvisibility=hidden -fno-weak -EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec fbguard nbackup fb_lock_print fbsvcmgr fbtracemgr -CLIENT_UTIL_TARGETS=gds_drop gds_relay gstat gsec fbguard fbmgr_bin nbackup fb_lock_print fbsvcmgr \ +EMBED_UTIL_TARGETS=gstat gds_relay gsec fbguard nbackup fb_lock_print fbsvcmgr fbtracemgr +CLIENT_UTIL_TARGETS=gds_relay gstat gsec fbguard fbmgr_bin nbackup fb_lock_print fbsvcmgr \ fbtracemgr Physical_IO_Module=os/posix/unix.cpp PLATFORM_PATH=os/darwin LINK_OPTS:=-m32 -LD_FLAGS+=-m32 -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk +LD_FLAGS+=-m32 -arch i386 include $(ROOT)/gen/darwin.defaults Modified: firebird/trunk/builds/posix/prefix.darwin_x86_64 =================================================================== --- firebird/trunk/builds/posix/prefix.darwin_x86_64 2010-06-08 13:35:46 UTC (rev 51231) +++ firebird/trunk/builds/posix/prefix.darwin_x86_64 2010-06-08 14:44:45 UTC (rev 51232) @@ -22,16 +22,16 @@ DYLD_LIBRARY_PATH=$(FIREBIRD)/lib export DYLD_LIBRARY_PATH -MACOSX_DEPLOYMENT_TARGET=10.5 +MACOSX_DEPLOYMENT_TARGET=10.6 export MACOSX_DEPLOYMENT_TARGET OS_ServerFiles=inet_server.cpp -PROD_FLAGS=-O3 -DDARWIN -pipe -p -MMD -fPIC -fno-common -mmacosx-version-min=10.5 -DEV_FLAGS=-ggdb -DDARWIN -pipe -p -MMD -fPIC -fno-common -Wall -mmacosx-version-min=10.5 -Wno-non-virtual-dtor +PROD_FLAGS=-O3 -DDARWIN -pipe -p -MMD -fPIC -fno-common -mmacosx-version-min=10.6 +DEV_FLAGS=-ggdb -DDARWIN -pipe -p -MMD -fPIC -fno-common -Wall -mmacosx-version-min=10.6 -Wno-non-virtual-dtor CXXFLAGS:=$(CXXFLAGS) -fvisibility-inlines-hidden -fvisibility=hidden -fno-weak -EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec fbguard nbackup fb_lock_print fbsvcmgr fbtracemgr -CLIENT_UTIL_TARGETS=gds_drop gds_relay gstat gsec fbguard fbmgr_bin nbackup fb_lock_print fbsvcmgr \ +EMBED_UTIL_TARGETS=gstat gds_relay gsec fbguard nbackup fb_lock_print fbsvcmgr fbtracemgr +CLIENT_UTIL_TARGETS=gds_relay gstat gsec fbguard fbmgr_bin nbackup fb_lock_print fbsvcmgr \ fbtracemgr Physical_IO_Module=os/posix/unix.cpp Modified: firebird/trunk/extern/icu/source/config/mh-darwin =================================================================== --- firebird/trunk/extern/icu/source/config/mh-darwin 2010-06-08 13:35:46 UTC (rev 51231) +++ firebird/trunk/extern/icu/source/config/mh-darwin 2010-06-08 14:44:45 UTC (rev 51232) @@ -17,9 +17,9 @@ # Set CFLAGS and CXXFLAGS for relevant MacOS architecture # and backwards compatibility. Set accordingly before building. -# Default 64 bit Leopard/Snow Leopard - intel (MacOS 10.5+) -CFLAGS += -arch x86_64 -CXXFLAGS += -arch x86_64 +# Default 64 bit Snow Leopard - intel (MacOS 10.6+) +CFLAGS += -arch x86_64 -mmacosx-version-min=10.6 +CXXFLAGS += -arch x86_64 -mmacosx-version-min=10.6 # 64 bit powerpc #CFLAGS += -arch ppc64 -mmacosx-version-min=10.5 @@ -27,8 +27,8 @@ # 32bit intel default # DARWIN flag added because of problem with putil.c -#CFLAGS += -arch i386 -mmacosx-version-min=10.4 -DDARWIN -#CXXFLAGS += -arch i386 -mmacosx-version-min=10.4 +#CFLAGS += -arch i386 -mmacosx-version-min=10.6 -DDARWIN +#CXXFLAGS += -arch i386 -mmacosx-version-min=10.6 # 32 bit powerpc #CFLAGS += -arch ppc -mmacosx-version-min=10.2 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-06-17 01:18:47
|
Revision: 51259 http://firebird.svn.sourceforge.net/firebird/?rev=51259&view=rev Author: asfernandes Date: 2010-06-17 01:18:40 +0000 (Thu, 17 Jun 2010) Log Message: ----------- Created class BlrWriter and reorganization (move BLR generation from statement to scratch) Modified Paths: -------------- firebird/trunk/builds/posix/make.shared.variables firebird/trunk/builds/win32/msvc9/dsql_server.vcproj firebird/trunk/builds/win32/msvc9/dsql_server_classic.vcproj firebird/trunk/src/dsql/AggNodes.cpp firebird/trunk/src/dsql/DdlNodes.epp firebird/trunk/src/dsql/ExprNodes.cpp firebird/trunk/src/dsql/Nodes.h firebird/trunk/src/dsql/StmtNodes.cpp firebird/trunk/src/dsql/ddl.cpp firebird/trunk/src/dsql/dsql.cpp firebird/trunk/src/dsql/dsql.h firebird/trunk/src/dsql/gen.cpp firebird/trunk/src/dsql/gen_proto.h firebird/trunk/src/dsql/pass1.cpp Added Paths: ----------- firebird/trunk/src/dsql/BlrWriter.cpp firebird/trunk/src/dsql/BlrWriter.h Modified: firebird/trunk/builds/posix/make.shared.variables =================================================================== --- firebird/trunk/builds/posix/make.shared.variables 2010-06-16 16:28:09 UTC (rev 51258) +++ firebird/trunk/builds/posix/make.shared.variables 2010-06-17 01:18:40 UTC (rev 51259) @@ -81,7 +81,7 @@ DSQL_ServerFiles= metd.epp DSqlDataTypeUtil.cpp \ ddl.cpp dsql.cpp errd.cpp gen.cpp hsh.cpp make.cpp \ movd.cpp parse.cpp Parser.cpp pass1.cpp misc_func.cpp \ - DdlNodes.epp PackageNodes.epp AggNodes.cpp ExprNodes.cpp StmtNodes.cpp WinNodes.cpp + DdlNodes.epp PackageNodes.epp AggNodes.cpp BlrWriter.cpp ExprNodes.cpp StmtNodes.cpp WinNodes.cpp DSQL_Files = $(DSQL_ClientFiles) $(DSQL_ServerFiles) Modified: firebird/trunk/builds/win32/msvc9/dsql_server.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc9/dsql_server.vcproj 2010-06-16 16:28:09 UTC (rev 51258) +++ firebird/trunk/builds/win32/msvc9/dsql_server.vcproj 2010-06-17 01:18:40 UTC (rev 51259) @@ -271,6 +271,10 @@ > </File> <File + RelativePath="..\..\..\src\dsql\BlrWriter.cpp" + > + </File> + <File RelativePath="..\..\..\src\dsql\ddl.cpp" > </File> @@ -422,6 +426,10 @@ > </File> <File + RelativePath="..\..\..\src\dsql\BlrWriter.h" + > + </File> + <File RelativePath="..\..\..\src\dsql\chars.h" > </File> Modified: firebird/trunk/builds/win32/msvc9/dsql_server_classic.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc9/dsql_server_classic.vcproj 2010-06-16 16:28:09 UTC (rev 51258) +++ firebird/trunk/builds/win32/msvc9/dsql_server_classic.vcproj 2010-06-17 01:18:40 UTC (rev 51259) @@ -271,6 +271,10 @@ > </File> <File + RelativePath="..\..\..\src\dsql\BlrWriter.cpp" + > + </File> + <File RelativePath="..\..\..\src\dsql\ddl.cpp" > </File> @@ -422,6 +426,10 @@ > </File> <File + RelativePath="..\..\..\src\dsql\BlrWriter.h" + > + </File> + <File RelativePath="..\..\..\src\dsql\chars.h" > </File> Modified: firebird/trunk/src/dsql/AggNodes.cpp =================================================================== --- firebird/trunk/src/dsql/AggNodes.cpp 2010-06-16 16:28:09 UTC (rev 51258) +++ firebird/trunk/src/dsql/AggNodes.cpp 2010-06-17 01:18:40 UTC (rev 51259) @@ -277,11 +277,11 @@ DsqlCompiledStatement* statement = dsqlScratch->getStatement(); if (aggInfo.blr) // Is this a standard aggregate function? - stuff(statement, (distinct ? aggInfo.distinctBlr : aggInfo.blr)); + dsqlScratch->appendUChar((distinct ? aggInfo.distinctBlr : aggInfo.blr)); else // This is a new window function. { - stuff(statement, blr_agg_function); - stuff_cstring(statement, aggInfo.name); + dsqlScratch->appendUChar(blr_agg_function); + dsqlScratch->appendNullString(aggInfo.name); unsigned count = 0; for (dsql_nod*** i = dsqlChildNodes.begin(); i != dsqlChildNodes.end(); ++i) @@ -290,7 +290,7 @@ ++count; } - stuff(statement, UCHAR(count)); + dsqlScratch->appendUChar(UCHAR(count)); } for (dsql_nod*** i = dsqlChildNodes.begin(); i != dsqlChildNodes.end(); ++i) @@ -795,7 +795,7 @@ if (dsqlArg) AggNode::genBlr(); else - dsqlScratch->getStatement()->append_uchar(blr_agg_count); + dsqlScratch->appendUChar(blr_agg_count); } void CountAggNode::getDesc(thread_db* tdbb, CompilerScratch* /*csb*/, dsc* desc) Added: firebird/trunk/src/dsql/BlrWriter.cpp =================================================================== --- firebird/trunk/src/dsql/BlrWriter.cpp (rev 0) +++ firebird/trunk/src/dsql/BlrWriter.cpp 2010-06-17 01:18:40 UTC (rev 51259) @@ -0,0 +1,207 @@ +/* + * The contents of this file are subject to the Interbase Public + * License Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy + * of the License at http://www.Inprise.com/IPL.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 was created by Inprise Corporation + * and its predecessors. Portions created by Inprise Corporation are + * Copyright (C) Inprise Corporation. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + * Adriano dos Santos Fernandes - refactored from others modules. + */ + +#include "firebird.h" +#include "consts_pub.h" +#include "dyn_consts.h" +#include "gen/iberror.h" +#include "../dsql/BlrWriter.h" +#include "../jrd/common.h" +#include "../jrd/blr.h" +#include "../dsql/errd_proto.h" + +using namespace Firebird; + +namespace Jrd { + + +// Write out a string valued attribute. +void BlrWriter::appendString(UCHAR verb, const char* string, USHORT length) +{ + // TMN: Doesn't this look pretty awkward? If we are given + // a verb, the length is a ushort, else it's uchar. + if (verb) + { + appendUChar(verb); + appendUShort(length); + } + else + { + fb_assert(length <= MAX_UCHAR); + appendUChar(length); + } + + if (string) + appendBytes(reinterpret_cast<const UCHAR*>(string), length); +} + +// Input +// blr_ptr: current position of blr being generated +// verb: blr byte of which number is an argument +// number: value to be written to blr +// Function +// Write out a numeric valued attribute. +void BlrWriter::appendNumber(UCHAR verb, SSHORT number) +{ + if (verb) + appendUChar(verb); + + appendUShortWithLength(number); +} + +void BlrWriter::appendUShortWithLength(USHORT val) +{ + // append an USHORT value, prepended with the USHORT length of an USHORT + appendUShort(2); + appendUShort(val); +} + +void BlrWriter::appendULongWithLength(ULONG val) +{ + // append an ULONG value, prepended with the USHORT length of an ULONG + appendUShort(4); + appendULong(val); +} + +void BlrWriter::appendFileLength(ULONG length) +{ + appendUChar(isc_dyn_file_length); + appendULongWithLength(length); +} + +void BlrWriter::appendFileStart(ULONG start) +{ + appendUChar(isc_dyn_file_start); + appendULongWithLength(start); +} + +// Write out a string of blr as part of a ddl string, as in a view or computed field definition. +void BlrWriter::beginBlr(UCHAR verb) +{ + if (verb) + appendUChar(verb); + + baseOffset = blrData.getCount(); + + // put in a place marker for the size of the blr, since it is unknown + appendUShort(0); + appendUChar(isVersion4() ? blr_version4 : blr_version5); +} + +// Complete the stuffing of a piece of blr by going back and inserting the length. +void BlrWriter::endBlr() +{ + appendUChar(blr_eoc); + + // go back and stuff in the proper length + + UCHAR* blr_base = &blrData[baseOffset]; + const ULONG length = (blrData.getCount() - baseOffset) - 2; + + if (length > 0xFFFF) + ERRD_post(Arg::Gds(isc_too_big_blr) << Arg::Num(length) << Arg::Num(0xFFFF)); + + *blr_base++ = (UCHAR) length; + *blr_base = (UCHAR) (length >> 8); +} + +void BlrWriter::beginDebug() +{ + fb_assert(debugData.isEmpty()); + + debugData.add(fb_dbg_version); + debugData.add(1); +} + +void BlrWriter::endDebug() +{ + debugData.add(fb_dbg_end); +} + +void BlrWriter::putDebugSrcInfo(USHORT line, USHORT col) +{ + debugData.add(fb_dbg_map_src2blr); + + debugData.add(line); + debugData.add(line >> 8); + + debugData.add(col); + debugData.add(col >> 8); + + ULONG offset = (blrData.getCount() - baseOffset); + + // for DDL statements we store BLR's length at the first 2 bytes + if (isDdlDyn()) + offset -= 2; + + debugData.add(offset); + debugData.add(offset >> 8); +} + +void BlrWriter::putDebugVariable(USHORT number, const TEXT* name) +{ + fb_assert(name); + + debugData.add(fb_dbg_map_varname); + + debugData.add(number); + debugData.add(number >> 8); + + USHORT len = strlen(name); + if (len > MAX_UCHAR) + len = MAX_UCHAR; + debugData.add(len); + + debugData.add(reinterpret_cast<const UCHAR*>(name), len); +} + +void BlrWriter::putDebugArgument(UCHAR type, USHORT number, const TEXT* name) +{ + fb_assert(name); + + debugData.add(fb_dbg_map_argument); + + debugData.add(type); + debugData.add(number); + debugData.add(number >> 8); + + USHORT len = strlen(name); + if (len > MAX_UCHAR) + len = MAX_UCHAR; + debugData.add(len); + + debugData.add(reinterpret_cast<const UCHAR*>(name), len); +} + +void BlrWriter::appendDebugInfo() +{ + endDebug(); + + const size_t len = blrData.getCount() + debugData.getCount(); + if (len + 4 < MAX_USHORT) + { + appendUChar(isc_dyn_debug_info); + appendUShort(debugData.getCount()); + appendBytes(debugData.begin(), debugData.getCount()); + } +} + + +} // namespace Jrd Property changes on: firebird/trunk/src/dsql/BlrWriter.cpp ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: firebird/trunk/src/dsql/BlrWriter.h =================================================================== --- firebird/trunk/src/dsql/BlrWriter.h (rev 0) +++ firebird/trunk/src/dsql/BlrWriter.h 2010-06-17 01:18:40 UTC (rev 51259) @@ -0,0 +1,148 @@ +/* + * The contents of this file are subject to the Interbase Public + * License Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy + * of the License at http://www.Inprise.com/IPL.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 was created by Inprise Corporation + * and its predecessors. Portions created by Inprise Corporation are + * Copyright (C) Inprise Corporation. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + * Adriano dos Santos Fernandes - refactored from others modules. + */ + +#ifndef DSQL_BLR_WRITER_H +#define DSQL_BLR_WRITER_H + +#include "../jrd/common.h" +#include "../common/classes/alloc.h" +#include "../common/classes/array.h" +#include "../common/classes/fb_string.h" +#include "../common/classes/MetaName.h" + +namespace Jrd { + +class dsql_nod; + + +// BLR/DYN writer. +class BlrWriter : public Firebird::PermanentStorage +{ +public: + explicit BlrWriter(MemoryPool& p) + : PermanentStorage(p), + blrData(p), + debugData(p), + baseOffset(0) + { + } + + void appendUChar(const UCHAR byte) + { + blrData.add(byte); + } + + // Cram a word into the blr buffer. + void appendUShort(USHORT word) + { + appendUChar(word); + appendUChar(word >> 8); + } + + void appendULong(ULONG val) + { + appendUShort(val); + appendUShort(val >> 16); + } + + void appendUCharRepeated(UCHAR byte, int count) + { + for (int i = 0; i < count; ++i) + appendUChar(byte); + } + + void appendBytes(const UCHAR* string, USHORT len) + { + blrData.add(string, len); + } + + // Write out a string with one byte of length. + void appendNullString(const char* string) + { + size_t len = strlen(string); + + // CVC: Maybe the Release version should truncate "len" to 255? + fb_assert(len >= 0 && len <= 255); + + appendUChar(len); + appendBytes(reinterpret_cast<const UCHAR*>(string), len); + } + + // Write out a string valued attribute. + void appendNullString(UCHAR verb, const char* string) + { + const USHORT length = string ? strlen(string) : 0; + appendString(verb, string, length); + } + + // Write out a string in metadata charset with one byte of length. + void appendMetaString(const char* string) + { + appendString(0, string, strlen(string)); + } + + void appendString(UCHAR verb, const char* string, USHORT len); + + void appendString(UCHAR verb, const Firebird::MetaName& name) + { + appendString(verb, name.c_str(), name.length()); + } + + void appendString(UCHAR verb, const Firebird::string& name) + { + appendString(verb, name.c_str(), name.length()); + } + + void appendNumber(UCHAR verb, SSHORT number); + void appendUShortWithLength(USHORT val); + void appendULongWithLength(ULONG val); + void appendFileLength(ULONG length); + void appendFileStart(ULONG start); + + void beginBlr(UCHAR verb); + void endBlr(); + + void beginDebug(); + void endDebug(); + void putDebugSrcInfo(USHORT, USHORT); + void putDebugVariable(USHORT, const TEXT*); + void putDebugArgument(UCHAR, USHORT, const TEXT*); + void appendDebugInfo(); + + Firebird::HalfStaticArray<UCHAR, 1024>& getBlrData() { return blrData; } + Firebird::HalfStaticArray<UCHAR, 128>& getDebugData() { return debugData; } + + ULONG getBaseOffset() const { return baseOffset; } + void setBaseOffset(ULONG value) { baseOffset = value; } + +protected: + virtual bool isVersion4() = 0; + virtual bool isDdlDyn() = 0; + +private: + Firebird::HalfStaticArray<UCHAR, 1024> blrData; + Firebird::HalfStaticArray<UCHAR, 128> debugData; + ULONG baseOffset; // place to go back and stuff in blr length +}; + + +} // namespace + +#endif // DSQL_BLR_WRITER_H Property changes on: firebird/trunk/src/dsql/BlrWriter.h ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: firebird/trunk/src/dsql/DdlNodes.epp =================================================================== --- firebird/trunk/src/dsql/DdlNodes.epp 2010-06-16 16:28:09 UTC (rev 51258) +++ firebird/trunk/src/dsql/DdlNodes.epp 2010-06-17 01:18:40 UTC (rev 51259) @@ -132,7 +132,7 @@ DsqlCompiledStatement* statement = dsqlScratch->getStatement(); if (type.notNull) - statement->append_uchar(blr_not_nullable); + dsqlScratch->appendUChar(blr_not_nullable); if (type.typeOfName.hasData()) { @@ -140,34 +140,34 @@ { if (type.collateSpecified) { - statement->append_uchar(blr_column_name2); - statement->append_uchar(type.fullDomain ? blr_domain_full : blr_domain_type_of); - statement->append_meta_string(type.typeOfTable.c_str()); - statement->append_meta_string(type.typeOfName.c_str()); - statement->append_ushort(type.textType); + dsqlScratch->appendUChar(blr_column_name2); + dsqlScratch->appendUChar(type.fullDomain ? blr_domain_full : blr_domain_type_of); + dsqlScratch->appendMetaString(type.typeOfTable.c_str()); + dsqlScratch->appendMetaString(type.typeOfName.c_str()); + dsqlScratch->appendUShort(type.textType); } else { - statement->append_uchar(blr_column_name); - statement->append_uchar(type.fullDomain ? blr_domain_full : blr_domain_type_of); - statement->append_meta_string(type.typeOfTable.c_str()); - statement->append_meta_string(type.typeOfName.c_str()); + dsqlScratch->appendUChar(blr_column_name); + dsqlScratch->appendUChar(type.fullDomain ? blr_domain_full : blr_domain_type_of); + dsqlScratch->appendMetaString(type.typeOfTable.c_str()); + dsqlScratch->appendMetaString(type.typeOfName.c_str()); } } else { if (type.collateSpecified) { - statement->append_uchar(blr_domain_name2); - statement->append_uchar(type.fullDomain ? blr_domain_full : blr_domain_type_of); - statement->append_meta_string(type.typeOfName.c_str()); - statement->append_ushort(type.textType); + dsqlScratch->appendUChar(blr_domain_name2); + dsqlScratch->appendUChar(type.fullDomain ? blr_domain_full : blr_domain_type_of); + dsqlScratch->appendMetaString(type.typeOfName.c_str()); + dsqlScratch->appendUShort(type.textType); } else { - statement->append_uchar(blr_domain_name); - statement->append_uchar(type.fullDomain ? blr_domain_full : blr_domain_type_of); - statement->append_meta_string(type.typeOfName.c_str()); + dsqlScratch->appendUChar(blr_domain_name); + dsqlScratch->appendUChar(type.fullDomain ? blr_domain_full : blr_domain_type_of); + dsqlScratch->appendMetaString(type.typeOfName.c_str()); } } @@ -181,39 +181,39 @@ case dtype_varying: case dtype_blob: if (!useSubType) - statement->append_uchar(blr_dtypes[type.type]); + dsqlScratch->appendUChar(blr_dtypes[type.type]); else if (type.type == dtype_varying) { - statement->append_uchar(blr_varying2); - statement->append_ushort(type.textType); + dsqlScratch->appendUChar(blr_varying2); + dsqlScratch->appendUShort(type.textType); } else if (type.type == dtype_cstring) { - statement->append_uchar(blr_cstring2); - statement->append_ushort(type.textType); + dsqlScratch->appendUChar(blr_cstring2); + dsqlScratch->appendUShort(type.textType); } else if (type.type == dtype_blob) { - statement->append_uchar(blr_blob2); - statement->append_ushort(type.subType); - statement->append_ushort(type.textType); + dsqlScratch->appendUChar(blr_blob2); + dsqlScratch->appendUShort(type.subType); + dsqlScratch->appendUShort(type.textType); } else { - statement->append_uchar(blr_text2); - statement->append_ushort(type.textType); + dsqlScratch->appendUChar(blr_text2); + dsqlScratch->appendUShort(type.textType); } if (type.type == dtype_varying) - statement->append_ushort(type.length - sizeof(USHORT)); + dsqlScratch->appendUShort(type.length - sizeof(USHORT)); else if (type.type != dtype_blob) - statement->append_ushort(type.length); + dsqlScratch->appendUShort(type.length); break; default: - statement->append_uchar(blr_dtypes[type.type]); + dsqlScratch->appendUChar(blr_dtypes[type.type]); if (DTYPE_IS_EXACT(type.type) || dtype_quad == type.type) - statement->append_uchar(type.scale); + dsqlScratch->appendUChar(type.scale); break; } } @@ -959,13 +959,13 @@ { FUN.RDB$FUNCTION_BLR.NULL = FALSE; attachment->storeBinaryBlob(tdbb, transaction, &FUN.RDB$FUNCTION_BLR, - statement->getBlrData().begin(), - statement->getBlrData().getCount()); + dsqlScratch->getBlrData().begin(), + dsqlScratch->getBlrData().getCount()); FUN.RDB$DEBUG_INFO.NULL = FALSE; attachment->storeBinaryBlob(tdbb, transaction, &FUN.RDB$DEBUG_INFO, - statement->getDebugData().begin(), - statement->getDebugData().getCount()); + dsqlScratch->getDebugData().begin(), + dsqlScratch->getDebugData().getCount()); } } @@ -1110,20 +1110,20 @@ string defaultSource = string(defaultString->str_data, defaultString->str_length); attachment->storeMetaDataBlob(tdbb, transaction, &ARG.RDB$DEFAULT_SOURCE, defaultSource); - statement->getBlrData().clear(); + dsqlScratch->getBlrData().clear(); if (statement->getFlags() & DsqlCompiledStatement::FLAG_BLR_VERSION4) - statement->append_uchar(blr_version4); + dsqlScratch->appendUChar(blr_version4); else - statement->append_uchar(blr_version5); + dsqlScratch->appendUChar(blr_version5); GEN_expr(dsqlScratch, parameter.legacyDefault->nod_arg[e_dft_default]); - statement->append_uchar(blr_eoc); + dsqlScratch->appendUChar(blr_eoc); attachment->storeBinaryBlob(tdbb, transaction, &ARG.RDB$DEFAULT_VALUE, - statement->getBlrData().begin(), - statement->getBlrData().getCount()); + dsqlScratch->getBlrData().begin(), + dsqlScratch->getBlrData().getCount()); } } END_STORE @@ -1145,49 +1145,49 @@ if (body) { - statement->beginDebug(); - statement->getBlrData().clear(); + dsqlScratch->beginDebug(); + dsqlScratch->getBlrData().clear(); if (statement->getFlags() & DsqlCompiledStatement::FLAG_BLR_VERSION4) - statement->append_uchar(blr_version4); + dsqlScratch->appendUChar(blr_version4); else - statement->append_uchar(blr_version5); + dsqlScratch->appendUChar(blr_version5); - statement->append_uchar(blr_begin); + dsqlScratch->appendUChar(blr_begin); if (parameters.getCount() != 0) { fb_assert(parameters.getCount() < size_t(MAX_USHORT / 2)); - statement->append_uchar(blr_message); - statement->append_uchar(0); - statement->append_ushort(2 * parameters.getCount()); + dsqlScratch->appendUChar(blr_message); + dsqlScratch->appendUChar(0); + dsqlScratch->appendUShort(2 * parameters.getCount()); for (unsigned i = 0; i < parameters.getCount(); ++i) { ParameterClause& parameter = parameters[i]; - statement->put_debug_argument(fb_dbg_arg_input, i, + dsqlScratch->putDebugArgument(fb_dbg_arg_input, i, parameter.name.c_str()); putType(parameter, true); // add slot for null flag (parameter2) - statement->append_uchar(blr_short); - statement->append_uchar(0); + dsqlScratch->appendUChar(blr_short); + dsqlScratch->appendUChar(0); variables.add(MAKE_variable(parameter.legacyField, parameter.name.c_str(), VAR_input, 0, (USHORT) (2 * i), 0)); } } - statement->append_uchar(blr_message); - statement->append_uchar(1); - statement->append_ushort(2); + dsqlScratch->appendUChar(blr_message); + dsqlScratch->appendUChar(1); + dsqlScratch->appendUShort(2); - statement->put_debug_argument(fb_dbg_arg_output, 0, ""); + dsqlScratch->putDebugArgument(fb_dbg_arg_output, 0, ""); putType(returnType, true); // add slot for null flag (parameter2) - statement->append_uchar(blr_short); - statement->append_uchar(0); + dsqlScratch->appendUChar(blr_short); + dsqlScratch->appendUChar(0); dsql_nod* const var = MAKE_variable(returnType.legacyField, "", VAR_output, 1, 0, 0); variables.add(var); @@ -1195,11 +1195,11 @@ if (parameters.getCount() != 0) { - statement->append_uchar(blr_receive); - statement->append_uchar(0); + dsqlScratch->appendUChar(blr_receive); + dsqlScratch->appendUChar(0); } - statement->append_uchar(blr_begin); + dsqlScratch->appendUChar(blr_begin); for (unsigned i = 0; i < parameters.getCount(); ++i) { @@ -1209,12 +1209,12 @@ { // ASF: To validate input parameters we need only to read its value. // Assigning it to null is an easy way to do this. - statement->append_uchar(blr_assignment); - statement->append_uchar(blr_parameter2); - statement->append_uchar(0); // input - statement->append_ushort(i * 2); - statement->append_ushort(i * 2 + 1); - statement->append_uchar(blr_null); + dsqlScratch->appendUChar(blr_assignment); + dsqlScratch->appendUChar(blr_parameter2); + dsqlScratch->appendUChar(0); // input + dsqlScratch->appendUShort(i * 2); + dsqlScratch->appendUShort(i * 2 + 1); + dsqlScratch->appendUChar(blr_null); } } @@ -1227,24 +1227,24 @@ putLocalVariables(dsqlScratch, localDeclList, 1); - statement->append_uchar(blr_stall); + dsqlScratch->appendUChar(blr_stall); // put a label before body of procedure, // so that any EXIT statement can get out - statement->append_uchar(blr_label); - statement->append_uchar(0); + dsqlScratch->appendUChar(blr_label); + dsqlScratch->appendUChar(0); dsqlScratch->loopLevel = 0; dsqlScratch->cursorNumber = 0; GEN_statement(dsqlScratch, PASS1_statement(dsqlScratch, body)); statement->setType(DsqlCompiledStatement::TYPE_DDL); - statement->append_uchar(blr_end); - genReturn(statement, false); + dsqlScratch->appendUChar(blr_end); + genReturn(dsqlScratch, false); - statement->append_uchar(blr_end); - statement->append_uchar(blr_eoc); + dsqlScratch->appendUChar(blr_end); + dsqlScratch->appendUChar(blr_eoc); - statement->endDebug(); + dsqlScratch->endDebug(); } invalid = false; @@ -1761,13 +1761,13 @@ { P.RDB$PROCEDURE_BLR.NULL = FALSE; attachment->storeBinaryBlob(tdbb, transaction, &P.RDB$PROCEDURE_BLR, - statement->getBlrData().begin(), - statement->getBlrData().getCount()); + dsqlScratch->getBlrData().begin(), + dsqlScratch->getBlrData().getCount()); P.RDB$DEBUG_INFO.NULL = FALSE; attachment->storeBinaryBlob(tdbb, transaction, &P.RDB$DEBUG_INFO, - statement->getDebugData().begin(), - statement->getDebugData().getCount()); + dsqlScratch->getDebugData().begin(), + dsqlScratch->getDebugData().getCount()); P.RDB$PROCEDURE_TYPE.NULL = FALSE; P.RDB$PROCEDURE_TYPE = (USHORT) @@ -1914,20 +1914,20 @@ DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - statement->getBlrData().clear(); + dsqlScratch->getBlrData().clear(); if (statement->getFlags() & DsqlCompiledStatement::FLAG_BLR_VERSION4) - statement->append_uchar(blr_version4); + dsqlScratch->appendUChar(blr_version4); else - statement->append_uchar(blr_version5); + dsqlScratch->appendUChar(blr_version5); GEN_expr(dsqlScratch, parameter.legacyDefault->nod_arg[e_dft_default]); - statement->append_uchar(blr_eoc); + dsqlScratch->appendUChar(blr_eoc); attachment->storeBinaryBlob(tdbb, transaction, &PRM.RDB$DEFAULT_VALUE, - statement->getBlrData().begin(), - statement->getBlrData().getCount()); + dsqlScratch->getBlrData().begin(), + dsqlScratch->getBlrData().getCount()); } } END_STORE @@ -1951,32 +1951,32 @@ DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - statement->beginDebug(); - statement->getBlrData().clear(); + dsqlScratch->beginDebug(); + dsqlScratch->getBlrData().clear(); if (statement->getFlags() & DsqlCompiledStatement::FLAG_BLR_VERSION4) - statement->append_uchar(blr_version4); + dsqlScratch->appendUChar(blr_version4); else - statement->append_uchar(blr_version5); + dsqlScratch->appendUChar(blr_version5); - statement->append_uchar(blr_begin); + dsqlScratch->appendUChar(blr_begin); if (parameters.getCount() != 0) { fb_assert(parameters.getCount() < MAX_USHORT / 2); - statement->append_uchar(blr_message); - statement->append_uchar(0); - statement->append_ushort(2 * parameters.getCount()); + dsqlScratch->appendUChar(blr_message); + dsqlScratch->appendUChar(0); + dsqlScratch->appendUShort(2 * parameters.getCount()); for (unsigned i = 0; i < parameters.getCount(); ++i) { ParameterClause& parameter = parameters[i]; - statement->put_debug_argument(fb_dbg_arg_input, i, parameter.name.c_str()); + dsqlScratch->putDebugArgument(fb_dbg_arg_input, i, parameter.name.c_str()); putType(parameter, true); // add slot for null flag (parameter2) - statement->append_uchar(blr_short); - statement->append_uchar(0); + dsqlScratch->appendUChar(blr_short); + dsqlScratch->appendUChar(0); variables.add(MAKE_variable(parameter.legacyField, parameter.name.c_str(), VAR_input, 0, (USHORT) (2 * i), 0)); @@ -1984,21 +1984,21 @@ } fb_assert(returns.getCount() < MAX_USHORT / 2); - statement->append_uchar(blr_message); - statement->append_uchar(1); - statement->append_ushort(2 * returns.getCount() + 1); + dsqlScratch->appendUChar(blr_message); + dsqlScratch->appendUChar(1); + dsqlScratch->appendUShort(2 * returns.getCount() + 1); if (returns.getCount() != 0) { for (unsigned i = 0; i < returns.getCount(); ++i) { ParameterClause& parameter = returns[i]; - statement->put_debug_argument(fb_dbg_arg_output, i, parameter.name.c_str()); + dsqlScratch->putDebugArgument(fb_dbg_arg_output, i, parameter.name.c_str()); putType(parameter, true); // add slot for null flag (parameter2) - statement->append_uchar(blr_short); - statement->append_uchar(0); + dsqlScratch->appendUChar(blr_short); + dsqlScratch->appendUChar(0); dsql_nod* const var = MAKE_variable(parameter.legacyField, parameter.name.c_str(), VAR_output, 1, (USHORT) (2 * i), i); @@ -2009,16 +2009,16 @@ } // add slot for EOS - statement->append_uchar(blr_short); - statement->append_uchar(0); + dsqlScratch->appendUChar(blr_short); + dsqlScratch->appendUChar(0); if (parameters.getCount() != 0) { - statement->append_uchar(blr_receive); - statement->append_uchar(0); + dsqlScratch->appendUChar(blr_receive); + dsqlScratch->appendUChar(0); } - statement->append_uchar(blr_begin); + dsqlScratch->appendUChar(blr_begin); for (unsigned i = 0; i < parameters.getCount(); ++i) { @@ -2028,12 +2028,12 @@ { // ASF: To validate an input parameter we need only to read its value. // Assigning it to null is an easy way to do this. - statement->append_uchar(blr_assignment); - statement->append_uchar(blr_parameter2); - statement->append_uchar(0); // input - statement->append_ushort(i * 2); - statement->append_ushort(i * 2 + 1); - statement->append_uchar(blr_null); + dsqlScratch->appendUChar(blr_assignment); + dsqlScratch->appendUChar(blr_parameter2); + dsqlScratch->appendUChar(0); // input + dsqlScratch->appendUShort(i * 2); + dsqlScratch->appendUShort(i * 2 + 1); + dsqlScratch->appendUChar(blr_null); } } @@ -2050,24 +2050,24 @@ putLocalVariables(dsqlScratch, localDeclList, returns.getCount()); - statement->append_uchar(blr_stall); + dsqlScratch->appendUChar(blr_stall); // put a label before body of procedure, // so that any EXIT statement can get out - statement->append_uchar(blr_label); - statement->append_uchar(0); + dsqlScratch->appendUChar(blr_label); + dsqlScratch->appendUChar(0); dsqlScratch->loopLevel = 0; dsqlScratch->cursorNumber = 0; GEN_statement(dsqlScratch, PASS1_statement(dsqlScratch, body)); statement->setType(DsqlCompiledStatement::TYPE_DDL); - statement->append_uchar(blr_end); - genReturn(statement, true); + dsqlScratch->appendUChar(blr_end); + genReturn(dsqlScratch, true); - statement->append_uchar(blr_end); - statement->append_uchar(blr_eoc); + dsqlScratch->appendUChar(blr_end); + dsqlScratch->appendUChar(blr_eoc); - statement->endDebug(); + dsqlScratch->endDebug(); invalid = false; } @@ -2466,13 +2466,13 @@ TRG.RDB$TRIGGER_BLR.NULL = FALSE; attachment->storeBinaryBlob(tdbb, transaction, &TRG.RDB$TRIGGER_BLR, - statement->getBlrData().begin(), - statement->getBlrData().getCount()); + dsqlScratch->getBlrData().begin(), + dsqlScratch->getBlrData().getCount()); TRG.RDB$DEBUG_INFO.NULL = FALSE; attachment->storeBinaryBlob(tdbb, transaction, &TRG.RDB$DEBUG_INFO, - statement->getDebugData().begin(), - statement->getDebugData().getCount()); + dsqlScratch->getDebugData().begin(), + dsqlScratch->getDebugData().getCount()); } if (source.hasData()) @@ -2515,8 +2515,8 @@ { DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - statement->beginDebug(); - statement->getBlrData().clear(); + dsqlScratch->beginDebug(); + dsqlScratch->getBlrData().clear(); // Create the "OLD" and "NEW" contexts for the trigger -- // the new one could be a dummy place holder to avoid resolving @@ -2559,11 +2559,11 @@ // generate the trigger blr if (statement->getFlags() & DsqlCompiledStatement::FLAG_BLR_VERSION4) - statement->append_uchar(blr_version4); + dsqlScratch->appendUChar(blr_version4); else - statement->append_uchar(blr_version5); + dsqlScratch->appendUChar(blr_version5); - statement->append_uchar(blr_begin); + dsqlScratch->appendUChar(blr_begin); dsqlScratch->setPsql(true); @@ -2577,16 +2577,16 @@ // although the fact that they use the same BLR code // is still a potential danger and must be fixed. // Hopefully, system triggers are never recompiled. - statement->append_uchar(blr_label); - statement->append_uchar(0); + dsqlScratch->appendUChar(blr_label); + dsqlScratch->appendUChar(0); dsqlScratch->loopLevel = 0; dsqlScratch->cursorNumber = 0; GEN_statement(dsqlScratch, PASS1_statement(dsqlScratch, body)); dsqlScratch->scopeLevel--; - statement->append_uchar(blr_end); - statement->append_uchar(blr_eoc); + dsqlScratch->appendUChar(blr_end); + dsqlScratch->appendUChar(blr_eoc); - statement->endDebug(); + dsqlScratch->endDebug(); // The statement type may have been set incorrectly when parsing // the trigger actions, so reset it to reflect the fact that this Modified: firebird/trunk/src/dsql/ExprNodes.cpp =================================================================== --- firebird/trunk/src/dsql/ExprNodes.cpp 2010-06-16 16:28:09 UTC (rev 51258) +++ firebird/trunk/src/dsql/ExprNodes.cpp 2010-06-17 01:18:40 UTC (rev 51259) @@ -189,7 +189,7 @@ void ConcatenateNode::genBlr() { - stuff(dsqlScratch->getStatement(), blr_concatenate); + dsqlScratch->appendUChar(blr_concatenate); GEN_expr(dsqlScratch, dsqlArg1); GEN_expr(dsqlScratch, dsqlArg2); } @@ -677,7 +677,7 @@ void SubstringSimilarNode::genBlr() { - stuff(dsqlScratch->getStatement(), blr_substring_similar); + dsqlScratch->appendUChar(blr_substring_similar); GEN_expr(dsqlScratch, dsqlExpr); GEN_expr(dsqlScratch, dsqlPattern); GEN_expr(dsqlScratch, dsqlEscape); @@ -928,9 +928,9 @@ { DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - stuff(statement, blr_sys_function); - statement->append_meta_string(function->name.c_str()); - stuff(statement, dsqlArgs->nod_count); + dsqlScratch->appendUChar(blr_sys_function); + dsqlScratch->appendMetaString(function->name.c_str()); + dsqlScratch->appendUChar(dsqlArgs->nod_count); dsql_nod* const* ptr = dsqlArgs->nod_arg; for (const dsql_nod* const* const end = ptr + dsqlArgs->nod_count; ptr < end; ptr++) @@ -1161,15 +1161,15 @@ DsqlCompiledStatement* statement = dsqlScratch->getStatement(); if (dsqlFunction->udf_name.package.isEmpty()) - stuff(statement, blr_function); + dsqlScratch->appendUChar(blr_function); else { - stuff(statement, blr_function2); - statement->append_meta_string(dsqlFunction->udf_name.package.c_str()); + dsqlScratch->appendUChar(blr_function2); + dsqlScratch->appendMetaString(dsqlFunction->udf_name.package.c_str()); } - statement->append_meta_string(dsqlFunction->udf_name.identifier.c_str()); - stuff(statement, dsqlArgs->nod_count); + dsqlScratch->appendMetaString(dsqlFunction->udf_name.identifier.c_str()); + dsqlScratch->appendUChar(dsqlArgs->nod_count); dsql_nod* const* ptr = dsqlArgs->nod_arg; for (const dsql_nod* const* const end = ptr + dsqlArgs->nod_count; ptr < end; ptr++) Modified: firebird/trunk/src/dsql/Nodes.h =================================================================== --- firebird/trunk/src/dsql/Nodes.h 2010-06-16 16:28:09 UTC (rev 51258) +++ firebird/trunk/src/dsql/Nodes.h 2010-06-17 01:18:40 UTC (rev 51259) @@ -592,7 +592,7 @@ void putLocalVariable(DsqlCompilerScratch* dsqlScratch, dsql_var* variable, dsql_nod* hostParam, const dsql_str* collationName); dsql_nod* resolveVariable(const dsql_str* varName); - void genReturn(DsqlCompiledStatement* statement, bool eosFlag = false); + void genReturn(DsqlCompilerScratch* dsqlScratch, bool eosFlag = false); private: bool hasEos; Modified: firebird/trunk/src/dsql/StmtNodes.cpp =================================================================== --- firebird/trunk/src/dsql/StmtNodes.cpp 2010-06-16 16:28:09 UTC (rev 51258) +++ firebird/trunk/src/dsql/StmtNodes.cpp 2010-06-17 01:18:40 UTC (rev 51259) @@ -70,7 +70,7 @@ DsqlCompiledStatement* statement = dsqlScratch->getStatement(); if (field->fld_not_nullable) - statement->append_uchar(blr_not_nullable); + dsqlScratch->appendUChar(blr_not_nullable); if (field->fld_type_of_name.hasData()) { @@ -78,34 +78,34 @@ { if (field->fld_explicit_collation) { - statement->append_uchar(blr_column_name2); - statement->append_uchar(field->fld_full_domain ? blr_domain_full : blr_domain_type_of); - statement->append_meta_string(field->fld_type_of_table->str_data); - statement->append_meta_string(field->fld_type_of_name.c_str()); - statement->append_ushort(field->fld_ttype); + dsqlScratch->appendUChar(blr_column_name2); + dsqlScratch->appendUChar(field->fld_full_domain ? blr_domain_full : blr_domain_type_of); + dsqlScratch->appendMetaString(field->fld_type_of_table->str_data); + dsqlScratch->appendMetaString(field->fld_type_of_name.c_str()); + dsqlScratch->appendUShort(field->fld_ttype); } else { - statement->append_uchar(blr_column_name); - statement->append_uchar(field->fld_full_domain ? blr_domain_full : blr_domain_type_of); - statement->append_meta_string(field->fld_type_of_table->str_data); - statement->append_meta_string(field->fld_type_of_name.c_str()); + dsqlScratch->appendUChar(blr_column_name); + dsqlScratch->appendUChar(field->fld_full_domain ? blr_domain_full : blr_domain_type_of); + dsqlScratch->appendMetaString(field->fld_type_of_table->str_data); + dsqlScratch->appendMetaString(field->fld_type_of_name.c_str()); } } else { if (field->fld_explicit_collation) { - statement->append_uchar(blr_domain_name2); - statement->append_uchar(field->fld_full_domain ? blr_domain_full : blr_domain_type_of); - statement->append_meta_string(field->fld_type_of_name.c_str()); - statement->append_ushort(field->fld_ttype); + dsqlScratch->appendUChar(blr_domain_name2); + dsqlScratch->appendUChar(field->fld_full_domain ? blr_domain_full : blr_domain_type_of); + dsqlScratch->appendMetaString(field->fld_type_of_name.c_str()); + dsqlScratch->appendUShort(field->fld_ttype); } else { - statement->append_uchar(blr_domain_name); - statement->append_uchar(field->fld_full_domain ? blr_domain_full : blr_domain_type_of); - statement->append_meta_string(field->fld_type_of_name.c_str()); + dsqlScratch->appendUChar(blr_domain_name); + dsqlScratch->appendUChar(field->fld_full_domain ? blr_domain_full : blr_domain_type_of); + dsqlScratch->appendMetaString(field->fld_type_of_name.c_str()); } } @@ -119,39 +119,39 @@ case dtype_varying: case dtype_blob: if (!useSubType) - statement->append_uchar(blr_dtypes[field->fld_dtype]); + dsqlScratch->appendUChar(blr_dtypes[field->fld_dtype]); else if (field->fld_dtype == dtype_varying) { - statement->append_uchar(blr_varying2); - statement->append_ushort(field->fld_ttype); + dsqlScratch->appendUChar(blr_varying2); + dsqlScratch->appendUShort(field->fld_ttype); } else if (field->fld_dtype == dtype_cstring) { - statement->append_uchar(blr_cstring2); - statement->append_ushort(field->fld_ttype); + dsqlScratch->appendUChar(blr_cstring2); + dsqlScratch->appendUShort(field->fld_ttype); } else if (field->fld_dtype == dtype_blob) { - statement->append_uchar(blr_blob2); - statement->append_ushort(field->fld_sub_type); - statement->append_ushort(field->fld_ttype); + dsqlScratch->appendUChar(blr_blob2); + dsqlScratch->appendUShort(field->fld_sub_type); + dsqlScratch->appendUShort(field->fld_ttype); } else { - statement->append_uchar(blr_text2); - statement->append_ushort(field->fld_ttype); + dsqlScratch->appendUChar(blr_text2); + dsqlScratch->appendUShort(field->fld_ttype); } if (field->fld_dtype == dtype_varying) - statement->append_ushort(field->fld_length - sizeof(USHORT)); + dsqlScratch->appendUShort(field->fld_length - sizeof(USHORT)); else if (field->fld_dtype != dtype_blob) - statement->append_ushort(field->fld_length); + dsqlScratch->appendUShort(field->fld_length); break; default: - statement->append_uchar(blr_dtypes[field->fld_dtype]); + dsqlScratch->appendUChar(blr_dtypes[field->fld_dtype]); if (DTYPE_IS_EXACT(field->fld_dtype) || (dtype_quad == field->fld_dtype)) - statement->append_uchar(field->fld_scale); + dsqlScratch->appendUChar(field->fld_scale); break; } } @@ -160,8 +160,6 @@ void BlockNode::putLocalVariables(DsqlCompilerScratch* dsqlScratch, const dsql_nod* parameters, SSHORT locals) { - using namespace Dsql; // nod_*, e_* - if (!parameters) return; @@ -170,17 +168,17 @@ { dsql_nod* parameter = *ptr; - dsqlScratch->getStatement()->put_debug_src_info(parameter->nod_line, parameter->nod_column); + dsqlScratch->putDebugSrcInfo(parameter->nod_line, parameter->nod_column); - if (parameter->nod_type == nod_def_field) + if (parameter->nod_type == Dsql::nod_def_field) { - dsql_fld* field = (dsql_fld*) parameter->nod_arg[e_dfl_field]; + dsql_fld* field = (dsql_fld*) parameter->nod_arg[Dsql::e_dfl_field]; const dsql_nod* const* rest = ptr; while (++rest != end) { - if ((*rest)->nod_type == nod_def_field) + if ((*rest)->nod_type == Dsql::nod_def_field) { - const dsql_fld* rest_field = (dsql_fld*) (*rest)->nod_arg[e_dfl_field]; + const dsql_fld* rest_field = (dsql_fld*) (*rest)->nod_arg[Dsql::e_dfl_field]; if (field->fld_name == rest_field->fld_name) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-637) << @@ -194,7 +192,7 @@ dsql_var* variable = (dsql_var*) var_node->nod_arg[Dsql::e_var_variable]; putLocalVariable(dsqlScratch, variable, parameter, - reinterpret_cast<const dsql_str*>(parameter->nod_arg[e_dfl_collate])); + reinterpret_cast<const dsql_str*>(parameter->nod_arg[Dsql::e_dfl_collate])); // Some field attributes are calculated inside // putLocalVariable(), so we reinitialize the @@ -203,7 +201,7 @@ locals++; } - else if (parameter->nod_type == nod_cursor) + else if (parameter->nod_type == Dsql::nod_cursor) { PASS1_statement(dsqlScratch, parameter); GEN_statement(dsqlScratch, parameter); @@ -215,13 +213,11 @@ void BlockNode::putLocalVariable(DsqlCompilerScratch* dsqlScratch, dsql_var* variable, dsql_nod* hostParam, const dsql_str* collationName) { - using namespace Dsql; // nod_*, e_* - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); dsql_fld* field = variable->var_field; - statement->append_uchar(blr_dcl_variable); - statement->append_ushort(variable->var_variable_number); + dsqlScratch->appendUChar(blr_dcl_variable); + dsqlScratch->appendUShort(variable->var_variable_number); DDL_resolve_intl_type(dsqlScratch, field, collationName); //const USHORT dtype = field->fld_dtype; @@ -230,33 +226,33 @@ //field->fld_dtype = dtype; // Check for a default value, borrowed from define_domain - dsql_nod* node = hostParam ? hostParam->nod_arg[e_dfl_default] : NULL; + dsql_nod* node = hostParam ? hostParam->nod_arg[Dsql::e_dfl_default] : NULL; if (node || (!field->fld_full_domain && !field->fld_not_nullable)) { - statement->append_uchar(blr_assignment); + dsqlScratch->appendUChar(blr_assignment); if (node) { - fb_assert(node->nod_type == nod_def_default); + fb_assert(node->nod_type == Dsql::nod_def_default); PsqlChanger psqlChanger(dsqlScratch, false); - node = PASS1_node(dsqlScratch, node->nod_arg[e_dft_default]); + node = PASS1_node(dsqlScratch, node->nod_arg[Dsql::e_dft_default]); GEN_expr(dsqlScratch, node); } else - statement->append_uchar(blr_null); // Initialize variable to NULL + dsqlScratch->appendUChar(blr_null); // Initialize variable to NULL - statement->append_uchar(blr_variable); - statement->append_ushort(variable->var_variable_number); + dsqlScratch->appendUChar(blr_variable); + dsqlScratch->appendUShort(variable->var_variable_number); } else { - statement->append_uchar(blr_init_variable); - statement->append_ushort(variable->var_variable_number); + dsqlScratch->appendUChar(blr_init_variable); + dsqlScratch->appendUShort(variable->var_variable_number); } if (variable->var_name[0]) // Not a function return value - statement->put_debug_variable(variable->var_variable_number, variable->var_name); + dsqlScratch->putDebugVariable(variable->var_variable_number, variable->var_name); ++dsqlScratch->hiddenVarsNumber; } @@ -283,46 +279,46 @@ } // Generate BLR for a return. -void BlockNode::genReturn(DsqlCompiledStatement* statement, bool eosFlag) +void BlockNode::genReturn(DsqlCompilerScratch* dsqlScratch, bool eosFlag) { if (hasEos && !eosFlag) - stuff(statement, blr_begin); + dsqlScratch->appendUChar(blr_begin); - stuff(statement, blr_send); - stuff(statement, 1); - stuff(statement, blr_begin); + dsqlScratch->appendUChar(blr_send); + dsqlScratch->appendUChar(1); + dsqlScratch->appendUChar(blr_begin); for (Array<dsql_nod*>::const_iterator i = outputVariables.begin(); i != outputVariables.end(); ++i) { const dsql_nod* parameter = *i; const dsql_var* variable = (dsql_var*) parameter->nod_arg[Dsql::e_var_variable]; - stuff(statement, blr_assignment); - stuff(statement, blr_variable); - stuff_word(statement, variable->var_variable_number); - stuff(statement, blr_parameter2); - stuff(statement, variable->var_msg_number); - stuff_word(statement, variable->var_msg_item); - stuff_word(statement, variable->var_msg_item + 1); + dsqlScratch->appendUChar(blr_assignment); + dsqlScratch->appendUChar(blr_variable); + dsqlScratch->appendUShort(variable->var_variable_number); + dsqlScratch->appendUChar(blr_parameter2); + dsqlScratch->appendUChar(variable->var_msg_number); + dsqlScratch->appendUShort(variable->var_msg_item); + dsqlScratch->appendUShort(variable->var_msg_item + 1); } if (hasEos) { - stuff(statement, blr_assignment); - stuff(statement, blr_literal); - stuff(statement, blr_short); - stuff(statement, 0); - stuff_word(statement, (eosFlag ? 0 : 1)); - stuff(statement, blr_parameter); - stuff(statement, 1); - stuff_word(statement, USHORT(2 * outputVariables.getCount())); + dsqlScratch->appendUChar(blr_assignment); + dsqlScratch->appendUChar(blr_literal); + dsqlScratch->appendUChar(blr_short); + dsqlScratch->appendUChar(0); + dsqlScratch->appendUShort((eosFlag ? 0 : 1)); + dsqlScratch->appendUChar(blr_parameter); + dsqlScratch->appendUChar(1); + dsqlScratch->appendUShort(USHORT(2 * outputVariables.getCount())); } - stuff(statement, blr_end); + dsqlScratch->appendUChar(blr_end); if (hasEos && !eosFlag) { - stuff(statement, blr_stall); - stuff(statement, blr_end); + dsqlScratch->appendUChar(blr_stall); + dsqlScratch->appendUChar(blr_end); } } @@ -371,11 +367,11 @@ { DsqlCompiledStatement* const statement = dsqlScratch->getStatement(); - statement->append_uchar(blr_begin); - statement->append_uchar(blr_start_savepoint); + dsqlScratch->appendUChar(blr_begin); + dsqlScratch->appendUChar(blr_start_savepoint); stmt->genBlr(); - statement->append_uchar(blr_end_savepoint); - statement->append_uchar(blr_end); + dsqlScratch->appendUChar(blr_end_savepoint); + dsqlScratch->appendUChar(blr_end); } @@ -402,12 +398,10 @@ IfNode* IfNode::internalDsqlPass() { - IfNode* node = FB_NEW(getPool()) IfNode(getPool()); - node->dsqlScratch = dsqlScratch; + IfNode* node = FB_NEW(getPool()) IfNode(getPool(), dsqlScratch); node->dsqlCondition = PASS1_node(dsqlScratch, dsqlCondition); node->dsqlTrueAction = PASS1_statement(dsqlScratch, dsqlTrueAction); node->dsqlFalseAction = PASS1_statement(dsqlScratch, dsqlFalseAction); - return node; } @@ -424,15 +418,13 @@ void IfNode::genBlr() { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - - stuff(statement, blr_if); + dsqlScratch->appendUChar(blr_if); GEN_expr(dsqlScratch, dsqlCondition); GEN_statement(dsqlScratch, dsqlTrueAction); if (dsqlFalseAction) GEN_statement(dsqlScratch, dsqlFalseAction); else - stuff(statement, blr_end); + dsqlScratch->appendUChar(blr_end); } @@ -522,10 +514,8 @@ void InAutonomousTransactionNode::genBlr() { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - - stuff(statement, blr_auto_trans); - stuff(statement, 0); // to extend syntax in the future + dsqlScratch->appendUChar(blr_auto_trans); + dsqlScratch->appendUChar(0); // to extend syntax in the future GEN_statement(dsqlScratch, dsqlAction); } @@ -758,7 +748,7 @@ const size_t count = node->parameters.getCount() + node->returns.getCount() + (node->localDeclList ? node->localDeclList->nod_count : 0); - if (count) + if (count != 0) { StrArray names(*getDefaultMemoryPool(), count); @@ -815,22 +805,17 @@ // Update blockNode, because we have a reference to the original unprocessed node. statement->setBlockNode(this); - statement->beginDebug(); + dsqlScratch->beginDebug(); - USHORT inputs = 0, outputs = 0, locals = 0; - // now do the input parameters for (size_t i = 0; i < parameters.getCount(); ++i) { ParameterClause& parameter = parameters[i]; dsql_nod* var = MAKE_variable(parameter.legacyField, - parameter.name.c_str(), VAR_input, 0, (USHORT) (2 * inputs), locals); + parameter.name.c_str(), VAR_input, 0, (USHORT) (2 * i), 0); variables.add(var); - - // ASF: do not increment locals here - CORE-2341 - inputs++; } const unsigned returnsPos = variables.getCount(); @@ -841,17 +826,15 @@ ParameterClause& parameter = returns[i]; dsql_nod* var = MAKE_variable(parameter.legacyField, - parameter.name.c_str(), VAR_output, 1, (USHORT) (2 * outputs), locals++); + parameter.name.c_str(), VAR_output, 1, (USHORT) (2 * i), i); variables.add(var); outputVariables.add(var); - - ++outputs; } - statement->append_uchar(blr_begin); + dsqlScratch->appendUChar(blr_begin); - if (inputs) + if (parameters.hasData()) { revertParametersOrder(statement->getSendMsg()->msg_parameters); GEN_port(dsqlScratch, statement->getSendMsg()); @@ -878,13 +861,13 @@ revertParametersOrder(statement->getReceiveMsg()->msg_parameters); GEN_port(dsqlScratch, statement->getReceiveMsg()); - if (inputs) + if (parameters.hasData()) { - statement->append_uchar(blr_receive); - statement->append_uchar(0); + dsqlScratch->appendUChar(blr_receive); + dsqlScratch->appendUChar(0); } - statement->append_uchar(blr_begin); + dsqlScratch->appendUChar(blr_begin); for (unsigned i = 0; i < returnsPos; ++i) { @@ -897,14 +880,14 @@ // ASF: Validation of execute block input parameters is different than procedure // parameters, because we can't generate messages using the domains due to the // connection charset influence. So to validate, we cast them and assign to null. - statement->append_uchar(blr_assignment); - statement->append_uchar(blr_cast); + dsqlScratch->appendUChar(blr_assignment); + dsqlScratch->appendUChar(blr_cast); BlockNode::putDtype(dsqlScratch, field, true); - statement->append_uchar(blr_parameter2); - statement->append_uchar(0); - statement->append_ushort(variable->var_msg_item); - statement->append_ushort(variable->var_msg_item + 1); - statement->append_uchar(blr_null); + dsqlScratch->appendUChar(blr_parameter2); + dsqlScratch->appendUChar(0); + dsqlScratch->appendUShort(variable->var_msg_item); + dsqlScratch->appendUShort(variable->var_msg_item + 1); + dsqlScratch->appendUChar(blr_null); } } @@ -917,29 +900,29 @@ dsqlScratch->setPsql(true); - putLocalVariables(dsqlScratch, localDeclList, locals); + putLocalVariables(dsqlScratch, localDeclList, USHORT(returns.getCount())); dsqlScratch->loopLevel = 0; dsql_nod* stmtNode = PASS1_statement(dsqlScratch, body); GEN_hidden_variables(dsqlScratch, false); - statement->append_uchar(blr_stall); + dsqlScratch->appendUChar(blr_stall); // Put a label before body of procedure, so that // any exit statement can get out - statement->append_uchar(blr_label); - statement->append_uchar(0); + dsqlScratch->appendUChar(blr_label); + dsqlScratch->appendUChar(0); GEN_statement(dsqlScratch, stmtNode); - if (outputs) + if (returns.hasData()) statement->setType(DsqlCompiledStatement::TYPE_SELECT_BLOCK); else statement->setType(DsqlCompiledStatement::TYPE_EXEC_BLOCK); - statement->append_uchar(blr_end); - genReturn(statement, true); - statement->append_uchar(blr_end); + dsqlScratch->appendUChar(blr_end); + genReturn(dsqlScratch, true); + dsqlScratch->appendUChar(blr_end); - statement->endDebug(); + dsqlScratch->endDebug(); } @@ -1063,33 +1046,31 @@ void ExceptionNode::genBlr() { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); + dsqlScratch->appendUChar(blr_abort); - stuff(statement, blr_abort); - // If exception name is undefined, it means we have re-initiate semantics here, // so blr_raise verb should be generated. if (name.isEmpty()) { - stuff(statement, blr_raise); + dsqlScratch->appendUChar(blr_raise); return; } // If exception value is defined, it means we have user-defined exception message // here, so blr_exception_msg verb should be generated. if (dsqlParameters) - stuff(statement, blr_exception_params); + dsqlScratch->appendUChar(blr_exception_params); else if (dsqlMessageExpr) - stuff(statement, blr_exception_msg); + dsqlScratch->appendUChar(blr_exception_msg); else // Otherwise go usual way, i.e. generate blr_exception. - stuff(statement, blr_exception); + dsqlScratch->appendUChar(blr_exception); - stuff_cstring(statement, name.c_str()); + dsqlScratch->appendNullString(name.c_str()); // If exception parameters or value is defined, generate appropriate BLR verbs. if (dsqlParameters) { - stuff_word(statement, dsqlParameters->nod_count); + dsqlScratch->appendUShort(dsqlParameters->nod_count); dsql_nod** ptr = dsqlParameters->nod_arg; const dsql_nod* const* end = ptr + dsqlParameters->nod_count; @@ -1298,9 +1279,8 @@ void ExitNode::genBlr() { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - stuff(statement, blr_leave); - stuff(statement, 0); + dsqlScratch->appendUChar(blr_leave); + dsqlScratch->appendUChar(0); } @@ -1393,25 +1373,23 @@ void ForNode::genBlr() { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - // CVC: Only put a label if this is not singular; otherwise, // what loop is the user trying to abandon? if (dsqlAction) { - stuff(statement, blr_label); - stuff(statement, (int) (IPTR) dsqlLabel->nod_arg[Dsql::e_label_number]); + dsqlScratch->appendUChar(blr_label); + dsqlScratch->appendUChar((int) (IPTR) dsqlLabel->nod_arg[Dsql::e_label_number]); } // Generate FOR loop - stuff(statement, blr_for); + dsqlScratch->appendUChar(blr_for); if (!dsqlAction || dsqlForceSingular) - stuff(statement, blr_singular); + dsqlScratch->appendUChar(blr_singular); GEN_rse(dsqlScratch, dsqlSelect); - stuff(statement, blr_begin); + dsqlScratch->appendUChar(blr_begin); // Build body of FOR loop @@ -1430,7 +1408,7 @@ for (const dsql_nod* const* const end = ptr + list->nod_count; ptr < end; ptr++, ptr_to++) { - stuff(statement, blr_assignment); + dsqlScratch->appendUChar(blr_assignment); GEN_expr(dsqlScratch, *ptr); GEN_expr(dsqlScratch, *ptr_to); } @@ -1439,7 +1417,7 @@ if (dsqlAction) GEN_statement(dsqlScratch, dsqlAction); - stuff(statement, blr_end); + dsqlScratch->appendUChar(blr_end); } StmtNode* ForNode::pass1(thread_db* tdbb, CompilerScratch* csb) @@ -1549,17 +1527,15 @@ void PostEventNode::genBlr() { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - if (dsqlArgument) { - stuff(statement, blr_post_arg); + dsqlScratch->appendUChar(blr_post_arg); GEN_expr(dsqlScratch, dsqlEvent); GEN_expr(dsqlScratch, dsqlArgument); } else { - stuff(statement, blr_post); + dsqlScratch->appendUChar(blr_post); GEN_expr(dsqlScratch, dsqlEvent); } } @@ -1668,10 +1644,9 @@ void SavepointNode::genBlr() { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - stuff(statement, blr_user_savepoint); - stuff(statement, (UCHAR) command); - stuff_cstring(statement, name.c_str()); + dsqlScratch->appendUChar(blr_user_savepoint); + dsqlScratch->appendUChar((UCHAR) command); + dsqlScratch->appendNullString(name.c_str()); } @@ -1847,7 +1822,7 @@ void SuspendNode::genBlr() { if (blockNode) - blockNode->genReturn(dsqlScratch->getStatement()); + blockNode->genReturn(dsqlScratch); } @@ -1930,15 +1905,15 @@ { DsqlCompiledStatement* const statement = dsqlScratch->getStatement(); - statement->append_uchar(blr_assignment); + dsqlScratch->appendUChar(blr_assignment); GEN_expr(dsqlScratch, value); - statement->append_uchar(blr_variable); - statement->append_ushort(0); + dsqlScratch->appendUChar(blr_variable); + dsqlScratch->appendUShort(0); - blockNode->genReturn(statement); + blockNode->genReturn(dsqlScratch); - statement->append_uchar(blr_leave); - statement->append_uchar(0); + dsqlScratch->appendUChar(blr_leave); + dsqlScratch->appendUChar(0); } Modified: firebird/trunk/src/dsql/ddl.cpp =================================================================== --- firebird/trunk/src/dsql/ddl.cpp 2010-06-16 16:28:09 UTC (rev 51258) +++ firebird/trunk/src/dsql/ddl.cpp 2010-06-17 01:18:40 UTC (rev 51259) @@ -155,6 +155,9 @@ static void fix_default_source(dsql_str* string); static void foreign_key(DsqlCompilerScratch*, dsql_nod*, const char* index_name); static void generate_dyn(DsqlCompilerScratch*, dsql_nod*); +static void generateUnnamedTriggerBeginning(BlrWriter* blrWriter, bool onUpdateTrigger, + const char* primRelName, const dsql_nod* primColumns, + const char* forRelName, const dsql_nod* forColumns); static void grant_revoke(DsqlCompilerScratch*); static void make_index(DsqlCompilerScratch*, const dsql_nod*, const dsql_nod*, const char*); static void make_index_trg_ref_int(DsqlCompilerScratch*, dsql_nod*, dsql_nod*, dsql_nod*, @@ -181,8 +184,8 @@ static void save_relation(DsqlCompilerScratch*, const dsql_str*); static void set_statistics(DsqlCompilerScratch*); static void stuff_default_blr(DsqlCompilerScratch*, const UCHAR*, USHORT); -static void stuff_matching_blr(DsqlCompiledStatement*, const dsql_nod*, const dsql_nod*); -static void stuff_trg_firing_cond(DsqlCompiledStatement*, const dsql_nod*); +static void stuff_matching_blr(BlrWriter*, const dsql_nod*, const dsql_nod*); +static void stuff_trg_firing_cond(BlrWriter*, const dsql_nod*); static void set_nod_value_attributes(dsql_nod*, const dsql_fld*); static void clearPermanentField (dsql_rel*, bool); static void define_user(DsqlCompilerScratch*, UCHAR); @@ -214,34 +217,6 @@ }; -void DsqlCompiledStatement::append_raw_string(const char* string, USHORT len) -{ - blrData.add(reinterpret_cast<const UCHAR*>(string), len); -} - -void DsqlCompiledStatement::append_raw_string(const UCHAR* string, USHORT len) -{ - blrData.add(string, len); -} - -// -// Write out a string valued attribute. (Overload 2.) -// -void DsqlCompiledStatement::append_string(UCHAR verb, const MetaName& name) -{ - append_string(verb, name.c_str(), name.length()); -} - - -// -// Write out a string valued attribute. (Overload 3.) -// -void DsqlCompiledStatement::append_string(UCHAR verb, const string& name) -{ - append_string(verb, name.c_str(), name.length()); -} - - void DDL_execute(dsql_req* request) { /************************************** @@ -264,7 +239,7 @@ if (DSQL_debug & 4) { dsql_trace("Output DYN string for DDL:"); - PRETTY_print_dyn(statement->getBlrData().begin(), gds__trace_printer, NULL, 0); + PRETTY_print_dyn(statement->getDdlData().begin(), gds__trace_printer, NULL, 0); } #endif @@ -327,9 +302,9 @@ } else { - fb_assert(statement->getBlrData().getCount() <= MAX_ULONG); + fb_assert(statement->getDdlData().getCount() <= MAX_ULONG); DYN_ddl(request->req_transaction, - statement->getBlrData().getCount(), statement->getBlrData().begin(), + statement->getDdlData().getCount(), statement->getDdlData().begin(), *statement->getSqlText()); } @@ -359,12 +334,17 @@ } if (node->nod_type != nod_class_stmtnode) - dsqlScratch->getStatement()->append_uchar(isc_dyn_version_1); + dsqlScratch->appendUChar(isc_dyn_ver... [truncated message content] |
From: <asf...@us...> - 2010-06-26 01:52:14
|
Revision: 51288 http://firebird.svn.sourceforge.net/firebird/?rev=51288&view=rev Author: asfernandes Date: 2010-06-26 01:52:06 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Refactor CREATE/DROP COLLATION Modified Paths: -------------- firebird/trunk/lang_helpers/gds_codes.ftn firebird/trunk/lang_helpers/gds_codes.pas firebird/trunk/src/dsql/DdlNodes.epp firebird/trunk/src/dsql/DdlNodes.h firebird/trunk/src/dsql/ddl.cpp firebird/trunk/src/dsql/node.h firebird/trunk/src/dsql/parse.y firebird/trunk/src/dsql/pass1.cpp firebird/trunk/src/include/gen/codetext.h firebird/trunk/src/include/gen/iberror.h firebird/trunk/src/include/gen/msgs.h firebird/trunk/src/include/gen/sql_code.h firebird/trunk/src/include/gen/sql_state.h firebird/trunk/src/jrd/Attachment.cpp firebird/trunk/src/jrd/Attachment.h firebird/trunk/src/jrd/drq.h firebird/trunk/src/jrd/dyn.epp firebird/trunk/src/jrd/dyn.h firebird/trunk/src/jrd/dyn_def.epp firebird/trunk/src/jrd/dyn_del.epp firebird/trunk/src/jrd/dyn_df_proto.h firebird/trunk/src/jrd/dyn_dl_proto.h firebird/trunk/src/msgs/messages2.sql firebird/trunk/src/msgs/system_errors2.sql Modified: firebird/trunk/lang_helpers/gds_codes.ftn =================================================================== --- firebird/trunk/lang_helpers/gds_codes.ftn 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/lang_helpers/gds_codes.ftn 2010-06-26 01:52:06 UTC (rev 51288) @@ -1638,8 +1638,18 @@ PARAMETER (GDS__invalid_coll_attr = 336068830) INTEGER*4 GDS__dyn_wrong_gtt_scope PARAMETER (GDS__dyn_wrong_gtt_scope = 336068840) + INTEGER*4 GDS__dyn_coll_used_table + PARAMETER (GDS__dyn_coll_used_table = 336068843) + INTEGER*4 GDS__dyn_coll_used_domain + PARAMETER (GDS__dyn_coll_used_domain = 336068844) + INTEGER*4 GDS__dyn_cannot_del_syscoll + PARAMETER (GDS__dyn_cannot_del_syscoll = 336068845) + INTEGER*4 GDS__dyn_cannot_del_def_coll + PARAMETER (GDS__dyn_cannot_del_def_coll = 336068846) INTEGER*4 GDS__dyn_table_not_found PARAMETER (GDS__dyn_table_not_found = 336068849) + INTEGER*4 GDS__dyn_coll_used_procedure + PARAMETER (GDS__dyn_coll_used_procedure = 336068851) INTEGER*4 GDS__dyn_scale_too_big PARAMETER (GDS__dyn_scale_too_big = 336068852) INTEGER*4 GDS__dyn_precision_too_small Modified: firebird/trunk/lang_helpers/gds_codes.pas =================================================================== --- firebird/trunk/lang_helpers/gds_codes.pas 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/lang_helpers/gds_codes.pas 2010-06-26 01:52:06 UTC (rev 51288) @@ -826,7 +826,12 @@ gds_max_coll_per_charset = 336068829; gds_invalid_coll_attr = 336068830; gds_dyn_wrong_gtt_scope = 336068840; + gds_dyn_coll_used_table = 336068843; + gds_dyn_coll_used_domain = 336068844; + gds_dyn_cannot_del_syscoll = 336068845; + gds_dyn_cannot_del_def_coll = 336068846; gds_dyn_table_not_found = 336068849; + gds_dyn_coll_used_procedure = 336068851; gds_dyn_scale_too_big = 336068852; gds_dyn_precision_too_small = 336068853; gds_dyn_miss_priv_warning = 336068855; Modified: firebird/trunk/src/dsql/DdlNodes.epp =================================================================== --- firebird/trunk/src/dsql/DdlNodes.epp 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/dsql/DdlNodes.epp 2010-06-26 01:52:06 UTC (rev 51288) @@ -30,6 +30,7 @@ #include "../jrd/msg_encode.h" #include "../jrd/obj.h" #include "../jrd/tra.h" +#include "../jrd/IntlManager.h" #include "../jrd/PreparedStatement.h" #include "../jrd/blb_proto.h" #include "../jrd/cmp_proto.h" @@ -2757,6 +2758,360 @@ //---------------------- +void CreateCollationNode::print(string& text, Array<dsql_nod*>& /*nodes*/) const +{ + text.printf( + "CreateCollationNode\n" + " name: '%s'\n" + " forCharSet: '%s'\n" + " fromName: '%s'\n" + " fromExternal: '%s'\n" + " attributesOn: %x\n" + " attributesOff: %x\n", + name.c_str(), forCharSet.c_str(), fromName.c_str(), fromExternal.c_str(), + attributesOn, attributesOff); +} + +void CreateCollationNode::execute(thread_db* tdbb, jrd_tra* transaction) +{ + Attachment* attachment = transaction->tra_attachment; + + // run all statements under savepoint control + AutoSavePoint savePoint(tdbb, transaction); + + executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_COLLATION, name); + + bool endStore = false; + + try + { + AutoCacheRequest request(tdbb, drq_s_colls, DYN_REQUESTS); + + STORE(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + X IN RDB$COLLATIONS + { + X.RDB$CHARACTER_SET_ID = forCharSetId; + strcpy(X.RDB$COLLATION_NAME, name.c_str()); + X.RDB$SYSTEM_FLAG = 0; + + X.RDB$SPECIFIC_ATTRIBUTES.NULL = TRUE; + X.RDB$BASE_COLLATION_NAME.NULL = TRUE; + + CharSet* cs = INTL_charset_lookup(tdbb, forCharSetId); + SubtypeInfo info; + + if (fromName.hasData()) + { + if (MET_get_char_coll_subtype_info(tdbb, + INTL_CS_COLL_TO_TTYPE(forCharSetId, fromCollationId), &info) && + info.specificAttributes.hasData()) + { + UCharBuffer temp; + ULONG size = info.specificAttributes.getCount() * cs->maxBytesPerChar(); + + size = INTL_convert_bytes(tdbb, forCharSetId, temp.getBuffer(size), size, + CS_METADATA, info.specificAttributes.begin(), + info.specificAttributes.getCount(), status_exception::raise); + temp.shrink(size); + info.specificAttributes = temp; + } + + strcpy(X.RDB$BASE_COLLATION_NAME, info.baseCollationName.c_str()); + X.RDB$BASE_COLLATION_NAME.NULL = FALSE; + } + else if (fromExternal.hasData()) + { + strcpy(X.RDB$BASE_COLLATION_NAME, fromExternal.c_str()); + X.RDB$BASE_COLLATION_NAME.NULL = FALSE; + } + + if (specificAttributes.hasData()) + { + UCharBuffer temp; + ULONG size = specificAttributes.getCount() * cs->maxBytesPerChar(); + + size = INTL_convert_bytes(tdbb, forCharSetId, temp.getBuffer(size), size, + attachment->att_charset, specificAttributes.begin(), + specificAttributes.getCount(), status_exception::raise); + temp.shrink(size); + specificAttributes = temp; + } + + info.charsetName = forCharSet.c_str(); + info.collationName = name; + if (X.RDB$BASE_COLLATION_NAME.NULL) + info.baseCollationName = info.collationName; + else + info.baseCollationName = X.RDB$BASE_COLLATION_NAME; + info.ignoreAttributes = false; + + if (!IntlManager::collationInstalled(info.baseCollationName.c_str(), + info.charsetName.c_str())) + { + // msg: 223: "Collation @1 not installed for character set @2" + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(ENCODE_ISC_MSG(223, DYN_MSG_FAC)) << + info.baseCollationName << info.charsetName); + } + + IntlUtil::SpecificAttributesMap map; + + if (!IntlUtil::parseSpecificAttributes( + cs, info.specificAttributes.getCount(), info.specificAttributes.begin(), &map) || + !IntlUtil::parseSpecificAttributes( + cs, specificAttributes.getCount(), specificAttributes.begin(), &map)) + { + // msg: 222: "Invalid collation attributes" + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(ENCODE_ISC_MSG(222, DYN_MSG_FAC))); + } + + const string s = IntlUtil::generateSpecificAttributes(cs, map); + string newSpecificAttributes; + + if (!IntlManager::setupCollationAttributes( + info.baseCollationName.c_str(), info.charsetName.c_str(), s, + newSpecificAttributes)) + { + // msg: 222: "Invalid collation attributes" + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(ENCODE_ISC_MSG(222, DYN_MSG_FAC))); + } + + memcpy(info.specificAttributes.getBuffer(newSpecificAttributes.length()), + newSpecificAttributes.begin(), newSpecificAttributes.length()); + + if (info.specificAttributes.hasData()) + { + X.RDB$SPECIFIC_ATTRIBUTES.NULL = FALSE; + attachment->storeMetaDataBlob(tdbb, transaction, &X.RDB$SPECIFIC_ATTRIBUTES, + string(info.specificAttributes.begin(), info.specificAttributes.getCount()), + forCharSetId); + } + + info.attributes = (info.attributes | attributesOn) & (~attributesOff); + X.RDB$COLLATION_ATTRIBUTES = info.attributes; + + // Do not allow invalid attributes here. + if (!INTL_texttype_validate(tdbb, &info)) + { + // msg: 222: "Invalid collation attributes" + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(ENCODE_ISC_MSG(222, DYN_MSG_FAC))); + } + + // ASF: User collations are created with the last number available, + // to minimize the possibility of conflicts with future system collations. + // The greater available number is 126 to avoid signed/unsigned problems. + + X.RDB$COLLATION_ID.NULL = TRUE; + X.RDB$COLLATION_ID = 126; + + AutoCacheRequest request2(tdbb, drq_l_max_coll_id, DYN_REQUESTS); + + FOR(REQUEST_HANDLE request2) + Y IN RDB$COLLATIONS + WITH Y.RDB$CHARACTER_SET_ID = forCharSetId AND + Y.RDB$COLLATION_ID NOT MISSING + SORTED BY DESCENDING Y.RDB$COLLATION_ID + { + if (Y.RDB$COLLATION_ID + 1 <= X.RDB$COLLATION_ID) + { + X.RDB$COLLATION_ID.NULL = FALSE; + break; + } + else + X.RDB$COLLATION_ID = Y.RDB$COLLATION_ID - 1; + } + END_FOR + + if (X.RDB$COLLATION_ID.NULL) + { + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(isc_max_coll_per_charset)); + } + + endStore = true; + } + END_STORE + } + catch (const status_exception& ex) + { + // DEFINE COLLATION failed + rethrowMetaException(ex, ENCODE_ISC_MSG(219, DYN_MSG_FAC), endStore); + } + + executeDdlTrigger(tdbb, transaction, DTW_AFTER, DDL_TRIGGER_CREATE_COLLATION, name); + + savePoint.release(); // everything is ok + + // Update DSQL cache + AutoPtr<dsql_str> str(MAKE_string(name.c_str(), name.length())); + METD_drop_collation(transaction, str); + MET_dsql_cache_release(tdbb, SYM_intlsym_collation, str->str_data); +} + +DdlNode* CreateCollationNode::internalDsqlPass() +{ + const dsql_intlsym* resolvedCharSet = METD_get_charset( + dsqlScratch->getTransaction(), forCharSet.length(), forCharSet.c_str()); + + if (!resolvedCharSet) + { + // specified character set not found + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-504) << + Arg::Gds(isc_charset_not_found) << forCharSet); + } + + forCharSetId = resolvedCharSet->intlsym_charset_id; + + if (fromName.hasData()) + { + AutoPtr<dsql_str> str(MAKE_string(fromName.c_str(), fromName.length())); + const dsql_intlsym* resolvedCollation = METD_get_collation( + dsqlScratch->getTransaction(), str, forCharSetId); + + if (!resolvedCollation) + { + // Specified collation not found + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) << + Arg::Gds(isc_collation_not_found) << fromName << forCharSet); + } + + fromCollationId = resolvedCollation->intlsym_collate_id; + } + + return DdlNode::internalDsqlPass(); +} + + +//---------------------- + + +void DropCollationNode::print(string& text, Array<dsql_nod*>& /*nodes*/) const +{ + text.printf( + "DropCollationNode\n" + " name: '%s'\n", + name.c_str()); +} + +void DropCollationNode::execute(thread_db* tdbb, jrd_tra* transaction) +{ + // run all statements under savepoint control + AutoSavePoint savePoint(tdbb, transaction); + + bool found = false; + AutoCacheRequest request(tdbb, drq_e_colls, DYN_REQUESTS); + + FOR (REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + COLL IN RDB$COLLATIONS + CROSS CS IN RDB$CHARACTER_SETS + WITH COLL.RDB$COLLATION_NAME EQ name.c_str() AND + CS.RDB$CHARACTER_SET_ID EQ COLL.RDB$CHARACTER_SET_ID + { + executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_DROP_COLLATION, name); + + if (!COLL.RDB$SYSTEM_FLAG.NULL && COLL.RDB$SYSTEM_FLAG) + { + status_exception::raise(Arg::Gds(isc_no_meta_update) << + Arg::Gds(isc_dyn_cannot_del_syscoll)); + } + + if (COLL.RDB$COLLATION_ID == 0 || + (!CS.RDB$DEFAULT_COLLATE_NAME.NULL && + MetaName(COLL.RDB$COLLATION_NAME) == MetaName(CS.RDB$DEFAULT_COLLATE_NAME))) + { + fb_utils::exact_name_limit(CS.RDB$CHARACTER_SET_NAME, + sizeof(CS.RDB$CHARACTER_SET_NAME)); + + status_exception::raise(Arg::Gds(isc_no_meta_update) << + Arg::Gds(isc_dyn_cannot_del_def_coll) << CS.RDB$CHARACTER_SET_NAME); + } + + found = true; + fb_utils::exact_name_limit(COLL.RDB$COLLATION_NAME, sizeof(COLL.RDB$COLLATION_NAME)); + + AutoCacheRequest request2(tdbb, drq_l_rfld_coll, DYN_REQUESTS); + + FOR (REQUEST_HANDLE request2 TRANSACTION_HANDLE transaction) + RF IN RDB$RELATION_FIELDS CROSS F IN RDB$FIELDS + WITH RF.RDB$FIELD_SOURCE EQ F.RDB$FIELD_NAME AND + F.RDB$CHARACTER_SET_ID EQ COLL.RDB$CHARACTER_SET_ID AND + RF.RDB$COLLATION_ID EQ COLL.RDB$COLLATION_ID + { + fb_utils::exact_name_limit(RF.RDB$RELATION_NAME, sizeof(RF.RDB$RELATION_NAME)); + fb_utils::exact_name_limit(RF.RDB$FIELD_NAME, sizeof(RF.RDB$FIELD_NAME)); + + status_exception::raise(Arg::Gds(isc_no_meta_update) << + Arg::Gds(isc_dyn_coll_used_table) << COLL.RDB$COLLATION_NAME << + RF.RDB$RELATION_NAME << RF.RDB$FIELD_NAME); + } + END_FOR + + request2.reset(tdbb, drq_l_prm_coll, DYN_REQUESTS); + + FOR (REQUEST_HANDLE request2 TRANSACTION_HANDLE transaction) + PRM IN RDB$PROCEDURE_PARAMETERS CROSS F IN RDB$FIELDS + WITH PRM.RDB$FIELD_SOURCE EQ F.RDB$FIELD_NAME AND + F.RDB$CHARACTER_SET_ID EQ COLL.RDB$CHARACTER_SET_ID AND + PRM.RDB$COLLATION_ID EQ COLL.RDB$COLLATION_ID + { + fb_utils::exact_name_limit(PRM.RDB$PARAMETER_NAME, sizeof(PRM.RDB$PARAMETER_NAME)); + + status_exception::raise(Arg::Gds(isc_no_meta_update) << + Arg::Gds(isc_dyn_coll_used_procedure) << + COLL.RDB$COLLATION_NAME << + QualifiedName(PRM.RDB$PROCEDURE_NAME, + (PRM.RDB$PACKAGE_NAME.NULL ? NULL : PRM.RDB$PACKAGE_NAME)).toString().c_str() << + PRM.RDB$PARAMETER_NAME); + } + END_FOR + + request2.reset(tdbb, drq_l_fld_coll, DYN_REQUESTS); + + FOR (REQUEST_HANDLE request2 TRANSACTION_HANDLE transaction) + F IN RDB$FIELDS + WITH F.RDB$CHARACTER_SET_ID EQ COLL.RDB$CHARACTER_SET_ID AND + F.RDB$COLLATION_ID EQ COLL.RDB$COLLATION_ID + { + fb_utils::exact_name_limit(F.RDB$FIELD_NAME, sizeof(F.RDB$FIELD_NAME)); + + status_exception::raise(Arg::Gds(isc_no_meta_update) << + Arg::Gds(isc_dyn_coll_used_domain) << COLL.RDB$COLLATION_NAME << F.RDB$FIELD_NAME); + } + END_FOR + + ERASE COLL; + } + END_FOR + + if (found) + executeDdlTrigger(tdbb, transaction, DTW_AFTER, DDL_TRIGGER_DROP_COLLATION, name); + else + { + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(isc_dyn_collation_not_found) << Arg::Str(name)); + } + + savePoint.release(); // everything is ok + + // Update DSQL cache + AutoPtr<dsql_str> str(MAKE_string(name.c_str(), name.length())); + METD_drop_collation(transaction, str); + MET_dsql_cache_release(tdbb, SYM_intlsym_collation, str->str_data); +} + + +//---------------------- + + void CreateSequenceNode::print(string& text, Array<dsql_nod*>& /*nodes*/) const { text.printf( Modified: firebird/trunk/src/dsql/DdlNodes.h =================================================================== --- firebird/trunk/src/dsql/DdlNodes.h 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/dsql/DdlNodes.h 2010-06-26 01:52:06 UTC (rev 51288) @@ -24,11 +24,14 @@ #define DSQL_DDL_NODES_H #include "../jrd/common.h" +#include "../jrd/dyn.h" +#include "../jrd/msg_encode.h" #include "../dsql/node.h" #include "../dsql/make_proto.h" #include "../dsql/Nodes.h" #include "../common/classes/array.h" #include "../common/classes/TriState.h" +#include "../dsql/errd_proto.h" namespace Jrd { @@ -494,6 +497,91 @@ }; +class CreateCollationNode : public DdlNode +{ +public: + explicit CreateCollationNode(MemoryPool& p, const Firebird::string& sqlText, + const Firebird::MetaName& aName, const Firebird::MetaName& aForCharSet) + : DdlNode(p, sqlText), + name(p, aName), + forCharSet(p, aForCharSet), + fromName(p), + fromExternal(p), + specificAttributes(p), + attributesOn(0), + attributesOff(0), + forCharSetId(0), + fromCollationId(0) + { + } + +public: + virtual void print(Firebird::string& text, Firebird::Array<dsql_nod*>& nodes) const; + virtual void execute(thread_db* tdbb, jrd_tra* transaction); + + void setAttribute(USHORT attribute) + { + if ((attributesOn | attributesOff) & attribute) + { + // msg: 222: "Invalid collation attributes" + using namespace Firebird; + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + Arg::Gds(ENCODE_ISC_MSG(222, DYN_MSG_FAC))); + } + + attributesOn |= attribute; + } + + void unsetAttribute(USHORT attribute) + { + if ((attributesOn | attributesOff) & attribute) + { + // msg: 222: "Invalid collation attributes" + using namespace Firebird; + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + Arg::Gds(ENCODE_ISC_MSG(222, DYN_MSG_FAC))); + } + + attributesOff |= attribute; + } + +protected: + virtual DdlNode* internalDsqlPass(); + +public: + Firebird::MetaName name; + Firebird::MetaName forCharSet; + Firebird::MetaName fromName; + Firebird::string fromExternal; + Firebird::UCharBuffer specificAttributes; + +private: + USHORT attributesOn; + USHORT attributesOff; + USHORT forCharSetId; + USHORT fromCollationId; +}; + + +class DropCollationNode : public DdlNode +{ +public: + explicit DropCollationNode(MemoryPool& p, const Firebird::string& sqlText, + const Firebird::MetaName& aName) + : DdlNode(p, sqlText), + name(p, aName) + { + } + +public: + virtual void print(Firebird::string& text, Firebird::Array<dsql_nod*>& nodes) const; + virtual void execute(thread_db* tdbb, jrd_tra* transaction); + +public: + Firebird::MetaName name; +}; + + class CreateSequenceNode : public DdlNode { public: Modified: firebird/trunk/src/dsql/ddl.cpp =================================================================== --- firebird/trunk/src/dsql/ddl.cpp 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/dsql/ddl.cpp 2010-06-26 01:52:06 UTC (rev 51288) @@ -132,7 +132,6 @@ static void define_field(DsqlCompilerScratch*, dsql_nod*, SSHORT, const dsql_str*, const dsql_nod* pkcols); static void define_filter(DsqlCompilerScratch*); static SSHORT getBlobFilterSubType(DsqlCompilerScratch* dsqlScratch, const dsql_nod* node); -static void define_collation(DsqlCompilerScratch*); static void define_role(DsqlCompilerScratch*); static void define_index(DsqlCompilerScratch*); static void define_rel_constraint(DsqlCompilerScratch*, dsql_nod*); @@ -148,7 +147,6 @@ const dsql_nod*, const char*, const char*); static void define_view(DsqlCompilerScratch*, NOD_TYPE); static void define_view_trigger(DsqlCompilerScratch*, dsql_nod*, dsql_nod*, dsql_nod*); -static void delete_collation(DsqlCompilerScratch*); static void delete_exception(DsqlCompilerScratch*, dsql_nod*, bool); static void delete_relation_view(DsqlCompilerScratch*, dsql_nod*, bool); static const dsql_nod* find_pk_columns(const dsql_nod* def_rel_elements); @@ -270,13 +268,6 @@ METD_drop_relation(request->getTransaction(), string); break; - case nod_del_collation: - // for delete, get rid of the cached collation metadata - string = (dsql_str*) statement->getDdlNode()->nod_arg[e_del_coll_name]; - sym_type = SYM_intlsym_collation; - METD_drop_collation(request->getTransaction(), string); - break; - case nod_del_udf: case nod_mod_udf: // Signal UDF for obsolescence @@ -1918,105 +1909,6 @@ } -static void define_collation(DsqlCompilerScratch* dsqlScratch) -{ -/************************************** - * - * d e f i n e _ c o l l a t i o n - * - ************************************** - * - * Function - * Create a collation. - * - **************************************/ - - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - - const dsql_nod* ddlNode = statement->getDdlNode(); - const dsql_str* coll_name = (dsql_str*) ddlNode->nod_arg[e_def_coll_name]; - const dsql_str* coll_for = (dsql_str*) ddlNode->nod_arg[e_def_coll_for]; - const dsql_nod* coll_from = ddlNode->nod_arg[e_def_coll_from]; - const dsql_nod* coll_attributes = ddlNode->nod_arg[e_def_coll_attributes]; - const dsql_nod* coll_specific_attributes = - PASS1_node(dsqlScratch, ddlNode->nod_arg[e_def_coll_specific_attributes]); - - const dsql_intlsym* resolved_charset = - METD_get_charset(dsqlScratch->getTransaction(), (USHORT) strlen(coll_for->str_data), - coll_for->str_data); - - if (!resolved_charset) - { - // specified character set not found - ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-504) << - Arg::Gds(isc_charset_not_found) << Arg::Str(coll_for->str_data)); - } - - if (coll_specific_attributes) - coll_specific_attributes = coll_specific_attributes->nod_arg[0]; - - dsqlScratch->appendNullString(isc_dyn_def_collation, coll_name->str_data); - dsqlScratch->appendNumber(isc_dyn_coll_for_charset, resolved_charset->intlsym_charset_id); - - if (coll_from) - { - const dsql_str* coll_name = reinterpret_cast<dsql_str*>(coll_from->nod_arg[0]); - if (coll_from->nod_type == nod_collation_from) - { - const dsql_intlsym* resolved_collation = METD_get_collation( - dsqlScratch->getTransaction(), coll_name, resolved_charset->intlsym_charset_id); - - if (!resolved_collation) - { - // Specified collation not found - ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) << - Arg::Gds(isc_collation_not_found) << Arg::Str(coll_name->str_data) << - Arg::Str(resolved_charset->intlsym_name)); - } - - dsqlScratch->appendNumber(isc_dyn_coll_from, - INTL_CS_COLL_TO_TTYPE(resolved_collation->intlsym_charset_id, - resolved_collation->intlsym_collate_id)); - } - else if (coll_from->nod_type == nod_collation_from_external) - { - dsqlScratch->appendNullString(isc_dyn_coll_from_external, coll_name->str_data); - } - else - fb_assert(false); - } - - if (coll_attributes) - { - const dsql_nod* const* ptr = coll_attributes->nod_arg; - for (const dsql_nod* const* const end = ptr + coll_attributes->nod_count; ptr < end; ptr++) - { - const dsql_nod* attribute = *ptr; - - switch (attribute->nod_type) - { - case nod_collation_attr: - dsqlScratch->appendNumber(isc_dyn_coll_attribute, (IPTR) attribute->nod_arg[0]); - break; - - default: - break; - } - } - } - - if (coll_specific_attributes) - { - dsqlScratch->appendNumber(isc_dyn_coll_specific_attributes_charset, - coll_specific_attributes->nod_desc.dsc_ttype()); - dsqlScratch->appendNullString(isc_dyn_coll_specific_attributes, - ((dsql_str*)coll_specific_attributes->nod_arg[0])->str_data); - } - - dsqlScratch->appendUChar(isc_dyn_end); -} - - static void define_index(DsqlCompilerScratch* dsqlScratch) { /************************************** @@ -3258,26 +3150,6 @@ } -static void delete_collation(DsqlCompilerScratch* dsqlScratch) -{ -/************************************** - * - * d e l e t e _ c o l l a t i o n - * - ************************************** - * - * Function - * Delete a collation. - * - **************************************/ - - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - const dsql_str* coll_name = (dsql_str*) statement->getDdlNode()->nod_arg[e_del_coll_name]; - dsqlScratch->appendNullString(isc_dyn_del_collation, coll_name->str_data); - dsqlScratch->appendUChar(isc_dyn_end); -} - - static void delete_exception (DsqlCompilerScratch* dsqlScratch, dsql_nod* node, bool silent_deletion) { /************************************** @@ -3673,14 +3545,6 @@ modify_map(dsqlScratch); break; - case nod_def_collation: - define_collation(dsqlScratch); - break; - - case nod_del_collation: - delete_collation(dsqlScratch); - break; - case nod_add_user: define_user(dsqlScratch, isc_dyn_user_add); break; Modified: firebird/trunk/src/dsql/node.h =================================================================== --- firebird/trunk/src/dsql/node.h 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/dsql/node.h 2010-06-26 01:52:06 UTC (rev 51288) @@ -265,12 +265,6 @@ nod_redef_exception, // RECREATE EXCEPTION nod_replace_exception, // CREATE OR ALTER EXCEPTION nod_mod_udf, - nod_def_collation, - nod_del_collation, - nod_collation_from, - nod_collation_from_external, - nod_collation_attr, - nod_collation_specific_attr, nod_strlen, nod_trim, nod_returning, @@ -831,16 +825,6 @@ e_mod_udf_module, e_mod_udf_count, - e_def_coll_name = 0, - e_def_coll_for, - e_def_coll_from, - e_def_coll_attributes, - e_def_coll_specific_attributes, - e_def_coll_count, - - e_del_coll_name = 0, - e_del_coll_count, - e_strlen_type = 0, // constant representing type of length e_strlen_value, e_strlen_count, Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/dsql/parse.y 2010-06-26 01:52:06 UTC (rev 51288) @@ -627,6 +627,7 @@ Jrd::ExprNode* exprNode; Jrd::StmtNode* stmtNode; Jrd::DdlNode* ddlNode; + Jrd::CreateCollationNode* createCollationNode; Jrd::CreateAlterFunctionNode* createAlterFunctionNode; Jrd::CreateAlterProcedureNode* createAlterProcedureNode; Jrd::CreateAlterTriggerNode* createAlterTriggerNode; @@ -659,10 +660,7 @@ %type <legacyNode> case_abbreviation case_expression case_operand case_result case_specification %type <legacyNode> cast_specification char_length_expression character_keyword character_type %type <legacyNode> charset_clause check_constraint check_opt close_cursor col_opt collate_clause -%type <legacyNode> collation_accent_attribute collation_attribute collation_attribute_list -%type <legacyNode> collation_attribute_list_opt collation_case_attribute collation_clause -%type <legacyNode> collation_pad_attribute collation_sequence_definition -%type <legacyNode> collation_specific_attribute_opt column_constraint column_constraint_clause +%type <legacyNode> column_constraint column_constraint_clause %type <legacyNode> column_constraint_def column_constraint_list column_def %type <legacyNode> column_list column_name column_parens column_parens_opt column_select @@ -822,6 +820,16 @@ %type <createAlterProcedureNode> alter_procedure_clause procedure_clause procedure_clause_start replace_procedure_clause %type <externalClause> external_clause +%type <createCollationNode> collation_clause +%type collation_sequence_definition(<createCollationNode>) +%type collation_accent_attribute(<createCollationNode>) +%type collation_attribute(<createCollationNode>) +%type collation_attribute_list(<createCollationNode>) +%type collation_attribute_list_opt(<createCollationNode>) +%type collation_case_attribute(<createCollationNode>) +%type collation_pad_attribute(<createCollationNode>) +%type collation_specific_attribute_opt(<createCollationNode>) + %type <triBoolVal> trigger_active %type <uint64Val> trigger_db_type trigger_ddl_type trigger_ddl_type_items trigger_type %type <uint64Val> trigger_type_prefix trigger_type_suffix @@ -1213,7 +1221,7 @@ | ROLE role_clause { $$ = $2; } | COLLATION collation_clause - { $$ = $2; } + { $$ = makeClassNode($2); } | USER create_user_clause { $$ = $2; } | PACKAGE package_clause @@ -1426,62 +1434,71 @@ // CREATE COLLATION -collation_clause : symbol_collation_name FOR symbol_character_set_name - collation_sequence_definition - collation_attribute_list_opt collation_specific_attribute_opt - { $$ = make_node (nod_def_collation, - (int) e_def_coll_count, $1, $3, $4, make_list($5), $6); } - ; +collation_clause + : symbol_collation_name FOR symbol_character_set_name + { + $<createCollationNode>$ = FB_NEW(getPool()) CreateCollationNode( + getPool(), compilingText, toName($1), toName($3)); + } + collation_sequence_definition($4) + collation_attribute_list_opt($4) collation_specific_attribute_opt($4) + { $$ = $4; } + ; -collation_sequence_definition : - FROM symbol_collation_name - { $$ = make_node(nod_collation_from, 1, $2); } - | FROM EXTERNAL '(' sql_string ')' - { $$ = make_node(nod_collation_from_external, 1, $4); } - | - { $$ = NULL; } - ; +collation_sequence_definition($createCollation) + : + | FROM symbol_collation_name + { $createCollation->fromName = toName($2); } + | FROM EXTERNAL '(' sql_string ')' + { $createCollation->fromExternal = toString($4); } + ; -collation_attribute_list_opt : - { $$ = NULL; } - | collation_attribute_list - ; +collation_attribute_list_opt($createCollation) + : + | collation_attribute_list($createCollation) + ; -collation_attribute_list : collation_attribute - | collation_attribute_list collation_attribute - { $$ = make_node(nod_list, 2, $1, $2); } - ; +collation_attribute_list($createCollation) + : collation_attribute($createCollation) + | collation_attribute_list collation_attribute($createCollation) + ; -collation_attribute : - collation_pad_attribute - | collation_case_attribute - | collation_accent_attribute - ; +collation_attribute($createCollation) + : collation_pad_attribute($createCollation) + | collation_case_attribute($createCollation) + | collation_accent_attribute($createCollation) + ; -collation_pad_attribute : NO PAD - { $$ = make_node(nod_collation_attr, 1, -TEXTTYPE_ATTR_PAD_SPACE); } - | PAD SPACE - { $$ = make_node(nod_collation_attr, 1, TEXTTYPE_ATTR_PAD_SPACE); } - ; +collation_pad_attribute($createCollation) + : NO PAD + { $createCollation->unsetAttribute(TEXTTYPE_ATTR_PAD_SPACE); } + | PAD SPACE + { $createCollation->setAttribute(TEXTTYPE_ATTR_PAD_SPACE); } + ; -collation_case_attribute : CASE SENSITIVE - { $$ = make_node(nod_collation_attr, 1, -TEXTTYPE_ATTR_CASE_INSENSITIVE); } - | CASE INSENSITIVE - { $$ = make_node(nod_collation_attr, 1, TEXTTYPE_ATTR_CASE_INSENSITIVE); } - ; +collation_case_attribute($createCollation) + : CASE SENSITIVE + { $createCollation->unsetAttribute(TEXTTYPE_ATTR_CASE_INSENSITIVE); } + | CASE INSENSITIVE + { $createCollation->setAttribute(TEXTTYPE_ATTR_CASE_INSENSITIVE); } + ; -collation_accent_attribute : ACCENT SENSITIVE - { $$ = make_node(nod_collation_attr, 1, -TEXTTYPE_ATTR_ACCENT_INSENSITIVE); } - | ACCENT INSENSITIVE - { $$ = make_node(nod_collation_attr, 1, TEXTTYPE_ATTR_ACCENT_INSENSITIVE); } - ; +collation_accent_attribute($createCollation) + : ACCENT SENSITIVE + { $createCollation->unsetAttribute(TEXTTYPE_ATTR_ACCENT_INSENSITIVE); } + | ACCENT INSENSITIVE + { $createCollation->setAttribute(TEXTTYPE_ATTR_ACCENT_INSENSITIVE); } + ; -collation_specific_attribute_opt : - { $$ = NULL; } - | sql_string - { $$ = make_node(nod_collation_specific_attr, 1, - MAKE_constant((dsql_str*)$1, CONSTANT_STRING)); } - ; +collation_specific_attribute_opt($createCollation) + : + | sql_string + { + string s(toString($1)); + $createCollation->specificAttributes.clear(); + $createCollation->specificAttributes.add((const UCHAR*) s.begin(), s.length()); + } + ; // ALTER CHARACTER SET @@ -3361,7 +3378,7 @@ | SEQUENCE symbol_generator_name { $$ = make_node (nod_del_generator, (int) 1, $2); } | COLLATION symbol_collation_name - { $$ = make_node (nod_del_collation, (int) 1, $2); } + { $$ = makeClassNode(FB_NEW(getPool()) DropCollationNode(getPool(), compilingText, toName($2))); } | USER drop_user_clause { $$ = $2; } | PACKAGE symbol_package_name Modified: firebird/trunk/src/dsql/pass1.cpp =================================================================== --- firebird/trunk/src/dsql/pass1.cpp 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/dsql/pass1.cpp 2010-06-26 01:52:06 UTC (rev 51288) @@ -1929,8 +1929,6 @@ case nod_add_user: case nod_mod_user: case nod_del_user: - case nod_def_collation: - case nod_del_collation: dsqlScratch->getStatement()->setType(DsqlCompiledStatement::TYPE_DDL); return input; @@ -10696,30 +10694,6 @@ verb = "mod_udf"; break; - case nod_def_collation: - verb = "def_collation"; - break; - - case nod_del_collation: - verb = "del_collation"; - break; - - case nod_collation_from: - verb = "collation_from"; - break; - - case nod_collation_from_external: - verb = "collation_from_external"; - break; - - case nod_collation_attr: - verb = "collation_attr"; - break; - - case nod_collation_specific_attr: - verb = "collation_specific_attr"; - break; - case nod_returning: verb = "returning"; break; Modified: firebird/trunk/src/include/gen/codetext.h =================================================================== --- firebird/trunk/src/include/gen/codetext.h 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/include/gen/codetext.h 2010-06-26 01:52:06 UTC (rev 51288) @@ -815,7 +815,12 @@ {"max_coll_per_charset", 336068829}, {"invalid_coll_attr", 336068830}, {"dyn_wrong_gtt_scope", 336068840}, + {"dyn_coll_used_table", 336068843}, + {"dyn_coll_used_domain", 336068844}, + {"dyn_cannot_del_syscoll", 336068845}, + {"dyn_cannot_del_def_coll", 336068846}, {"dyn_table_not_found", 336068849}, + {"dyn_coll_used_procedure", 336068851}, {"dyn_scale_too_big", 336068852}, {"dyn_precision_too_small", 336068853}, {"dyn_miss_priv_warning", 336068855}, Modified: firebird/trunk/src/include/gen/iberror.h =================================================================== --- firebird/trunk/src/include/gen/iberror.h 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/include/gen/iberror.h 2010-06-26 01:52:06 UTC (rev 51288) @@ -849,7 +849,12 @@ const ISC_STATUS isc_max_coll_per_charset = 336068829L; const ISC_STATUS isc_invalid_coll_attr = 336068830L; const ISC_STATUS isc_dyn_wrong_gtt_scope = 336068840L; +const ISC_STATUS isc_dyn_coll_used_table = 336068843L; +const ISC_STATUS isc_dyn_coll_used_domain = 336068844L; +const ISC_STATUS isc_dyn_cannot_del_syscoll = 336068845L; +const ISC_STATUS isc_dyn_cannot_del_def_coll = 336068846L; const ISC_STATUS isc_dyn_table_not_found = 336068849L; +const ISC_STATUS isc_dyn_coll_used_procedure = 336068851L; const ISC_STATUS isc_dyn_scale_too_big = 336068852L; const ISC_STATUS isc_dyn_precision_too_small = 336068853L; const ISC_STATUS isc_dyn_miss_priv_warning = 336068855L; @@ -1123,7 +1128,7 @@ const ISC_STATUS isc_trace_switch_param_miss = 337182758L; const ISC_STATUS isc_trace_param_act_notcompat = 337182759L; const ISC_STATUS isc_trace_mandatory_switch_miss = 337182760L; -const ISC_STATUS isc_err_max = 1067; +const ISC_STATUS isc_err_max = 1072; #else /* c definitions */ @@ -1942,7 +1947,12 @@ #define isc_max_coll_per_charset 336068829L #define isc_invalid_coll_attr 336068830L #define isc_dyn_wrong_gtt_scope 336068840L +#define isc_dyn_coll_used_table 336068843L +#define isc_dyn_coll_used_domain 336068844L +#define isc_dyn_cannot_del_syscoll 336068845L +#define isc_dyn_cannot_del_def_coll 336068846L #define isc_dyn_table_not_found 336068849L +#define isc_dyn_coll_used_procedure 336068851L #define isc_dyn_scale_too_big 336068852L #define isc_dyn_precision_too_small 336068853L #define isc_dyn_miss_priv_warning 336068855L @@ -2216,7 +2226,7 @@ #define isc_trace_switch_param_miss 337182758L #define isc_trace_param_act_notcompat 337182759L #define isc_trace_mandatory_switch_miss 337182760L -#define isc_err_max 1067 +#define isc_err_max 1072 #endif Modified: firebird/trunk/src/include/gen/msgs.h =================================================================== --- firebird/trunk/src/include/gen/msgs.h 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/include/gen/msgs.h 2010-06-26 01:52:06 UTC (rev 51288) @@ -818,7 +818,12 @@ {336068829, "Maximum number of collations per character set exceeded"}, /* max_coll_per_charset */ {336068830, "Invalid collation attributes"}, /* invalid_coll_attr */ {336068840, "@1 cannot reference @2"}, /* dyn_wrong_gtt_scope */ + {336068843, "Collation @1 is used in table @2 (field name @3) and cannot be dropped"}, /* dyn_coll_used_table */ + {336068844, "Collation @1 is used in domain @2 and cannot be dropped"}, /* dyn_coll_used_domain */ + {336068845, "Cannot delete system collation"}, /* dyn_cannot_del_syscoll */ + {336068846, "Cannot delete default collation of CHARACTER SET @1"}, /* dyn_cannot_del_def_coll */ {336068849, "Table @1 not found"}, /* dyn_table_not_found */ + {336068851, "Collation @1 is used in procedure @2 (parameter name @3) and cannot be dropped"}, /* dyn_coll_used_procedure */ {336068852, "New scale specified for column @1 must be at most @2."}, /* dyn_scale_too_big */ {336068853, "New precision specified for column @1 must be at least @2."}, /* dyn_precision_too_small */ {336068855, "Warning: @1 on @2 is not granted to @3."}, /* dyn_miss_priv_warning */ Modified: firebird/trunk/src/include/gen/sql_code.h =================================================================== --- firebird/trunk/src/include/gen/sql_code.h 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/include/gen/sql_code.h 2010-06-26 01:52:06 UTC (rev 51288) @@ -814,7 +814,12 @@ {336068829, -829}, /* 221 max_coll_per_charset */ {336068830, -829}, /* 222 invalid_coll_attr */ {336068840, -901}, /* 232 dyn_wrong_gtt_scope */ + {336068843, -901}, /* 235 dyn_coll_used_table */ + {336068844, -901}, /* 236 dyn_coll_used_domain */ + {336068845, -607}, /* 237 dyn_cannot_del_syscoll */ + {336068846, -901}, /* 238 dyn_cannot_del_def_coll */ {336068849, -901}, /* 241 dyn_table_not_found */ + {336068851, -901}, /* 243 dyn_coll_used_procedure */ {336068852, -829}, /* 244 dyn_scale_too_big */ {336068853, -829}, /* 245 dyn_precision_too_small */ {336068855, 106}, /* 247 dyn_miss_priv_warning */ Modified: firebird/trunk/src/include/gen/sql_state.h =================================================================== --- firebird/trunk/src/include/gen/sql_state.h 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/include/gen/sql_state.h 2010-06-26 01:52:06 UTC (rev 51288) @@ -814,7 +814,12 @@ {336068829, "2C000"}, // 221 max_coll_per_charset {336068830, "HY000"}, // 222 invalid_coll_attr {336068840, "HY000"}, // 232 dyn_wrong_gtt_scope + {336068843, "HY000"}, // 235 dyn_coll_used_table + {336068844, "HY000"}, // 236 dyn_coll_used_domain + {336068845, "HY000"}, // 237 dyn_cannot_del_syscoll + {336068846, "HY000"}, // 238 dyn_cannot_del_def_coll {336068849, "42000"}, // 241 dyn_table_not_found + {336068851, "HY000"}, // 243 dyn_coll_used_procedure {336068852, "42000"}, // 244 dyn_scale_too_big {336068853, "42000"}, // 245 dyn_precision_too_small {336068855, "42000"}, // 247 dyn_miss_priv_warning Modified: firebird/trunk/src/jrd/Attachment.cpp =================================================================== --- firebird/trunk/src/jrd/Attachment.cpp 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/jrd/Attachment.cpp 2010-06-26 01:52:06 UTC (rev 51288) @@ -264,10 +264,10 @@ // We store in CS_METADATA. void Jrd::Attachment::storeMetaDataBlob(thread_db* tdbb, jrd_tra* transaction, - bid* blobId, const string& text) + bid* blobId, const string& text, USHORT fromCharSet) { UCharBuffer bpb; - BLB_gen_bpb(isc_blob_text, isc_blob_text, att_charset, CS_METADATA, bpb); + BLB_gen_bpb(isc_blob_text, isc_blob_text, fromCharSet, CS_METADATA, bpb); blb* blob = BLB_create2(tdbb, transaction, blobId, bpb.getCount(), bpb.begin()); try Modified: firebird/trunk/src/jrd/Attachment.h =================================================================== --- firebird/trunk/src/jrd/Attachment.h 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/jrd/Attachment.h 2010-06-26 01:52:06 UTC (rev 51288) @@ -195,7 +195,13 @@ Firebird::string stringToUserCharSet(thread_db* tdbb, const Firebird::string& str); void storeMetaDataBlob(thread_db* tdbb, jrd_tra* transaction, bid* blobId, - const Firebird::string& text); + const Firebird::string& text) + { + storeMetaDataBlob(tdbb, transaction, blobId, text, att_charset); + } + + void storeMetaDataBlob(thread_db* tdbb, jrd_tra* transaction, + bid* blobId, const Firebird::string& text, USHORT fromCharSet); void storeBinaryBlob(thread_db* tdbb, jrd_tra* transaction, bid* blobId, const UCHAR* data, unsigned length); Modified: firebird/trunk/src/jrd/drq.h =================================================================== --- firebird/trunk/src/jrd/drq.h 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/jrd/drq.h 2010-06-26 01:52:06 UTC (rev 51288) @@ -160,7 +160,6 @@ drq_m_fun, // modify udf drq_m_view, // modify view drq_s_colls, // store collations - drq_l_charset, // lookup charset drq_dom_is_array, // lookup domain to see if it's an array drq_l_rel_info, // lookup name and flags of one master relation drq_l_rel_info2, // lookup names and flags of all master relations Modified: firebird/trunk/src/jrd/dyn.epp =================================================================== --- firebird/trunk/src/jrd/dyn.epp 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/jrd/dyn.epp 2010-06-26 01:52:06 UTC (rev 51288) @@ -378,14 +378,6 @@ DYN_modify_database(gbl, ptr); break; - case isc_dyn_def_collation: - DYN_define_collation(gbl, ptr); - break; - - case isc_dyn_del_collation: - DYN_delete_collation(gbl, ptr); - break; - case isc_dyn_def_rel: case isc_dyn_def_view: DYN_define_relation(gbl, ptr, verb == isc_dyn_def_view); Modified: firebird/trunk/src/jrd/dyn.h =================================================================== --- firebird/trunk/src/jrd/dyn.h 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/jrd/dyn.h 2010-06-26 01:52:06 UTC (rev 51288) @@ -25,6 +25,10 @@ #define JRD_DYN_H #include "../common/classes/MsgPrint.h" +#include "../common/classes/MetaName.h" +#include "../common/classes/array.h" +#include "../common/classes/fb_string.h" +#include "../jrd/dsc.h" const char* const ALL_PRIVILEGES = "SIUDR"; // all applicable grant/revoke privileges const char* const ALL_PROC_PRIVILEGES = "X"; // all applicable grant/revoke privileges for a procedure @@ -40,6 +44,7 @@ struct bid; class jrd_tra; +class thread_db; class Global { Modified: firebird/trunk/src/jrd/dyn_def.epp =================================================================== --- firebird/trunk/src/jrd/dyn_def.epp 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/jrd/dyn_def.epp 2010-06-26 01:52:06 UTC (rev 51288) @@ -108,287 +108,6 @@ static void make_relation_scope_name(const TEXT*, const rel_t, Firebird::string&); -void DYN_define_collation( Global* gbl, const UCHAR** ptr) -{ -/************************************** - * - * D Y N _ d e f i n e _ c o l l a t i o n - * - ************************************** - * - * Functional description - * Define a collation. - * - **************************************/ - - thread_db* tdbb = JRD_get_thread_data(); - Jrd::Attachment* attachment = tdbb->getAttachment(); - - MetaName collation_name; - MetaName charsetName; - - GET_STRING(ptr, collation_name); - - DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE, - DDL_TRIGGER_CREATE_COLLATION, collation_name, gbl->sqlText); - - AutoCacheRequest request(tdbb, drq_s_colls, DYN_REQUESTS); - - bool b_ending_store = false; - - try - { - STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) - X IN RDB$COLLATIONS - { - CharSet* cs = NULL; - SubtypeInfo info; - USHORT attributes_on = 0; - USHORT attributes_off = 0; - SSHORT specific_attributes_charset = CS_NONE; - UCharBuffer specific_attributes; - - X.RDB$SYSTEM_FLAG = 0; - X.RDB$SYSTEM_FLAG.NULL = FALSE; - X.RDB$SPECIFIC_ATTRIBUTES.NULL = TRUE; - X.RDB$BASE_COLLATION_NAME.NULL = TRUE; - - while (**ptr != isc_dyn_end) - { - switch (*(*ptr)++) - { - case isc_dyn_coll_for_charset: - { - X.RDB$CHARACTER_SET_ID.NULL = FALSE; - X.RDB$CHARACTER_SET_ID = DYN_get_number(ptr); - - cs = INTL_charset_lookup(tdbb, X.RDB$CHARACTER_SET_ID); - - AutoCacheRequest request2(tdbb, drq_l_charset, DYN_REQUESTS); - - FOR(REQUEST_HANDLE request2 - TRANSACTION_HANDLE gbl->gbl_transaction) - CS IN RDB$CHARACTER_SETS - WITH CS.RDB$CHARACTER_SET_ID EQ X.RDB$CHARACTER_SET_ID - { - charsetName = CS.RDB$CHARACTER_SET_NAME; - } - END_FOR - - break; - } - - case isc_dyn_coll_from: - if (!MET_get_char_coll_subtype_info(tdbb, DYN_get_number(ptr), &info)) - break; - - fb_assert(cs); - if (cs) - { - if (info.specificAttributes.getCount() != 0) - { - UCharBuffer temp; - ULONG size = info.specificAttributes.getCount() * cs->maxBytesPerChar(); - - size = INTL_convert_bytes(tdbb, X.RDB$CHARACTER_SET_ID, - temp.getBuffer(size), size, - CS_METADATA, info.specificAttributes.begin(), - info.specificAttributes.getCount(), ERR_post); - temp.shrink(size); - info.specificAttributes = temp; - } - } - - X.RDB$BASE_COLLATION_NAME.NULL = FALSE; - strcpy(X.RDB$BASE_COLLATION_NAME, info.baseCollationName.c_str()); - - break; - - case isc_dyn_coll_from_external: - GET_STRING(ptr, X.RDB$BASE_COLLATION_NAME); - X.RDB$BASE_COLLATION_NAME.NULL = FALSE; - break; - - case isc_dyn_coll_attribute: - { - const SSHORT attr = DYN_get_number(ptr); - - if (attr >= 0) - { - attributes_on |= attr; - attributes_off &= ~attr; - } - else - { - attributes_on &= ~(-attr); - attributes_off |= -attr; - } - - break; - } - - // ASF: Our DDL strings is very weak. - // I've added isc_dyn_coll_specific_attributes_charset to pass the character set of a string. - // It may be the connection charset or some charset specified with INTRODUCER. - // Better approach is to pass DYN strings (including delimited identifiers) with the - // charset and reading it converting to CS_METADATA. - case isc_dyn_coll_specific_attributes_charset: - specific_attributes_charset = DYN_get_number(ptr); - break; - - case isc_dyn_coll_specific_attributes: - GET_STRING(ptr, specific_attributes); - - fb_assert(cs); - if (cs) - { - if (specific_attributes.getCount() != 0) - { - UCharBuffer temp; - ULONG size = specific_attributes.getCount() * cs->maxBytesPerChar(); - - size = INTL_convert_bytes(tdbb, X.RDB$CHARACTER_SET_ID, - temp.getBuffer(size), size, - specific_attributes_charset, specific_attributes.begin(), - specific_attributes.getCount(), ERR_post); - temp.shrink(size); - specific_attributes = temp; - } - } - - break; - - default: - DYN_unsupported_verb(); - } - } - - strcpy(X.RDB$COLLATION_NAME, collation_name.c_str()); - - info.charsetName = charsetName.c_str(); - info.collationName = X.RDB$COLLATION_NAME; - if (X.RDB$BASE_COLLATION_NAME.NULL) - info.baseCollationName = info.collationName; - else - info.baseCollationName = X.RDB$BASE_COLLATION_NAME; - info.ignoreAttributes = false; - - if (!IntlManager::collationInstalled(info.baseCollationName.c_str(), - info.charsetName.c_str())) - { - DYN_error_punt(false, 223, - SafeArg() << info.baseCollationName.c_str() << info.charsetName.c_str()); - // msg: 223: "Collation @1 not installed for character set @2" - } - - fb_assert(cs); - if (cs) - { - IntlUtil::SpecificAttributesMap map; - - if (!IntlUtil::parseSpecificAttributes( - cs, info.specificAttributes.getCount(), info.specificAttributes.begin(), &map) || - !IntlUtil::parseSpecificAttributes( - cs, specific_attributes.getCount(), specific_attributes.begin(), &map)) - { - DYN_error_punt(false, 222); - // msg: 222: "Invalid collation attributes" - } - - const string s = IntlUtil::generateSpecificAttributes(cs, map); - string newSpecificAttributes; - - if (!IntlManager::setupCollationAttributes( - info.baseCollationName.c_str(), info.charsetName.c_str(), s, - newSpecificAttributes)) - { - DYN_error_punt(false, 222); - // msg: 222: "Invalid collation attributes" - } - - memcpy(info.specificAttributes.getBuffer(newSpecificAttributes.length()), - newSpecificAttributes.begin(), newSpecificAttributes.length()); - } - - info.attributes = (info.attributes | attributes_on) & (~attributes_off); - X.RDB$COLLATION_ATTRIBUTES = info.attributes; - - if (info.specificAttributes.getCount() != 0) - { - X.RDB$SPECIFIC_ATTRIBUTES.NULL = FALSE; - - UCHAR bpb[] = {isc_bpb_version1, - isc_bpb_source_type, 1, isc_blob_text, isc_bpb_source_interp, 1, 0, - isc_bpb_target_type, 1, isc_blob_text, isc_bpb_target_interp, 1, 0}; - - bpb[6] = X.RDB$CHARACTER_SET_ID; // from charset - bpb[12] = CS_METADATA; // to charset - - blb* blob = BLB_create2(tdbb, gbl->gbl_transaction, &X.RDB$SPECIFIC_ATTRIBUTES, - sizeof(bpb), bpb); - BLB_put_segment(tdbb, blob, info.specificAttributes.begin(), - info.specificAttributes.getCount()); - BLB_close(tdbb, blob); - } - - // Do not allow invalid attributes here. - if (!INTL_texttype_validate(tdbb, &info)) - { - DYN_error_punt(false, 222); - // msg: 222: "Invalid collation attributes" - } - - // ASF: User collations are created with the last number available, - // to minimize the possibility of conflicts with future system collations. - // The greater available number is 126 to avoid signed/unsigned problems. - - X.RDB$COLLATION_ID.NULL = TRUE; - X.RDB$COLLATION_ID = 126; - - AutoCacheRequest request2(tdbb, drq_l_max_coll_id, DYN_REQUESTS); - - FOR(REQUEST_HANDLE request2) - Y IN RDB$COLLATIONS - WITH Y.RDB$CHARACTER_SET_ID = X.RDB$CHARACTER_SET_ID AND - Y.RDB$COLLATION_ID NOT MISSING - SORTED BY DESCENDING Y.RDB$COLLATION_ID - { - if (Y.RDB$COLLATION_ID + 1 <= X.RDB$COLLATION_ID) - { - X.RDB$COLLATION_ID.NULL = FALSE; - break; - } - else - X.RDB$COLLATION_ID = Y.RDB$COLLATION_ID - 1; - } - END_FOR - - if (X.RDB$COLLATION_ID.NULL) - { - ERR_post(Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_max_coll_per_charset)); - } - - b_ending_store = true; - } - END_STORE - } - catch (const Exception& ex) - { - Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); - if (b_ending_store) - { - DYN_error_punt(true, 219); - // msg 219: "DEFINE COLLATION failed" - } - throw; - } - - DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_AFTER, - DDL_TRIGGER_CREATE_COLLATION, collation_name, gbl->sqlText); -} - - void DYN_define_constraint(Global* gbl, const UCHAR** ptr, const Firebird::MetaName* relation_name, Modified: firebird/trunk/src/jrd/dyn_del.epp =================================================================== --- firebird/trunk/src/jrd/dyn_del.epp 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/jrd/dyn_del.epp 2010-06-26 01:52:06 UTC (rev 51288) @@ -79,134 +79,6 @@ static bool delete_index_segment_records(Global*, const Firebird::MetaName&); -void DYN_delete_collation(Global* gbl, const UCHAR** ptr) -{ -/************************************** - * - * D Y N _ d e l e t e _ c o l l a t i o n - * - ************************************** - * - * Functional description - * Execute a dynamic ddl statement that - * deletes a collation from rdb$collations. - * - **************************************/ - thread_db* tdbb = JRD_get_thread_data(); - - bool found = false; - Firebird::MetaName collName; - - try - { - GET_STRING(ptr, collName); - - AutoCacheRequest request(tdbb, drq_e_colls, DYN_REQUESTS); - - FOR (REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) - COLL IN RDB$COLLATIONS - CROSS CS IN RDB$CHARACTER_SETS - WITH COLL.RDB$COLLATION_NAME EQ collName.c_str() AND - CS.RDB$CHARACTER_SET_ID EQ COLL.RDB$CHARACTER_SET_ID - { - DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE, - DDL_TRIGGER_DROP_COLLATION, collName, gbl->sqlText); - - if (COLL.RDB$SYSTEM_FLAG == 1) - { - DYN_error_punt(false, 237); - // msg 237: "Cannot delete system collation" - } - - if (COLL.RDB$COLLATION_ID == 0 || - (!CS.RDB$DEFAULT_COLLATE_NAME.NULL && - Firebird::MetaName(COLL.RDB$COLLATION_NAME) == Firebird::MetaName(CS.RDB$DEFAULT_COLLATE_NAME))) - { - fb_utils::exact_name_limit(CS.RDB$CHARACTER_SET_NAME, - sizeof(CS.RDB$CHARACTER_SET_NAME)); - - DYN_error_punt(false, 238, CS.RDB$CHARACTER_SET_NAME); - // msg 238: "Cannot delete default collation of CHARACTER SET %s" - } - - found = true; - fb_utils::exact_name_limit(COLL.RDB$COLLATION_NAME, - sizeof(COLL.RDB$COLLATION_NAME)); - - AutoCacheRequest request2(tdbb, drq_l_rfld_coll, DYN_REQUESTS); - - FOR (REQUEST_HANDLE request2 TRANSACTION_HANDLE gbl->gbl_transaction) - RF IN RDB$RELATION_FIELDS CROSS F IN RDB$FIELDS - WITH RF.RDB$FIELD_SOURCE EQ F.RDB$FIELD_NAME AND - F.RDB$CHARACTER_SET_ID EQ COLL.RDB$CHARACTER_SET_ID AND - RF.RDB$COLLATION_ID EQ COLL.RDB$COLLATION_ID - { - fb_utils::exact_name_limit(RF.RDB$RELATION_NAME, sizeof(RF.RDB$RELATION_NAME)); - fb_utils::exact_name_limit(RF.RDB$FIELD_NAME, sizeof(RF.RDB$FIELD_NAME)); - - DYN_error_punt(false, 235, SafeArg() << COLL.RDB$COLLATION_NAME << - RF.RDB$RELATION_NAME << RF.RDB$FIELD_NAME); - // msg 235: "Collation %s is used in table %s (field name %s) and cannot be dropped" - } - END_FOR - - request2.reset(tdbb, drq_l_prm_coll, DYN_REQUESTS); - - FOR (REQUEST_HANDLE request2 TRANSACTION_HANDLE gbl->gbl_transaction) - PRM IN RDB$PROCEDURE_PARAMETERS CROSS F IN RDB$FIELDS - WITH PRM.RDB$FIELD_SOURCE EQ F.RDB$FIELD_NAME AND - F.RDB$CHARACTER_SET_ID EQ COLL.RDB$CHARACTER_SET_ID AND - PRM.RDB$COLLATION_ID EQ COLL.RDB$COLLATION_ID - { - fb_utils::exact_name_limit(PRM.RDB$PARAMETER_NAME, sizeof(PRM.RDB$PARAMETER_NAME)); - - DYN_error_punt(false, 243, SafeArg() << - COLL.RDB$COLLATION_NAME << - QualifiedName(PRM.RDB$PROCEDURE_NAME, - (PRM.RDB$PACKAGE_NAME.NULL ? NULL : PRM.RDB$PACKAGE_NAME)).toString().c_str() << - PRM.RDB$PARAMETER_NAME); - // msg 243: "Collation %s is used in procedure %s (parameter name %s) and cannot be dropped" - } - END_FOR - - request2.reset(tdbb, drq_l_fld_coll, DYN_REQUESTS); - - FOR (REQUEST_HANDLE request2 TRANSACTION_HANDLE gbl->gbl_transaction) - F IN RDB$FIELDS - WITH F.RDB$CHARACTER_SET_ID EQ COLL.RDB$CHARACTER_SET_ID AND - F.RDB$COLLATION_ID EQ COLL.RDB$COLLATION_ID - { - fb_utils::exact_name_limit(F.RDB$FIELD_NAME, sizeof(F.RDB$FIELD_NAME)); - - DYN_error_punt(false, 236, SafeArg() << COLL.RDB$COLLATION_NAME << F.RDB$FIELD_NAME); - // msg 236: "Collation %s is used in domain %s and cannot be dropped" - } - END_FOR - - ERASE COLL; - } - END_FOR - } - catch (const Firebird::Exception& ex) - { - Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); - DYN_error_punt(true, 233); - // msg 234: "ERASE RDB$COLLATIONS failed" - } - - if (found) - { - DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_AFTER, - DDL_TRIGGER_DROP_COLLATION, collName, gbl->sqlText); - } - else - { - DYN_error_punt(false, 152, collName.c_str()); - // msg 152: "Collation %s not found" - } -} - - void DYN_delete_constraint (Global* gbl, const UCHAR** ptr, const Firebird::MetaName* relation) { /************************************** Modified: firebird/trunk/src/jrd/dyn_df_proto.h =================================================================== --- firebird/trunk/src/jrd/dyn_df_proto.h 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/jrd/dyn_df_proto.h 2010-06-26 01:52:06 UTC (rev 51288) @@ -24,7 +24,6 @@ #ifndef JRD_DYN_DF_PROTO_H #define JRD_DYN_DF_PROTO_H -void DYN_define_collation(Jrd::Global*, const UCHAR**); void DYN_define_constraint(Jrd::Global*, const UCHAR**, const Firebird::MetaName*, Firebird::MetaName*); void DYN_define_dimension(Jrd::Global*, const UCHAR**, const Firebird::MetaName*, Firebird::MetaName*); void DYN_define_exception(Jrd::Global*, const UCHAR**); Modified: firebird/trunk/src/jrd/dyn_dl_proto.h =================================================================== --- firebird/trunk/src/jrd/dyn_dl_proto.h 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/jrd/dyn_dl_proto.h 2010-06-26 01:52:06 UTC (rev 51288) @@ -24,7 +24,6 @@ #ifndef JRD_DYN_DL_PROTO_H #define JRD_DYN_DL_PROTO_H -void DYN_delete_collation(Jrd::Global*, const UCHAR**); void DYN_delete_constraint(Jrd::Global*, const UCHAR**, const Firebird::MetaName*); void DYN_delete_dimensions(Jrd::Global*, const UCHAR**); //, const Firebird::MetaName*, Firebird::MetaName*); void DYN_delete_exception(Jrd::Global*, const UCHAR**); Modified: firebird/trunk/src/msgs/messages2.sql =================================================================== --- firebird/trunk/src/msgs/messages2.sql 2010-06-26 01:24:31 UTC (rev 51287) +++ firebird/trunk/src/msgs/messages2.sql 2010-06-26 01:52:06 UTC (rev 51288) @@ -1798,15 +1798,15 @@ ('dyn_wrong_gtt_scope', 'DYN_define_constraint', 'dyn_def.e', NULL, 8, 232, NULL, '@1 cannot reference @2', NULL, NULL); (NULL, 'dyn_mod.epp', 'DYN_modify_sql_field', NULL, 8, 233, NULL, 'Local column @1 is computed, cannot set a default value', NULL, NULL); ('del_coll_fail', 'DYN_delete_collation', 'dyn_del.epp', NULL, 8, 234, NULL, 'ERASE RDB$COLLATIONS failed', NULL, NULL); -(NULL, NULL, 'dyn_del.epp', NULL, 8, 235, NULL, 'Collation @1 is used in table @2 (field name @3) and cannot be dropped', NULL, NULL); -(NULL, NULL, 'dyn_del.epp', NULL, 8, 236, NULL, 'Collation @1 is used in domain @2 and cannot be dropped', NULL, NULL); -(NULL, 'DYN_delete_collation', 'dyn_del.epp', NULL, 8, 237, NULL, 'Cannot delete system collation', NULL, NULL); -(NULL, 'DYN_delete_collation', 'dyn_del.epp', NULL, 8, 238, NULL, 'Cannot delete default collation of CHARACTER SET @1', NULL, NULL); +('dyn_coll_used_table', NULL, 'dyn_del.epp', NULL, 8, 235, NULL, 'Collation @1 is used in table @2 (field name @3) and cannot be dropped', NULL, NULL); +('dyn_coll_used_domain', NULL, 'dyn_del.epp', NULL, 8, 236, NULL, 'Collation @1 is used in domain @2 and cannot be dropped', NULL, NULL); +('dyn_cannot_del_syscoll', 'DYN_delete_collation', 'dyn_del.epp', NULL, 8, 237, NULL, 'Cannot delete system collation', NULL, NULL); +('dyn_cannot_del_def_coll', 'DYN_delete_collation', 'dyn_del.epp', NULL, 8, 238, NULL, 'Cannot delete default collation of CHARACTER SET @1', NULL, NULL); (NULL, NULL, 'dyn_del.epp', NULL, 8, 239, NULL, 'Domain @1 is used in procedure @2 (parameter name @3) and cannot be dropped', NULL, NULL); (NULL, 'DYN_define_index', 'dyn_def.epp', NULL, 8, 240, NULL, 'Field @1 cannot be used twice in index @2', NULL, NULL); ('dyn_table_not_found', 'DYN_define_index', 'dyn_def.epp', NULL, 8, 241, NULL, 'Table @1 not found', NULL, NULL); (NULL, 'DYN_define_index', 'dyn_def.epp', NULL, 8, 242, NULL, 'attempt to reference a view (@1) in a foreign key', NULL, NULL); -(NULL, 'DYN_delete_collation', 'dyn_del.epp', NULL, 8, 243, NULL, 'Collation @1 is used in procedure @2 (parameter name @3) and cannot be dropped', NULL, NULL); +('dyn_coll_used_procedure', 'DYN_delete_collation', 'dyn_del.epp', NULL, 8, 243, NULL, 'Collation @1 is used in procedure @2 (parameter name @3) and cannot be dropped', NULL, NULL); -- Do not change the arguments of the previous DYN messages. -- Write the new DYN messages h... [truncated message content] |
From: <asf...@us...> - 2010-06-27 03:47:49
|
Revision: 51295 http://firebird.svn.sourceforge.net/firebird/?rev=51295&view=rev Author: asfernandes Date: 2010-06-27 03:47:40 +0000 (Sun, 27 Jun 2010) Log Message: ----------- MSVC10 support Modified Paths: -------------- firebird/trunk/builds/win32/setenvvar.bat firebird/trunk/src/jrd/gds.cpp firebird/trunk/src/jrd/os/win32/mod_loader.cpp Added Paths: ----------- firebird/trunk/builds/win32/msvc10/ firebird/trunk/builds/win32/msvc10/DllNoEmbedManifest.props firebird/trunk/builds/win32/msvc10/Firebird2.sln firebird/trunk/builds/win32/msvc10/Firebird2Boot.sln firebird/trunk/builds/win32/msvc10/Firebird2_Examples.sln firebird/trunk/builds/win32/msvc10/alice.vcxproj firebird/trunk/builds/win32/msvc10/alice.vcxproj.filters firebird/trunk/builds/win32/msvc10/btyacc.vcxproj firebird/trunk/builds/win32/msvc10/btyacc.vcxproj.filters firebird/trunk/builds/win32/msvc10/build_msg.vcxproj firebird/trunk/builds/win32/msvc10/build_msg.vcxproj.filters firebird/trunk/builds/win32/msvc10/burp.vcxproj firebird/trunk/builds/win32/msvc10/burp.vcxproj.filters firebird/trunk/builds/win32/msvc10/codes.vcxproj firebird/trunk/builds/win32/msvc10/codes.vcxproj.filters firebird/trunk/builds/win32/msvc10/common.vcxproj firebird/trunk/builds/win32/msvc10/common.vcxproj.filters firebird/trunk/builds/win32/msvc10/common_classic.vcxproj firebird/trunk/builds/win32/msvc10/common_classic.vcxproj.filters firebird/trunk/builds/win32/msvc10/common_static.vcxproj firebird/trunk/builds/win32/msvc10/common_static.vcxproj.filters firebird/trunk/builds/win32/msvc10/config.vcxproj firebird/trunk/builds/win32/msvc10/config.vcxproj.filters firebird/trunk/builds/win32/msvc10/dsql_server.vcxproj firebird/trunk/builds/win32/msvc10/dsql_server.vcxproj.filters firebird/trunk/builds/win32/msvc10/dsql_server_classic.vcxproj firebird/trunk/builds/win32/msvc10/dsql_server_classic.vcxproj.filters firebird/trunk/builds/win32/msvc10/empbuild.vcxproj firebird/trunk/builds/win32/msvc10/empbuild.vcxproj.filters firebird/trunk/builds/win32/msvc10/engine.vcxproj firebird/trunk/builds/win32/msvc10/engine.vcxproj.filters firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj.filters firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj.filters firebird/trunk/builds/win32/msvc10/fb2control.vcxproj firebird/trunk/builds/win32/msvc10/fb2control.vcxproj.filters firebird/trunk/builds/win32/msvc10/fb_inet_server.vcxproj firebird/trunk/builds/win32/msvc10/fb_inet_server.vcxproj.filters firebird/trunk/builds/win32/msvc10/fb_lock_print.vcxproj firebird/trunk/builds/win32/msvc10/fb_lock_print.vcxproj.filters firebird/trunk/builds/win32/msvc10/fbclient.vcxproj firebird/trunk/builds/win32/msvc10/fbclient.vcxproj.filters firebird/trunk/builds/win32/msvc10/fbembed.vcxproj firebird/trunk/builds/win32/msvc10/fbembed.vcxproj.filters firebird/trunk/builds/win32/msvc10/fbguard.vcxproj firebird/trunk/builds/win32/msvc10/fbguard.vcxproj.filters firebird/trunk/builds/win32/msvc10/fbrmclib.vcxproj firebird/trunk/builds/win32/msvc10/fbrmclib.vcxproj.filters firebird/trunk/builds/win32/msvc10/fbserver.vcxproj firebird/trunk/builds/win32/msvc10/fbserver.vcxproj.filters firebird/trunk/builds/win32/msvc10/fbsvcmgr.vcxproj firebird/trunk/builds/win32/msvc10/fbsvcmgr.vcxproj.filters firebird/trunk/builds/win32/msvc10/fbtrace.vcxproj firebird/trunk/builds/win32/msvc10/fbtrace.vcxproj.filters firebird/trunk/builds/win32/msvc10/fbtracemgr.vcxproj firebird/trunk/builds/win32/msvc10/fbtracemgr.vcxproj.filters firebird/trunk/builds/win32/msvc10/fbudf.vcxproj firebird/trunk/builds/win32/msvc10/fbudf.vcxproj.filters firebird/trunk/builds/win32/msvc10/firebird2.props firebird/trunk/builds/win32/msvc10/firebird2debug.props firebird/trunk/builds/win32/msvc10/firebird2release.props firebird/trunk/builds/win32/msvc10/gbak.vcxproj firebird/trunk/builds/win32/msvc10/gbak.vcxproj.filters firebird/trunk/builds/win32/msvc10/gbak_embed.vcxproj firebird/trunk/builds/win32/msvc10/gbak_embed.vcxproj.filters firebird/trunk/builds/win32/msvc10/gfix.vcxproj firebird/trunk/builds/win32/msvc10/gfix.vcxproj.filters firebird/trunk/builds/win32/msvc10/gpre.vcxproj firebird/trunk/builds/win32/msvc10/gpre.vcxproj.filters firebird/trunk/builds/win32/msvc10/gpre_boot.vcxproj firebird/trunk/builds/win32/msvc10/gpre_boot.vcxproj.filters firebird/trunk/builds/win32/msvc10/gpre_embed.vcxproj firebird/trunk/builds/win32/msvc10/gpre_embed.vcxproj.filters firebird/trunk/builds/win32/msvc10/gsec.vcxproj firebird/trunk/builds/win32/msvc10/gsec.vcxproj.filters firebird/trunk/builds/win32/msvc10/gsplit.vcxproj firebird/trunk/builds/win32/msvc10/gsplit.vcxproj.filters firebird/trunk/builds/win32/msvc10/gstat.vcxproj firebird/trunk/builds/win32/msvc10/gstat.vcxproj.filters firebird/trunk/builds/win32/msvc10/ib_udf.vcxproj firebird/trunk/builds/win32/msvc10/ib_udf.vcxproj.filters firebird/trunk/builds/win32/msvc10/ib_util.vcxproj firebird/trunk/builds/win32/msvc10/ib_util.vcxproj.filters firebird/trunk/builds/win32/msvc10/instclient.vcxproj firebird/trunk/builds/win32/msvc10/instclient.vcxproj.filters firebird/trunk/builds/win32/msvc10/instreg.vcxproj firebird/trunk/builds/win32/msvc10/instreg.vcxproj.filters firebird/trunk/builds/win32/msvc10/instsvc.vcxproj firebird/trunk/builds/win32/msvc10/instsvc.vcxproj.filters firebird/trunk/builds/win32/msvc10/intl.vcxproj firebird/trunk/builds/win32/msvc10/intl.vcxproj.filters firebird/trunk/builds/win32/msvc10/intlbuild.vcxproj firebird/trunk/builds/win32/msvc10/intlbuild.vcxproj.filters firebird/trunk/builds/win32/msvc10/isql.vcxproj firebird/trunk/builds/win32/msvc10/isql.vcxproj.filters firebird/trunk/builds/win32/msvc10/isql_embed.vcxproj firebird/trunk/builds/win32/msvc10/isql_embed.vcxproj.filters firebird/trunk/builds/win32/msvc10/lock.vcxproj firebird/trunk/builds/win32/msvc10/lock.vcxproj.filters firebird/trunk/builds/win32/msvc10/lock_classic.vcxproj firebird/trunk/builds/win32/msvc10/lock_classic.vcxproj.filters firebird/trunk/builds/win32/msvc10/nbackup.vcxproj firebird/trunk/builds/win32/msvc10/nbackup.vcxproj.filters firebird/trunk/builds/win32/msvc10/qli.vcxproj firebird/trunk/builds/win32/msvc10/qli.vcxproj.filters firebird/trunk/builds/win32/msvc10/remote.vcxproj firebird/trunk/builds/win32/msvc10/remote.vcxproj.filters firebird/trunk/builds/win32/msvc10/udr_engine.vcxproj firebird/trunk/builds/win32/msvc10/udr_engine.vcxproj.filters firebird/trunk/builds/win32/msvc10/udrcpp_example.vcxproj firebird/trunk/builds/win32/msvc10/udrcpp_example.vcxproj.filters firebird/trunk/extern/icu/source/allinone/allinone_10.sln firebird/trunk/extern/icu/source/allinone/firebird2debug.props firebird/trunk/extern/icu/source/allinone/firebird2intl.props firebird/trunk/extern/icu/source/allinone/firebird2release.props firebird/trunk/extern/icu/source/common/common_10.vcxproj firebird/trunk/extern/icu/source/common/common_10.vcxproj.filters firebird/trunk/extern/icu/source/data/makedata_10.vcxproj firebird/trunk/extern/icu/source/data/makedata_10.vcxproj.filters firebird/trunk/extern/icu/source/extra/uconv/uconv_10.vcxproj firebird/trunk/extern/icu/source/extra/uconv/uconv_10.vcxproj.filters firebird/trunk/extern/icu/source/i18n/i18n_10.vcxproj firebird/trunk/extern/icu/source/i18n/i18n_10.vcxproj.filters firebird/trunk/extern/icu/source/io/io_10.vcxproj firebird/trunk/extern/icu/source/io/io_10.vcxproj.filters firebird/trunk/extern/icu/source/layout/layout_10.vcxproj firebird/trunk/extern/icu/source/layout/layout_10.vcxproj.filters firebird/trunk/extern/icu/source/layoutex/layoutex_10.vcxproj firebird/trunk/extern/icu/source/layoutex/layoutex_10.vcxproj.filters firebird/trunk/extern/icu/source/stubdata/stubdata_10.vcxproj firebird/trunk/extern/icu/source/stubdata/stubdata_10.vcxproj.filters firebird/trunk/extern/icu/source/test/cintltst/cintltst_10.vcxproj firebird/trunk/extern/icu/source/test/cintltst/cintltst_10.vcxproj.filters firebird/trunk/extern/icu/source/test/intltest/intltest_10.vcxproj firebird/trunk/extern/icu/source/test/intltest/intltest_10.vcxproj.filters firebird/trunk/extern/icu/source/test/iotest/iotest_10.vcxproj firebird/trunk/extern/icu/source/test/iotest/iotest_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/ctestfw/ctestfw_10.vcxproj firebird/trunk/extern/icu/source/tools/ctestfw/ctestfw_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/genbrk/genbrk_10.vcxproj firebird/trunk/extern/icu/source/tools/genbrk/genbrk_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/genccode/genccode_10.vcxproj firebird/trunk/extern/icu/source/tools/genccode/genccode_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/gencmn/decmn_10.vcxproj firebird/trunk/extern/icu/source/tools/gencmn/decmn_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/gencmn/gencmn_10.vcxproj firebird/trunk/extern/icu/source/tools/gencmn/gencmn_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/gencnval/gencnval_10.vcxproj firebird/trunk/extern/icu/source/tools/gencnval/gencnval_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/gennames/gennames_10.vcxproj firebird/trunk/extern/icu/source/tools/gennames/gennames_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/gennorm/gennorm_10.vcxproj firebird/trunk/extern/icu/source/tools/gennorm/gennorm_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/genpname/genpname_10.vcxproj firebird/trunk/extern/icu/source/tools/genpname/genpname_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/genprops/genprops_10.vcxproj firebird/trunk/extern/icu/source/tools/genprops/genprops_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/genrb/derb_10.vcxproj firebird/trunk/extern/icu/source/tools/genrb/derb_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/genrb/genrb_10.vcxproj firebird/trunk/extern/icu/source/tools/genrb/genrb_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/gensprep/gensprep_10.vcxproj firebird/trunk/extern/icu/source/tools/gensprep/gensprep_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/gentest/gentest_10.vcxproj firebird/trunk/extern/icu/source/tools/gentest/gentest_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/genuca/genuca_10.vcxproj firebird/trunk/extern/icu/source/tools/genuca/genuca_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/icuswap/icuswap_10.vcxproj firebird/trunk/extern/icu/source/tools/icuswap/icuswap_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/makeconv/makeconv_10.vcxproj firebird/trunk/extern/icu/source/tools/makeconv/makeconv_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/pkgdata/pkgdata_10.vcxproj firebird/trunk/extern/icu/source/tools/pkgdata/pkgdata_10.vcxproj.filters firebird/trunk/extern/icu/source/tools/toolutil/toolutil_10.vcxproj firebird/trunk/extern/icu/source/tools/toolutil/toolutil_10.vcxproj.filters Added: firebird/trunk/builds/win32/msvc10/DllNoEmbedManifest.props =================================================================== --- firebird/trunk/builds/win32/msvc10/DllNoEmbedManifest.props (rev 0) +++ firebird/trunk/builds/win32/msvc10/DllNoEmbedManifest.props 2010-06-27 03:47:40 UTC (rev 51295) @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <GenerateManifest>false</GenerateManifest> + </PropertyGroup> +</Project> \ No newline at end of file Property changes on: firebird/trunk/builds/win32/msvc10/DllNoEmbedManifest.props ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: firebird/trunk/builds/win32/msvc10/Firebird2.sln =================================================================== --- firebird/trunk/builds/win32/msvc10/Firebird2.sln (rev 0) +++ firebird/trunk/builds/win32/msvc10/Firebird2.sln 2010-06-27 03:47:40 UTC (rev 51295) @@ -0,0 +1,423 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "alice", "alice.vcxproj", "{0D616380-1A5A-4230-A80B-021360E4E669}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "burp", "burp.vcxproj", "{D1507562-A363-4685-96AF-B036F5E5E47F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "common.vcxproj", "{15605F44-BFFD-444F-AD4C-55DC9D704465}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common_classic", "common_classic.vcxproj", "{F5746066-8613-4811-B27C-0ED70FF9F0FF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsql_server", "dsql_server.vcxproj", "{520DF501-5775-44FD-BDC6-37753A17696A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsql_server_classic", "dsql_server_classic.vcxproj", "{488199DD-D9F3-41C8-AED6-8AFFFB294CFF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "engine", "engine.vcxproj", "{F8798A49-9D20-451E-A7BD-FEB5237103B5}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "engine_classic", "engine_classic.vcxproj", "{E029E4E2-0C3F-4F7D-BC4C-D9C20F40EB4E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "engine_embed", "engine_embed.vcxproj", "{F55ACA54-70DF-4343-8E16-FA97C757CCF6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fb_inet_server", "fb_inet_server.vcxproj", "{664D4A04-36E0-48EF-8BCA-D5C331EFAA24}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fb_lock_print", "fb_lock_print.vcxproj", "{E8397148-0E9C-449B-9F45-7FB377A08242}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fbclient", "fbclient.vcxproj", "{492E7BDA-8948-408D-A43E-4C0A5B86AFB8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fbembed", "fbembed.vcxproj", "{C5A60E3D-7815-4127-B856-96277BEC1D11}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fbguard", "fbguard.vcxproj", "{BBD83ED3-8A48-4FE8-B4B7-CB27730986B2}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fbserver", "fbserver.vcxproj", "{23EC8DAA-6718-4EF3-979F-89F611C7D504}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fbudf", "fbudf.vcxproj", "{9DC67B05-AC3E-49A3-B0CC-83B25D757445}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gbak", "gbak.vcxproj", "{B732F5D2-B5D9-417F-B156-D790F466CB8E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gfix", "gfix.vcxproj", "{44A9E4AD-B932-4620-B319-431A153BB341}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpre", "gpre.vcxproj", "{D84F0839-28A4-40B2-B5F4-F5E1E7F48FD0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsec", "gsec.vcxproj", "{7043CC61-DEC1-4C6B-86B9-0E911D1094C9}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsplit", "gsplit.vcxproj", "{B7F22B7F-9937-4874-9A8B-6AB4E36E74A5}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gstat", "gstat.vcxproj", "{7E862973-37C4-4202-80E7-490ED4DEDA14}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ib_udf", "ib_udf.vcxproj", "{0D4A2D8E-6461-479E-9399-F7929174E050}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ib_util", "ib_util.vcxproj", "{EABA0FF3-1C4D-4FAB-8418-31C9061F3F0D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "instreg", "instreg.vcxproj", "{19470DE6-1975-4F9B-B1BE-E87A83240B15}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "instsvc", "instsvc.vcxproj", "{72894398-38CA-47A6-95FE-9647DE2BE968}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "intl", "intl.vcxproj", "{DFFA2117-E6A8-4806-BB69-94DAC8F8F42A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "isql", "isql.vcxproj", "{DEE75AD5-F165-40E1-80B2-400E27725D5C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lock", "lock.vcxproj", "{604E1144-1A22-43AF-9A3E-08650EE4EE90}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lock_classic", "lock_classic.vcxproj", "{213C6F21-D83F-48C7-BBB5-B35AB1B706B1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qli", "qli.vcxproj", "{EBB8361B-49D5-43A5-8771-940DF3E308EF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "remote", "remote.vcxproj", "{4BCC693D-1745-45ED-8302-E5E2F979549A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nbackup", "nbackup.vcxproj", "{01A41DFA-8908-4576-A1F1-C8BC7EAE39A1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "config", "config.vcxproj", "{E83187C1-AAC2-445D-B8B2-883EFC10C39A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "instclient", "instclient.vcxproj", "{C6A31374-178C-4680-A404-76BE24D0229B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fb2control", "fb2control.vcxproj", "{1AE02D41-7E24-43CC-9BCB-E4CEB6037D16}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fbrmclib", "fbrmclib.vcxproj", "{FAF9AD25-8238-49E9-9AC9-8C56E190440A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fbsvcmgr", "fbsvcmgr.vcxproj", "{EFB07DBC-36E3-4C54-B941-3CDAFAACF47B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fbtrace", "fbtrace.vcxproj", "{53F75437-15B8-4A5C-86BF-E238CC68FCBC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fbtracemgr", "fbtracemgr.vcxproj", "{58C7E370-0EDD-4F5E-8617-3F5071170205}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "udr_engine", "udr_engine.vcxproj", "{20DEBF08-EF0A-4C94-ADEB-FE9BBA14588B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0D616380-1A5A-4230-A80B-021360E4E669}.Debug|Win32.ActiveCfg = Debug|Win32 + {0D616380-1A5A-4230-A80B-021360E4E669}.Debug|Win32.Build.0 = Debug|Win32 + {0D616380-1A5A-4230-A80B-021360E4E669}.Debug|x64.ActiveCfg = Debug|x64 + {0D616380-1A5A-4230-A80B-021360E4E669}.Debug|x64.Build.0 = Debug|x64 + {0D616380-1A5A-4230-A80B-021360E4E669}.Release|Win32.ActiveCfg = Release|Win32 + {0D616380-1A5A-4230-A80B-021360E4E669}.Release|Win32.Build.0 = Release|Win32 + {0D616380-1A5A-4230-A80B-021360E4E669}.Release|x64.ActiveCfg = Release|x64 + {0D616380-1A5A-4230-A80B-021360E4E669}.Release|x64.Build.0 = Release|x64 + {D1507562-A363-4685-96AF-B036F5E5E47F}.Debug|Win32.ActiveCfg = Debug|Win32 + {D1507562-A363-4685-96AF-B036F5E5E47F}.Debug|Win32.Build.0 = Debug|Win32 + {D1507562-A363-4685-96AF-B036F5E5E47F}.Debug|x64.ActiveCfg = Debug|x64 + {D1507562-A363-4685-96AF-B036F5E5E47F}.Debug|x64.Build.0 = Debug|x64 + {D1507562-A363-4685-96AF-B036F5E5E47F}.Release|Win32.ActiveCfg = Release|Win32 + {D1507562-A363-4685-96AF-B036F5E5E47F}.Release|Win32.Build.0 = Release|Win32 + {D1507562-A363-4685-96AF-B036F5E5E47F}.Release|x64.ActiveCfg = Release|x64 + {D1507562-A363-4685-96AF-B036F5E5E47F}.Release|x64.Build.0 = Release|x64 + {15605F44-BFFD-444F-AD4C-55DC9D704465}.Debug|Win32.ActiveCfg = Debug|Win32 + {15605F44-BFFD-444F-AD4C-55DC9D704465}.Debug|Win32.Build.0 = Debug|Win32 + {15605F44-BFFD-444F-AD4C-55DC9D704465}.Debug|x64.ActiveCfg = Debug|x64 + {15605F44-BFFD-444F-AD4C-55DC9D704465}.Debug|x64.Build.0 = Debug|x64 + {15605F44-BFFD-444F-AD4C-55DC9D704465}.Release|Win32.ActiveCfg = Release|Win32 + {15605F44-BFFD-444F-AD4C-55DC9D704465}.Release|Win32.Build.0 = Release|Win32 + {15605F44-BFFD-444F-AD4C-55DC9D704465}.Release|x64.ActiveCfg = Release|x64 + {15605F44-BFFD-444F-AD4C-55DC9D704465}.Release|x64.Build.0 = Release|x64 + {F5746066-8613-4811-B27C-0ED70FF9F0FF}.Debug|Win32.ActiveCfg = Debug|Win32 + {F5746066-8613-4811-B27C-0ED70FF9F0FF}.Debug|Win32.Build.0 = Debug|Win32 + {F5746066-8613-4811-B27C-0ED70FF9F0FF}.Debug|x64.ActiveCfg = Debug|x64 + {F5746066-8613-4811-B27C-0ED70FF9F0FF}.Debug|x64.Build.0 = Debug|x64 + {F5746066-8613-4811-B27C-0ED70FF9F0FF}.Release|Win32.ActiveCfg = Release|Win32 + {F5746066-8613-4811-B27C-0ED70FF9F0FF}.Release|Win32.Build.0 = Release|Win32 + {F5746066-8613-4811-B27C-0ED70FF9F0FF}.Release|x64.ActiveCfg = Release|x64 + {F5746066-8613-4811-B27C-0ED70FF9F0FF}.Release|x64.Build.0 = Release|x64 + {520DF501-5775-44FD-BDC6-37753A17696A}.Debug|Win32.ActiveCfg = Debug|Win32 + {520DF501-5775-44FD-BDC6-37753A17696A}.Debug|Win32.Build.0 = Debug|Win32 + {520DF501-5775-44FD-BDC6-37753A17696A}.Debug|x64.ActiveCfg = Debug|x64 + {520DF501-5775-44FD-BDC6-37753A17696A}.Debug|x64.Build.0 = Debug|x64 + {520DF501-5775-44FD-BDC6-37753A17696A}.Release|Win32.ActiveCfg = Release|Win32 + {520DF501-5775-44FD-BDC6-37753A17696A}.Release|Win32.Build.0 = Release|Win32 + {520DF501-5775-44FD-BDC6-37753A17696A}.Release|x64.ActiveCfg = Release|x64 + {520DF501-5775-44FD-BDC6-37753A17696A}.Release|x64.Build.0 = Release|x64 + {488199DD-D9F3-41C8-AED6-8AFFFB294CFF}.Debug|Win32.ActiveCfg = Debug|Win32 + {488199DD-D9F3-41C8-AED6-8AFFFB294CFF}.Debug|Win32.Build.0 = Debug|Win32 + {488199DD-D9F3-41C8-AED6-8AFFFB294CFF}.Debug|x64.ActiveCfg = Debug|x64 + {488199DD-D9F3-41C8-AED6-8AFFFB294CFF}.Debug|x64.Build.0 = Debug|x64 + {488199DD-D9F3-41C8-AED6-8AFFFB294CFF}.Release|Win32.ActiveCfg = Release|Win32 + {488199DD-D9F3-41C8-AED6-8AFFFB294CFF}.Release|Win32.Build.0 = Release|Win32 + {488199DD-D9F3-41C8-AED6-8AFFFB294CFF}.Release|x64.ActiveCfg = Release|x64 + {488199DD-D9F3-41C8-AED6-8AFFFB294CFF}.Release|x64.Build.0 = Release|x64 + {F8798A49-9D20-451E-A7BD-FEB5237103B5}.Debug|Win32.ActiveCfg = Debug|Win32 + {F8798A49-9D20-451E-A7BD-FEB5237103B5}.Debug|Win32.Build.0 = Debug|Win32 + {F8798A49-9D20-451E-A7BD-FEB5237103B5}.Debug|x64.ActiveCfg = Debug|x64 + {F8798A49-9D20-451E-A7BD-FEB5237103B5}.Debug|x64.Build.0 = Debug|x64 + {F8798A49-9D20-451E-A7BD-FEB5237103B5}.Release|Win32.ActiveCfg = Release|Win32 + {F8798A49-9D20-451E-A7BD-FEB5237103B5}.Release|Win32.Build.0 = Release|Win32 + {F8798A49-9D20-451E-A7BD-FEB5237103B5}.Release|x64.ActiveCfg = Release|x64 + {F8798A49-9D20-451E-A7BD-FEB5237103B5}.Release|x64.Build.0 = Release|x64 + {E029E4E2-0C3F-4F7D-BC4C-D9C20F40EB4E}.Debug|Win32.ActiveCfg = Debug|Win32 + {E029E4E2-0C3F-4F7D-BC4C-D9C20F40EB4E}.Debug|Win32.Build.0 = Debug|Win32 + {E029E4E2-0C3F-4F7D-BC4C-D9C20F40EB4E}.Debug|x64.ActiveCfg = Debug|x64 + {E029E4E2-0C3F-4F7D-BC4C-D9C20F40EB4E}.Debug|x64.Build.0 = Debug|x64 + {E029E4E2-0C3F-4F7D-BC4C-D9C20F40EB4E}.Release|Win32.ActiveCfg = Release|Win32 + {E029E4E2-0C3F-4F7D-BC4C-D9C20F40EB4E}.Release|Win32.Build.0 = Release|Win32 + {E029E4E2-0C3F-4F7D-BC4C-D9C20F40EB4E}.Release|x64.ActiveCfg = Release|x64 + {E029E4E2-0C3F-4F7D-BC4C-D9C20F40EB4E}.Release|x64.Build.0 = Release|x64 + {F55ACA54-70DF-4343-8E16-FA97C757CCF6}.Debug|Win32.ActiveCfg = Debug|Win32 + {F55ACA54-70DF-4343-8E16-FA97C757CCF6}.Debug|Win32.Build.0 = Debug|Win32 + {F55ACA54-70DF-4343-8E16-FA97C757CCF6}.Debug|x64.ActiveCfg = Debug|x64 + {F55ACA54-70DF-4343-8E16-FA97C757CCF6}.Debug|x64.Build.0 = Debug|x64 + {F55ACA54-70DF-4343-8E16-FA97C757CCF6}.Release|Win32.ActiveCfg = Release|Win32 + {F55ACA54-70DF-4343-8E16-FA97C757CCF6}.Release|Win32.Build.0 = Release|Win32 + {F55ACA54-70DF-4343-8E16-FA97C757CCF6}.Release|x64.ActiveCfg = Release|x64 + {F55ACA54-70DF-4343-8E16-FA97C757CCF6}.Release|x64.Build.0 = Release|x64 + {664D4A04-36E0-48EF-8BCA-D5C331EFAA24}.Debug|Win32.ActiveCfg = Debug|Win32 + {664D4A04-36E0-48EF-8BCA-D5C331EFAA24}.Debug|Win32.Build.0 = Debug|Win32 + {664D4A04-36E0-48EF-8BCA-D5C331EFAA24}.Debug|x64.ActiveCfg = Debug|x64 + {664D4A04-36E0-48EF-8BCA-D5C331EFAA24}.Debug|x64.Build.0 = Debug|x64 + {664D4A04-36E0-48EF-8BCA-D5C331EFAA24}.Release|Win32.ActiveCfg = Release|Win32 + {664D4A04-36E0-48EF-8BCA-D5C331EFAA24}.Release|Win32.Build.0 = Release|Win32 + {664D4A04-36E0-48EF-8BCA-D5C331EFAA24}.Release|x64.ActiveCfg = Release|x64 + {664D4A04-36E0-48EF-8BCA-D5C331EFAA24}.Release|x64.Build.0 = Release|x64 + {E8397148-0E9C-449B-9F45-7FB377A08242}.Debug|Win32.ActiveCfg = Debug|Win32 + {E8397148-0E9C-449B-9F45-7FB377A08242}.Debug|Win32.Build.0 = Debug|Win32 + {E8397148-0E9C-449B-9F45-7FB377A08242}.Debug|x64.ActiveCfg = Debug|x64 + {E8397148-0E9C-449B-9F45-7FB377A08242}.Debug|x64.Build.0 = Debug|x64 + {E8397148-0E9C-449B-9F45-7FB377A08242}.Release|Win32.ActiveCfg = Release|Win32 + {E8397148-0E9C-449B-9F45-7FB377A08242}.Release|Win32.Build.0 = Release|Win32 + {E8397148-0E9C-449B-9F45-7FB377A08242}.Release|x64.ActiveCfg = Release|x64 + {E8397148-0E9C-449B-9F45-7FB377A08242}.Release|x64.Build.0 = Release|x64 + {492E7BDA-8948-408D-A43E-4C0A5B86AFB8}.Debug|Win32.ActiveCfg = Debug|Win32 + {492E7BDA-8948-408D-A43E-4C0A5B86AFB8}.Debug|Win32.Build.0 = Debug|Win32 + {492E7BDA-8948-408D-A43E-4C0A5B86AFB8}.Debug|x64.ActiveCfg = Debug|x64 + {492E7BDA-8948-408D-A43E-4C0A5B86AFB8}.Debug|x64.Build.0 = Debug|x64 + {492E7BDA-8948-408D-A43E-4C0A5B86AFB8}.Release|Win32.ActiveCfg = Release|Win32 + {492E7BDA-8948-408D-A43E-4C0A5B86AFB8}.Release|Win32.Build.0 = Release|Win32 + {492E7BDA-8948-408D-A43E-4C0A5B86AFB8}.Release|x64.ActiveCfg = Release|x64 + {492E7BDA-8948-408D-A43E-4C0A5B86AFB8}.Release|x64.Build.0 = Release|x64 + {C5A60E3D-7815-4127-B856-96277BEC1D11}.Debug|Win32.ActiveCfg = Debug|Win32 + {C5A60E3D-7815-4127-B856-96277BEC1D11}.Debug|Win32.Build.0 = Debug|Win32 + {C5A60E3D-7815-4127-B856-96277BEC1D11}.Debug|x64.ActiveCfg = Debug|x64 + {C5A60E3D-7815-4127-B856-96277BEC1D11}.Debug|x64.Build.0 = Debug|x64 + {C5A60E3D-7815-4127-B856-96277BEC1D11}.Release|Win32.ActiveCfg = Release|Win32 + {C5A60E3D-7815-4127-B856-96277BEC1D11}.Release|Win32.Build.0 = Release|Win32 + {C5A60E3D-7815-4127-B856-96277BEC1D11}.Release|x64.ActiveCfg = Release|x64 + {C5A60E3D-7815-4127-B856-96277BEC1D11}.Release|x64.Build.0 = Release|x64 + {BBD83ED3-8A48-4FE8-B4B7-CB27730986B2}.Debug|Win32.ActiveCfg = Debug|Win32 + {BBD83ED3-8A48-4FE8-B4B7-CB27730986B2}.Debug|Win32.Build.0 = Debug|Win32 + {BBD83ED3-8A48-4FE8-B4B7-CB27730986B2}.Debug|x64.ActiveCfg = Debug|x64 + {BBD83ED3-8A48-4FE8-B4B7-CB27730986B2}.Debug|x64.Build.0 = Debug|x64 + {BBD83ED3-8A48-4FE8-B4B7-CB27730986B2}.Release|Win32.ActiveCfg = Release|Win32 + {BBD83ED3-8A48-4FE8-B4B7-CB27730986B2}.Release|Win32.Build.0 = Release|Win32 + {BBD83ED3-8A48-4FE8-B4B7-CB27730986B2}.Release|x64.ActiveCfg = Release|x64 + {BBD83ED3-8A48-4FE8-B4B7-CB27730986B2}.Release|x64.Build.0 = Release|x64 + {23EC8DAA-6718-4EF3-979F-89F611C7D504}.Debug|Win32.ActiveCfg = Debug|Win32 + {23EC8DAA-6718-4EF3-979F-89F611C7D504}.Debug|Win32.Build.0 = Debug|Win32 + {23EC8DAA-6718-4EF3-979F-89F611C7D504}.Debug|x64.ActiveCfg = Debug|x64 + {23EC8DAA-6718-4EF3-979F-89F611C7D504}.Debug|x64.Build.0 = Debug|x64 + {23EC8DAA-6718-4EF3-979F-89F611C7D504}.Release|Win32.ActiveCfg = Release|Win32 + {23EC8DAA-6718-4EF3-979F-89F611C7D504}.Release|Win32.Build.0 = Release|Win32 + {23EC8DAA-6718-4EF3-979F-89F611C7D504}.Release|x64.ActiveCfg = Release|x64 + {23EC8DAA-6718-4EF3-979F-89F611C7D504}.Release|x64.Build.0 = Release|x64 + {9DC67B05-AC3E-49A3-B0CC-83B25D757445}.Debug|Win32.ActiveCfg = Debug|Win32 + {9DC67B05-AC3E-49A3-B0CC-83B25D757445}.Debug|Win32.Build.0 = Debug|Win32 + {9DC67B05-AC3E-49A3-B0CC-83B25D757445}.Debug|x64.ActiveCfg = Debug|x64 + {9DC67B05-AC3E-49A3-B0CC-83B25D757445}.Debug|x64.Build.0 = Debug|x64 + {9DC67B05-AC3E-49A3-B0CC-83B25D757445}.Release|Win32.ActiveCfg = Release|Win32 + {9DC67B05-AC3E-49A3-B0CC-83B25D757445}.Release|Win32.Build.0 = Release|Win32 + {9DC67B05-AC3E-49A3-B0CC-83B25D757445}.Release|x64.ActiveCfg = Release|x64 + {9DC67B05-AC3E-49A3-B0CC-83B25D757445}.Release|x64.Build.0 = Release|x64 + {B732F5D2-B5D9-417F-B156-D790F466CB8E}.Debug|Win32.ActiveCfg = Debug|Win32 + {B732F5D2-B5D9-417F-B156-D790F466CB8E}.Debug|Win32.Build.0 = Debug|Win32 + {B732F5D2-B5D9-417F-B156-D790F466CB8E}.Debug|x64.ActiveCfg = Debug|x64 + {B732F5D2-B5D9-417F-B156-D790F466CB8E}.Debug|x64.Build.0 = Debug|x64 + {B732F5D2-B5D9-417F-B156-D790F466CB8E}.Release|Win32.ActiveCfg = Release|Win32 + {B732F5D2-B5D9-417F-B156-D790F466CB8E}.Release|Win32.Build.0 = Release|Win32 + {B732F5D2-B5D9-417F-B156-D790F466CB8E}.Release|x64.ActiveCfg = Release|x64 + {B732F5D2-B5D9-417F-B156-D790F466CB8E}.Release|x64.Build.0 = Release|x64 + {44A9E4AD-B932-4620-B319-431A153BB341}.Debug|Win32.ActiveCfg = Debug|Win32 + {44A9E4AD-B932-4620-B319-431A153BB341}.Debug|Win32.Build.0 = Debug|Win32 + {44A9E4AD-B932-4620-B319-431A153BB341}.Debug|x64.ActiveCfg = Debug|x64 + {44A9E4AD-B932-4620-B319-431A153BB341}.Debug|x64.Build.0 = Debug|x64 + {44A9E4AD-B932-4620-B319-431A153BB341}.Release|Win32.ActiveCfg = Release|Win32 + {44A9E4AD-B932-4620-B319-431A153BB341}.Release|Win32.Build.0 = Release|Win32 + {44A9E4AD-B932-4620-B319-431A153BB341}.Release|x64.ActiveCfg = Release|x64 + {44A9E4AD-B932-4620-B319-431A153BB341}.Release|x64.Build.0 = Release|x64 + {D84F0839-28A4-40B2-B5F4-F5E1E7F48FD0}.Debug|Win32.ActiveCfg = Debug|Win32 + {D84F0839-28A4-40B2-B5F4-F5E1E7F48FD0}.Debug|Win32.Build.0 = Debug|Win32 + {D84F0839-28A4-40B2-B5F4-F5E1E7F48FD0}.Debug|x64.ActiveCfg = Debug|x64 + {D84F0839-28A4-40B2-B5F4-F5E1E7F48FD0}.Debug|x64.Build.0 = Debug|x64 + {D84F0839-28A4-40B2-B5F4-F5E1E7F48FD0}.Release|Win32.ActiveCfg = Release|Win32 + {D84F0839-28A4-40B2-B5F4-F5E1E7F48FD0}.Release|Win32.Build.0 = Release|Win32 + {D84F0839-28A4-40B2-B5F4-F5E1E7F48FD0}.Release|x64.ActiveCfg = Release|x64 + {D84F0839-28A4-40B2-B5F4-F5E1E7F48FD0}.Release|x64.Build.0 = Release|x64 + {7043CC61-DEC1-4C6B-86B9-0E911D1094C9}.Debug|Win32.ActiveCfg = Debug|Win32 + {7043CC61-DEC1-4C6B-86B9-0E911D1094C9}.Debug|Win32.Build.0 = Debug|Win32 + {7043CC61-DEC1-4C6B-86B9-0E911D1094C9}.Debug|x64.ActiveCfg = Debug|x64 + {7043CC61-DEC1-4C6B-86B9-0E911D1094C9}.Debug|x64.Build.0 = Debug|x64 + {7043CC61-DEC1-4C6B-86B9-0E911D1094C9}.Release|Win32.ActiveCfg = Release|Win32 + {7043CC61-DEC1-4C6B-86B9-0E911D1094C9}.Release|Win32.Build.0 = Release|Win32 + {7043CC61-DEC1-4C6B-86B9-0E911D1094C9}.Release|x64.ActiveCfg = Release|x64 + {7043CC61-DEC1-4C6B-86B9-0E911D1094C9}.Release|x64.Build.0 = Release|x64 + {B7F22B7F-9937-4874-9A8B-6AB4E36E74A5}.Debug|Win32.ActiveCfg = Debug|Win32 + {B7F22B7F-9937-4874-9A8B-6AB4E36E74A5}.Debug|Win32.Build.0 = Debug|Win32 + {B7F22B7F-9937-4874-9A8B-6AB4E36E74A5}.Debug|x64.ActiveCfg = Debug|x64 + {B7F22B7F-9937-4874-9A8B-6AB4E36E74A5}.Debug|x64.Build.0 = Debug|x64 + {B7F22B7F-9937-4874-9A8B-6AB4E36E74A5}.Release|Win32.ActiveCfg = Release|Win32 + {B7F22B7F-9937-4874-9A8B-6AB4E36E74A5}.Release|Win32.Build.0 = Release|Win32 + {B7F22B7F-9937-4874-9A8B-6AB4E36E74A5}.Release|x64.ActiveCfg = Release|x64 + {B7F22B7F-9937-4874-9A8B-6AB4E36E74A5}.Release|x64.Build.0 = Release|x64 + {7E862973-37C4-4202-80E7-490ED4DEDA14}.Debug|Win32.ActiveCfg = Debug|Win32 + {7E862973-37C4-4202-80E7-490ED4DEDA14}.Debug|Win32.Build.0 = Debug|Win32 + {7E862973-37C4-4202-80E7-490ED4DEDA14}.Debug|x64.ActiveCfg = Debug|x64 + {7E862973-37C4-4202-80E7-490ED4DEDA14}.Debug|x64.Build.0 = Debug|x64 + {7E862973-37C4-4202-80E7-490ED4DEDA14}.Release|Win32.ActiveCfg = Release|Win32 + {7E862973-37C4-4202-80E7-490ED4DEDA14}.Release|Win32.Build.0 = Release|Win32 + {7E862973-37C4-4202-80E7-490ED4DEDA14}.Release|x64.ActiveCfg = Release|x64 + {7E862973-37C4-4202-80E7-490ED4DEDA14}.Release|x64.Build.0 = Release|x64 + {0D4A2D8E-6461-479E-9399-F7929174E050}.Debug|Win32.ActiveCfg = Debug|Win32 + {0D4A2D8E-6461-479E-9399-F7929174E050}.Debug|Win32.Build.0 = Debug|Win32 + {0D4A2D8E-6461-479E-9399-F7929174E050}.Debug|x64.ActiveCfg = Debug|x64 + {0D4A2D8E-6461-479E-9399-F7929174E050}.Debug|x64.Build.0 = Debug|x64 + {0D4A2D8E-6461-479E-9399-F7929174E050}.Release|Win32.ActiveCfg = Release|Win32 + {0D4A2D8E-6461-479E-9399-F7929174E050}.Release|Win32.Build.0 = Release|Win32 + {0D4A2D8E-6461-479E-9399-F7929174E050}.Release|x64.ActiveCfg = Release|x64 + {0D4A2D8E-6461-479E-9399-F7929174E050}.Release|x64.Build.0 = Release|x64 + {EABA0FF3-1C4D-4FAB-8418-31C9061F3F0D}.Debug|Win32.ActiveCfg = Debug|Win32 + {EABA0FF3-1C4D-4FAB-8418-31C9061F3F0D}.Debug|Win32.Build.0 = Debug|Win32 + {EABA0FF3-1C4D-4FAB-8418-31C9061F3F0D}.Debug|x64.ActiveCfg = Debug|x64 + {EABA0FF3-1C4D-4FAB-8418-31C9061F3F0D}.Debug|x64.Build.0 = Debug|x64 + {EABA0FF3-1C4D-4FAB-8418-31C9061F3F0D}.Release|Win32.ActiveCfg = Release|Win32 + {EABA0FF3-1C4D-4FAB-8418-31C9061F3F0D}.Release|Win32.Build.0 = Release|Win32 + {EABA0FF3-1C4D-4FAB-8418-31C9061F3F0D}.Release|x64.ActiveCfg = Release|x64 + {EABA0FF3-1C4D-4FAB-8418-31C9061F3F0D}.Release|x64.Build.0 = Release|x64 + {19470DE6-1975-4F9B-B1BE-E87A83240B15}.Debug|Win32.ActiveCfg = Debug|Win32 + {19470DE6-1975-4F9B-B1BE-E87A83240B15}.Debug|Win32.Build.0 = Debug|Win32 + {19470DE6-1975-4F9B-B1BE-E87A83240B15}.Debug|x64.ActiveCfg = Debug|x64 + {19470DE6-1975-4F9B-B1BE-E87A83240B15}.Debug|x64.Build.0 = Debug|x64 + {19470DE6-1975-4F9B-B1BE-E87A83240B15}.Release|Win32.ActiveCfg = Release|Win32 + {19470DE6-1975-4F9B-B1BE-E87A83240B15}.Release|Win32.Build.0 = Release|Win32 + {19470DE6-1975-4F9B-B1BE-E87A83240B15}.Release|x64.ActiveCfg = Release|x64 + {19470DE6-1975-4F9B-B1BE-E87A83240B15}.Release|x64.Build.0 = Release|x64 + {72894398-38CA-47A6-95FE-9647DE2BE968}.Debug|Win32.ActiveCfg = Debug|Win32 + {72894398-38CA-47A6-95FE-9647DE2BE968}.Debug|Win32.Build.0 = Debug|Win32 + {72894398-38CA-47A6-95FE-9647DE2BE968}.Debug|x64.ActiveCfg = Debug|x64 + {72894398-38CA-47A6-95FE-9647DE2BE968}.Debug|x64.Build.0 = Debug|x64 + {72894398-38CA-47A6-95FE-9647DE2BE968}.Release|Win32.ActiveCfg = Release|Win32 + {72894398-38CA-47A6-95FE-9647DE2BE968}.Release|Win32.Build.0 = Release|Win32 + {72894398-38CA-47A6-95FE-9647DE2BE968}.Release|x64.ActiveCfg = Release|x64 + {72894398-38CA-47A6-95FE-9647DE2BE968}.Release|x64.Build.0 = Release|x64 + {DFFA2117-E6A8-4806-BB69-94DAC8F8F42A}.Debug|Win32.ActiveCfg = Debug|Win32 + {DFFA2117-E6A8-4806-BB69-94DAC8F8F42A}.Debug|Win32.Build.0 = Debug|Win32 + {DFFA2117-E6A8-4806-BB69-94DAC8F8F42A}.Debug|x64.ActiveCfg = Debug|x64 + {DFFA2117-E6A8-4806-BB69-94DAC8F8F42A}.Debug|x64.Build.0 = Debug|x64 + {DFFA2117-E6A8-4806-BB69-94DAC8F8F42A}.Release|Win32.ActiveCfg = Release|Win32 + {DFFA2117-E6A8-4806-BB69-94DAC8F8F42A}.Release|Win32.Build.0 = Release|Win32 + {DFFA2117-E6A8-4806-BB69-94DAC8F8F42A}.Release|x64.ActiveCfg = Release|x64 + {DFFA2117-E6A8-4806-BB69-94DAC8F8F42A}.Release|x64.Build.0 = Release|x64 + {DEE75AD5-F165-40E1-80B2-400E27725D5C}.Debug|Win32.ActiveCfg = Debug|Win32 + {DEE75AD5-F165-40E1-80B2-400E27725D5C}.Debug|Win32.Build.0 = Debug|Win32 + {DEE75AD5-F165-40E1-80B2-400E27725D5C}.Debug|x64.ActiveCfg = Debug|x64 + {DEE75AD5-F165-40E1-80B2-400E27725D5C}.Debug|x64.Build.0 = Debug|x64 + {DEE75AD5-F165-40E1-80B2-400E27725D5C}.Release|Win32.ActiveCfg = Release|Win32 + {DEE75AD5-F165-40E1-80B2-400E27725D5C}.Release|Win32.Build.0 = Release|Win32 + {DEE75AD5-F165-40E1-80B2-400E27725D5C}.Release|x64.ActiveCfg = Release|x64 + {DEE75AD5-F165-40E1-80B2-400E27725D5C}.Release|x64.Build.0 = Release|x64 + {604E1144-1A22-43AF-9A3E-08650EE4EE90}.Debug|Win32.ActiveCfg = Debug|Win32 + {604E1144-1A22-43AF-9A3E-08650EE4EE90}.Debug|Win32.Build.0 = Debug|Win32 + {604E1144-1A22-43AF-9A3E-08650EE4EE90}.Debug|x64.ActiveCfg = Debug|x64 + {604E1144-1A22-43AF-9A3E-08650EE4EE90}.Debug|x64.Build.0 = Debug|x64 + {604E1144-1A22-43AF-9A3E-08650EE4EE90}.Release|Win32.ActiveCfg = Release|Win32 + {604E1144-1A22-43AF-9A3E-08650EE4EE90}.Release|Win32.Build.0 = Release|Win32 + {604E1144-1A22-43AF-9A3E-08650EE4EE90}.Release|x64.ActiveCfg = Release|x64 + {604E1144-1A22-43AF-9A3E-08650EE4EE90}.Release|x64.Build.0 = Release|x64 + {213C6F21-D83F-48C7-BBB5-B35AB1B706B1}.Debug|Win32.ActiveCfg = Debug|Win32 + {213C6F21-D83F-48C7-BBB5-B35AB1B706B1}.Debug|Win32.Build.0 = Debug|Win32 + {213C6F21-D83F-48C7-BBB5-B35AB1B706B1}.Debug|x64.ActiveCfg = Debug|x64 + {213C6F21-D83F-48C7-BBB5-B35AB1B706B1}.Debug|x64.Build.0 = Debug|x64 + {213C6F21-D83F-48C7-BBB5-B35AB1B706B1}.Release|Win32.ActiveCfg = Release|Win32 + {213C6F21-D83F-48C7-BBB5-B35AB1B706B1}.Release|Win32.Build.0 = Release|Win32 + {213C6F21-D83F-48C7-BBB5-B35AB1B706B1}.Release|x64.ActiveCfg = Release|x64 + {213C6F21-D83F-48C7-BBB5-B35AB1B706B1}.Release|x64.Build.0 = Release|x64 + {EBB8361B-49D5-43A5-8771-940DF3E308EF}.Debug|Win32.ActiveCfg = Debug|Win32 + {EBB8361B-49D5-43A5-8771-940DF3E308EF}.Debug|Win32.Build.0 = Debug|Win32 + {EBB8361B-49D5-43A5-8771-940DF3E308EF}.Debug|x64.ActiveCfg = Debug|x64 + {EBB8361B-49D5-43A5-8771-940DF3E308EF}.Debug|x64.Build.0 = Debug|x64 + {EBB8361B-49D5-43A5-8771-940DF3E308EF}.Release|Win32.ActiveCfg = Release|Win32 + {EBB8361B-49D5-43A5-8771-940DF3E308EF}.Release|Win32.Build.0 = Release|Win32 + {EBB8361B-49D5-43A5-8771-940DF3E308EF}.Release|x64.ActiveCfg = Release|x64 + {EBB8361B-49D5-43A5-8771-940DF3E308EF}.Release|x64.Build.0 = Release|x64 + {4BCC693D-1745-45ED-8302-E5E2F979549A}.Debug|Win32.ActiveCfg = Debug|Win32 + {4BCC693D-1745-45ED-8302-E5E2F979549A}.Debug|Win32.Build.0 = Debug|Win32 + {4BCC693D-1745-45ED-8302-E5E2F979549A}.Debug|x64.ActiveCfg = Debug|x64 + {4BCC693D-1745-45ED-8302-E5E2F979549A}.Debug|x64.Build.0 = Debug|x64 + {4BCC693D-1745-45ED-8302-E5E2F979549A}.Release|Win32.ActiveCfg = Release|Win32 + {4BCC693D-1745-45ED-8302-E5E2F979549A}.Release|Win32.Build.0 = Release|Win32 + {4BCC693D-1745-45ED-8302-E5E2F979549A}.Release|x64.ActiveCfg = Release|x64 + {4BCC693D-1745-45ED-8302-E5E2F979549A}.Release|x64.Build.0 = Release|x64 + {01A41DFA-8908-4576-A1F1-C8BC7EAE39A1}.Debug|Win32.ActiveCfg = Debug|Win32 + {01A41DFA-8908-4576-A1F1-C8BC7EAE39A1}.Debug|Win32.Build.0 = Debug|Win32 + {01A41DFA-8908-4576-A1F1-C8BC7EAE39A1}.Debug|x64.ActiveCfg = Debug|x64 + {01A41DFA-8908-4576-A1F1-C8BC7EAE39A1}.Debug|x64.Build.0 = Debug|x64 + {01A41DFA-8908-4576-A1F1-C8BC7EAE39A1}.Release|Win32.ActiveCfg = Release|Win32 + {01A41DFA-8908-4576-A1F1-C8BC7EAE39A1}.Release|Win32.Build.0 = Release|Win32 + {01A41DFA-8908-4576-A1F1-C8BC7EAE39A1}.Release|x64.ActiveCfg = Release|x64 + {01A41DFA-8908-4576-A1F1-C8BC7EAE39A1}.Release|x64.Build.0 = Release|x64 + {E83187C1-AAC2-445D-B8B2-883EFC10C39A}.Debug|Win32.ActiveCfg = Debug|Win32 + {E83187C1-AAC2-445D-B8B2-883EFC10C39A}.Debug|Win32.Build.0 = Debug|Win32 + {E83187C1-AAC2-445D-B8B2-883EFC10C39A}.Debug|x64.ActiveCfg = Debug|x64 + {E83187C1-AAC2-445D-B8B2-883EFC10C39A}.Debug|x64.Build.0 = Debug|x64 + {E83187C1-AAC2-445D-B8B2-883EFC10C39A}.Release|Win32.ActiveCfg = Release|Win32 + {E83187C1-AAC2-445D-B8B2-883EFC10C39A}.Release|Win32.Build.0 = Release|Win32 + {E83187C1-AAC2-445D-B8B2-883EFC10C39A}.Release|x64.ActiveCfg = Release|x64 + {E83187C1-AAC2-445D-B8B2-883EFC10C39A}.Release|x64.Build.0 = Release|x64 + {C6A31374-178C-4680-A404-76BE24D0229B}.Debug|Win32.ActiveCfg = Debug|Win32 + {C6A31374-178C-4680-A404-76BE24D0229B}.Debug|Win32.Build.0 = Debug|Win32 + {C6A31374-178C-4680-A404-76BE24D0229B}.Debug|x64.ActiveCfg = Debug|x64 + {C6A31374-178C-4680-A404-76BE24D0229B}.Debug|x64.Build.0 = Debug|x64 + {C6A31374-178C-4680-A404-76BE24D0229B}.Release|Win32.ActiveCfg = Release|Win32 + {C6A31374-178C-4680-A404-76BE24D0229B}.Release|Win32.Build.0 = Release|Win32 + {C6A31374-178C-4680-A404-76BE24D0229B}.Release|x64.ActiveCfg = Release|x64 + {C6A31374-178C-4680-A404-76BE24D0229B}.Release|x64.Build.0 = Release|x64 + {1AE02D41-7E24-43CC-9BCB-E4CEB6037D16}.Debug|Win32.ActiveCfg = Debug|Win32 + {1AE02D41-7E24-43CC-9BCB-E4CEB6037D16}.Debug|Win32.Build.0 = Debug|Win32 + {1AE02D41-7E24-43CC-9BCB-E4CEB6037D16}.Debug|x64.ActiveCfg = Debug|x64 + {1AE02D41-7E24-43CC-9BCB-E4CEB6037D16}.Debug|x64.Build.0 = Debug|x64 + {1AE02D41-7E24-43CC-9BCB-E4CEB6037D16}.Release|Win32.ActiveCfg = Release|Win32 + {1AE02D41-7E24-43CC-9BCB-E4CEB6037D16}.Release|Win32.Build.0 = Release|Win32 + {1AE02D41-7E24-43CC-9BCB-E4CEB6037D16}.Release|x64.ActiveCfg = Release|x64 + {1AE02D41-7E24-43CC-9BCB-E4CEB6037D16}.Release|x64.Build.0 = Release|x64 + {FAF9AD25-8238-49E9-9AC9-8C56E190440A}.Debug|Win32.ActiveCfg = Debug|Win32 + {FAF9AD25-8238-49E9-9AC9-8C56E190440A}.Debug|Win32.Build.0 = Debug|Win32 + {FAF9AD25-8238-49E9-9AC9-8C56E190440A}.Debug|x64.ActiveCfg = Debug|Win32 + {FAF9AD25-8238-49E9-9AC9-8C56E190440A}.Release|Win32.ActiveCfg = Release|Win32 + {FAF9AD25-8238-49E9-9AC9-8C56E190440A}.Release|Win32.Build.0 = Release|Win32 + {FAF9AD25-8238-49E9-9AC9-8C56E190440A}.Release|x64.ActiveCfg = Release|Win32 + {EFB07DBC-36E3-4C54-B941-3CDAFAACF47B}.Debug|Win32.ActiveCfg = Debug|Win32 + {EFB07DBC-36E3-4C54-B941-3CDAFAACF47B}.Debug|Win32.Build.0 = Debug|Win32 + {EFB07DBC-36E3-4C54-B941-3CDAFAACF47B}.Debug|x64.ActiveCfg = Debug|x64 + {EFB07DBC-36E3-4C54-B941-3CDAFAACF47B}.Debug|x64.Build.0 = Debug|x64 + {EFB07DBC-36E3-4C54-B941-3CDAFAACF47B}.Release|Win32.ActiveCfg = Release|Win32 + {EFB07DBC-36E3-4C54-B941-3CDAFAACF47B}.Release|Win32.Build.0 = Release|Win32 + {EFB07DBC-36E3-4C54-B941-3CDAFAACF47B}.Release|x64.ActiveCfg = Release|x64 + {EFB07DBC-36E3-4C54-B941-3CDAFAACF47B}.Release|x64.Build.0 = Release|x64 + {53F75437-15B8-4A5C-86BF-E238CC68FCBC}.Debug|Win32.ActiveCfg = Debug|Win32 + {53F75437-15B8-4A5C-86BF-E238CC68FCBC}.Debug|Win32.Build.0 = Debug|Win32 + {53F75437-15B8-4A5C-86BF-E238CC68FCBC}.Debug|x64.ActiveCfg = Debug|x64 + {53F75437-15B8-4A5C-86BF-E238CC68FCBC}.Debug|x64.Build.0 = Debug|x64 + {53F75437-15B8-4A5C-86BF-E238CC68FCBC}.Release|Win32.ActiveCfg = Release|Win32 + {53F75437-15B8-4A5C-86BF-E238CC68FCBC}.Release|Win32.Build.0 = Release|Win32 + {53F75437-15B8-4A5C-86BF-E238CC68FCBC}.Release|x64.ActiveCfg = Release|x64 + {53F75437-15B8-4A5C-86BF-E238CC68FCBC}.Release|x64.Build.0 = Release|x64 + {58C7E370-0EDD-4F5E-8617-3F5071170205}.Debug|Win32.ActiveCfg = Debug|Win32 + {58C7E370-0EDD-4F5E-8617-3F5071170205}.Debug|Win32.Build.0 = Debug|Win32 + {58C7E370-0EDD-4F5E-8617-3F5071170205}.Debug|x64.ActiveCfg = Debug|x64 + {58C7E370-0EDD-4F5E-8617-3F5071170205}.Debug|x64.Build.0 = Debug|x64 + {58C7E370-0EDD-4F5E-8617-3F5071170205}.Release|Win32.ActiveCfg = Release|Win32 + {58C7E370-0EDD-4F5E-8617-3F5071170205}.Release|Win32.Build.0 = Release|Win32 + {58C7E370-0EDD-4F5E-8617-3F5071170205}.Release|x64.ActiveCfg = Release|x64 + {58C7E370-0EDD-4F5E-8617-3F5071170205}.Release|x64.Build.0 = Release|x64 + {20DEBF08-EF0A-4C94-ADEB-FE9BBA14588B}.Debug|Win32.ActiveCfg = Debug|Win32 + {20DEBF08-EF0A-4C94-ADEB-FE9BBA14588B}.Debug|Win32.Build.0 = Debug|Win32 + {20DEBF08-EF0A-4C94-ADEB-FE9BBA14588B}.Debug|x64.ActiveCfg = Debug|x64 + {20DEBF08-EF0A-4C94-ADEB-FE9BBA14588B}.Debug|x64.Build.0 = Debug|x64 + {20DEBF08-EF0A-4C94-ADEB-FE9BBA14588B}.Release|Win32.ActiveCfg = Release|Win32 + {20DEBF08-EF0A-4C94-ADEB-FE9BBA14588B}.Release|Win32.Build.0 = Release|Win32 + {20DEBF08-EF0A-4C94-ADEB-FE9BBA14588B}.Release|x64.ActiveCfg = Release|x64 + {20DEBF08-EF0A-4C94-ADEB-FE9BBA14588B}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Property changes on: firebird/trunk/builds/win32/msvc10/Firebird2.sln ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: firebird/trunk/builds/win32/msvc10/Firebird2Boot.sln =================================================================== --- firebird/trunk/builds/win32/msvc10/Firebird2Boot.sln (rev 0) +++ firebird/trunk/builds/win32/msvc10/Firebird2Boot.sln 2010-06-27 03:47:40 UTC (rev 51295) @@ -0,0 +1,195 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "build_msg", "build_msg.vcxproj", "{99A84638-DF3A-417F-895D-5BD88FC29411}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "codes", "codes.vcxproj", "{5658573B-E79E-4C84-8B15-C910C4CDB9AD}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common_static", "common_static.vcxproj", "{DC8E2FAB-B3E1-4A13-A1EC-60D05D0135C9}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpre_boot", "gpre_boot.vcxproj", "{8348521F-4480-4A1D-AE3B-E260235E9860}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpre_embed", "gpre_embed.vcxproj", "{A8FA63F9-9F86-49DA-96AC-2A6AB5B8F292}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fbembed", "fbembed.vcxproj", "{C5A60E3D-7815-4127-B856-96277BEC1D11}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "alice", "alice.vcxproj", "{0D616380-1A5A-4230-A80B-021360E4E669}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "burp", "burp.vcxproj", "{D1507562-A363-4685-96AF-B036F5E5E47F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "common.vcxproj", "{15605F44-BFFD-444F-AD4C-55DC9D704465}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "config", "config.vcxproj", "{E83187C1-AAC2-445D-B8B2-883EFC10C39A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "engine_embed", "engine_embed.vcxproj", "{F55ACA54-70DF-4343-8E16-FA97C757CCF6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gbak_embed", "gbak_embed.vcxproj", "{03136BE7-9E18-4B03-94DB-D19A6EF992B4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "isql_embed", "isql_embed.vcxproj", "{B8AACEB0-2586-4EAE-868F-18A6A93A1A19}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "btyacc", "btyacc.vcxproj", "{57CDBF51-F1FB-4227-8C03-6F4134A7E234}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsql_server_classic", "dsql_server_classic.vcxproj", "{488199DD-D9F3-41C8-AED6-8AFFFB294CFF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lock_classic", "lock_classic.vcxproj", "{213C6F21-D83F-48C7-BBB5-B35AB1B706B1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "remote", "remote.vcxproj", "{4BCC693D-1745-45ED-8302-E5E2F979549A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common_classic", "common_classic.vcxproj", "{F5746066-8613-4811-B27C-0ED70FF9F0FF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {99A84638-DF3A-417F-895D-5BD88FC29411}.Debug|Win32.ActiveCfg = Debug|Win32 + {99A84638-DF3A-417F-895D-5BD88FC29411}.Debug|Win32.Build.0 = Debug|Win32 + {99A84638-DF3A-417F-895D-5BD88FC29411}.Debug|x64.ActiveCfg = Debug|x64 + {99A84638-DF3A-417F-895D-5BD88FC29411}.Debug|x64.Build.0 = Debug|x64 + {99A84638-DF3A-417F-895D-5BD88FC29411}.Release|Win32.ActiveCfg = Release|Win32 + {99A84638-DF3A-417F-895D-5BD88FC29411}.Release|Win32.Build.0 = Release|Win32 + {99A84638-DF3A-417F-895D-5BD88FC29411}.Release|x64.ActiveCfg = Release|x64 + {99A84638-DF3A-417F-895D-5BD88FC29411}.Release|x64.Build.0 = Release|x64 + {5658573B-E79E-4C84-8B15-C910C4CDB9AD}.Debug|Win32.ActiveCfg = Debug|Win32 + {5658573B-E79E-4C84-8B15-C910C4CDB9AD}.Debug|Win32.Build.0 = Debug|Win32 + {5658573B-E79E-4C84-8B15-C910C4CDB9AD}.Debug|x64.ActiveCfg = Debug|x64 + {5658573B-E79E-4C84-8B15-C910C4CDB9AD}.Debug|x64.Build.0 = Debug|x64 + {5658573B-E79E-4C84-8B15-C910C4CDB9AD}.Release|Win32.ActiveCfg = Release|Win32 + {5658573B-E79E-4C84-8B15-C910C4CDB9AD}.Release|Win32.Build.0 = Release|Win32 + {5658573B-E79E-4C84-8B15-C910C4CDB9AD}.Release|x64.ActiveCfg = Release|x64 + {5658573B-E79E-4C84-8B15-C910C4CDB9AD}.Release|x64.Build.0 = Release|x64 + {DC8E2FAB-B3E1-4A13-A1EC-60D05D0135C9}.Debug|Win32.ActiveCfg = Debug|Win32 + {DC8E2FAB-B3E1-4A13-A1EC-60D05D0135C9}.Debug|Win32.Build.0 = Debug|Win32 + {DC8E2FAB-B3E1-4A13-A1EC-60D05D0135C9}.Debug|x64.ActiveCfg = Debug|x64 + {DC8E2FAB-B3E1-4A13-A1EC-60D05D0135C9}.Debug|x64.Build.0 = Debug|x64 + {DC8E2FAB-B3E1-4A13-A1EC-60D05D0135C9}.Release|Win32.ActiveCfg = Release|Win32 + {DC8E2FAB-B3E1-4A13-A1EC-60D05D0135C9}.Release|Win32.Build.0 = Release|Win32 + {DC8E2FAB-B3E1-4A13-A1EC-60D05D0135C9}.Release|x64.ActiveCfg = Release|x64 + {DC8E2FAB-B3E1-4A13-A1EC-60D05D0135C9}.Release|x64.Build.0 = Release|x64 + {8348521F-4480-4A1D-AE3B-E260235E9860}.Debug|Win32.ActiveCfg = Debug|Win32 + {8348521F-4480-4A1D-AE3B-E260235E9860}.Debug|Win32.Build.0 = Debug|Win32 + {8348521F-4480-4A1D-AE3B-E260235E9860}.Debug|x64.ActiveCfg = Debug|x64 + {8348521F-4480-4A1D-AE3B-E260235E9860}.Debug|x64.Build.0 = Debug|x64 + {8348521F-4480-4A1D-AE3B-E260235E9860}.Release|Win32.ActiveCfg = Release|Win32 + {8348521F-4480-4A1D-AE3B-E260235E9860}.Release|Win32.Build.0 = Release|Win32 + {8348521F-4480-4A1D-AE3B-E260235E9860}.Release|x64.ActiveCfg = Release|x64 + {8348521F-4480-4A1D-AE3B-E260235E9860}.Release|x64.Build.0 = Release|x64 + {A8FA63F9-9F86-49DA-96AC-2A6AB5B8F292}.Debug|Win32.ActiveCfg = Debug|Win32 + {A8FA63F9-9F86-49DA-96AC-2A6AB5B8F292}.Debug|Win32.Build.0 = Debug|Win32 + {A8FA63F9-9F86-49DA-96AC-2A6AB5B8F292}.Debug|x64.ActiveCfg = Debug|x64 + {A8FA63F9-9F86-49DA-96AC-2A6AB5B8F292}.Debug|x64.Build.0 = Debug|x64 + {A8FA63F9-9F86-49DA-96AC-2A6AB5B8F292}.Release|Win32.ActiveCfg = Release|Win32 + {A8FA63F9-9F86-49DA-96AC-2A6AB5B8F292}.Release|Win32.Build.0 = Release|Win32 + {A8FA63F9-9F86-49DA-96AC-2A6AB5B8F292}.Release|x64.ActiveCfg = Release|x64 + {A8FA63F9-9F86-49DA-96AC-2A6AB5B8F292}.Release|x64.Build.0 = Release|x64 + {C5A60E3D-7815-4127-B856-96277BEC1D11}.Debug|Win32.ActiveCfg = Debug|Win32 + {C5A60E3D-7815-4127-B856-96277BEC1D11}.Debug|Win32.Build.0 = Debug|Win32 + {C5A60E3D-7815-4127-B856-96277BEC1D11}.Debug|x64.ActiveCfg = Debug|x64 + {C5A60E3D-7815-4127-B856-96277BEC1D11}.Debug|x64.Build.0 = Debug|x64 + {C5A60E3D-7815-4127-B856-96277BEC1D11}.Release|Win32.ActiveCfg = Release|Win32 + {C5A60E3D-7815-4127-B856-96277BEC1D11}.Release|Win32.Build.0 = Release|Win32 + {C5A60E3D-7815-4127-B856-96277BEC1D11}.Release|x64.ActiveCfg = Release|x64 + {C5A60E3D-7815-4127-B856-96277BEC1D11}.Release|x64.Build.0 = Release|x64 + {0D616380-1A5A-4230-A80B-021360E4E669}.Debug|Win32.ActiveCfg = Debug|Win32 + {0D616380-1A5A-4230-A80B-021360E4E669}.Debug|Win32.Build.0 = Debug|Win32 + {0D616380-1A5A-4230-A80B-021360E4E669}.Debug|x64.ActiveCfg = Debug|x64 + {0D616380-1A5A-4230-A80B-021360E4E669}.Debug|x64.Build.0 = Debug|x64 + {0D616380-1A5A-4230-A80B-021360E4E669}.Release|Win32.ActiveCfg = Release|Win32 + {0D616380-1A5A-4230-A80B-021360E4E669}.Release|Win32.Build.0 = Release|Win32 + {0D616380-1A5A-4230-A80B-021360E4E669}.Release|x64.ActiveCfg = Release|x64 + {0D616380-1A5A-4230-A80B-021360E4E669}.Release|x64.Build.0 = Release|x64 + {D1507562-A363-4685-96AF-B036F5E5E47F}.Debug|Win32.ActiveCfg = Debug|Win32 + {D1507562-A363-4685-96AF-B036F5E5E47F}.Debug|Win32.Build.0 = Debug|Win32 + {D1507562-A363-4685-96AF-B036F5E5E47F}.Debug|x64.ActiveCfg = Debug|x64 + {D1507562-A363-4685-96AF-B036F5E5E47F}.Debug|x64.Build.0 = Debug|x64 + {D1507562-A363-4685-96AF-B036F5E5E47F}.Release|Win32.ActiveCfg = Release|Win32 + {D1507562-A363-4685-96AF-B036F5E5E47F}.Release|Win32.Build.0 = Release|Win32 + {D1507562-A363-4685-96AF-B036F5E5E47F}.Release|x64.ActiveCfg = Release|x64 + {D1507562-A363-4685-96AF-B036F5E5E47F}.Release|x64.Build.0 = Release|x64 + {15605F44-BFFD-444F-AD4C-55DC9D704465}.Debug|Win32.ActiveCfg = Debug|Win32 + {15605F44-BFFD-444F-AD4C-55DC9D704465}.Debug|Win32.Build.0 = Debug|Win32 + {15605F44-BFFD-444F-AD4C-55DC9D704465}.Debug|x64.ActiveCfg = Debug|x64 + {15605F44-BFFD-444F-AD4C-55DC9D704465}.Debug|x64.Build.0 = Debug|x64 + {15605F44-BFFD-444F-AD4C-55DC9D704465}.Release|Win32.ActiveCfg = Release|Win32 + {15605F44-BFFD-444F-AD4C-55DC9D704465}.Release|Win32.Build.0 = Release|Win32 + {15605F44-BFFD-444F-AD4C-55DC9D704465}.Release|x64.ActiveCfg = Release|x64 + {15605F44-BFFD-444F-AD4C-55DC9D704465}.Release|x64.Build.0 = Release|x64 + {E83187C1-AAC2-445D-B8B2-883EFC10C39A}.Debug|Win32.ActiveCfg = Debug|Win32 + {E83187C1-AAC2-445D-B8B2-883EFC10C39A}.Debug|Win32.Build.0 = Debug|Win32 + {E83187C1-AAC2-445D-B8B2-883EFC10C39A}.Debug|x64.ActiveCfg = Debug|x64 + {E83187C1-AAC2-445D-B8B2-883EFC10C39A}.Debug|x64.Build.0 = Debug|x64 + {E83187C1-AAC2-445D-B8B2-883EFC10C39A}.Release|Win32.ActiveCfg = Release|Win32 + {E83187C1-AAC2-445D-B8B2-883EFC10C39A}.Release|Win32.Build.0 = Release|Win32 + {E83187C1-AAC2-445D-B8B2-883EFC10C39A}.Release|x64.ActiveCfg = Release|x64 + {E83187C1-AAC2-445D-B8B2-883EFC10C39A}.Release|x64.Build.0 = Release|x64 + {F55ACA54-70DF-4343-8E16-FA97C757CCF6}.Debug|Win32.ActiveCfg = Debug|Win32 + {F55ACA54-70DF-4343-8E16-FA97C757CCF6}.Debug|Win32.Build.0 = Debug|Win32 + {F55ACA54-70DF-4343-8E16-FA97C757CCF6}.Debug|x64.ActiveCfg = Debug|x64 + {F55ACA54-70DF-4343-8E16-FA97C757CCF6}.Debug|x64.Build.0 = Debug|x64 + {F55ACA54-70DF-4343-8E16-FA97C757CCF6}.Release|Win32.ActiveCfg = Release|Win32 + {F55ACA54-70DF-4343-8E16-FA97C757CCF6}.Release|Win32.Build.0 = Release|Win32 + {F55ACA54-70DF-4343-8E16-FA97C757CCF6}.Release|x64.ActiveCfg = Release|x64 + {F55ACA54-70DF-4343-8E16-FA97C757CCF6}.Release|x64.Build.0 = Release|x64 + {03136BE7-9E18-4B03-94DB-D19A6EF992B4}.Debug|Win32.ActiveCfg = Debug|Win32 + {03136BE7-9E18-4B03-94DB-D19A6EF992B4}.Debug|Win32.Build.0 = Debug|Win32 + {03136BE7-9E18-4B03-94DB-D19A6EF992B4}.Debug|x64.ActiveCfg = Debug|x64 + {03136BE7-9E18-4B03-94DB-D19A6EF992B4}.Debug|x64.Build.0 = Debug|x64 + {03136BE7-9E18-4B03-94DB-D19A6EF992B4}.Release|Win32.ActiveCfg = Release|Win32 + {03136BE7-9E18-4B03-94DB-D19A6EF992B4}.Release|Win32.Build.0 = Release|Win32 + {03136BE7-9E18-4B03-94DB-D19A6EF992B4}.Release|x64.ActiveCfg = Release|x64 + {03136BE7-9E18-4B03-94DB-D19A6EF992B4}.Release|x64.Build.0 = Release|x64 + {B8AACEB0-2586-4EAE-868F-18A6A93A1A19}.Debug|Win32.ActiveCfg = Debug|Win32 + {B8AACEB0-2586-4EAE-868F-18A6A93A1A19}.Debug|Win32.Build.0 = Debug|Win32 + {B8AACEB0-2586-4EAE-868F-18A6A93A1A19}.Debug|x64.ActiveCfg = Debug|x64 + {B8AACEB0-2586-4EAE-868F-18A6A93A1A19}.Debug|x64.Build.0 = Debug|x64 + {B8AACEB0-2586-4EAE-868F-18A6A93A1A19}.Release|Win32.ActiveCfg = Release|Win32 + {B8AACEB0-2586-4EAE-868F-18A6A93A1A19}.Release|Win32.Build.0 = Release|Win32 + {B8AACEB0-2586-4EAE-868F-18A6A93A1A19}.Release|x64.ActiveCfg = Release|x64 + {B8AACEB0-2586-4EAE-868F-18A6A93A1A19}.Release|x64.Build.0 = Release|x64 + {57CDBF51-F1FB-4227-8C03-6F4134A7E234}.Debug|Win32.ActiveCfg = Debug|Win32 + {57CDBF51-F1FB-4227-8C03-6F4134A7E234}.Debug|Win32.Build.0 = Debug|Win32 + {57CDBF51-F1FB-4227-8C03-6F4134A7E234}.Debug|x64.ActiveCfg = Debug|x64 + {57CDBF51-F1FB-4227-8C03-6F4134A7E234}.Debug|x64.Build.0 = Debug|x64 + {57CDBF51-F1FB-4227-8C03-6F4134A7E234}.Release|Win32.ActiveCfg = Release|Win32 + {57CDBF51-F1FB-4227-8C03-6F4134A7E234}.Release|Win32.Build.0 = Release|Win32 + {57CDBF51-F1FB-4227-8C03-6F4134A7E234}.Release|x64.ActiveCfg = Release|x64 + {57CDBF51-F1FB-4227-8C03-6F4134A7E234}.Release|x64.Build.0 = Release|x64 + {488199DD-D9F3-41C8-AED6-8AFFFB294CFF}.Debug|Win32.ActiveCfg = Debug|Win32 + {488199DD-D9F3-41C8-AED6-8AFFFB294CFF}.Debug|Win32.Build.0 = Debug|Win32 + {488199DD-D9F3-41C8-AED6-8AFFFB294CFF}.Debug|x64.ActiveCfg = Debug|x64 + {488199DD-D9F3-41C8-AED6-8AFFFB294CFF}.Debug|x64.Build.0 = Debug|x64 + {488199DD-D9F3-41C8-AED6-8AFFFB294CFF}.Release|Win32.ActiveCfg = Release|Win32 + {488199DD-D9F3-41C8-AED6-8AFFFB294CFF}.Release|Win32.Build.0 = Release|Win32 + {488199DD-D9F3-41C8-AED6-8AFFFB294CFF}.Release|x64.ActiveCfg = Release|x64 + {488199DD-D9F3-41C8-AED6-8AFFFB294CFF}.Release|x64.Build.0 = Release|x64 + {213C6F21-D83F-48C7-BBB5-B35AB1B706B1}.Debug|Win32.ActiveCfg = Debug|Win32 + {213C6F21-D83F-48C7-BBB5-B35AB1B706B1}.Debug|Win32.Build.0 = Debug|Win32 + {213C6F21-D83F-48C7-BBB5-B35AB1B706B1}.Debug|x64.ActiveCfg = Debug|x64 + {213C6F21-D83F-48C7-BBB5-B35AB1B706B1}.Debug|x64.Build.0 = Debug|x64 + {213C6F21-D83F-48C7-BBB5-B35AB1B706B1}.Release|Win32.ActiveCfg = Release|Win32 + {213C6F21-D83F-48C7-BBB5-B35AB1B706B1}.Release|Win32.Build.0 = Release|Win32 + {213C6F21-D83F-48C7-BBB5-B35AB1B706B1}.Release|x64.ActiveCfg = Release|x64 + {213C6F21-D83F-48C7-BBB5-B35AB1B706B1}.Release|x64.Build.0 = Release|x64 + {4BCC693D-1745-45ED-8302-E5E2F979549A}.Debug|Win32.ActiveCfg = Debug|Win32 + {4BCC693D-1745-45ED-8302-E5E2F979549A}.Debug|Win32.Build.0 = Debug|Win32 + {4BCC693D-1745-45ED-8302-E5E2F979549A}.Debug|x64.ActiveCfg = Debug|x64 + {4BCC693D-1745-45ED-8302-E5E2F979549A}.Debug|x64.Build.0 = Debug|x64 + {4BCC693D-1745-45ED-8302-E5E2F979549A}.Release|Win32.ActiveCfg = Release|Win32 + {4BCC693D-1745-45ED-8302-E5E2F979549A}.Release|Win32.Build.0 = Release|Win32 + {4BCC693D-1745-45ED-8302-E5E2F979549A}.Release|x64.ActiveCfg = Release|x64 + {4BCC693D-1745-45ED-8302-E5E2F979549A}.Release|x64.Build.0 = Release|x64 + {F5746066-8613-4811-B27C-0ED70FF9F0FF}.Debug|Win32.ActiveCfg = Debug|Win32 + {F5746066-8613-4811-B27C-0ED70FF9F0FF}.Debug|Win32.Build.0 = Debug|Win32 + {F5746066-8613-4811-B27C-0ED70FF9F0FF}.Debug|x64.ActiveCfg = Debug|x64 + {F5746066-8613-4811-B27C-0ED70FF9F0FF}.Debug|x64.Build.0 = Debug|x64 + {F5746066-8613-4811-B27C-0ED70FF9F0FF}.Release|Win32.ActiveCfg = Release|Win32 + {F5746066-8613-4811-B27C-0ED70FF9F0FF}.Release|Win32.Build.0 = Release|Win32 + {F5746066-8613-4811-B27C-0ED70FF9F0FF}.Release|x64.ActiveCfg = Release|x64 + {F5746066-8613-4811-B27C-0ED70FF9F0FF}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Property changes on: firebird/trunk/builds/win32/msvc10/Firebird2Boot.sln ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: firebird/trunk/builds/win32/msvc10/Firebird2_Examples.sln =================================================================== --- firebird/trunk/builds/win32/msvc10/Firebird2_Examples.sln (rev 0) +++ firebird/trunk/builds/win32/msvc10/Firebird2_Examples.sln 2010-06-27 03:47:40 UTC (rev 51295) @@ -0,0 +1,61 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "empbuild", "empbuild.vcxproj", "{FC2859B9-56DB-40B4-86C4-2DE31ECE9144}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "intlbuild", "intlbuild.vcxproj", "{9546EF04-1326-464B-A6ED-395C60DD63CC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "udr_engine", "udr_engine.vcxproj", "{20DEBF08-EF0A-4C94-ADEB-FE9BBA14588B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "udrcpp_example", "udrcpp_example.vcxproj", "{FF0FD8DF-1E5C-486E-B395-A620376A4633}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "common.vcxproj", "{15605F44-BFFD-444F-AD4C-55DC9D704465}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FC2859B9-56DB-40B4-86C4-2DE31ECE9144}.Debug|Win32.ActiveCfg = Debug|Win32 + {FC2859B9-56DB-40B4-86C4-2DE31ECE9144}.Debug|Win32.Build.0 = Debug|Win32 + {FC2859B9-56DB-40B4-86C4-2DE31ECE9144}.Debug|x64.ActiveCfg = Debug|x64 + {FC2859B9-56DB-40B4-86C4-2DE31ECE9144}.Debug|x64.Build.0 = Debug|x64 + {FC2859B9-56DB-40B4-86C4-2DE31ECE9144}.Release|Win32.ActiveCf... [truncated message content] |
From: <asf...@us...> - 2010-07-06 00:49:41
|
Revision: 51312 http://firebird.svn.sourceforge.net/firebird/?rev=51312&view=rev Author: asfernandes Date: 2010-07-06 00:49:33 +0000 (Tue, 06 Jul 2010) Log Message: ----------- Refactor CREATE/ALTER/DROP DOMAIN Modified Paths: -------------- firebird/trunk/builds/win32/msvc10/common.vcxproj firebird/trunk/builds/win32/msvc10/common_classic.vcxproj firebird/trunk/builds/win32/msvc10/common_static.vcxproj firebird/trunk/builds/win32/msvc8/common.vcproj firebird/trunk/builds/win32/msvc8/common_classic.vcproj firebird/trunk/builds/win32/msvc8/common_static.vcproj firebird/trunk/builds/win32/msvc9/common.vcproj firebird/trunk/builds/win32/msvc9/common_classic.vcproj firebird/trunk/builds/win32/msvc9/common_static.vcproj firebird/trunk/src/dsql/BlrWriter.h firebird/trunk/src/dsql/DdlNodes.epp firebird/trunk/src/dsql/DdlNodes.h firebird/trunk/src/dsql/Nodes.h firebird/trunk/src/dsql/Parser.h firebird/trunk/src/dsql/ddl.cpp firebird/trunk/src/dsql/dsql.h firebird/trunk/src/dsql/node.h firebird/trunk/src/dsql/parse.y firebird/trunk/src/dsql/pass1.cpp firebird/trunk/src/jrd/Attachment.cpp firebird/trunk/src/jrd/Attachment.h firebird/trunk/src/jrd/drq.h firebird/trunk/src/jrd/dyn.epp firebird/trunk/src/jrd/dyn_def.epp firebird/trunk/src/jrd/dyn_del.epp firebird/trunk/src/jrd/dyn_df_proto.h firebird/trunk/src/jrd/dyn_dl_proto.h firebird/trunk/src/jrd/dyn_md_proto.h firebird/trunk/src/jrd/dyn_mod.epp firebird/trunk/src/jrd/ini.epp Added Paths: ----------- firebird/trunk/src/common/classes/ByteChunk.h Modified: firebird/trunk/builds/win32/msvc10/common.vcxproj =================================================================== --- firebird/trunk/builds/win32/msvc10/common.vcxproj 2010-07-05 18:37:35 UTC (rev 51311) +++ firebird/trunk/builds/win32/msvc10/common.vcxproj 2010-07-06 00:49:33 UTC (rev 51312) @@ -181,6 +181,7 @@ <ClInclude Include="..\..\..\src\common\classes\alloc.h" /> <ClInclude Include="..\..\..\src\common\classes\array.h" /> <ClInclude Include="..\..\..\src\common\classes\BaseStream.h" /> + <ClInclude Include="..\..\..\src\common\classes\ByteChunk.h" /> <ClInclude Include="..\..\..\src\common\classes\ClumpletReader.h" /> <ClInclude Include="..\..\..\src\common\classes\ClumpletWriter.h" /> <ClInclude Include="..\..\..\src\common\classes\condition.h" /> Modified: firebird/trunk/builds/win32/msvc10/common_classic.vcxproj =================================================================== --- firebird/trunk/builds/win32/msvc10/common_classic.vcxproj 2010-07-05 18:37:35 UTC (rev 51311) +++ firebird/trunk/builds/win32/msvc10/common_classic.vcxproj 2010-07-06 00:49:33 UTC (rev 51312) @@ -181,6 +181,7 @@ <ClInclude Include="..\..\..\src\common\classes\alloc.h" /> <ClInclude Include="..\..\..\src\common\classes\array.h" /> <ClInclude Include="..\..\..\src\common\classes\BaseStream.h" /> + <ClInclude Include="..\..\..\src\common\classes\ByteChunk.h" /> <ClInclude Include="..\..\..\src\common\classes\ClumpletReader.h" /> <ClInclude Include="..\..\..\src\common\classes\ClumpletWriter.h" /> <ClInclude Include="..\..\..\src\common\classes\condition.h" /> Modified: firebird/trunk/builds/win32/msvc10/common_static.vcxproj =================================================================== --- firebird/trunk/builds/win32/msvc10/common_static.vcxproj 2010-07-05 18:37:35 UTC (rev 51311) +++ firebird/trunk/builds/win32/msvc10/common_static.vcxproj 2010-07-06 00:49:33 UTC (rev 51312) @@ -178,6 +178,7 @@ <ClInclude Include="..\..\..\src\common\classes\alloc.h" /> <ClInclude Include="..\..\..\src\common\classes\array.h" /> <ClInclude Include="..\..\..\src\common\classes\BaseStream.h" /> + <ClInclude Include="..\..\..\src\common\classes\ByteChunk.h" /> <ClInclude Include="..\..\..\src\common\classes\ClumpletReader.h" /> <ClInclude Include="..\..\..\src\common\classes\ClumpletWriter.h" /> <ClInclude Include="..\..\..\src\common\config\config.h" /> Modified: firebird/trunk/builds/win32/msvc8/common.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc8/common.vcproj 2010-07-05 18:37:35 UTC (rev 51311) +++ firebird/trunk/builds/win32/msvc8/common.vcproj 2010-07-06 00:49:33 UTC (rev 51312) @@ -429,6 +429,10 @@ > </File> <File + RelativePath="..\..\..\src\common\classes\ByteChunk.h" + > + </File> + <File RelativePath="..\..\..\src\common\classes\ClumpletReader.h" > </File> Modified: firebird/trunk/builds/win32/msvc8/common_classic.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc8/common_classic.vcproj 2010-07-05 18:37:35 UTC (rev 51311) +++ firebird/trunk/builds/win32/msvc8/common_classic.vcproj 2010-07-06 00:49:33 UTC (rev 51312) @@ -429,6 +429,10 @@ > </File> <File + RelativePath="..\..\..\src\common\classes\ByteChunk.h" + > + </File> + <File RelativePath="..\..\..\src\common\classes\ClumpletReader.h" > </File> Modified: firebird/trunk/builds/win32/msvc8/common_static.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc8/common_static.vcproj 2010-07-05 18:37:35 UTC (rev 51311) +++ firebird/trunk/builds/win32/msvc8/common_static.vcproj 2010-07-06 00:49:33 UTC (rev 51312) @@ -410,6 +410,10 @@ > </File> <File + RelativePath="..\..\..\src\common\classes\ByteChunk.h" + > + </File> + <File RelativePath="..\..\..\src\common\classes\ClumpletReader.h" > </File> Modified: firebird/trunk/builds/win32/msvc9/common.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc9/common.vcproj 2010-07-05 18:37:35 UTC (rev 51311) +++ firebird/trunk/builds/win32/msvc9/common.vcproj 2010-07-06 00:49:33 UTC (rev 51312) @@ -430,6 +430,10 @@ > </File> <File + RelativePath="..\..\..\src\common\classes\ByteChunk.h" + > + </File> + <File RelativePath="..\..\..\src\common\classes\ClumpletReader.h" > </File> Modified: firebird/trunk/builds/win32/msvc9/common_classic.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc9/common_classic.vcproj 2010-07-05 18:37:35 UTC (rev 51311) +++ firebird/trunk/builds/win32/msvc9/common_classic.vcproj 2010-07-06 00:49:33 UTC (rev 51312) @@ -430,6 +430,10 @@ > </File> <File + RelativePath="..\..\..\src\common\classes\ByteChunk.h" + > + </File> + <File RelativePath="..\..\..\src\common\classes\ClumpletReader.h" > </File> Modified: firebird/trunk/builds/win32/msvc9/common_static.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc9/common_static.vcproj 2010-07-05 18:37:35 UTC (rev 51311) +++ firebird/trunk/builds/win32/msvc9/common_static.vcproj 2010-07-06 00:49:33 UTC (rev 51312) @@ -411,6 +411,10 @@ > </File> <File + RelativePath="..\..\..\src\common\classes\ByteChunk.h" + > + </File> + <File RelativePath="..\..\..\src\common\classes\ClumpletReader.h" > </File> Added: firebird/trunk/src/common/classes/ByteChunk.h =================================================================== --- firebird/trunk/src/common/classes/ByteChunk.h (rev 0) +++ firebird/trunk/src/common/classes/ByteChunk.h 2010-07-06 00:49:33 UTC (rev 51312) @@ -0,0 +1,55 @@ +/* + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl. + * + * Software distributed under the License is distributed AS IS, + * 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 was created by Adriano dos Santos Fernandes + * for the Firebird Open Source RDBMS project. + * + * Copyright (c) 2010 Adriano dos Santos Fernandes <adr...@gm...> + * and all contributors signed below. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + */ + +#ifndef COMMON_BYTE_CHUNK_H +#define COMMON_BYTE_CHUNK_H + +#include "../common/classes/array.h" + +namespace Firebird { + +// Wrapper for different kinds of byte buffers. +struct ByteChunk +{ + // Separate pointer/length buffer. + ByteChunk(const UCHAR* aData, size_t aLength) + : data(aData), + length(aLength) + { + } + + // Array<UCHAR> buffer. + // This constructor is intentionally not-explicit. + template <typename Storage> + ByteChunk(const Firebird::Array<UCHAR, Storage>& array) + : data(array.begin()), + length(array.getCount()) + { + } + + const UCHAR* const data; + const size_t length; +}; + +} // namespace Firebird + +#endif // COMMON_BYTE_CHUNK_H Property changes on: firebird/trunk/src/common/classes/ByteChunk.h ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: firebird/trunk/src/dsql/BlrWriter.h =================================================================== --- firebird/trunk/src/dsql/BlrWriter.h 2010-07-05 18:37:35 UTC (rev 51311) +++ firebird/trunk/src/dsql/BlrWriter.h 2010-07-06 00:49:33 UTC (rev 51312) @@ -132,8 +132,9 @@ ULONG getBaseOffset() const { return baseOffset; } void setBaseOffset(ULONG value) { baseOffset = value; } + virtual bool isVersion4() = 0; + protected: - virtual bool isVersion4() = 0; virtual bool isDdlDyn() = 0; private: Modified: firebird/trunk/src/dsql/DdlNodes.epp =================================================================== --- firebird/trunk/src/dsql/DdlNodes.epp 2010-07-05 18:37:35 UTC (rev 51311) +++ firebird/trunk/src/dsql/DdlNodes.epp 2010-07-06 00:49:33 UTC (rev 51312) @@ -34,6 +34,7 @@ #include "../jrd/PreparedStatement.h" #include "../jrd/blb_proto.h" #include "../jrd/cmp_proto.h" +#include "../jrd/dsc_proto.h" #include "../jrd/dyn_dl_proto.h" #include "../jrd/dyn_ut_proto.h" #include "../jrd/exe_proto.h" @@ -82,7 +83,89 @@ status_exception::raise(newVector); } +// Update RDB$FIELDS received by reference. +static void updateRdbFields(const TypeClause& type, + SSHORT& fieldType, + SSHORT& fieldLength, + SSHORT& fieldSubTypeNull, SSHORT& fieldSubType, + SSHORT& fieldScaleNull, SSHORT& fieldScale, + SSHORT& characterSetIdNull, SSHORT& characterSetId, + SSHORT& characterLengthNull, SSHORT& characterLength, + SSHORT& fieldPrecisionNull, SSHORT& fieldPrecision, + SSHORT& collationIdNull, SSHORT& collationId, + SSHORT& segmentLengthNull, SSHORT& segmentLength) +{ + // Initialize all nullable fields. + fieldSubTypeNull = fieldScaleNull = characterSetIdNull = characterLengthNull = + fieldPrecisionNull = collationIdNull = segmentLengthNull = TRUE; + if (type.type == dtype_blob) + { + fieldSubTypeNull = FALSE; + fieldSubType = type.subType; + + fieldScaleNull = FALSE; + fieldScale = 0; + + if (type.subType == isc_blob_text) + { + characterSetIdNull = FALSE; + characterSetId = type.charSetId; + + collationIdNull = !type.collateSpecified; + collationId = type.collationId; + } + + if (type.segLength != 0) + { + segmentLengthNull = FALSE; + segmentLength = type.segLength; + } + } + else if (type.type <= dtype_any_text) + { + fieldSubTypeNull = FALSE; + fieldSubType = type.subType; + + fieldScaleNull = FALSE; + fieldScale = 0; + + characterLengthNull = FALSE; + characterLength = type.charLength; + + characterSetIdNull = FALSE; + characterSetId = type.charSetId; + + collationIdNull = !type.collateSpecified; + collationId = type.collationId; + } + else + { + fieldScaleNull = FALSE; + fieldScale = type.scale; + + if (DTYPE_IS_EXACT(type.type)) + { + fieldPrecisionNull = FALSE; + fieldPrecision = type.precision; + + fieldSubTypeNull = FALSE; + fieldSubType = type.subType; + } + } + + if (type.type == dtype_varying) + { + fb_assert(type.length <= MAX_SSHORT); + fieldLength = (SSHORT) (type.length - sizeof(USHORT)); + } + else + fieldLength = type.length; + + fieldType = blr_dtypes[type.type]; +} + + //---------------------- @@ -225,94 +308,44 @@ } -MetaName DdlNode::storeGlobalField(thread_db* tdbb, jrd_tra* transaction, const TypeClause& parameter) +MetaName DdlNode::storeGlobalField(thread_db* tdbb, jrd_tra* transaction, const TypeClause& field, + MetaName& name) { - MetaName name; + bool endStore = false; - AutoCacheRequest requestHandle(tdbb, drq_s_fld_src, DYN_REQUESTS); - - STORE (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction) - FLD IN RDB$FIELDS + try { - FLD.RDB$FIELD_SUB_TYPE.NULL = TRUE; - FLD.RDB$FIELD_SCALE.NULL = TRUE; - FLD.RDB$CHARACTER_SET_ID.NULL = TRUE; - FLD.RDB$CHARACTER_LENGTH.NULL = TRUE; - FLD.RDB$FIELD_PRECISION.NULL = TRUE; - FLD.RDB$COLLATION_ID.NULL = TRUE; - FLD.RDB$SEGMENT_LENGTH.NULL = TRUE; + if (name.isEmpty()) + DYN_UTIL_generate_field_name(tdbb, NULL, name); - FLD.RDB$SYSTEM_FLAG = 0; + AutoCacheRequest requestHandle(tdbb, drq_s_fld_src, DYN_REQUESTS); - DYN_UTIL_generate_field_name(tdbb, NULL, name); - strcpy(FLD.RDB$FIELD_NAME, name.c_str()); - - if (parameter.type == dtype_blob) + STORE (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction) + FLD IN RDB$FIELDS { - FLD.RDB$FIELD_SUB_TYPE.NULL = FALSE; - FLD.RDB$FIELD_SUB_TYPE = parameter.subType; + FLD.RDB$SYSTEM_FLAG = 0; + strcpy(FLD.RDB$FIELD_NAME, name.c_str()); - FLD.RDB$FIELD_SCALE.NULL = FALSE; - FLD.RDB$FIELD_SCALE = 0; + updateRdbFields(field, + FLD.RDB$FIELD_TYPE, + FLD.RDB$FIELD_LENGTH, + FLD.RDB$FIELD_SUB_TYPE.NULL, FLD.RDB$FIELD_SUB_TYPE, + FLD.RDB$FIELD_SCALE.NULL, FLD.RDB$FIELD_SCALE, + FLD.RDB$CHARACTER_SET_ID.NULL, FLD.RDB$CHARACTER_SET_ID, + FLD.RDB$CHARACTER_LENGTH.NULL, FLD.RDB$CHARACTER_LENGTH, + FLD.RDB$FIELD_PRECISION.NULL, FLD.RDB$FIELD_PRECISION, + FLD.RDB$COLLATION_ID.NULL, FLD.RDB$COLLATION_ID, + FLD.RDB$SEGMENT_LENGTH.NULL, FLD.RDB$SEGMENT_LENGTH); - if (parameter.subType == isc_blob_text) - { - FLD.RDB$CHARACTER_SET_ID.NULL = FALSE; - FLD.RDB$CHARACTER_SET_ID = parameter.charSetId; - - FLD.RDB$COLLATION_ID.NULL = !parameter.collateSpecified; - FLD.RDB$COLLATION_ID = parameter.collationId; - } - - if (parameter.segLength != 0) - { - FLD.RDB$SEGMENT_LENGTH.NULL = FALSE; - FLD.RDB$SEGMENT_LENGTH = parameter.segLength; - } + endStore = true; } - else if (parameter.type <= dtype_any_text) - { - FLD.RDB$FIELD_SUB_TYPE.NULL = FALSE; - FLD.RDB$FIELD_SUB_TYPE = parameter.subType; - - FLD.RDB$FIELD_SCALE.NULL = FALSE; - FLD.RDB$FIELD_SCALE = 0; - - FLD.RDB$CHARACTER_LENGTH.NULL = FALSE; - FLD.RDB$CHARACTER_LENGTH = parameter.charLength; - - FLD.RDB$CHARACTER_SET_ID.NULL = FALSE; - FLD.RDB$CHARACTER_SET_ID = parameter.charSetId; - - FLD.RDB$COLLATION_ID.NULL = !parameter.collateSpecified; - FLD.RDB$COLLATION_ID = parameter.collationId; - } - else - { - FLD.RDB$FIELD_SCALE.NULL = FALSE; - FLD.RDB$FIELD_SCALE = parameter.scale; - - if (DTYPE_IS_EXACT(parameter.type)) - { - FLD.RDB$FIELD_PRECISION.NULL = FALSE; - FLD.RDB$FIELD_PRECISION = parameter.precision; - - FLD.RDB$FIELD_SUB_TYPE.NULL = FALSE; - FLD.RDB$FIELD_SUB_TYPE = parameter.subType; - } - } - - if (parameter.type == dtype_varying) - { - fb_assert(parameter.length <= MAX_SSHORT); - FLD.RDB$FIELD_LENGTH = (SSHORT) (parameter.length - sizeof(USHORT)); - } - else - FLD.RDB$FIELD_LENGTH = parameter.length; - - FLD.RDB$FIELD_TYPE = blr_dtypes[parameter.type]; + END_STORE } - END_STORE + catch (const status_exception& ex) + { + // STORE RDB$FIELDS failed + rethrowMetaException(ex, ENCODE_ISC_MSG(13, DYN_MSG_FAC), endStore); + } return name; } @@ -956,13 +989,11 @@ { FUN.RDB$FUNCTION_BLR.NULL = FALSE; attachment->storeBinaryBlob(tdbb, transaction, &FUN.RDB$FUNCTION_BLR, - dsqlScratch->getBlrData().begin(), - dsqlScratch->getBlrData().getCount()); + dsqlScratch->getBlrData()); FUN.RDB$DEBUG_INFO.NULL = FALSE; attachment->storeBinaryBlob(tdbb, transaction, &FUN.RDB$DEBUG_INFO, - dsqlScratch->getDebugData().begin(), - dsqlScratch->getDebugData().getCount()); + dsqlScratch->getDebugData()); } } @@ -1069,7 +1100,8 @@ strcpy(ARG.RDB$FIELD_SOURCE, parameter.typeOfName.c_str()); else { - const MetaName fieldName = storeGlobalField(tdbb, transaction, parameter); + MetaName fieldName; + storeGlobalField(tdbb, transaction, parameter, fieldName); strcpy(ARG.RDB$FIELD_SOURCE, fieldName.c_str()); } } @@ -1119,8 +1151,7 @@ dsqlScratch->appendUChar(blr_eoc); attachment->storeBinaryBlob(tdbb, transaction, &ARG.RDB$DEFAULT_VALUE, - dsqlScratch->getBlrData().begin(), - dsqlScratch->getBlrData().getCount()); + dsqlScratch->getBlrData()); } } END_STORE @@ -1756,13 +1787,11 @@ { P.RDB$PROCEDURE_BLR.NULL = FALSE; attachment->storeBinaryBlob(tdbb, transaction, &P.RDB$PROCEDURE_BLR, - dsqlScratch->getBlrData().begin(), - dsqlScratch->getBlrData().getCount()); + dsqlScratch->getBlrData()); P.RDB$DEBUG_INFO.NULL = FALSE; attachment->storeBinaryBlob(tdbb, transaction, &P.RDB$DEBUG_INFO, - dsqlScratch->getDebugData().begin(), - dsqlScratch->getDebugData().getCount()); + dsqlScratch->getDebugData()); P.RDB$PROCEDURE_TYPE.NULL = FALSE; P.RDB$PROCEDURE_TYPE = (USHORT) @@ -1874,7 +1903,8 @@ strcpy(PRM.RDB$FIELD_SOURCE, parameter.typeOfName.c_str()); else { - const MetaName fieldName = storeGlobalField(tdbb, transaction, parameter); + MetaName fieldName; + storeGlobalField(tdbb, transaction, parameter, fieldName); strcpy(PRM.RDB$FIELD_SOURCE, fieldName.c_str()); } } @@ -1921,8 +1951,7 @@ dsqlScratch->appendUChar(blr_eoc); attachment->storeBinaryBlob(tdbb, transaction, &PRM.RDB$DEFAULT_VALUE, - dsqlScratch->getBlrData().begin(), - dsqlScratch->getBlrData().getCount()); + dsqlScratch->getBlrData()); } } END_STORE @@ -2458,13 +2487,11 @@ { TRG.RDB$TRIGGER_BLR.NULL = FALSE; attachment->storeBinaryBlob(tdbb, transaction, &TRG.RDB$TRIGGER_BLR, - dsqlScratch->getBlrData().begin(), - dsqlScratch->getBlrData().getCount()); + dsqlScratch->getBlrData()); TRG.RDB$DEBUG_INFO.NULL = FALSE; attachment->storeBinaryBlob(tdbb, transaction, &TRG.RDB$DEBUG_INFO, - dsqlScratch->getDebugData().begin(), - dsqlScratch->getDebugData().getCount()); + dsqlScratch->getDebugData()); } if (source.hasData()) @@ -3105,6 +3132,1027 @@ //---------------------- +void CreateDomainNode::print(string& text, Array<dsql_nod*>& nodes) const +{ + string nameTypeStr; + nameType.print(nameTypeStr); + + text = + "CreateDomainNode\n" + " " + nameTypeStr + "\n"; +} + +void CreateDomainNode::execute(thread_db* tdbb, jrd_tra* transaction) +{ + Attachment* attachment = transaction->tra_attachment; + + if (fb_utils::implicit_domain(nameType.name.c_str())) + { + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-637) << + Arg::Gds(isc_dsql_implicit_domain_name) << nameType.name); + } + + const dsql_nod* elements = nameType.legacyField->fld_ranges; + const USHORT dims = elements ? elements->nod_count / 2 : 0; + + if (nameType.legacyDefault && dims != 0) + { + // Default value is not allowed for array type in domain %s + status_exception::raise(Arg::Gds(isc_no_meta_update) << + Arg::Gds(ENCODE_ISC_MSG(226, DYN_MSG_FAC)) << nameType.name); + } + + if (dims > MAX_ARRAY_DIMENSIONS) + { + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-604) << + Arg::Gds(isc_dsql_max_arr_dim_exceeded)); + } + + nameType.resolve(dsqlScratch); + + dsqlScratch->domainValue.dsc_dtype = nameType.type; + dsqlScratch->domainValue.dsc_length = nameType.length; + dsqlScratch->domainValue.dsc_scale = nameType.scale; + + // run all statements under savepoint control + AutoSavePoint savePoint(tdbb, transaction); + + executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_DOMAIN, nameType.name); + + storeGlobalField(tdbb, transaction, nameType, nameType.name); + + if (nameType.legacyDefault || check || notNull || dims != 0) + { + AutoCacheRequest request(tdbb, drq_m_fld, DYN_REQUESTS); + + FOR (REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + FLD IN RDB$FIELDS + WITH FLD.RDB$FIELD_NAME EQ nameType.name.c_str() + { + MODIFY FLD + if (nameType.legacyDefault) + { + dsql_str* defaultString = + (dsql_str*) nameType.legacyDefault->nod_arg[e_dft_default_source]; + string defaultSource = string(defaultString->str_data, defaultString->str_length); + + FLD.RDB$DEFAULT_SOURCE.NULL = FALSE; + attachment->storeMetaDataBlob(tdbb, transaction, &FLD.RDB$DEFAULT_SOURCE, defaultSource); + + dsqlScratch->getBlrData().clear(); + dsqlScratch->appendUChar(dsqlScratch->isVersion4() ? blr_version4 : blr_version5); + + dsql_nod* node = PASS1_node(dsqlScratch, nameType.legacyDefault->nod_arg[e_dft_default]); + + GEN_hidden_variables(dsqlScratch, true); + GEN_expr(dsqlScratch, node); + + dsqlScratch->appendUChar(blr_eoc); + + FLD.RDB$DEFAULT_VALUE.NULL = FALSE; + attachment->storeBinaryBlob(tdbb, transaction, &FLD.RDB$DEFAULT_VALUE, + dsqlScratch->getBlrData()); + } + + if (check) + { + dsql_str* checkString = (dsql_str*) check->nod_arg[e_cnstr_source]; + string checkSource = string(checkString->str_data, checkString->str_length); + + FLD.RDB$VALIDATION_SOURCE.NULL = FALSE; + attachment->storeMetaDataBlob(tdbb, transaction, &FLD.RDB$VALIDATION_SOURCE, checkSource); + + dsqlScratch->getBlrData().clear(); + dsqlScratch->appendUChar(dsqlScratch->isVersion4() ? blr_version4 : blr_version5); + + // Increment the context level for this statement, so that the context number for + // any RSE generated for a SELECT within the CHECK clause will be greater than 0. + // In the environment of a domain check constraint, context number 0 is reserved + // for the "blr_fid, 0, 0, 0," which is emitted for a nod_dom_value, corresponding + // to an occurance of the VALUE keyword in the body of the check constraint. + // -- chrisj 1999-08-20 + ++dsqlScratch->contextNumber; + + dsql_nod* node = PASS1_node(dsqlScratch, check->nod_arg[e_cnstr_condition]); + + GEN_hidden_variables(dsqlScratch, true); + GEN_expr(dsqlScratch, node); + + dsqlScratch->appendUChar(blr_eoc); + + FLD.RDB$VALIDATION_BLR.NULL = FALSE; + attachment->storeBinaryBlob(tdbb, transaction, &FLD.RDB$VALIDATION_BLR, + dsqlScratch->getBlrData()); + } + + if (notNull) + { + FLD.RDB$NULL_FLAG.NULL = FALSE; + FLD.RDB$NULL_FLAG = 1; + } + + if (dims != 0) + { + FLD.RDB$DIMENSIONS.NULL = FALSE; + FLD.RDB$DIMENSIONS = dims; + } + END_MODIFY + } + END_FOR + } + + if (elements) // Is the type an array? + { + AutoCacheRequest request(tdbb, drq_s_fld_dym, DYN_REQUESTS); + + SSHORT position = 0; + const dsql_nod* const* ptr = elements->nod_arg; + for (const dsql_nod* const* const end = ptr + elements->nod_count; ptr < end; ++ptr, ++position) + { + const dsql_nod* element = *ptr++; + const SLONG lrange = element->getSlong(); + element = *ptr; + const SLONG hrange = element->getSlong(); + + if (lrange >= hrange) + { + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-604) << + Arg::Gds(isc_dsql_arr_range_error)); + } + + bool endStore = false; + + try + { + STORE (REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + DIM IN RDB$FIELD_DIMENSIONS + { + strcpy(DIM.RDB$FIELD_NAME, nameType.name.c_str()); + DIM.RDB$DIMENSION = position; + DIM.RDB$UPPER_BOUND = hrange; + DIM.RDB$LOWER_BOUND = lrange; + + endStore = true; + } + END_STORE + + } + catch (const status_exception& ex) + { + // STORE RDB$FIELD_DIMENSIONS failed + rethrowMetaException(ex, ENCODE_ISC_MSG(3, DYN_MSG_FAC), endStore); + } + } + } + + executeDdlTrigger(tdbb, transaction, DTW_AFTER, DDL_TRIGGER_CREATE_DOMAIN, nameType.name); + + savePoint.release(); // everything is ok +} + + +//---------------------- + + +// Compare the original field type with the new field type to determine if the original type can be +// changed to the new type. +// +// The following conversions are not allowed: +// Blob to anything +// Array to anything +// Date to anything +// Char to any numeric +// Varchar to any numeric +// Anything to Blob +// Anything to Array +// +// This function throws an exception if the conversion can not be made. +// +// ASF: We should stop using dyn_fld here as soon DYN stops to be a caller of this function. +void AlterDomainNode::checkUpdate(const dyn_fld& origFld, const dyn_fld& newFld) +{ + ULONG errorCode = FB_SUCCESS; + + // Check to make sure that the old and new types are compatible + switch (origFld.dyn_dtype) + { + // CHARACTER types + case blr_text: + case blr_varying: + case blr_cstring: + switch (newFld.dyn_dtype) + { + case blr_blob: + case blr_blob_id: + // Cannot change datatype for column %s. + // The operation cannot be performed on BLOB, or ARRAY columns. + errorCode = isc_dyn_dtype_invalid; + break; + + case blr_sql_date: + case blr_sql_time: + case blr_timestamp: + case blr_int64: + case blr_long: + case blr_short: + case blr_d_float: + case blr_double: + case blr_float: + // Cannot convert column %s from character to non-character data. + errorCode = isc_dyn_dtype_conv_invalid; + break; + + // If the original field is a character field and the new field is a character field, + // is there enough space in the new field? + case blr_text: + case blr_varying: + case blr_cstring: + { + // CVC: Because our caller invoked DSC_make_descriptor() on newFld previously, + // we should have the added bytes for varchar. For cstring, we are done, since + // DSC_make_descriptor(DSC_string_length) != DSC_string_length(DSC_make_descriptor). + + const USHORT maxflen = DSC_string_length(&origFld.dyn_dsc); + + // We can have this assertion since this case is for both string fields. + const ULONG new_len = DSC_string_length(&newFld.dyn_dsc); + fb_assert(new_len - maxflen == (ULONG) newFld.dyn_charbytelen - origFld.dyn_charbytelen); + // if (newFld.dyn_dsc.dsc_length < maxflen) + if (new_len < maxflen) + { + // msg 208: New size specified for column %s must be at least %d characters. + errorCode = isc_dyn_char_fld_too_small; + } + } + break; + + default: + fb_assert(FALSE); + errorCode = 87; // MODIFY RDB$FIELDS FAILED + break; + } + break; + + // BLOB and ARRAY types + case blr_blob: + case blr_blob_id: + // Cannot change datatype for column %s. + // The operation cannot be performed on BLOB, or ARRAY columns. + errorCode = isc_dyn_dtype_invalid; + break; + + // DATE types + case blr_sql_date: + case blr_sql_time: + case blr_timestamp: + switch (newFld.dyn_dtype) + { + case blr_sql_date: + if (origFld.dyn_dtype == blr_sql_time) + { + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. + errorCode = isc_dyn_invalid_dtype_conversion; + } + break; + + case blr_sql_time: + if (origFld.dyn_dtype == blr_sql_date) + { + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. + errorCode = isc_dyn_invalid_dtype_conversion; + } + break; + + case blr_timestamp: + if (origFld.dyn_dtype == blr_sql_time) + { + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. + errorCode = isc_dyn_invalid_dtype_conversion; + } + break; + + // If the original field is a date field and the new field is a character field, + // is there enough space in the new field? + case blr_text: + case blr_text2: + case blr_varying: + case blr_varying2: + case blr_cstring: + case blr_cstring2: + { + const USHORT maxflen = DSC_string_length(&origFld.dyn_dsc); + + // CVC: Solve bug #910423, missing DSC_string_length call. + // if (newFld.dyn_dsc.dsc_length < maxflen) + if (DSC_string_length(&newFld.dyn_dsc) < maxflen) + { + // msg 208: New size specified for column %s must be at least %d characters. + errorCode = isc_dyn_char_fld_too_small; + } + } + + break; + + default: + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. + errorCode = isc_dyn_invalid_dtype_conversion; + break; + } + break; + + // NUMERIC types + case blr_int64: + case blr_long: + case blr_short: + case blr_d_float: + case blr_double: + case blr_float: + switch (newFld.dyn_dtype) + { + case blr_blob: + case blr_blob_id: + // Cannot change datatype for column %s. + // The operation cannot be performed on BLOB, or ARRAY columns. + errorCode = isc_dyn_dtype_invalid; + break; + + case blr_sql_date: + case blr_sql_time: + case blr_timestamp: + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. + errorCode = isc_dyn_invalid_dtype_conversion; + break; + + // If the original field is a numeric field and the new field is a numeric field, + // is there enough space in the new field (do not allow the base type to decrease) + + case blr_short: + switch (origFld.dyn_dtype) + { + case blr_short: + errorCode = checkUpdateNumericType(origFld, newFld); + break; + + default: + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. + errorCode = isc_dyn_invalid_dtype_conversion; + break; + } + break; + + case blr_long: + switch (origFld.dyn_dtype) + { + case blr_long: + case blr_short: + errorCode = checkUpdateNumericType(origFld, newFld); + break; + + default: + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. + errorCode = isc_dyn_invalid_dtype_conversion; + break; + } + break; + + case blr_float: + switch (origFld.dyn_dtype) + { + case blr_float: + case blr_short: + break; + + default: + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. + errorCode = isc_dyn_invalid_dtype_conversion; + break; + } + break; + + case blr_int64: + switch (origFld.dyn_dtype) + { + case blr_int64: + case blr_long: + case blr_short: + errorCode = checkUpdateNumericType(origFld, newFld); + break; + + default: + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. + errorCode = isc_dyn_invalid_dtype_conversion; + break; + } + break; + + case blr_d_float: + case blr_double: + switch (origFld.dyn_dtype) + { + case blr_double: + case blr_d_float: + case blr_float: + case blr_short: + case blr_long: + break; + + default: + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. + errorCode = isc_dyn_invalid_dtype_conversion; + break; + } + break; + + // If the original field is a numeric field and the new field is a character field, + // is there enough space in the new field? + case blr_text: + case blr_varying: + case blr_cstring: + { + const USHORT maxflen = DSC_string_length(&origFld.dyn_dsc); + + // CVC: Solve bug #910423, missing DSC_string_length call. + // if (newFld.dyn_dsc.dsc_length < maxflen) + if (DSC_string_length(&newFld.dyn_dsc) < maxflen) + { + // msg 208: New size specified for column %s must be at least %d characters. + errorCode = isc_dyn_char_fld_too_small; + } + } + break; + + default: + fb_assert(FALSE); + errorCode = 87; // MODIFY RDB$FIELDS FAILED + break; + } + break; + + default: + fb_assert(FALSE); + errorCode = 87; // MODIFY RDB$FIELDS FAILED + break; + } + + if (errorCode == FB_SUCCESS) + return; + + switch (errorCode) + { + case isc_dyn_dtype_invalid: + // Cannot change datatype for column %s.The operation cannot be performed on DATE, BLOB, or ARRAY columns. + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(errorCode) << origFld.dyn_fld_name.c_str()); + break; + + case isc_dyn_dtype_conv_invalid: + // Cannot convert column %s from character to non-character data. + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(errorCode) << origFld.dyn_fld_name.c_str()); + break; + + case isc_dyn_char_fld_too_small: + // msg 208: New size specified for column %s must be at least %d characters. + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(errorCode) << origFld.dyn_fld_name.c_str() << + Arg::Num(DSC_string_length(&origFld.dyn_dsc))); + break; + + case isc_dyn_scale_too_big: + { + int code = errorCode; + int diff = newFld.dyn_precision - + (origFld.dyn_precision + origFld.dyn_dsc.dsc_scale); + if (diff < 0) + { + // If new scale becomes negative externally, the message is useless for the user. + // (The scale is always zero or negative for us but externally is non-negative.) + // Let's ask the user to widen the precision, then. Example: numeric(4, 0) -> numeric(1, 1). + code = isc_dyn_precision_too_small; + diff = newFld.dyn_precision - newFld.dyn_dsc.dsc_scale - diff; + } + + // scale_too_big: New scale specified for column @1 must be at most @2. + // precision_too_small: New precision specified for column @1 must be at least @2. + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(code) << origFld.dyn_fld_name.c_str() << Arg::Num(diff)); + } + break; + + case isc_dyn_invalid_dtype_conversion: + { + TEXT orig_type[25], new_type[25]; + + DSC_get_dtype_name(&origFld.dyn_dsc, orig_type, sizeof(orig_type)); + DSC_get_dtype_name(&newFld.dyn_dsc, new_type, sizeof(new_type)); + + // Cannot change datatype for @1. Conversion from base type @2 to @3 is not supported. + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(errorCode) << origFld.dyn_fld_name.c_str() << orig_type << new_type); + } + break; + + default: + // msg 95: "MODIFY RDB$RELATION_FIELDS failed" + status_exception::raise(Arg::Gds(ENCODE_ISC_MSG(95, DYN_MSG_FAC))); + } +} + +// Compare the original field type with the new field type to determine if the original type can be +// changed to the new type. +// The types should be integral, since it tests only numeric/decimal subtypes to ensure the scale is +// not being widened at the expense of the precision, because the old stored values should fit in +// the new definition. +// +// This function returns an error code if the conversion can not be made. If the conversion can be +// made, FB_SUCCESS is returned. +ULONG AlterDomainNode::checkUpdateNumericType(const dyn_fld& origFld, const dyn_fld& newFld) +{ + // Since dsc_scale is negative, the sum of precision and scale produces + // the width of the integral part. + if (origFld.dyn_sub_type && newFld.dyn_sub_type && + origFld.dyn_precision + origFld.dyn_dsc.dsc_scale > + newFld.dyn_precision + newFld.dyn_dsc.dsc_scale) + { + return isc_dyn_scale_too_big; + } + + return FB_SUCCESS; +} + +// Updates the field names in an index and forces the index to be rebuilt with the new field names. +void AlterDomainNode::modifyLocalFieldIndex(thread_db* tdbb, jrd_tra* transaction, + const MetaName& relationName, const MetaName& fieldName, const MetaName& newFieldName) +{ + AutoRequest request; + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + IDX IN RDB$INDICES CROSS IDXS IN RDB$INDEX_SEGMENTS WITH + IDX.RDB$INDEX_NAME EQ IDXS.RDB$INDEX_NAME AND + IDX.RDB$RELATION_NAME EQ relationName.c_str() AND + IDXS.RDB$FIELD_NAME EQ fieldName.c_str() + { + // Change the name of the field in the index + MODIFY IDXS USING + memcpy(IDXS.RDB$FIELD_NAME, newFieldName.c_str(), sizeof(IDXS.RDB$FIELD_NAME)); + END_MODIFY + + // Set the index name to itself to tell the index to rebuild + MODIFY IDX USING + // This is to fool both gpre and gcc. + char* p = IDX.RDB$INDEX_NAME; + p[MAX_SQL_IDENTIFIER_LEN] = 0; + END_MODIFY + } + END_FOR +} + +void AlterDomainNode::print(string& text, Array<dsql_nod*>& nodes) const +{ + text.printf( + "AlterDomainNode\n" + " %s\n", name.c_str()); +} + +void AlterDomainNode::execute(thread_db* tdbb, jrd_tra* transaction) +{ + Attachment* attachment = transaction->tra_attachment; + + // run all statements under savepoint control + AutoSavePoint savePoint(tdbb, transaction); + bool found = false; + + bool endModify = false; + + try + { + AutoCacheRequest request(tdbb, drq_m_fld2, DYN_REQUESTS); + + FOR (REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + FLD IN RDB$FIELDS + WITH FLD.RDB$FIELD_NAME EQ name.c_str() + { + found = true; + executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_DOMAIN, name); + + MODIFY FLD + if (dropConstraint) + { + FLD.RDB$VALIDATION_BLR.NULL = TRUE; + FLD.RDB$VALIDATION_SOURCE.NULL = TRUE; + } + + if (dropDefault) + { + FLD.RDB$DEFAULT_VALUE.NULL = TRUE; + FLD.RDB$DEFAULT_SOURCE.NULL = TRUE; + } + + if (setConstraint) + { + if (!FLD.RDB$VALIDATION_BLR.NULL) + { + // msg 160: "Only one constraint allowed for a domain" + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(ENCODE_ISC_MSG(160, DYN_MSG_FAC))); + } + + dsql_fld localField(dsqlScratch->getStatement()->getPool()); + + // Get the attributes of the domain, and set any occurances of + // keyword VALUE to the correct type, length, scale, etc. + if (!METD_get_domain(dsqlScratch->getTransaction(), &localField, name.c_str())) + { + // Specified domain or source field does not exist + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-607) << + Arg::Gds(isc_dsql_command_err) << + Arg::Gds(isc_dsql_domain_not_found) << name); + } + + dsqlScratch->domainValue.dsc_dtype = localField.fld_dtype; + dsqlScratch->domainValue.dsc_length = localField.fld_length; + dsqlScratch->domainValue.dsc_scale = localField.fld_scale; + + dsql_str* checkString = (dsql_str*) setConstraint->nod_arg[e_cnstr_source]; + string checkSource = string(checkString->str_data, checkString->str_length); + + FLD.RDB$VALIDATION_SOURCE.NULL = FALSE; + attachment->storeMetaDataBlob(tdbb, transaction, &FLD.RDB$VALIDATION_SOURCE, checkSource); + + dsqlScratch->getBlrData().clear(); + dsqlScratch->appendUChar(dsqlScratch->isVersion4() ? blr_version4 : blr_version5); + + // Increment the context level for this statement, so that the context number for + // any RSE generated for a SELECT within the CHECK clause will be greater than 0. + // In the environment of a domain check constraint, context number 0 is reserved + // for the "blr_fid, 0, 0, 0," which is emitted for a nod_dom_value, corresponding + // to an occurance of the VALUE keyword in the body of the check constraint. + // -- chrisj 1999-08-20 + ++dsqlScratch->contextNumber; + + dsql_nod* node = PASS1_node(dsqlScratch, setConstraint->nod_arg[e_cnstr_condition]); + + GEN_hidden_variables(dsqlScratch, true); + GEN_expr(dsqlScratch, node); + + dsqlScratch->appendUChar(blr_eoc); + + FLD.RDB$VALIDATION_BLR.NULL = FALSE; + attachment->storeBinaryBlob(tdbb, transaction, &FLD.RDB$VALIDATION_BLR, + dsqlScratch->getBlrData()); + } + + if (setDefault) + { + if (FLD.RDB$DIMENSIONS) + { + // msg 226: "Default value is not allowed for array type in domain %s" + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(ENCODE_ISC_MSG(226, DYN_MSG_FAC)) << name); + } + + dsql_str* defaultString = + (dsql_str*) setDefault->nod_arg[e_dft_default_source]; + string defaultSource = string(defaultString->str_data, defaultString->str_length); + + FLD.RDB$DEFAULT_SOURCE.NULL = FALSE; + attachment->storeMetaDataBlob(tdbb, transaction, &FLD.RDB$DEFAULT_SOURCE, defaultSource); + + dsqlScratch->getBlrData().clear(); + dsqlScratch->appendUChar(dsqlScratch->isVersion4() ? blr_version4 : blr_version5); + + dsql_nod* node = PASS1_node(dsqlScratch, setDefault->nod_arg[e_dft_default]); + + GEN_hidden_variables(dsqlScratch, true); + GEN_expr(dsqlScratch, node); + + dsqlScratch->appendUChar(blr_eoc); + + FLD.RDB$DEFAULT_VALUE.NULL = FALSE; + attachment->storeBinaryBlob(tdbb, transaction, &FLD.RDB$DEFAULT_VALUE, + dsqlScratch->getBlrData()); + } + + if (type) + { + type->resolve(dsqlScratch); + + dyn_fld origDom, newDom; + + DSC_make_descriptor(&origDom.dyn_dsc, FLD.RDB$FIELD_TYPE, FLD.RDB$FIELD_SCALE, + FLD.RDB$FIELD_LENGTH, FLD.RDB$FIELD_SUB_TYPE, FLD.RDB$CHARACTER_SET_ID, + FLD.RDB$COLLATION_ID); + + origDom.dyn_fld_name = name; + origDom.dyn_charbytelen = FLD.RDB$FIELD_LENGTH; + origDom.dyn_dtype = FLD.RDB$FIELD_TYPE; + origDom.dyn_precision = FLD.RDB$FIELD_PRECISION; + origDom.dyn_sub_type = FLD.RDB$FIELD_SUB_TYPE; + origDom.dyn_charlen = FLD.RDB$CHARACTER_LENGTH; + origDom.dyn_collation = FLD.RDB$COLLATION_ID; + origDom.dyn_null_flag = !FLD.RDB$NULL_FLAG.NULL && FLD.RDB$NULL_FLAG != 0; + + // If the original field type is an array, force its blr type to blr_blob + bool has_dimensions = false; + if (FLD.RDB$DIMENSIONS != 0) + origDom.dyn_dtype = blr_blob; + + USHORT typeLength = type->length; + switch (type->type) + { + case dtype_varying: + typeLength -= sizeof(USHORT); + break; + + // Not valid for domains, but may be important for a future refactor. + case dtype_cstring: + --typeLength; + break; + + default: + break; + } + + DSC_make_descriptor(&newDom.dyn_dsc, blr_dtypes[type->type], type->scale, + typeLength, type->subType, type->charSetId, type->collationId); + + newDom.dyn_fld_name = name; + newDom.dyn_charbytelen = typeLength; + newDom.dyn_dtype = blr_dtypes[type->type]; + newDom.dyn_precision = type->precision; + newDom.dyn_sub_type = type->subType; + newDom.dyn_charlen = type->charLength; + newDom.dyn_collation = type->collationId; + newDom.dyn_null_flag = type->notNull; + + // Now that we have all of the information needed, let's check to see if the field + // type can be modifed. + + checkUpdate(origDom, newDom); + + if (!newDom.dyn_dsc.isExact() || newDom.dyn_dsc.dsc_scale != 0) + { + AutoCacheRequest request(tdbb, drq_l_ident_gens, DYN_REQUESTS); + + FOR (REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + RFR IN RDB$RELATION_FIELDS + WITH RFR.RDB$FIELD_SOURCE = FLD.RDB$FIELD_NAME AND + RFR.RDB$GENERATOR_NAME NOT MISSING + { + // Domain @1 must be of exact number type with zero scale because it's used + // in an identity column. + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(ENCODE_ISC_MSG(276, DYN_MSG_FAC)) << name); + } + END_FOR + } + + // If the datatype was changed, update any indexes that involved the domain + + AutoRequest request2; + + FOR(REQUEST_HANDLE request2 TRANSACTION_HANDLE transaction) + DOM IN RDB$RELATION_FIELDS + WITH DOM.RDB$FIELD_SOURCE EQ name.c_str() + { + modifyLocalFieldIndex(tdbb, transaction, DOM.RDB$RELATION_NAME, + DOM.RDB$FIELD_NAME, DOM.RDB$FIELD_NAME); + } + END_FOR + + // Update RDB$FIELDS + updateRdbFields(*type, + FLD.RDB$FIELD_TYPE, + FLD.RDB$FIELD_LENGTH, + FLD.RDB$FIELD_SUB_TYPE.NULL, FLD.RDB$FIELD_SUB_TYPE, + FLD.RDB$FIELD_SCALE.NULL, FLD.RDB$FIELD_SCALE, + FLD.RDB$CHARACTER_SET_ID.NULL, FLD.RDB$CHARACTER_SET_ID, + FLD.RDB$CHARACTER_LENGTH.NULL, FLD.RDB$CHARACTER_LENGTH, + FLD.RDB$FIELD_PRECISION.NULL, FLD.RDB$FIELD_PRECISION, + FLD.RDB$COLLATION_ID.NULL, FLD.RDB$COLLATION_ID, + FLD.RDB$SEGMENT_LENGTH.NULL, FLD.RDB$SEGMENT_LENGTH); + } + + if (renameTo.hasData()) + { + rename(tdbb, transaction, (FLD.RDB$DIMENSIONS.NULL ? 0 : FLD.RDB$DIMENSIONS)); + strcpy(FLD.RDB$FIELD_NAME, renameTo.c_str()); + } + END_MODIFY + + endModify = true; + } + END_FOR + } + catch (const status_exception& ex) + { + // msg 87: "MODIFY RDB$FIELDS failed" + rethrowMetaException(ex, ENCODE_ISC_MSG(87, DYN_MSG_FAC), endModify); + } + + if (!found) + { + // msg 89: "Global field not found" + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(ENCODE_ISC_MSG(89, DYN_MSG_FAC))); + } + + executeDdlTrigger(tdbb, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_DOMAIN, name); + + savePoint.release(); // everything is ok +} + +void AlterDomainNode::rename(thread_db* tdbb, jrd_tra* transaction, SSHORT dimensions) +{ + // Checks to see if the given domain already exists. + + AutoRequest request; + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + FLD IN RDB$FIELDS WITH FLD.RDB$FIELD_NAME EQ renameTo.c_str() + { + // msg 204: Cannot rename domain %s to %s. A domain with that name already exists. + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(ENCODE_ISC_MSG(204, DYN_MSG_FAC)) << name << renameTo); + } + END_FOR + + // CVC: Let's update the dimensions, too. + if (dimensions != 0) + { + request.reset(); + + FOR (REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + FDIM IN RDB$FIELD_DIMENSIONS + WITH FDIM.RDB$FIELD_NAME EQ name.c_str() + { + MODIFY FDIM USING + strcpy(FDIM.RDB$FIELD_NAME, renameTo.c_str()); + END_MODIFY + } + END_FOR + } + + request.reset(); + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + RFLD IN RDB$RELATION_FIELDS + WITH RFLD.RDB$FIELD_SOURCE EQ name.c_str() + { + MODIFY RFLD USING + strcpy(RFLD.RDB$FIELD_SOURCE, renameTo.c_str()); + END_MODIFY + + modifyLocalFieldIndex(tdbb, transaction, RFLD.RDB$RELATION_NAME, + RFLD.RDB$FIELD_NAME, RFLD.RDB$FIELD_NAME); + } + END_FOR +} + + +//---------------------- + + +// Delete the records in RDB$FIELD_DIMENSIONS pertaining to a field. +bool DropDomainNode::deleteDimensionRecords(thread_db* tdbb, jrd_tra* transaction, const MetaName& name) +{ + AutoCacheRequest request(tdbb, drq_e_dims, DYN_REQUESTS); + bool found = false; + + try + { + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + X IN RDB$FIELD_DIMENSIONS + WITH X.RDB$FIELD_NAME EQ name.c_str() + { + found = true; + ERASE X; + } + END_FOR + } + catch (const status_exception& ex) + { + // msg 35: "ERASE RDB$FIELDS failed" + rethrowMetaException(ex, ENCODE_ISC_MSG(35, DYN_MSG_FAC), true); + } + + return found; +} + +void DropDomainNode::print(string& text, Array<dsql_nod*>& /*nodes*/) const +{ + text.printf( + "DropDomainNode\n" + " name: '%s'\n", + name.c_str()); +} + +void DropDomainNode::execute(thread_db* tdbb, jrd_tra* transaction) +{ + // run all statements under savepoint control + AutoSavePoint savePoint(tdbb, transaction); + + bool found = false; + + try + { + AutoCacheRequest request(tdbb, drq_e_gfields, DYN_REQUESTS); + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + X IN RDB$FIELDS + WITH X.RDB$FIELD_NAME EQ name.c_str() + { + executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_DROP_DOMAIN, name); + + check(tdbb, transaction); + deleteDimensionRecords(tdbb, transaction, name); + + ERASE X; + + found = true; + } + END_FOR + } + catch (const status_exception& ex) + { + // msg 44: "ERASE RDB$FIELDS failed" + rethrowMetaException(ex, ENCODE_ISC_MSG(44, DYN_MSG_FAC), found); + } + + if (found) + executeDdlTrigger(tdbb, transaction, DTW_AFTER, DDL_TRIGGER_DROP_DOMAIN, name); + else + { + // msg 89: "Domain not found" + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(ENCODE_ISC_MSG(89, DYN_MSG_FAC))); + } + + savePoint.release(); // everything is ok +} + +void DropDomainNode::check(thread_db* tdbb, jrd_tra* transaction) +{ + AutoCacheRequest request(tdbb, drq_l_fld_src, DYN_REQUESTS); + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + Y IN RDB$RELATION_FIELDS + WITH Y.RDB$FIELD_SOURCE EQ name.c_str() + { + fb_utils::exact_name_limit(Y.RDB$FIELD_SOURCE, sizeof(Y.RDB$FIELD_SOURCE)); + fb_utils::exact_name_limit(Y.RDB$RELATION_NAME, sizeof(Y.RDB$RELATION_NAME)); + fb_utils::exact_name_limit(Y.RDB$FIELD_NAME, sizeof(Y.RDB$FIELD_NAME)); + + // msg 43: "Domain %s is used in table %s (local name %s) and can not be dropped" + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(ENCODE_ISC_MSG(43, DYN_MSG_FAC)) << Y.RDB$FIELD_SOURCE << + Y.RDB$RELATION_NAME << Y.RDB$FIELD_NAME); + } + END_FOR + + request.reset(tdbb, drq_l_prp_src, DYN_REQUESTS); + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + X IN RDB$PROCEDURE_PARAMETERS + WITH X.RDB$FIELD_SOURCE EQ name.c_str() + { + fb_utils::exact_name_limit(X.RDB$FIELD_SOURCE, sizeof(X.RDB$FIELD_SOURCE)); + fb_utils::exact_name_limit(X.RDB$PROCEDURE_NAME, sizeof(X.RDB$PROCEDURE_NAME)); + fb_utils::exact_name_limit(X.RDB$PARAMETER_NAME, sizeof(X.RDB$PARAMETER_NAME)); + + // msg 239: "Domain %s is used in procedure %s (parameter name %s) and cannot be dropped" + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(ENCODE_ISC_MSG(239, DYN_MSG_FAC)) << X.RDB$FIELD_SOURCE << + QualifiedName(X.RDB$PROCEDURE_NAME, + (X.RDB$PACKAGE_NAME.NULL ? NULL : X.RDB$PACKAGE_NAME)).toString().c_str() << + X.RDB$PARAMETER_NAME); + } + END_FOR + + //// FIXME: Check domain usage in functions. +} + + +//---------------------- + + void CreateSequenceNode::print(string& text, Array<dsql_nod*>& /*nodes*/) const { text.printf( Modified: firebird/trunk/src/dsql/DdlNodes.h =================================================================== --- firebird/trunk/src/dsql/DdlNodes.h 2010-07-05 18:37:35 UTC (rev 51311) +++ firebird/trunk/src/dsql/DdlNodes.h 2010-07-06 00:49:33 UTC (rev 51312) @@ -582,6 +582,94 @@ }; +class CreateDomainNode : public DdlNode +{ +public: + explicit CreateDomainNode(MemoryPool& p, const Firebird::string& sqlText, + const ParameterClause& aNameType) + : DdlNode(p, sqlText), + nameType(aNameType), + notNull(false), + check(NULL) + { + } + +public: + virtual void print(Firebird::string& text, Firebird::Array<dsql_nod*>& nodes) const; + virtual void execute(thread_db* tdbb, jrd_tra* transaction); + +public: + ParameterClause nameType; + bool notNull; + dsql_nod* check; +}; + + +class AlterDomainNode : public DdlNode +{ +public: + explicit AlterDomainNode(MemoryPool& p, const Firebird::string& sqlText, + const Firebird::MetaName& aName) + : DdlNode(p, sqlText), + name(p, aName), + dropConstraint(false), + dropDefault(false), + setConstraint(NULL), + setDefault(NULL), + renameTo(p) + { + } + +public: + static void checkUpdate(const dyn_fld& origFld, const dyn_fld& newFld); + static ULONG checkUpdateNumericType(const dyn_fld& origFld, const dyn_fld& newFld); + + static void modifyLocalFieldIndex(thread_db* tdbb, jrd_tra* transaction, + const Firebird::MetaName& relationName, const Firebird::MetaName& fieldName, + const Firebird::MetaName& newFieldName); + + virtual void print(Firebird::string& text, Firebird::Array<dsql_nod*>& nodes) const; + virtual void execute(thread_db* tdbb, jrd_tra* transaction); + +private: + void rename(thread_db* tdbb, jrd_tra* transaction, SSHORT dimensions); + +public: + Firebird::MetaName name; + bool dropConstraint; + bool dropDefault; + dsql_nod* setConstraint; + dsql_nod* setDefault; + Firebird::MetaName renameTo; + Firebird::AutoPtr<TypeClause> type; +}; + + +class DropDomainNode : public DdlNode +{ +public: + explicit DropDomainNode(MemoryPool& p, const Firebird::string& sqlText, + const Firebird::MetaName& aName) + : DdlNode(p, sqlText), + name(p, aName) + { + } + + static bool deleteDimensionRecords(thread_db* tdbb, jrd_tra* transaction, + const Firebird::MetaName& name); + +public: + virtual void print(Firebird::string& text, Firebird::Array<dsql_nod*>& nodes) const; + virtual void execute(thread_db* tdbb, jrd_tra* transaction); + +private: + void check(thread_db* tdbb, jrd_tra* transaction); + +public: + Firebird::MetaName name; +}; + + class CreateSequenceNode : public DdlNode { public: Modified: firebird/trunk/src/dsql/Nodes.h =================================================================== --- firebird/trunk/src/dsql/Nodes.h 2010-07-05 18:37:35 UTC (rev 51311) +++ firebird/trunk/src/dsql/Nodes.h 2010-07-06 00:49:33 UTC (rev 51312) @@ -122,7 +122,7 @@ void putType(const TypeClause& type, bool useSubType); void resetContextStack(); Firebird::MetaName storeGlobalField(thread_db* tdbb, jrd_tra* transaction, - const TypeClause& parameter); + const TypeClause& field, Firebird::MetaName& name); protected: virtual DdlNode* internalDsqlPass() Modified: firebird/trunk/src/dsql/Parser.h =================================================================== --- firebird/trunk/src/dsql/Parser.h 2010-07-05 18:37:35 UTC (rev 51311) +++ firebird/trunk/src/dsql/Parser.h 2010-07-06 00:49:33 UTC (rev 51312) @@ -136,6 +136,52 @@ private: void transformString(const char* start, unsigned length, Firebird::string& dest); + // Set the value of a clause, checking if it was already specified. + + template <typename T> + void setClause(T& clause, const char* duplicateMsg, const T& value) + { + using namespace Firebird; + if (isDuplicateClause(clause)) + { + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-637) << + Arg::Gds(isc_dsql_duplicate_spec) << duplicateMsg); + } + + clause = value; + } + + template <typename T, typename Delete> + void setClause(Firebird::AutoPtr<T, Delete>& clause, const char* duplicateMsg, T* value) + { + using namespace Firebird; + if (isDuplicateClause(clause)) + { + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-637) << + Arg::Gds(isc_dsql_duplicate_spec) << duplicateMsg); + } + + clause = value; + } + + void setClause(bool& clause, const char* duplicateMsg) + { + setClause(clause, duplicateMsg, true); + } + + template <typename T> + bool isDuplicateClause(const T& clause) + { + return clause != 0; + } + + bool isDuplicateClause(const Firebird::MetaName& clause) + { + return clause.hasData(); + } + // start - defined in btyacc_fb.ske private: static void yySCopy(YYSTYPE* to, YYSTYPE* from, int size); Modified: firebird/trunk/src/dsql/ddl.cpp =================================================================== --- firebird/trunk/src/dsql/ddl.cpp 2010-07-05 18:37:35 UTC (rev 51311) +++ firebird/trunk/src/dsql/ddl.cpp 2010-07-06 00:49:33 UTC (rev 51312) @@ -117,7 +117,6 @@ static void assign_field_length(dsql_fld*, USHORT); static void check_constraint(DsqlCompilerScratch*, dsql_nod*, bool); -static void check_one_call(USHORT*, SSHORT, const TEXT*); static void create_view_triggers(DsqlCompilerScratch*, dsql_nod*, dsql_nod*); static void define_computed(DsqlCompilerScratch*, dsql_nod*, dsql_fld*, dsql_nod*); static void define_constraint_trigger(DsqlCompilerScratch*, dsql_nod*); @@ -127,7 +126,6 @@ const dsql_nod*, const char*, const char*); //static void define_del_default_trg(DsqlCompilerScratch*, dsql_nod*, dsql_nod*, dsql_nod*, TEXT*, TEXT*); static void define_dimensions(DsqlCompilerScratch*, const dsql_fld*); -static void define_domain(DsqlCompilerScratch*); static void define_exception(DsqlCompilerScratch*, NOD_TYPE); static void define_field(DsqlCompilerScratch*, dsql_nod*, SSHORT, const dsql_str*, const dsql_nod* pkcols); static void define_filter(DsqlCompilerScratch*); @@ -162,7 +160,6 @@ static void make_index_trg_ref_int(DsqlCompilerScratch*, dsql_nod*, dsql_nod*, dsql_nod*, const char*, const char*); static void modify_database(DsqlCompilerScratch*); -static void modify_domain(DsqlCompilerScratch*); static void modify_field(DsqlCompilerScratch*, dsql_nod*, const dsql_str*); static void modify_index(DsqlCompilerScratch*); static void modify_privilege(DsqlCompilerScratch* dsqlScratch, NOD_TYPE type, SSHORT option, @@ -185,7 +182,6 @@ static void stuff_default_blr(DsqlCompilerScratch*, const UCHAR*, USHORT); static void stuff_matching_blr(BlrWriter*, const dsql_nod*, const dsql_nod*); static void stuff_trg_firing_cond(BlrWriter*, const dsql_nod*); -static void set_nod_value_attributes(dsql_nod*, const dsql_fld*); static void clearPermanentField (dsql_rel*, bool); static void define_user(DsqlCompilerScratch*, UCHAR); static void put_grantor(DsqlCompilerScratch* dsqlScratch, const dsql_nod* grantor); @@ -282,6 +278,8 @@ if (type == nod_class_stmtnode) { + fb_utils::init_status(tdbb->tdbb_status_vector); // Do the same as DYN_ddl does. + // run all statements under savepoint control { // scope AutoSavePoint savePoint(tdbb, request->req_transaction); @@ -754,27 +752,6 @@ } -static void check_one_call (USHORT* repetition_count, SSHORT pos, const TEXT* error_msg) -{ -/************************************** - * - * c h e c k _ o n e _ c a l l - * - ************************************** - * - * Function - * Ensure that each option in modify_domain() is called only once. - * This restriction cannot be enforced by the DSQL parser. - * - **************************************/ - if (++repetition_count[pos] > 1) - { - ERRD_post (Arg::Gds(isc_sqlerr) << Arg::Num(-637) << - Arg::Gds(isc_dsql_duplicate_spec) << Arg::Str(error_msg)); - } -} - - static void create_view_triggers(DsqlCompilerScratch* dsqlScratch, dsql_nod* element, dsql_nod* items) { /************************************** @@ -1446,123 +1423,6 @@ } -static void define_domain(DsqlCompilerScratch* dsqlScratch) -{ -/************************************** - * - * d e f i n e _ d o m a i n - * - ************************************** - * - * Function - * Define a domain (global field) - * - **************************************/ - - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - dsql_nod* element = statement->getDdlNode(); - dsql_fld* field = (dsql_fld*) element->nod_arg[e_dom_name]; - - if (fb_utils::implicit_domain(field->fld_name.c_str())) - { - ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-637) << - Arg::Gds(isc_dsql_implicit_domain_name) << Arg::Str(field->fld_name)); - } - - dsqlScratch->appendString(isc_dyn_def_global_fld, field->fld_name); - - DDL_resolve_intl_type(dsqlScratch, field, (dsql_str*) element->nod_arg[e_dom_collate]); - put_field(dsqlScratch, field, false); - - // check for a default value - - dsql_nod* node = element->nod_arg[e_dom_default]; - if (node) - { - define_default(dsqlScratch, node); - } - - if (field->fld_ranges) - { - define_dimensions(dsqlScratch, field); - } - - bool null_flag = false; - bool check_flag = false; - - // check for constraints - node = element->nod_arg[e_dom_constraint]; - if (node) - { - dsql_nod** ptr = node->nod_arg; - const dsql_nod* const* const end_ptr = ptr + node->nod_count; - for (; ptr < end_ptr; ++ptr) - { - if ((*ptr)->nod_type == nod_rel_constraint) - { - dsql_nod* node1 = (*ptr)->nod_arg[e_rct_type]; - if (node1->nod_type == nod_null) - { - if (!null_flag) - { - dsqlScratch->appendUChar(isc_dyn_fld_not_null); - null_flag = true; - } - else - { - ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-637) << - Arg::Gds(isc_dsql_duplicate_spec) << Arg::Str("NOT NULL")); - } - } - else if (node1->nod_type == nod_def_constraint) - { - if (check_flag) - { - ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-637) << - Arg::Gds(isc_dsql_duplicate_spec) << Arg::Str("DOMAIN CHECK CONSTRAINT")); - } - ... [truncated message content] |
From: <ale...@us...> - 2010-07-09 12:51:12
|
Revision: 51322 http://firebird.svn.sourceforge.net/firebird/?rev=51322&view=rev Author: alexpeshkoff Date: 2010-07-09 12:51:05 +0000 (Fri, 09 Jul 2010) Log Message: ----------- ODS change: made RDB$USERS system table, added virtual table SEC$USERS Modified Paths: -------------- firebird/trunk/builds/posix/Makefile.in.firebird firebird/trunk/builds/posix/make.shared.variables firebird/trunk/src/dbs/security.sql firebird/trunk/src/include/gen/ids.h firebird/trunk/src/jrd/DatabaseSnapshot.cpp firebird/trunk/src/jrd/DatabaseSnapshot.h firebird/trunk/src/jrd/Relation.h firebird/trunk/src/jrd/UserManagement.cpp firebird/trunk/src/jrd/UserManagement.h firebird/trunk/src/jrd/constants.h firebird/trunk/src/jrd/fields.h firebird/trunk/src/jrd/idx.h firebird/trunk/src/jrd/ini.epp firebird/trunk/src/jrd/met.epp firebird/trunk/src/jrd/names.h firebird/trunk/src/jrd/opt.cpp firebird/trunk/src/jrd/recsrc/RecordSource.h firebird/trunk/src/jrd/relations.h firebird/trunk/src/jrd/svc.cpp firebird/trunk/src/jrd/types.h firebird/trunk/src/msgs/facilities2.sql firebird/trunk/src/msgs/messages2.sql firebird/trunk/src/utilities/gsec/gsec.cpp firebird/trunk/src/utilities/gsec/gsec.h firebird/trunk/src/utilities/gsec/gsecswi.h firebird/trunk/src/utilities/gsec/secur_proto.h firebird/trunk/src/utilities/gsec/security.epp Added Paths: ----------- firebird/trunk/src/jrd/recsrc/UsersTableScan.cpp Modified: firebird/trunk/builds/posix/Makefile.in.firebird =================================================================== --- firebird/trunk/builds/posix/Makefile.in.firebird 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/builds/posix/Makefile.in.firebird 2010-07-09 12:51:05 UTC (rev 51322) @@ -76,9 +76,7 @@ # use the static files as a last resort. # # The bootstrap version of gpre (gpre_boot) is used to build all the -# engine files, except security.bin. security.epp requires the security -# database which is not available at this time. The code in jrd/alt.cpp -# that references the functions in security.bin has been #ifdef'ed out. +# engine file. # During this phase of the build process the limited version of alt.bin # is used. The full version of alt.bin is compiled later in the build # process after the security database is available. After the Modified: firebird/trunk/builds/posix/make.shared.variables =================================================================== --- firebird/trunk/builds/posix/make.shared.variables 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/builds/posix/make.shared.variables 2010-07-09 12:51:05 UTC (rev 51322) @@ -53,7 +53,7 @@ recsrc/MergeJoin.cpp recsrc/NestedLoopJoin.cpp \ recsrc/ProcedureScan.cpp recsrc/RecordSource.cpp recsrc/RecursiveStream.cpp \ recsrc/SingularStream.cpp recsrc/SkipRowsStream.cpp recsrc/SortedStream.cpp recsrc/Union.cpp \ - recsrc/VirtualTableScan.cpp recsrc/WindowedStream.cpp + recsrc/VirtualTableScan.cpp recsrc/UsersTableScan.cpp recsrc/WindowedStream.cpp JRD_ServerSources = $(addprefix jrd/, $(JRD_ServerFiles)) JRD_ServerSources += gpre/pretty.cpp @@ -357,7 +357,7 @@ # MOD 29-July-2002 # Stub for services entrypoints missing in static library -STUB_Sources = jrd/svc_stub.cpp +STUB_Sources = jrd/svc_stub.cpp utilities/gsec/security.epp STUB_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(STUB_Sources)))) Modified: firebird/trunk/src/dbs/security.sql =================================================================== --- firebird/trunk/src/dbs/security.sql 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/dbs/security.sql 2010-07-09 12:51:05 UTC (rev 51322) @@ -22,57 +22,6 @@ * (see http://www.volny.cz/iprenosil/interbase/ for details). */ -/* Domain definitions */ -CREATE DOMAIN RDB$COMMENT AS BLOB SUB_TYPE TEXT SEGMENT SIZE 80 CHARACTER SET UNICODE_FSS; -CREATE DOMAIN RDB$NAME_PART AS VARCHAR(32) CHARACTER SET UNICODE_FSS DEFAULT _UNICODE_FSS ''; -CREATE DOMAIN RDB$GID AS INTEGER; -CREATE DOMAIN RDB$PASSWD AS VARCHAR(64) CHARACTER SET BINARY; -CREATE DOMAIN RDB$UID AS INTEGER; -CREATE DOMAIN RDB$USER_NAME AS VARCHAR(128) CHARACTER SET UNICODE_FSS; -CREATE DOMAIN RDB$USER_PRIVILEGE AS INTEGER; - - -/* Table: RDB$USERS */ -CREATE TABLE RDB$USERS ( - RDB$USER_NAME RDB$USER_NAME NOT NULL PRIMARY KEY, - /* local system user name for setuid for file permissions */ - RDB$SYS_USER_NAME RDB$USER_NAME, - RDB$GROUP_NAME RDB$USER_NAME, - RDB$UID RDB$UID, - RDB$GID RDB$GID, - RDB$PASSWD RDB$PASSWD NOT NULL, - - /* Privilege level of user - mark a user as having DBA privilege */ - RDB$PRIVILEGE RDB$USER_PRIVILEGE, - - RDB$COMMENT RDB$COMMENT, - RDB$FIRST_NAME RDB$NAME_PART, - RDB$MIDDLE_NAME RDB$NAME_PART, - RDB$LAST_NAME RDB$NAME_PART); - -COMMIT; - -/* View: USERS. Let's user modify his own password. */ -CREATE VIEW USERS (USER_NAME, SYS_USER_NAME, GROUP_NAME, UID, GID, PASSWD, - PRIVILEGE, COMMENT, FIRST_NAME, MIDDLE_NAME, LAST_NAME, FULL_NAME) AS - SELECT RDB$USER_NAME, RDB$SYS_USER_NAME, RDB$GROUP_NAME, RDB$UID, RDB$GID, RDB$PASSWD, - RDB$PRIVILEGE, RDB$COMMENT, RDB$FIRST_NAME, RDB$MIDDLE_NAME, RDB$LAST_NAME, - COALESCE (RDB$first_name || _UNICODE_FSS ' ', '') || - COALESCE (RDB$middle_name || _UNICODE_FSS ' ', '') || - COALESCE (RDB$last_name, '') - FROM RDB$USERS - WHERE CURRENT_USER = 'SYSDBA' - OR CURRENT_ROLE = 'RDB$ADMIN' - OR CURRENT_USER = RDB$USERS.RDB$USER_NAME; - -/* Access rights */ -GRANT ALL ON RDB$USERS to VIEW USERS; -GRANT SELECT ON USERS to PUBLIC; -GRANT UPDATE(PASSWD, GROUP_NAME, UID, GID, FIRST_NAME, MIDDLE_NAME, LAST_NAME) - ON USERS TO PUBLIC; - -COMMIT; - /* Needed record - with PASSWD = random + SHA1 (random + 'SYSDBA' + crypt('masterke')) */ INSERT INTO RDB$USERS(RDB$USER_NAME, RDB$PASSWD, RDB$FIRST_NAME, RDB$MIDDLE_NAME, RDB$LAST_NAME) VALUES ('SYSDBA', 'NLtwcs9LrxLMOYhG0uGM9i6KS7mf3QAKvFVpmRg=', 'Sql', 'Server', 'Administrator'); Modified: firebird/trunk/src/include/gen/ids.h =================================================================== --- firebird/trunk/src/include/gen/ids.h 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/include/gen/ids.h 2010-07-09 12:51:05 UTC (rev 51322) @@ -592,3 +592,28 @@ const USHORT f_pkg_desc = 6; +// Relation 43 (RDB$USERS) + + const USHORT f_user_name = 0; + const USHORT f_group_name = 1; + const USHORT f_uid = 2; + const USHORT f_gid = 3; + const USHORT f_passwd_type = 4; + const USHORT f_passwd = 5; + const USHORT f_first_name = 6; + const USHORT f_middle_name = 7; + const USHORT f_last_name = 8; + const USHORT f_user_desc = 9; + + +// Relation 44 (SEC$USERS) + + const USHORT f_sec_user_name = 0; + const USHORT f_sec_group_name = 1; + const USHORT f_sec_uid = 2; + const USHORT f_sec_gid = 3; + const USHORT f_sec_first_name = 4; + const USHORT f_sec_middle_name = 5; + const USHORT f_sec_last_name = 6; + + Modified: firebird/trunk/src/jrd/DatabaseSnapshot.cpp =================================================================== --- firebird/trunk/src/jrd/DatabaseSnapshot.cpp 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/jrd/DatabaseSnapshot.cpp 2010-07-09 12:51:05 UTC (rev 51322) @@ -370,7 +370,7 @@ DatabaseSnapshot::DatabaseSnapshot(thread_db* tdbb, MemoryPool& pool) - : snapshot(pool), idMap(pool), idCounter(0) + : DataDump(pool), snapshot(pool) { SET_TDBB(tdbb); @@ -589,7 +589,7 @@ jrd_rel* relation = MET_lookup_relation_id(tdbb, rel_id, false); fb_assert(relation); MET_scan_relation(tdbb, relation); - fb_assert(relation->isVirtual()); + fb_assert(relation->isVirtual() && !relation->isUsers()); Format* format = MET_current(tdbb, relation); fb_assert(format); @@ -601,7 +601,7 @@ } -void DatabaseSnapshot::clearRecord(Record* record) +void DataDump::clearRecord(Record* record) { fb_assert(record); @@ -612,7 +612,7 @@ } -void DatabaseSnapshot::putField(thread_db* tdbb, Record* record, const DumpField& field, +void DataDump::putField(thread_db* tdbb, Record* record, const DumpField& field, int& charset, bool set_charset) { fb_assert(record); Modified: firebird/trunk/src/jrd/DatabaseSnapshot.h =================================================================== --- firebird/trunk/src/jrd/DatabaseSnapshot.h 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/jrd/DatabaseSnapshot.h 2010-07-09 12:51:05 UTC (rev 51322) @@ -18,6 +18,7 @@ * * All Rights Reserved. * Contributor(s): ______________________________________. + * Alex Peshkoff, 2010 - divided into class DataDump and the remaining part of DatabaseSnapshot */ #ifndef JRD_DATABASE_SNAPSHOT_H @@ -26,24 +27,36 @@ #include "../common/classes/array.h" #include "../common/classes/init.h" #include "../jrd/isc_s_proto.h" +#include "../common/classes/timestamp.h" +#include "../jrd/val.h" namespace Jrd { // forward declarations class jrd_rel; +class Record; class RecordBuffer; class RuntimeStatistics; -class DatabaseSnapshot +class DataDump { +public: enum ValueType {VALUE_GLOBAL_ID, VALUE_INTEGER, VALUE_TIMESTAMP, VALUE_STRING}; + DataDump(MemoryPool& pool) + : idMap(pool), idCounter(0) { } + struct DumpField { + DumpField(USHORT p_id, ValueType p_type, USHORT p_length, const void* p_data) + : id(p_id), type(p_type), length(p_length), data(p_data) { } + DumpField() + : id(0), type(VALUE_GLOBAL_ID), length(0), data(NULL) { } + USHORT id; ValueType type; USHORT length; - void* data; + const void* data; }; class DumpRecord @@ -178,6 +191,16 @@ ULONG sizeLimit; }; + void clearRecord(Record*); + void putField(thread_db*, Record*, const DumpField&, int&, bool = false); + +private: + Firebird::GenericMap<Firebird::Pair<Firebird::NonPooled<SINT64, SLONG> > > idMap; + int idCounter; +}; + +class DatabaseSnapshot : public DataDump +{ struct RelationData { int rel_id; @@ -321,8 +344,6 @@ private: RecordBuffer* allocBuffer(thread_db*, MemoryPool&, int); - void clearRecord(Record*); - void putField(thread_db*, Record*, const DumpField&, int&, bool = false); static void dumpData(thread_db*); @@ -338,8 +359,6 @@ static void putMemoryUsage(const Firebird::MemoryStats&, Writer&, int, int); Firebird::Array<RelationData> snapshot; - Firebird::GenericMap<Firebird::Pair<Firebird::NonPooled<SINT64, SLONG> > > idMap; - int idCounter; }; } // namespace Modified: firebird/trunk/src/jrd/Relation.h =================================================================== --- firebird/trunk/src/jrd/Relation.h 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/jrd/Relation.h 2010-07-09 12:51:05 UTC (rev 51322) @@ -176,8 +176,8 @@ { public: USHORT rel_id; - USHORT rel_flags; USHORT rel_current_fmt; // Current format number + ULONG rel_flags; Format* rel_current_format; // Current record format Firebird::MetaName rel_name; // ascii relation name vec<Format*>* rel_formats; // Known record formats @@ -219,6 +219,7 @@ bool isSystem() const; bool isTemporary() const; bool isVirtual() const; + bool isUsers() const; // global temporary relations attributes RelationPages* getPages(thread_db* tdbb, SLONG tran = -1, bool allocPages = true); @@ -282,22 +283,23 @@ // rel_flags -const USHORT REL_scanned = 0x0001; // Field expressions scanned (or being scanned) -const USHORT REL_system = 0x0002; -const USHORT REL_deleted = 0x0004; // Relation known gonzo -const USHORT REL_get_dependencies = 0x0008; // New relation needs dependencies during scan -const USHORT REL_force_scan = 0x0010; // system relation has been updated since ODS change, force a scan -const USHORT REL_check_existence = 0x0020; // Existence lock released pending drop of relation -const USHORT REL_blocking = 0x0040; // Blocking someone from dropping relation -const USHORT REL_sys_triggers = 0x0080; // The relation has system triggers to compile -const USHORT REL_sql_relation = 0x0100; // Relation defined as sql table -const USHORT REL_check_partners = 0x0200; // Rescan primary dependencies and foreign references -const USHORT REL_being_scanned = 0x0400; // relation scan in progress -const USHORT REL_sys_trigs_being_loaded = 0x0800; // System triggers being loaded -const USHORT REL_deleting = 0x1000; // relation delete in progress -const USHORT REL_temp_tran = 0x2000; // relation is a GTT delete rows -const USHORT REL_temp_conn = 0x4000; // relation is a GTT preserve rows -const USHORT REL_virtual = 0x8000; // relation is virtual +const ULONG REL_scanned = 0x0001; // Field expressions scanned (or being scanned) +const ULONG REL_system = 0x0002; +const ULONG REL_deleted = 0x0004; // Relation known gonzo +const ULONG REL_get_dependencies = 0x0008; // New relation needs dependencies during scan +const ULONG REL_force_scan = 0x0010; // system relation has been updated since ODS change, force a scan +const ULONG REL_check_existence = 0x0020; // Existence lock released pending drop of relation +const ULONG REL_blocking = 0x0040; // Blocking someone from dropping relation +const ULONG REL_sys_triggers = 0x0080; // The relation has system triggers to compile +const ULONG REL_sql_relation = 0x0100; // Relation defined as sql table +const ULONG REL_check_partners = 0x0200; // Rescan primary dependencies and foreign references +const ULONG REL_being_scanned = 0x0400; // relation scan in progress +const ULONG REL_sys_trigs_being_loaded = 0x0800; // System triggers being loaded +const ULONG REL_deleting = 0x1000; // relation delete in progress +const ULONG REL_temp_tran = 0x2000; // relation is a GTT delete rows +const ULONG REL_temp_conn = 0x4000; // relation is a GTT preserve rows +const ULONG REL_virtual = 0x8000; // relation is virtual +const ULONG REL_users = 0x00010000; // relation is users list inline bool jrd_rel::isSystem() const @@ -312,9 +314,14 @@ inline bool jrd_rel::isVirtual() const { - return (rel_flags & REL_virtual); + return (rel_flags & (REL_virtual | REL_users)); } +inline bool jrd_rel::isUsers() const +{ + return (rel_flags & REL_users); +} + inline RelationPages* jrd_rel::getPages(thread_db* tdbb, SLONG tran, bool allocPages) { if (!isTemporary()) Modified: firebird/trunk/src/jrd/UserManagement.cpp =================================================================== --- firebird/trunk/src/jrd/UserManagement.cpp 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/jrd/UserManagement.cpp 2010-07-09 12:51:05 UTC (rev 51322) @@ -30,31 +30,36 @@ #include "../jrd/msg_encode.h" #include "../utilities/gsec/gsec.h" #include "../utilities/gsec/secur_proto.h" +#include "../jrd/met_proto.h" +#include "../jrd/ini.h" +#include "gen/ids.h" using namespace Jrd; using namespace Firebird; UserManagement::UserManagement(jrd_tra* tra) - : database(0), transaction(0), commands(*tra->tra_pool) + : DataDump(*tra->tra_pool), database(0), transaction(0), buffer(0), + threadDbb(NULL), realUser(NULL), commands(*tra->tra_pool) { - char securityDatabaseName[MAXPATHLEN]; - Auth::SecurityDatabase::getPath(securityDatabaseName); - ISC_STATUS_ARRAY status; Attachment* att = tra->tra_attachment; - - ClumpletWriter dpb(ClumpletReader::dpbList, MAX_DPB_SIZE); - dpb.insertByte(isc_dpb_gsec_attach, TRUE); - dpb.insertString(isc_dpb_trusted_auth, att->att_user->usr_user_name); - if (att->att_user->usr_flags & USR_trole) + if (!att || !att->att_user) { - dpb.insertString(isc_dpb_trusted_role, ADMIN_ROLE, strlen(ADMIN_ROLE)); + (Arg::Gds(isc_random) << "Unknown user name for given transaction").raise(); } - else if (!att->att_user->usr_sql_role_name.empty()) + if (!att->att_user->locksmith()) { - dpb.insertString(isc_dpb_trusted_role, att->att_user->usr_sql_role_name); + realUser = att->att_user->usr_user_name.c_str(); } + char securityDatabaseName[MAXPATHLEN]; + Auth::SecurityDatabase::getPath(securityDatabaseName); + + ClumpletWriter dpb(ClumpletReader::dpbList, MAX_DPB_SIZE); + dpb.insertByte(isc_dpb_gsec_attach, TRUE); + dpb.insertString(isc_dpb_trusted_auth, SYSDBA_USER_NAME); + + ISC_STATUS_ARRAY status; if (isc_attach_database(status, 0, securityDatabaseName, &database, dpb.getBufferLength(), reinterpret_cast<const char*>(dpb.getBuffer()))) { @@ -92,6 +97,8 @@ status_exception::raise(status); } } + + delete buffer; } void UserManagement::commit() @@ -119,6 +126,25 @@ return ret; } +void UserManagement::checkSecurityResult(int errcode, ISC_STATUS* status, const char* userName) +{ + Arg::StatusVector tmp; + + if (!errcode) + { + return; + } + + tmp << Arg::Gds(ENCODE_ISC_MSG(errcode, GSEC_MSG_FAC)); + if (errcode == GsecMsg22) + { + tmp << userName; + } + tmp.append(Arg::StatusVector(&status[0])); + + tmp.raise(); +} + void UserManagement::execute(USHORT id) { if (!transaction || !commands[id]) @@ -138,30 +164,108 @@ #else ISC_STATUS_ARRAY status; int errcode = (!commands[id]->user_name_entered) ? GsecMsg18 : - SECURITY_exec_line(status, database, transaction, commands[id], NULL, NULL); + SECURITY_exec_line(status, realUser, database, transaction, commands[id], NULL, NULL); - switch (errcode) + checkSecurityResult(errcode, status, commands[id]->user_name); + + delete commands[id]; + commands[id] = NULL; +#endif +} + +void UserManagement::display(void* arg, const internal_user_data* u, bool/*firstTime*/) +{ + UserManagement* instance = reinterpret_cast<UserManagement*>(arg); + fb_assert(instance && instance->buffer); + + instance->display(u); +} + +void UserManagement::display(const internal_user_data* u) +{ + Record* record = buffer->getTempRecord(); + clearRecord(record); + + int attachment_charset = ttype_none; + + if (u->user_name_entered) + putField(threadDbb, record, + DumpField(f_sec_user_name, VALUE_STRING, strlen(u->user_name), u->user_name), + attachment_charset); + if (u->group_name_entered) + putField(threadDbb, record, + DumpField(f_sec_group_name, VALUE_STRING, strlen(u->group_name), u->group_name), + attachment_charset); + if (u->uid_entered) + putField(threadDbb, record, + DumpField(f_sec_uid, VALUE_INTEGER, sizeof(int), &u->uid), + attachment_charset); + if (u->gid_entered) + putField(threadDbb, record, + DumpField(f_sec_gid, VALUE_INTEGER, sizeof(int), &u->gid), + attachment_charset); + if (u->first_name_entered) + putField(threadDbb, record, + DumpField(f_sec_first_name, VALUE_STRING, strlen(u->first_name), u->first_name), + attachment_charset); + if (u->middle_name_entered) + putField(threadDbb, record, + DumpField(f_sec_middle_name, VALUE_STRING, strlen(u->middle_name), u->middle_name), + attachment_charset); + if (u->last_name_entered) + putField(threadDbb, record, + DumpField(f_sec_last_name, VALUE_STRING, strlen(u->last_name), u->last_name), + attachment_charset); + + buffer->store(record); +} + +RecordBuffer* UserManagement::getList(thread_db* tdbb) +{ +#ifdef EMBEDDED + // this restriction for embedded is temporarty and will gone when new build system will be introduced + status_exception::raise(Arg::Gds(isc_random) << "User management not supported in embedded library"); +#else + if (buffer) { - case 0: // nothing - break; - case GsecMsg22: - { - Arg::StatusVector tmp; - tmp << Arg::Gds(ENCODE_ISC_MSG(errcode, GSEC_MSG_FAC)) << Arg::Str(commands[id]->user_name); - tmp.append(Arg::StatusVector(&status[0])); - tmp.raise(); - } + return buffer; + } - default: + try + { + threadDbb = tdbb; + + jrd_rel* relation = MET_lookup_relation_id(threadDbb, rel_sec_users, false); + fb_assert(relation); + + MET_scan_relation(threadDbb, relation); + fb_assert(relation->isUsers()); + + Format* format = MET_current(threadDbb, relation); + fb_assert(format); + + MemoryPool* pool = threadDbb->getTransaction()->tra_pool; + fb_assert(pool); + + buffer = FB_NEW(*pool) RecordBuffer(*pool, format); + fb_assert(buffer); + + ISC_STATUS_ARRAY status; + internal_user_data u; + u.operation = DIS_OPER; + int errcode = SECURITY_exec_line(status, realUser, database, transaction, &u, display, this); + checkSecurityResult(errcode, status, u.user_name); + } + catch (const Exception&) + { + if (buffer) { - Arg::StatusVector tmp; - tmp << Arg::Gds(ENCODE_ISC_MSG(errcode, GSEC_MSG_FAC)); - tmp.append(Arg::StatusVector(&status[0])); - tmp.raise(); + delete buffer; + buffer = NULL; } + throw; } - delete commands[id]; - commands[id] = NULL; + return buffer; #endif } Modified: firebird/trunk/src/jrd/UserManagement.h =================================================================== --- firebird/trunk/src/jrd/UserManagement.h 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/jrd/UserManagement.h 2010-07-09 12:51:05 UTC (rev 51322) @@ -25,7 +25,9 @@ #include "firebird.h" #include "../common/classes/array.h" +#include "../common/classes/fb_string.h" #include "../jrd/ibase.h" +#include "../jrd/DatabaseSnapshot.h" struct internal_user_data; @@ -33,9 +35,10 @@ class thread_db; class jrd_tra; +class RecordBuffer; // User management argument for deferred work -class UserManagement +class UserManagement : public DataDump { public: explicit UserManagement(jrd_tra* tra); @@ -47,10 +50,19 @@ void execute(USHORT id); // commit transaction in security database void commit(); + // return users list for SEC$USERS + RecordBuffer* getList(thread_db* tdbb); private: FB_API_HANDLE database, transaction; + RecordBuffer* buffer; + thread_db* threadDbb; + const char* realUser; Firebird::HalfStaticArray<internal_user_data*, 8> commands; + + static void display(void* arg, const internal_user_data* u, bool firstTime); + void display(const internal_user_data* u); + static void checkSecurityResult(int errcode, ISC_STATUS* status, const char* userName); }; } // namespace Modified: firebird/trunk/src/jrd/constants.h =================================================================== --- firebird/trunk/src/jrd/constants.h 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/jrd/constants.h 2010-07-09 12:51:05 UTC (rev 51322) @@ -202,7 +202,8 @@ rel_external = 2, rel_virtual = 3, rel_global_temp_preserve = 4, - rel_global_temp_delete = 5 + rel_global_temp_delete = 5, + rel_vrt_users = 6 }; // procedure types Modified: firebird/trunk/src/jrd/fields.h =================================================================== --- firebird/trunk/src/jrd/fields.h 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/jrd/fields.h 2010-07-09 12:51:05 UTC (rev 51322) @@ -166,3 +166,9 @@ FIELD(fld_arg_mechanism , nam_arg_mechanism , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_identity_type , nam_identity_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true) + + FIELD(fld_uid , nam_uid , dtype_long , sizeof(SLONG) , 0 , NULL , true) + FIELD(fld_gid , nam_gid , dtype_long , sizeof(SLONG) , 0 , NULL , true) + FIELD(fld_passwd_type , nam_passwd_type , dtype_text , 32 , dsc_text_type_ascii , NULL , true) + FIELD(fld_passwd , nam_passwd , dtype_blob , BLOB_SIZE , isc_blob_untyped , NULL , true) + FIELD(fld_name_part , nam_name_part , dtype_text , 32 , dsc_text_type_metadata , NULL , true) Modified: firebird/trunk/src/jrd/idx.h =================================================================== --- firebird/trunk/src/jrd/idx.h 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/jrd/idx.h 2010-07-09 12:51:05 UTC (rev 51322) @@ -345,6 +345,10 @@ SEGMENT(f_prm_procedure, idx_metadata), // procedure name SEGMENT(f_prm_name, idx_metadata), // parameter name SEGMENT(f_prm_pkg_name, idx_metadata) // package name + }}, + // define index RDB$INDEX_52 for RDB$USERS unique RDB$USER_NAME; + INDEX(52, ODS_12_0, rel_users, idx_unique, 1) + SEGMENT(f_user_name, idx_metadata) // procedure name }} // Last index in ODS 12.0 is RDB$INDEX_51 Modified: firebird/trunk/src/jrd/ini.epp =================================================================== --- firebird/trunk/src/jrd/ini.epp 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/jrd/ini.epp 2010-07-09 12:51:05 UTC (rev 51322) @@ -71,7 +71,7 @@ static void add_index_set(thread_db*); static void add_security_to_sys_rel(thread_db*, const Firebird::MetaName&, - const TEXT*, const UCHAR*, const SSHORT); + const TEXT*, const UCHAR*, const SSHORT, const bool); static void store_generator(thread_db*, const gen*, AutoRequest&); static void store_global_field(thread_db*, const gfld*, AutoRequest&); static void store_intlnames(thread_db*); @@ -468,10 +468,39 @@ *acl++ = ACL_end; length = acl - buffer; - add_security_to_sys_rel(tdbb, ownerName, "RDB$ROLES", buffer, length); - add_security_to_sys_rel(tdbb, ownerName, "RDB$PAGES", buffer, length); + add_security_to_sys_rel(tdbb, ownerName, "RDB$ROLES", buffer, length, true); + add_security_to_sys_rel(tdbb, ownerName, "RDB$PAGES", buffer, length, true); // DFW writes here - add_security_to_sys_rel(tdbb, ownerName, "RDB$FORMATS", buffer, length); + add_security_to_sys_rel(tdbb, ownerName, "RDB$FORMATS", buffer, length, true); + + // nobody except DBA should access it + acl = buffer; + *acl++ = ACL_version; + *acl++ = ACL_id_list; + *acl++ = id_person; + + length = ownerName.length(); + if (length > MAX_UCHAR) + length = MAX_UCHAR; + + *acl++ = (UCHAR)length; + if (length) + { + const TEXT* p_1 = ownerName.c_str(); + memcpy(acl, p_1, length); + acl += length; + } + *acl++ = ACL_end; + *acl++ = ACL_priv_list; + *acl++ = priv_protect; + *acl++ = priv_control; + *acl++ = priv_delete; + *acl++ = priv_write; + *acl++ = priv_read; + *acl++ = ACL_end; + *acl++ = ACL_end; + length = acl - buffer; + add_security_to_sys_rel(tdbb, ownerName, "RDB$USERS", buffer, length, false); } @@ -863,7 +892,8 @@ const Firebird::MetaName& user_name, const TEXT* rel_name, const UCHAR* acl, - const SSHORT acl_length) + const SSHORT acl_length, + const bool pub_select) { /************************************** * @@ -935,7 +965,7 @@ handle1.reset(); - for (int cnt = 0; cnt < 6; cnt++) + for (int cnt = 0; cnt < (pub_select ? 6 : 5); cnt++) { STORE(REQUEST_HANDLE handle1) PRIV IN RDB$USER_PRIVILEGES switch (cnt) Modified: firebird/trunk/src/jrd/met.epp =================================================================== --- firebird/trunk/src/jrd/met.epp 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/jrd/met.epp 2010-07-09 12:51:05 UTC (rev 51322) @@ -3607,6 +3607,9 @@ case rel_view: fb_assert(relation->rel_view_rse); break; + case rel_vrt_users: + relation->rel_flags |= REL_users; + break; case rel_virtual: relation->rel_flags |= REL_virtual; break; Modified: firebird/trunk/src/jrd/names.h =================================================================== --- firebird/trunk/src/jrd/names.h 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/jrd/names.h 2010-07-09 12:51:05 UTC (rev 51322) @@ -257,6 +257,18 @@ NAME("RDB$ARGUMENT_NAME", nam_arg_name) NAME("RDB$IDENTITY_TYPE", nam_identity_type) +NAME("RDB$USERS", nam_users) +NAME("RDB$USER_NAME", nam_user_name) +NAME("RDB$GROUP_NAME", nam_group_name) +NAME("RDB$UID", nam_uid) +NAME("RDB$GID", nam_gid) +NAME("RDB$PASSWD_TYPE", nam_passwd_type) +NAME("RDB$PASSWD", nam_passwd) +NAME("RDB$FIRST_NAME", nam_first_name) +NAME("RDB$MIDDLE_NAME", nam_middle_name) +NAME("RDB$LAST_NAME", nam_last_name) +NAME("RDB$NAME_PART", nam_name_part) + NAME("MON$ATTACHMENTS", nam_mon_attachments) NAME("MON$ATTACHMENT_ID", nam_mon_att_id) NAME("MON$ATTACHMENT_NAME", nam_mon_att_name) @@ -331,6 +343,7 @@ NAME("MON$TRANSACTIONS", nam_mon_transactions) NAME("MON$TRANSACTION_ID", nam_mon_tra_id) NAME("MON$USER", nam_mon_user) +NAME("SEC$USERS", nam_sec_users) NAME("MON$VARIABLE_NAME", nam_mon_var_name) NAME("MON$VARIABLE_VALUE", nam_mon_var_value) NAME("MON$PACKAGE_NAME", nam_mon_pkg_name) Modified: firebird/trunk/src/jrd/opt.cpp =================================================================== --- firebird/trunk/src/jrd/opt.cpp 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/jrd/opt.cpp 2010-07-09 12:51:05 UTC (rev 51322) @@ -3074,6 +3074,11 @@ // External table rsb = FB_NEW(*tdbb->getDefaultPool()) ExternalTableScan(csb, alias, stream); } + else if (relation->isUsers()) + { + // Users table + rsb = FB_NEW(*tdbb->getDefaultPool()) UsersTableScan(csb, alias, stream); + } else if (relation->isVirtual()) { // Virtual table Modified: firebird/trunk/src/jrd/recsrc/RecordSource.h =================================================================== --- firebird/trunk/src/jrd/recsrc/RecordSource.h 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/jrd/recsrc/RecordSource.h 2010-07-09 12:51:05 UTC (rev 51322) @@ -302,6 +302,29 @@ const Firebird::string m_name; }; + class UsersTableScan : public RecordStream + { + struct Impure : public RecordSource::Impure + { + RecordBuffer* irsb_record_buffer; + }; + + public: + UsersTableScan(CompilerScratch* csb, const Firebird::string& name, UCHAR stream); + + void open(thread_db* tdbb) const; + void close(thread_db* tdbb) const; + + bool getRecord(thread_db* tdbb) const; + bool refetchRecord(thread_db* tdbb) const; + bool lockRecord(thread_db* tdbb) const; + + void dump(thread_db* tdbb, Firebird::UCharBuffer& buffer) const; + + private: + const Firebird::string m_name; + }; + class ProcedureScan : public RecordStream { struct Impure : public RecordSource::Impure Added: firebird/trunk/src/jrd/recsrc/UsersTableScan.cpp =================================================================== --- firebird/trunk/src/jrd/recsrc/UsersTableScan.cpp (rev 0) +++ firebird/trunk/src/jrd/recsrc/UsersTableScan.cpp 2010-07-09 12:51:05 UTC (rev 51322) @@ -0,0 +1,142 @@ +/* + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl. + * + * Software distributed under the License is distributed AS IS, + * 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 was created by Dmitry Yemanov + * for the Firebird Open Source RDBMS project. + * + * Copyright (c) 2009 Dmitry Yemanov <di...@fi...> + * and all contributors signed below. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + * Alex Peshkoff, 2010 - implemented users scan based on virtual tables + */ + +#include "firebird.h" +#include "../jrd/jrd.h" +#include "../jrd/req.h" +#include "../jrd/rse.h" +#include "../jrd/cmp_proto.h" +#include "../jrd/met_proto.h" +#include "../jrd/vio_proto.h" +#include "../jrd/UserManagement.h" +#include "../jrd/tra.h" + +#include "RecordSource.h" + +using namespace Firebird; +using namespace Jrd; + + +// ------------------------------- +// Data access: users table scan +// ------------------------------- + +UsersTableScan::UsersTableScan(CompilerScratch* csb, const string& name, UCHAR stream) + : RecordStream(csb, stream), m_name(csb->csb_pool, name) +{ + m_impure = CMP_impure(csb, sizeof(Impure)); +} + +void UsersTableScan::open(thread_db* tdbb) const +{ + jrd_req* const request = tdbb->getRequest(); + Impure* const impure = request->getImpure<Impure>(m_impure); + + impure->irsb_flags = irsb_open; + + record_param* const rpb = &request->req_rpb[m_stream]; + rpb->getWindow(tdbb).win_flags = 0; + + jrd_rel* const relation = rpb->rpb_relation; + + const Record* const record = rpb->rpb_record; + const Format* format = NULL; + if (!record || !record->rec_format) + { + format = MET_current(tdbb, relation); + VIO_record(tdbb, rpb, format, request->req_pool); + } + else + { + format = record->rec_format; + } + + rpb->rpb_number.setValue(BOF_NUMBER); + + impure->irsb_record_buffer = tdbb->getTransaction()->getUserManagement()->getList(tdbb); +} + +void UsersTableScan::close(thread_db* tdbb) const +{ + jrd_req* const request = tdbb->getRequest(); + + invalidateRecords(request); + + Impure* const impure = request->getImpure<Impure>(m_impure); + + if (impure->irsb_flags & irsb_open) + { + impure->irsb_flags &= ~irsb_open; + impure->irsb_record_buffer = NULL; + } +} + +bool UsersTableScan::getRecord(thread_db* tdbb) const +{ + jrd_req* const request = tdbb->getRequest(); + record_param* const rpb = &request->req_rpb[m_stream]; + Impure* const impure = request->getImpure<Impure>(m_impure); + + if (!(impure->irsb_flags & irsb_open)) + { + rpb->rpb_number.setValid(false); + return false; + } + + rpb->rpb_number.increment(); + + fb_assert(impure->irsb_record_buffer); + + if (impure->irsb_record_buffer->fetch(rpb->rpb_number.getValue(), rpb->rpb_record)) + { + rpb->rpb_number.setValid(true); + return true; + } + + rpb->rpb_number.setValid(false); + return false; +} + +bool UsersTableScan::refetchRecord(thread_db* tdbb) const +{ + return true; +} + +bool UsersTableScan::lockRecord(thread_db* tdbb) const +{ + status_exception::raise(Arg::Gds(isc_record_lock_not_supp)); + return false; // compiler silencer +} + +void UsersTableScan::dump(thread_db* tdbb, UCharBuffer& buffer) const +{ + buffer.add(isc_info_rsb_begin); + + buffer.add(isc_info_rsb_relation); + dumpName(tdbb, m_name, buffer); + + buffer.add(isc_info_rsb_type); + buffer.add(isc_info_rsb_virt_sequential); + + buffer.add(isc_info_rsb_end); +} Property changes on: firebird/trunk/src/jrd/recsrc/UsersTableScan.cpp ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: firebird/trunk/src/jrd/relations.h =================================================================== --- firebird/trunk/src/jrd/relations.h 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/jrd/relations.h 2010-07-09 12:51:05 UTC (rev 51322) @@ -590,3 +590,28 @@ FIELD(f_pkg_sys_flag, nam_sys_flag, fld_flag, 1, ODS_12_0) FIELD(f_pkg_desc, nam_description, fld_description, 1, ODS_12_0) END_RELATION + +// Relation 43 (RDB$USERS) +RELATION(nam_users, rel_users, ODS_12_0, rel_persistent) + FIELD(f_user_name, nam_user_name, fld_user, 1, ODS_12_0) + FIELD(f_group_name, nam_group_name, fld_user, 1, ODS_12_0) + FIELD(f_uid, nam_uid, fld_uid, 1, ODS_12_0) + FIELD(f_gid, nam_gid, fld_gid, 1, ODS_12_0) + FIELD(f_passwd_type, nam_passwd_type, fld_passwd_type, 1, ODS_12_0) + FIELD(f_passwd, nam_passwd, fld_passwd, 1, ODS_12_0) + FIELD(f_first_name, nam_first_name, fld_name_part, 1, ODS_12_0) + FIELD(f_middle_name, nam_middle_name, fld_name_part, 1, ODS_12_0) + FIELD(f_last_name, nam_last_name, fld_name_part, 1, ODS_12_0) + FIELD(f_user_desc, nam_description, fld_description, 1, ODS_12_0) +END_RELATION + +// Relation 44 (SEC$USERS) +RELATION(nam_sec_users, rel_sec_users, ODS_12_0, rel_vrt_users) + FIELD(f_sec_user_name, nam_user_name, fld_user, 1, ODS_12_0) + FIELD(f_sec_group_name, nam_group_name, fld_user, 1, ODS_12_0) + FIELD(f_sec_uid, nam_uid, fld_uid, 1, ODS_12_0) + FIELD(f_sec_gid, nam_gid, fld_gid, 1, ODS_12_0) + FIELD(f_sec_first_name, nam_first_name, fld_name_part, 1, ODS_12_0) + FIELD(f_sec_middle_name, nam_middle_name, fld_name_part, 1, ODS_12_0) + FIELD(f_sec_last_name, nam_last_name, fld_name_part, 1, ODS_12_0) +END_RELATION Modified: firebird/trunk/src/jrd/svc.cpp =================================================================== --- firebird/trunk/src/jrd/svc.cpp 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/jrd/svc.cpp 2010-07-09 12:51:05 UTC (rev 51322) @@ -1924,27 +1924,31 @@ // Only need to add username and password information to those calls which need // to make a database connection - if (svc_id == isc_action_svc_backup || + + bool flNeedUser = (svc_id == isc_action_svc_backup || svc_id == isc_action_svc_restore || svc_id == isc_action_svc_nbak || svc_id == isc_action_svc_nrest || svc_id == isc_action_svc_repair || - svc_id == isc_action_svc_add_user || - svc_id == isc_action_svc_delete_user || - svc_id == isc_action_svc_modify_user || - svc_id == isc_action_svc_display_user || - svc_id == isc_action_svc_display_user_adm || svc_id == isc_action_svc_db_stats || svc_id == isc_action_svc_properties || svc_id == isc_action_svc_trace_start || svc_id == isc_action_svc_trace_stop || svc_id == isc_action_svc_trace_suspend || svc_id == isc_action_svc_trace_resume || - svc_id == isc_action_svc_trace_list || + svc_id == isc_action_svc_trace_list); + + bool flGsecUser = (svc_id == isc_action_svc_add_user || + svc_id == isc_action_svc_delete_user || + svc_id == isc_action_svc_modify_user || + svc_id == isc_action_svc_display_user || + svc_id == isc_action_svc_display_user_adm || svc_id == isc_action_svc_set_mapping || - svc_id == isc_action_svc_drop_mapping) + svc_id == isc_action_svc_drop_mapping); + + if (flNeedUser || flGsecUser) { - // add the username and password to the end of svc_switches if needed + // add the username to the end of svc_switches if needed if (svc_switches.hasData()) { if (svc_username.hasData()) @@ -1952,9 +1956,15 @@ string auth = "-"; auth += TRUSTED_USER_SWITCH; auth += ' '; + if (flGsecUser) + { + // gsec service - gsec will take care itself about security + auth += SYSDBA_USER_NAME; + auth += " -REAL_USER "; + } auth += svc_username; auth += ' '; - if (svc_trusted_role) + if (svc_trusted_role && (!flGsecUser)) { auth += "-"; auth += TRUSTED_ROLE_SWITCH; @@ -1965,6 +1975,7 @@ } } + // All services except for get_ib_log require switches spb.rewind(); if ((!svc_switches.hasData()) && svc_id != isc_action_svc_get_fb_log) Modified: firebird/trunk/src/jrd/types.h =================================================================== --- firebird/trunk/src/jrd/types.h 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/jrd/types.h 2010-07-09 12:51:05 UTC (rev 51322) @@ -112,6 +112,7 @@ TYPE ("VIRTUAL", rel_virtual, nam_r_type) TYPE ("GLOBAL_TEMPORARY_PRESERVE", rel_global_temp_preserve, nam_r_type) TYPE ("GLOBAL_TEMPORARY_DELETE", rel_global_temp_delete, nam_r_type) +TYPE ("USERS LIST", rel_vrt_users, nam_r_type) TYPE ("LEGACY", prc_legacy, nam_prc_type) TYPE ("SELECTABLE", prc_selectable, nam_prc_type) Modified: firebird/trunk/src/msgs/facilities2.sql =================================================================== --- firebird/trunk/src/msgs/facilities2.sql 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/msgs/facilities2.sql 2010-07-09 12:51:05 UTC (rev 51322) @@ -27,7 +27,7 @@ --('1996-11-07 13:38:43', 'GJRN', 16, 241) -- ('2009-12-21 04:00:05', 'ISQL', 17, 173) -('2009-11-13 17:49:54', 'GSEC', 18, 104) +('2009-11-13 17:49:54', 'GSEC', 18, 105) -- --('2002-03-05 02:30:12', 'LICENSE', 19, 60) --('2002-03-05 02:31:54', 'DOS', 20, 74) Modified: firebird/trunk/src/msgs/messages2.sql =================================================================== --- firebird/trunk/src/msgs/messages2.sql 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/msgs/messages2.sql 2010-07-09 12:51:05 UTC (rev 51322) @@ -2905,6 +2905,7 @@ ('GsecMsg101', 'gsec', 'gsec.cpp', NULL, 18, 101, NULL, 'use gsec -? to get help', NULL, NULL); ('GsecMsg102', 'gsec', 'gsec.cpp', NULL, 18, 102, NULL, '-admin {yes|no}', NULL, NULL); ('GsecMsg103', 'gsec', 'gsec.cpp', NULL, 18, 103, NULL, 'invalid parameter for -ADMIN, only YES or NO is accepted', NULL, NULL); +('GsecMsg104', 'SECURITY_exec_line', 'security.epp', NULL, 18, 104, NULL, 'not enough privileges to complete operation', NULL, NULL); -- GSTAT ('gstat_unknown_switch', 'main', 'dba.e', NULL, 21, 1, NULL, 'found unknown switch', NULL, NULL); ('gstat_retry', 'main', 'dba.e', NULL, 21, 2, NULL, 'please retry, giving a database name', NULL, NULL); Modified: firebird/trunk/src/utilities/gsec/gsec.cpp =================================================================== --- firebird/trunk/src/utilities/gsec/gsec.cpp 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/utilities/gsec/gsec.cpp 2010-07-09 12:51:05 UTC (rev 51322) @@ -278,7 +278,8 @@ uSvc->started(); if (! useServices) { - ret = SECURITY_exec_line(status, db_handle, user_data, data_print, NULL); + ret = SECURITY_exec_line(status, tdsec->tsec_real_user, + db_handle, user_data, data_print, NULL); if (ret) { GSEC_print(ret, user_data->user_name); @@ -596,8 +597,7 @@ user_data->gid_entered = true; break; case IN_SW_GSEC_SYSUSER: - fb_utils::copy_terminate(user_data->sys_user_name, string, sizeof(user_data->sys_user_name)); - user_data->sys_user_entered = true; + // ignore it break; case IN_SW_GSEC_GROUP: fb_utils::copy_terminate(user_data->group_name, string, sizeof(user_data->group_name)); @@ -653,6 +653,10 @@ fb_utils::copy_terminate(user_data->dba_trust_user_name, string, sizeof(user_data->dba_trust_user_name)); user_data->dba_trust_user_name_entered = true; break; + case IN_SW_GSEC_REAL_USER: + tdsec->utilSvc->checkService(); + tdsec->tsec_real_user = string; + break; case IN_SW_GSEC_MAPPING: { Firebird::string val(string); @@ -808,13 +812,7 @@ user_data->gid = 0; break; case IN_SW_GSEC_SYSUSER: - if (user_data->sys_user_specified) - { - err_msg_no = GsecMsg34; - break; - } - user_data->sys_user_specified = true; - user_data->sys_user_name[0] = '\0'; + // ignore it break; case IN_SW_GSEC_GROUP: if (user_data->group_name_specified) @@ -932,6 +930,8 @@ GSEC_diag(GsecMsg41); // gsec - ambiguous switch specified return false; + case IN_SW_GSEC_REAL_USER: + break; } last_sw = in_sw; } @@ -940,7 +940,7 @@ // is valid, and if not, indicate why not if (user_data->uid_entered || user_data->gid_entered || - user_data->sys_user_entered || user_data->group_name_entered || + user_data->group_name_entered || user_data->password_entered || user_data->first_name_entered || user_data->middle_name_entered || user_data->last_name_entered) { Modified: firebird/trunk/src/utilities/gsec/gsec.h =================================================================== --- firebird/trunk/src/utilities/gsec/gsec.h 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/utilities/gsec/gsec.h 2010-07-09 12:51:05 UTC (rev 51322) @@ -65,9 +65,6 @@ int gid; // the user's group id bool gid_entered; // GID entered flag bool gid_specified; // GID specified flag - TEXT sys_user_name [ALT_NAME_LEN]; // the sys_user's name - bool sys_user_entered; // sys_user entered flag - bool sys_user_specified; // sys_user specified flag TEXT group_name [ALT_NAME_LEN]; // the group name bool group_name_entered; // group_name entered flag bool group_name_specified; // group_name specified flag @@ -123,13 +120,15 @@ public: explicit tsec(Firebird::UtilSvc* uf) : ThreadData(ThreadData::tddSEC), utilSvc(uf), - tsec_user_data(0), tsec_exit_code(0), tsec_throw(false), + tsec_user_data(0), tsec_real_user(NULL), + tsec_exit_code(0), tsec_throw(false), tsec_interactive(false), tsec_sw_version(false) { } Firebird::UtilSvc* utilSvc; internal_user_data* tsec_user_data; + const char* tsec_real_user; int tsec_exit_code; bool tsec_throw; bool tsec_interactive; @@ -255,6 +254,7 @@ const USHORT GsecMsg101 = 101; // use gsec -? to get help const USHORT GsecMsg102 = 102; // -adm(in) {yes|no} const USHORT GsecMsg103 = 103; // invalid parameter for -ADMIN, only YES or NO is accepted +const USHORT GsecMsg104 = 104; // not enough privileges to complete operation #endif // UTILITIES_GSEC_H Modified: firebird/trunk/src/utilities/gsec/gsecswi.h =================================================================== --- firebird/trunk/src/utilities/gsec/gsecswi.h 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/utilities/gsec/gsecswi.h 2010-07-09 12:51:05 UTC (rev 51322) @@ -34,7 +34,7 @@ const int IN_SW_GSEC_0 = 0; // not a known switch const int IN_SW_GSEC_UID = 1; // uid is specified const int IN_SW_GSEC_GID = 2; // gid is specified -const int IN_SW_GSEC_SYSUSER = 3; // sys_user_name is specified +const int IN_SW_GSEC_SYSUSER = 3; // sys_user name is specified const int IN_SW_GSEC_GROUP = 4; // group is specified const int IN_SW_GSEC_PASSWORD = 5; // password is specified const int IN_SW_GSEC_FNAME = 6; // first name is specified @@ -62,6 +62,7 @@ const int IN_SW_GSEC_MAPPING = 26; // Change auto admin mapping const int IN_SW_GSEC_ADMIN = 27; // Grant/revoke RDB$ADMIN in security database const int IN_SW_GSEC_DIS_ADM = 28; // display user(s) with admin info +const int IN_SW_GSEC_REAL_USER = 29; // svc user, if not SYSDBA static const struct Switches::in_sw_tab_t gsec_in_sw_table [] = { @@ -85,6 +86,7 @@ {IN_SW_GSEC_DBA_USER_NAME, 0, "USER", 0, 0, 0, false, 0, 1, NULL}, // Database Admin. User name {IN_SW_GSEC_DBA_PASSWORD, 0, "PASSWORD", 0, 0, 0, false, 0, 2, NULL}, // Database Admin. Password {IN_SW_GSEC_FETCH_PASSWORD, 0, "FETCH_PASSWORD", 0, 0, 0, false, 0, 2, NULL}, // Fetch Database Admin. Password + {IN_SW_GSEC_REAL_USER, 0, "REAL_USER", 0, 0, 0, false, 0, 9, NULL}, // name of real user, connected to services {IN_SW_GSEC_SQL_ROLE_NAME, isc_spb_sql_role_name, "ROLE", 0, 0, 0, false, 0, 2, NULL}, // SQL Role to assume {IN_SW_GSEC_DBA_TRUSTED_USER, 0, TRUSTED_USER_SWITCH, 0, 0, 0, false, 0, TRUSTED_USER_SWITCH_LEN, NULL}, // Database Admin. Trusted User name Modified: firebird/trunk/src/utilities/gsec/secur_proto.h =================================================================== --- firebird/trunk/src/utilities/gsec/secur_proto.h 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/utilities/gsec/secur_proto.h 2010-07-09 12:51:05 UTC (rev 51322) @@ -25,10 +25,10 @@ #define UTILITIES_SECUR_PROTO_H typedef void (*FPTR_SECURITY_CALLBACK)(void*, const internal_user_data*, bool); -SSHORT SECURITY_exec_line (ISC_STATUS* isc_status, FB_API_HANDLE DB, FB_API_HANDLE trans, +SSHORT SECURITY_exec_line (ISC_STATUS* isc_status, const char* realUser, FB_API_HANDLE DB, FB_API_HANDLE trans, internal_user_data* io_user_data, FPTR_SECURITY_CALLBACK display_func, void* callback_arg); -SSHORT SECURITY_exec_line (ISC_STATUS* isc_status, FB_API_HANDLE DB, +SSHORT SECURITY_exec_line (ISC_STATUS* isc_status, const char* realUser, FB_API_HANDLE DB, internal_user_data* io_user_data, FPTR_SECURITY_CALLBACK display_func, void* callback_arg); Modified: firebird/trunk/src/utilities/gsec/security.epp =================================================================== --- firebird/trunk/src/utilities/gsec/security.epp 2010-07-09 11:33:28 UTC (rev 51321) +++ firebird/trunk/src/utilities/gsec/security.epp 2010-07-09 12:51:05 UTC (rev 51322) @@ -37,6 +37,7 @@ #include "../utilities/gsec/secur_proto.h" #include "../common/utils_proto.h" #include "../common/classes/init.h" +#include "../common/classes/UserBlob.h" DATABASE DB = STATIC FILENAME "security2.fdb"; @@ -84,7 +85,27 @@ } +static bool storePasswd(ISC_STATUS* isc_status, FB_API_HANDLE DB, FB_API_HANDLE trans, + ISC_QUAD& blobId, const Firebird::string& passwd) +{ + UserBlob blob(isc_status); + const UCHAR blob_desc[] = {isc_bpb_version1, isc_bpb_type, 1, isc_blob_untyped}; + + if (!blob.create(DB, trans, blobId, sizeof(blob_desc), blob_desc)) + { + return false; + } + + if (!blob.putData(passwd.length(), passwd.c_str())) + { + return false; + } + + return blob.close(); +} + SSHORT SECURITY_exec_line(ISC_STATUS* isc_status, + const char *realUser, FB_API_HANDLE DB, FB_API_HANDLE trans, internal_user_data* io_user_data, @@ -173,7 +194,12 @@ { case MAP_DROP_OPER: case MAP_SET_OPER: + if (realUser) { + ret = GsecMsg104; + break; + } + { Firebird::string sql; sql.printf("ALTER ROLE RDB$ADMIN %s AUTO ADMIN MAPPING", io_user_data->operation == MAP_SET_OPER ? "SET" : "DROP"); @@ -185,62 +211,71 @@ } break; case ADD_OPER: + if (realUser) + { + ret = GsecMsg104; + break; + } // this checks the "entered" flags for each parameter (except the name) // and makes all non-entered parameters null valued - STORE (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN USERS USING - strcpy(U.USER_NAME, io_user_data->user_name); + STORE (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN RDB$USERS USING + strcpy(U.RDB$USER_NAME, io_user_data->user_name); if (io_user_data->uid_entered) { - U.UID = io_user_data->uid; - U.UID.NULL = ISC_FALSE; + U.RDB$UID = io_user_data->uid; + U.RDB$UID.NULL = ISC_FALSE; } else - U.UID.NULL = ISC_TRUE; + U.RDB$UID.NULL = ISC_TRUE; if (io_user_data->gid_entered) { - U.GID = io_user_data->gid; - U.GID.NULL = ISC_FALSE; + U.RDB$GID = io_user_data->gid; + U.RDB$GID.NULL = ISC_FALSE; } else - U.GID.NULL = ISC_TRUE; + U.RDB$GID.NULL = ISC_TRUE; if (io_user_data->group_name_entered) { - strcpy(U.GROUP_NAME, io_user_data->group_name); - U.GROUP_NAME.NULL = ISC_FALSE; + strcpy(U.RDB$GROUP_NAME, io_user_data->group_name); + U.RDB$GROUP_NAME.NULL = ISC_FALSE; } else - U.GROUP_NAME.NULL = ISC_TRUE; + U.RDB$GROUP_NAME.NULL = ISC_TRUE; if (io_user_data->password_entered) { ENC_crypt(encrypted1, sizeof encrypted1, io_user_data->password, Auth::PASSWORD_SALT); Auth::SecurityDatabase::hash(encrypted2, io_user_data->user_name, &encrypted1[2]); - strcpy(U.PASSWD, encrypted2.c_str()); - U.PASSWD.NULL = ISC_FALSE; + if (!storePasswd(isc_status, DB, trans, U.RDB$PASSWD, encrypted2)) + { + ret = GsecMsg19; + break; + } + U.RDB$PASSWD.NULL = ISC_FALSE; } else - U.PASSWD.NULL = ISC_TRUE; + U.RDB$PASSWD.NULL = ISC_TRUE; if (io_user_data->first_name_entered) { - strcpy(U.FIRST_NAME, io_user_data->first_name); - U.FIRST_NAME.NULL = ISC_FALSE; + strcpy(U.RDB$FIRST_NAME, io_user_data->first_name); + U.RDB$FIRST_NAME.NULL = ISC_FALSE; } else - U.FIRST_NAME.NULL = ISC_TRUE; + U.RDB$FIRST_NAME.NULL = ISC_TRUE; if (io_user_data->middle_name_entered) { - strcpy(U.MIDDLE_NAME, io_user_data->middle_name); - U.MIDDLE_NAME.NULL = ISC_FALSE; + strcpy(U.RDB$MIDDLE_NAME, io_user_data->middle_name); + U.RDB$MIDDLE_NAME.NULL = ISC_FALSE; } else - U.MIDDLE_NAME.NULL = ISC_TRUE; + U.RDB$MIDDLE_NAME.NULL = ISC_TRUE; if (io_user_data->last_name_entered) { - strcpy(U.LAST_NAME, io_user_data->last_name); - U.LAST_NAME.NULL = ISC_FALSE; + strcpy(U.RDB$LAST_NAME, io_user_data->last_name); + U.RDB$LAST_NAME.NULL = ISC_FALSE; } else - U.LAST_NAME.NULL = ISC_TRUE; + U.RDB$LAST_NAME.NULL = ISC_TRUE; END_STORE ON_ERROR ret = GsecMsg19; // gsec - add record error @@ -252,66 +287,76 @@ break; case MOD_OPER: + if (realUser && strcmp(realUser, io_user_data->user_name)) + { + ret = GsecMsg104; + break; + } + // this updates an existing record, replacing all fields that are // entered, and for those that were specified but not entered, it // changes the current value to the null value found = false; - FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN USERS - WITH U.USER_NAME EQ io_user_data->user_name + FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN RDB$USERS + WITH U.RDB$USER_NAME EQ io_user_data->user_name found = true; MODIFY U USING if (io_user_data->uid_entered) { - U.UID = io_user_data->uid; - U.UID.NULL = ISC_FALSE; + U.RDB$UID = io_user_data->uid; + U.RDB$UID.NULL = ISC_FALSE; } else if (io_user_data->uid_specified) - U.UID.NULL = ISC_TRUE; + U.RDB$UID.NULL = ISC_TRUE; if (io_user_data->gid_entered) { - U.GID = io_user_data->gid; - U.GID.NULL = ISC_FALSE; + U.RDB$GID = io_user_data->gid; + U.RDB$GID.NULL = ISC_FALSE; } else if (io_user_data->gid_specified) - U.GID.NULL = ISC_TRUE; + U.RDB$GID.NULL = ISC_TRUE; if (io_user_data->group_name_entered) { - strcpy(U.GROUP_NAME, io_user_data->group_name); - U.GROUP_NAME.NULL = ISC_FALSE; + strcpy(U.RDB$GROUP_NAME, io_user_data->group_name); + U.RDB$GROUP_NAME.NULL = ISC_FALSE; } else if (io_user_data->group_name_specified) - U.GROUP_NAME.NULL = ISC_TRUE; + U.RDB$GROUP_NAME.NULL = ISC_TRUE; if (io_user_data->password_entered) { ENC_crypt(encrypted1, sizeof encrypted1, io_user_data->password, Auth::PASSWORD_SALT); Auth::SecurityDatabase::hash(encrypted2, io_user_data->user_name, &encrypted1[2]); - strcpy(U.PASSWD, encrypted2.c_str()); - U.PASSWD.NULL = ISC_FALSE; + if (!storePasswd(isc_status, DB, trans, U.RDB$PASSWD, encrypted2)) + { + ret = GsecMsg21; + break; + } + U.RDB$PASSWD.NULL = ISC_FALSE; } else if (io_user_data->password_specified) - U.PASSWD.NULL = ISC_TRUE; + U.RDB$PASSWD.NULL = ISC_TRUE; if (io_user_data->first_name_entered) { - strcpy(U.FIRST_NAME, io_user_data->first_name); - U.FIRST_NAME.NULL = ISC_FALSE; + strcpy(U.RDB$FIRST_NAME, io_user_data->first_name); + U.RDB$FIRST_NAME.NULL = ISC_FALSE; } else if (io_user_data->first_name_specified) - U.FIRST_NAME.NULL = ISC_TRUE; + U.RDB$FIRST_NAME.NULL = ISC_TRUE; if (io_user_data->middle_name_entered) { - strcpy(U.MIDDLE_NAME, io_user_data->middle_name); - U.MIDDLE_NAME.NULL = ISC_FALSE; + strcpy(U.RDB$MIDDLE_NAME, io_user_data->middle_name); + U.RDB$MIDDLE_NAME.NULL = ISC_FALSE; } else if (io_user_data->middle_name_specified) - U.MIDDLE_NAME.NULL = ISC_TRUE; + U.RDB$MIDDLE_NAME.NULL = ISC_TRUE; if (io_user_data->last_name_entered) { - strcpy(U.LAST_NAME, io_user_data->last_name); - U.LAST_NAME.NULL = ISC_FALSE; + strcpy(U.RDB$LAST_NAME, io_user_data->last_name); + U.RDB$LAST_NAME.NULL = ISC_FALSE; } else if (io_user_data->last_name_specified) - U.LAST_NAME.NULL = ISC_TRUE; + U.RDB$LAST_NAME.NULL = ISC_TRUE; END_MODIFY ON_ERROR ret = GsecMsg20; @@ -329,6 +374,12 @@ break; case DEL_OPER: + if (realUser) + { + ret = GsecMsg104; + break; + } + // looks up the specified user record and deletes it found = false; @@ -337,8 +388,8 @@ ret = GsecMsg23; else { - FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN USERS - WITH U.USER_NAME EQ io_user_data->user_name + FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN RDB$USERS + WITH U.RDB$USER_NAME EQ io_user_data->user_name found = true; ERASE U ON_ERROR @@ -363,25 +414,51 @@ case DIS_OPER: case OLD_DIS_OPER: + if (realUser) + { + if (io_user_data->user_name_entered && strcmp(realUser, io_user_data->user_name)) + { + ret = GsecMsg104; + break; + } + if (!io_user_data->user_name_entered) + { + if (strlen(realUser) > sizeof(io_user_data->user_name) - 1) + { + ret = GsecMsg104; + break; + } + strcpy(io_user_data->user_name, realUser); + io_user_data->user_name_entered = true; + } + } + // gets either the desired record, or all records, and displays them found = false; if (!io_user_data->user_name_entered) { - FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN USERS - io_user_data->uid = U.UID; - io_user_data->gid = U.GID; - *(io_user_data->sys_user_name) = '\0'; - strcpy(io_user_data->user_name, U.USER_NAME); - strcpy(io_user_data->group_name, U.GROUP_NAME); + FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN RDB$USERS + io_user_data->uid = U.RDB$UID; + io_user_data->uid_entered = !U.RDB$UID.NULL; + io_user_data->gid = U.RDB$GID; + io_user_data->gid_entered = !U.RDB$GID.NULL; + strcpy(io_user_data->user_name, U.RDB$USER_NAME); + io_user_data->user_name_entered = !U.RDB$USER_NAME.NULL; + strcpy(io_user_data->group_name, U.RDB$GROUP_NAME); + io_user_data->group_name_entered = !U.RDB$GROUP_NAME.NULL; io_user_data->password[0] = 0; - strcpy(io_user_data->first_name, U.FIRST_NAME); - strcpy(io_user_data->middle_name, U.MIDDLE_NAME); - strcpy(io_user_data->last_name, U.LAST_NAME); + io_user_data->password_entered = false; + strcpy(io_user_data->first_name, U.RDB$FIRST_NAME); + io_user_data->first_name_entered = !U.RDB$FIRST_NAME.NULL; + strcpy(io_user_data->middle_name, U.RDB$MIDDLE_NAME); + io_user_data->middle_name_entered = !U.RDB$MIDDLE_NAME.NULL; + strcpy(io_user_data->last_name, U.RDB$LAST_NAME); + io_user_data->last_name_entered = !U.RDB$LAST_NAME.NULL; io_user_data->admin = 0; FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request2) P IN RDB$USER_PRIVILEGES - WITH P.RDB$USER EQ U.USER_NAME + WITH P.RDB$USER EQ U.RDB$USER_NAME AND P.RDB$RELATION_NAME EQ 'RDB$ADMIN' AND P.RDB$PRIVILEGE EQ 'M' io_user_data->admin = 1; @@ -397,21 +474,28 @@ } else { - FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN USERS - WITH U.USER_NAME EQ io_user_data->user_name - io_user_data->uid = U.UID; - io_user_data->gid = U.GID; - *(io_user_data->sys_user_name) = '\0'; - strcpy(io_user_data->user_name, U.USER_NAME); - strcpy(io_user_data->group_name, U.GROUP_NAME); + FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN RDB$USERS + WITH U.RDB$USER_NAME EQ io_user_data->user_name + io_user_data->uid = U.RDB$UID; + io_user_data->uid_entered = !U.RDB$UID.NULL; + io_user_data->gid = U.RDB$GID; + io_user_data->gid_entered = !U.RDB$GID.NULL; + strcpy(io_user_data->user_name, U.RDB$USER_NAME); + io_user_data->user_name_entered = !U.RDB$USER_NAME.NULL; + strcpy(io_user_data->group_name, U.RDB$GROUP_NAME); + io_user_data->group_name_entered = !U.RDB$GROUP_NAME.NULL; io_user_data->password[0] = 0; - strcpy(io_user_data->first_name, U.FIRST_NAME); - strcpy(io_user_data->middle_name, U.MIDDLE_NAME); - strcpy(io_user_data->last_name, U.LAST_NAME); + io_user_data->password_entered = false; + strcpy(io_user_data->first_name, U.RDB$FIRST_NAME); + io_user_data->first_name_entered = !U.RDB$FIRST_NAME.NULL; + strcpy(io_user_data->middle_name, U.RDB$MIDDLE_NAME); + io_user_data->middle_name_entered = !U.RDB$MIDDLE_NAME.NULL; + strcpy(io_user_data->last_name, U.RDB$LAST_NAME); + io_user_data->last_name_entered = !U.RDB$LAST_NAME.NULL; io_user_data->admin = 0; FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request2) P IN RDB$USER_PRIVILEGES - WITH P.RDB$USER EQ U.USER_NAME + WITH P.RDB$USER EQ U.RDB$USER_NAME AND P.RDB$RELATION_NAME EQ 'RDB$ADMIN' AND P.RDB$PRIVILEGE EQ 'M' io_user_data->admin = 1; @@ -460,6 +544,7 @@ } SSHORT SECURITY_exec_line(ISC_STATUS* isc_status, + const char *realUser, FB_API_HANDLE DB, internal_user_data* io_user_data, FPTR_SECURITY_CALLBACK display_func, @@ -472,7 +557,7 @@ return GsecMsg75; // gsec error END_ERROR; - SSHORT ret = SECURITY_exec_line(isc_status, DB, gds_trans, io_user_data, display_func, callback_arg); + SSHORT ret = SECURITY_exec_line(isc_status, realUser, DB, gds_trans, io_user_data, display_func, callback_arg); // rollback if we have an error using tmp_status to avoid // overwriting the error status which the caller wants to see This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2010-07-13 12:31:43
|
Revision: 51337 http://firebird.svn.sourceforge.net/firebird/?rev=51337&view=rev Author: dimitr Date: 2010-07-13 12:31:35 +0000 (Tue, 13 Jul 2010) Log Message: ----------- Reworked the SEC$USERS implementation so that no new physical table type and data access method would be required. More changes are likely to follow soon. Modified Paths: -------------- firebird/trunk/builds/win32/msvc10/engine.vcxproj firebird/trunk/builds/win32/msvc10/engine.vcxproj.filters firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj.filters firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj.filters firebird/trunk/builds/win32/msvc9/engine.vcproj firebird/trunk/builds/win32/msvc9/engine_classic.vcproj firebird/trunk/builds/win32/msvc9/engine_embed.vcproj firebird/trunk/src/jrd/Database.h firebird/trunk/src/jrd/DatabaseSnapshot.cpp firebird/trunk/src/jrd/DatabaseSnapshot.h firebird/trunk/src/jrd/Relation.h firebird/trunk/src/jrd/UserManagement.cpp firebird/trunk/src/jrd/UserManagement.h firebird/trunk/src/jrd/constants.h firebird/trunk/src/jrd/met.epp firebird/trunk/src/jrd/opt.cpp firebird/trunk/src/jrd/recsrc/RecordSource.h firebird/trunk/src/jrd/recsrc/VirtualTableScan.cpp firebird/trunk/src/jrd/relations.h firebird/trunk/src/jrd/types.h Modified: firebird/trunk/builds/win32/msvc10/engine.vcxproj =================================================================== --- firebird/trunk/builds/win32/msvc10/engine.vcxproj 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/builds/win32/msvc10/engine.vcxproj 2010-07-13 12:31:35 UTC (rev 51337) @@ -221,7 +221,6 @@ <ClCompile Include="..\..\..\src\jrd\PreparedStatement.cpp" /> <ClCompile Include="..\..\..\src\jrd\RandomGenerator.cpp" /> <ClCompile Include="..\..\..\src\jrd\RecordBuffer.cpp" /> - <ClCompile Include="..\..\..\src\jrd\recsrc\UsersTableScan.cpp" /> <ClCompile Include="..\..\..\src\jrd\Relation.cpp" /> <ClCompile Include="..\..\..\src\jrd\ResultSet.cpp" /> <ClCompile Include="..\..\..\src\jrd\rlck.cpp" /> Modified: firebird/trunk/builds/win32/msvc10/engine.vcxproj.filters =================================================================== --- firebird/trunk/builds/win32/msvc10/engine.vcxproj.filters 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/builds/win32/msvc10/engine.vcxproj.filters 2010-07-13 12:31:35 UTC (rev 51337) @@ -423,9 +423,6 @@ <ClCompile Include="..\..\..\src\gpre\pretty.cpp"> <Filter>GPRE files</Filter> </ClCompile> - <ClCompile Include="..\..\..\src\jrd\recsrc\UsersTableScan.cpp"> - <Filter>JRD files\Data Access</Filter> - </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\..\src\jrd\acl.h"> Modified: firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj =================================================================== --- firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj 2010-07-13 12:31:35 UTC (rev 51337) @@ -221,7 +221,6 @@ <ClCompile Include="..\..\..\src\jrd\PreparedStatement.cpp" /> <ClCompile Include="..\..\..\src\jrd\RandomGenerator.cpp" /> <ClCompile Include="..\..\..\src\jrd\RecordBuffer.cpp" /> - <ClCompile Include="..\..\..\src\jrd\recsrc\UsersTableScan.cpp" /> <ClCompile Include="..\..\..\src\jrd\Relation.cpp" /> <ClCompile Include="..\..\..\src\jrd\ResultSet.cpp" /> <ClCompile Include="..\..\..\src\jrd\rlck.cpp" /> Modified: firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj.filters =================================================================== --- firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj.filters 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj.filters 2010-07-13 12:31:35 UTC (rev 51337) @@ -423,9 +423,6 @@ <ClCompile Include="..\..\..\src\gpre\pretty.cpp"> <Filter>GPRE files</Filter> </ClCompile> - <ClCompile Include="..\..\..\src\jrd\recsrc\UsersTableScan.cpp"> - <Filter>JRD files\Data Access</Filter> - </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\..\src\jrd\acl.h"> Modified: firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj =================================================================== --- firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj 2010-07-13 12:31:35 UTC (rev 51337) @@ -221,7 +221,6 @@ <ClCompile Include="..\..\..\src\jrd\PreparedStatement.cpp" /> <ClCompile Include="..\..\..\src\jrd\RandomGenerator.cpp" /> <ClCompile Include="..\..\..\src\jrd\RecordBuffer.cpp" /> - <ClCompile Include="..\..\..\src\jrd\recsrc\UsersTableScan.cpp" /> <ClCompile Include="..\..\..\src\jrd\Relation.cpp" /> <ClCompile Include="..\..\..\src\jrd\ResultSet.cpp" /> <ClCompile Include="..\..\..\src\jrd\rlck.cpp" /> Modified: firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj.filters =================================================================== --- firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj.filters 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj.filters 2010-07-13 12:31:35 UTC (rev 51337) @@ -423,9 +423,6 @@ <ClCompile Include="..\..\..\src\gpre\pretty.cpp"> <Filter>GPRE files</Filter> </ClCompile> - <ClCompile Include="..\..\..\src\jrd\recsrc\UsersTableScan.cpp"> - <Filter>JRD files\Data Access</Filter> - </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\..\src\jrd\acl.h"> Modified: firebird/trunk/builds/win32/msvc9/engine.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc9/engine.vcproj 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/builds/win32/msvc9/engine.vcproj 2010-07-13 12:31:35 UTC (rev 51337) @@ -807,10 +807,6 @@ > </File> <File - RelativePath="..\..\..\src\jrd\recsrc\UsersTableScan.cpp" - > - </File> - <File RelativePath="..\..\..\src\jrd\recsrc\VirtualTableScan.cpp" > </File> Modified: firebird/trunk/builds/win32/msvc9/engine_classic.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc9/engine_classic.vcproj 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/builds/win32/msvc9/engine_classic.vcproj 2010-07-13 12:31:35 UTC (rev 51337) @@ -807,14 +807,10 @@ > </File> <File - RelativePath="..\..\..\src\jrd\recsrc\UsersTableScan.cpp" + RelativePath="..\..\..\src\jrd\recsrc\VirtualTableScan.cpp" > </File> <File - RelativePath="..\..\..\src\jrd\recsrc\VirtualTableScan.cpp" - > - </File> - <File RelativePath="..\..\..\src\jrd\recsrc\WindowedStream.cpp" > </File> Modified: firebird/trunk/builds/win32/msvc9/engine_embed.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc9/engine_embed.vcproj 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/builds/win32/msvc9/engine_embed.vcproj 2010-07-13 12:31:35 UTC (rev 51337) @@ -807,14 +807,10 @@ > </File> <File - RelativePath="..\..\..\src\jrd\recsrc\UsersTableScan.cpp" + RelativePath="..\..\..\src\jrd\recsrc\VirtualTableScan.cpp" > </File> <File - RelativePath="..\..\..\src\jrd\recsrc\VirtualTableScan.cpp" - > - </File> - <File RelativePath="..\..\..\src\jrd\recsrc\WindowedStream.cpp" > </File> Modified: firebird/trunk/src/jrd/Database.h =================================================================== --- firebird/trunk/src/jrd/Database.h 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/src/jrd/Database.h 2010-07-13 12:31:35 UTC (rev 51337) @@ -54,7 +54,6 @@ #include "../common/classes/PublicHandle.h" #include "../common/classes/semaphore.h" #include "../common/utils_proto.h" -#include "../jrd/DatabaseSnapshot.h" #include "../jrd/RandomGenerator.h" #include "../jrd/os/guid.h" #include "../jrd/sbm.h" @@ -79,6 +78,7 @@ class BackupManager; class vcl; class ExternalFileDirectoryList; + class MonitoringData; typedef Firebird::ObjectsArray<Trigger> trig_vec; @@ -368,7 +368,7 @@ trig_vec* dbb_triggers[DB_TRIGGER_MAX]; trig_vec* dbb_ddl_triggers; - DatabaseSnapshot::SharedData* dbb_monitoring_data; // monitoring data + MonitoringData* dbb_monitoring_data; // monitoring data DatabaseModules dbb_modules; // external function/filter modules ExtEngineManager dbb_extManager; // external engine manager Modified: firebird/trunk/src/jrd/DatabaseSnapshot.cpp =================================================================== --- firebird/trunk/src/jrd/DatabaseSnapshot.cpp 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/src/jrd/DatabaseSnapshot.cpp 2010-07-13 12:31:35 UTC (rev 51337) @@ -71,9 +71,17 @@ using namespace Jrd; -// SharedData class +bool MonitoringTableScan::retrieveRecord(thread_db* tdbb, jrd_rel* relation, + FB_UINT64 position, Record* record) const +{ + DatabaseSnapshot* const snapshot = DatabaseSnapshot::create(tdbb); + return snapshot->getData(relation)->fetch(position, record); +} -DatabaseSnapshot::SharedData::SharedData(const Database* dbb) + +// MonitoringData class + +MonitoringData::MonitoringData(const Database* dbb) : process_id(getpid()), local_id(dbb->dbb_monitoring_id) { string name; @@ -91,10 +99,10 @@ } -DatabaseSnapshot::SharedData::~SharedData() +MonitoringData::~MonitoringData() { { // scope - DumpGuard guard(this); + Guard guard(this); cleanup(); if (sh_mem_header->used == sizeof(Header)) @@ -106,7 +114,7 @@ } -void DatabaseSnapshot::SharedData::acquire() +void MonitoringData::acquire() { mutexLock(); @@ -126,13 +134,13 @@ } -void DatabaseSnapshot::SharedData::release() +void MonitoringData::release() { mutexUnlock(); } -UCHAR* DatabaseSnapshot::SharedData::read(MemoryPool& pool, ULONG& resultSize) +UCHAR* MonitoringData::read(MemoryPool& pool, ULONG& resultSize) { ULONG self_dbb_offset = 0; @@ -198,7 +206,7 @@ } -ULONG DatabaseSnapshot::SharedData::setup() +ULONG MonitoringData::setup() { ensureSpace(sizeof(Element)); @@ -214,7 +222,7 @@ } -void DatabaseSnapshot::SharedData::write(ULONG offset, ULONG length, const void* buffer) +void MonitoringData::write(ULONG offset, ULONG length, const void* buffer) { ensureSpace(length); @@ -229,7 +237,7 @@ } -void DatabaseSnapshot::SharedData::cleanup() +void MonitoringData::cleanup() { // Remove information about our dbb for (ULONG offset = alignOffset(sizeof(Header)); offset < sh_mem_header->used;) @@ -252,7 +260,7 @@ } -void DatabaseSnapshot::SharedData::ensureSpace(ULONG length) +void MonitoringData::ensureSpace(ULONG length) { ULONG newSize = sh_mem_header->used + length; @@ -274,7 +282,7 @@ } -void DatabaseSnapshot::SharedData::mutexBug(int osErrorCode, const char* string) +void MonitoringData::mutexBug(int osErrorCode, const char* string) { gds__log("MONITOR: mutex %s error, status = %d", string, osErrorCode); @@ -283,7 +291,7 @@ } -bool DatabaseSnapshot::SharedData::initialize(bool initialize) +bool MonitoringData::initialize(bool initialize) { if (initialize) { @@ -299,11 +307,12 @@ } -ULONG DatabaseSnapshot::SharedData::alignOffset(ULONG unaligned) +ULONG MonitoringData::alignOffset(ULONG unaligned) { - return Firebird::MEM_ALIGN(unaligned); + return (ULONG) Firebird::MEM_ALIGN(unaligned); } + // DatabaseSnapshot class @@ -424,7 +433,7 @@ { // scope fb_assert(dbb->dbb_monitoring_data); - DumpGuard guard(dbb->dbb_monitoring_data); + MonitoringData::Guard guard(dbb->dbb_monitoring_data); dataPtr = dbb->dbb_monitoring_data->read(pool, dataSize); } @@ -589,7 +598,7 @@ jrd_rel* relation = MET_lookup_relation_id(tdbb, rel_id, false); fb_assert(relation); MET_scan_relation(tdbb, relation); - fb_assert(relation->isVirtual() && !relation->isUsers()); + fb_assert(relation->isVirtual()); Format* format = MET_current(tdbb, relation); fb_assert(format); @@ -613,7 +622,7 @@ void DataDump::putField(thread_db* tdbb, Record* record, const DumpField& field, - int& charset, bool set_charset) + int& charset, bool set_charset) { fb_assert(record); @@ -726,10 +735,10 @@ if (!dbb->dbb_monitoring_data) { - dbb->dbb_monitoring_data = FB_NEW(*dbb->dbb_permanent) SharedData(dbb); + dbb->dbb_monitoring_data = FB_NEW(*dbb->dbb_permanent) MonitoringData(dbb); } - DumpGuard guard(dbb->dbb_monitoring_data); + MonitoringData::Guard guard(dbb->dbb_monitoring_data); dbb->dbb_monitoring_data->cleanup(); Writer writer(dbb->dbb_monitoring_data); @@ -905,7 +914,7 @@ bool DatabaseSnapshot::putAttachment(thread_db* tdbb, const Jrd::Attachment* attachment, - Writer& writer, int stat_id) + Writer& writer, int stat_id) { fb_assert(attachment); Modified: firebird/trunk/src/jrd/DatabaseSnapshot.h =================================================================== --- firebird/trunk/src/jrd/DatabaseSnapshot.h 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/src/jrd/DatabaseSnapshot.h 2010-07-13 12:31:35 UTC (rev 51337) @@ -29,6 +29,7 @@ #include "../jrd/isc_s_proto.h" #include "../common/classes/timestamp.h" #include "../jrd/val.h" +#include "../jrd/recsrc/RecordSource.h" namespace Jrd { @@ -199,91 +200,103 @@ int idCounter; }; -class DatabaseSnapshot : public DataDump + +class MonitoringHeader : public MemoryHeader { - struct RelationData +public: + ULONG used; + ULONG allocated; +}; + +class MonitoringData : public SharedMemory<MonitoringHeader> +{ + static const ULONG MONITOR_VERSION = 3; + static const ULONG DEFAULT_SIZE = 1048576; + + typedef MonitoringHeader Header; + + struct Element { - int rel_id; - RecordBuffer* data; + SLONG processId; + SLONG localId; + ULONG length; }; + static ULONG alignOffset(ULONG absoluteOffset); + public: - class SnapshotHeader : public MemoryHeader + class Guard { public: - ULONG used; - ULONG allocated; - }; + explicit Guard(MonitoringData* ptr) + : data(ptr) + { + data->acquire(); + } - class SharedData : public SharedMemory<SnapshotHeader> - { - static const ULONG MONITOR_VERSION = 3; - static const ULONG DEFAULT_SIZE = 1048576; + ~Guard() + { + data->release(); + } - typedef SnapshotHeader Header; + private: + Guard(const Guard&); + Guard& operator=(const Guard&); - struct Element - { - SLONG processId; - SLONG localId; - ULONG length; - }; + MonitoringData* const data; + }; - static ULONG alignOffset(ULONG absoluteOffset); + explicit MonitoringData(const Database*); + ~MonitoringData(); - public: - explicit SharedData(const Database*); - ~SharedData(); + bool initialize(bool); + void mutexBug(int osErrorCode, const char* text); - bool initialize(bool); - void mutexBug(int osErrorCode, const char* text); + void acquire(); + void release(); - void acquire(); - void release(); + UCHAR* read(MemoryPool&, ULONG&); + ULONG setup(); + void write(ULONG, ULONG, const void*); - UCHAR* read(MemoryPool&, ULONG&); - ULONG setup(); - void write(ULONG, ULONG, const void*); + void cleanup(); - void cleanup(); +private: + // copying is prohibited + MonitoringData(const MonitoringData&); + MonitoringData& operator =(const MonitoringData&); - private: - // copying is prohibited - SharedData(const SharedData&); - SharedData& operator =(const SharedData&); + void ensureSpace(ULONG); - void ensureSpace(ULONG); + const SLONG process_id; + const SLONG local_id; +}; - const SLONG process_id; - const SLONG local_id; - }; -private: - class DumpGuard - { - public: - explicit DumpGuard(SharedData* ptr) - : data(ptr) - { - data->acquire(); - } +class MonitoringTableScan: public VirtualTableScan +{ +public: + MonitoringTableScan(CompilerScratch* csb, const Firebird::string& name, UCHAR stream) + : VirtualTableScan(csb, name, stream) + {} - ~DumpGuard() - { - data->release(); - } + bool retrieveRecord(thread_db* tdbb, jrd_rel* relation, FB_UINT64 position, Record* record) const; +}; - private: - DumpGuard(const DumpGuard&); - DumpGuard& operator=(const DumpGuard&); - SharedData* const data; +class DatabaseSnapshot : public DataDump +{ + struct RelationData + { + int rel_id; + RecordBuffer* data; }; +private: class Writer { public: - explicit Writer(SharedData* data) + explicit Writer(MonitoringData* data) : dump(data) { fb_assert(dump); @@ -299,7 +312,7 @@ } private: - SharedData* dump; + MonitoringData* dump; ULONG offset; }; @@ -338,6 +351,7 @@ static DatabaseSnapshot* create(thread_db*); static int blockingAst(void*); + static bool getRecord(thread_db* tdbb, jrd_rel* relation, FB_UINT64 position, Record* record); protected: DatabaseSnapshot(thread_db*, MemoryPool&); Modified: firebird/trunk/src/jrd/Relation.h =================================================================== --- firebird/trunk/src/jrd/Relation.h 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/src/jrd/Relation.h 2010-07-13 12:31:35 UTC (rev 51337) @@ -219,7 +219,6 @@ bool isSystem() const; bool isTemporary() const; bool isVirtual() const; - bool isUsers() const; // global temporary relations attributes RelationPages* getPages(thread_db* tdbb, SLONG tran = -1, bool allocPages = true); @@ -299,7 +298,6 @@ const ULONG REL_temp_tran = 0x2000; // relation is a GTT delete rows const ULONG REL_temp_conn = 0x4000; // relation is a GTT preserve rows const ULONG REL_virtual = 0x8000; // relation is virtual -const ULONG REL_users = 0x00010000; // relation is users list inline bool jrd_rel::isSystem() const @@ -314,14 +312,9 @@ inline bool jrd_rel::isVirtual() const { - return (rel_flags & (REL_virtual | REL_users)); + return (rel_flags & REL_virtual); } -inline bool jrd_rel::isUsers() const -{ - return (rel_flags & REL_users); -} - inline RelationPages* jrd_rel::getPages(thread_db* tdbb, SLONG tran, bool allocPages) { if (!isTemporary()) Modified: firebird/trunk/src/jrd/UserManagement.cpp =================================================================== --- firebird/trunk/src/jrd/UserManagement.cpp 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/src/jrd/UserManagement.cpp 2010-07-13 12:31:35 UTC (rev 51337) @@ -38,6 +38,14 @@ using namespace Firebird; +bool UsersTableScan::retrieveRecord(thread_db* tdbb, jrd_rel* relation, + FB_UINT64 position, Record* record) const +{ + jrd_tra* const transaction = tdbb->getTransaction(); + return transaction->getUserManagement()->getList(tdbb, relation)->fetch(position, record); +} + + UserManagement::UserManagement(jrd_tra* tra) : DataDump(*tra->tra_pool), database(0), transaction(0), buffer(0), threadDbb(NULL), realUser(NULL), commands(*tra->tra_pool) @@ -219,51 +227,44 @@ buffer->store(record); } -RecordBuffer* UserManagement::getList(thread_db* tdbb) +RecordBuffer* UserManagement::getList(thread_db* tdbb, jrd_rel* relation) { #ifdef EMBEDDED // this restriction for embedded is temporarty and will gone when new build system will be introduced status_exception::raise(Arg::Gds(isc_random) << "User management not supported in embedded library"); return 0; // keep the compiler happy #else - if (buffer) + if (!buffer) { - return buffer; - } + try + { + threadDbb = tdbb; - try - { - threadDbb = tdbb; + fb_assert(relation && relation->rel_id == rel_sec_users); - jrd_rel* relation = MET_lookup_relation_id(threadDbb, rel_sec_users, false); - fb_assert(relation); + MET_scan_relation(threadDbb, relation); - MET_scan_relation(threadDbb, relation); - fb_assert(relation->isUsers()); + Format* const format = MET_current(threadDbb, relation); + fb_assert(format); - Format* format = MET_current(threadDbb, relation); - fb_assert(format); + MemoryPool* const pool = threadDbb->getTransaction()->tra_pool; + fb_assert(pool); - MemoryPool* pool = threadDbb->getTransaction()->tra_pool; - fb_assert(pool); + buffer = FB_NEW(*pool) RecordBuffer(*pool, format); + fb_assert(buffer); - buffer = FB_NEW(*pool) RecordBuffer(*pool, format); - fb_assert(buffer); - - ISC_STATUS_ARRAY status; - internal_user_data u; - u.operation = DIS_OPER; - int errcode = SECURITY_exec_line(status, realUser, database, transaction, &u, display, this); - checkSecurityResult(errcode, status, u.user_name); - } - catch (const Exception&) - { - if (buffer) + ISC_STATUS_ARRAY status; + internal_user_data u; + u.operation = DIS_OPER; + int errcode = SECURITY_exec_line(status, realUser, database, transaction, &u, display, this); + checkSecurityResult(errcode, status, u.user_name); + } + catch (const Exception&) { delete buffer; buffer = NULL; + throw; } - throw; } return buffer; Modified: firebird/trunk/src/jrd/UserManagement.h =================================================================== --- firebird/trunk/src/jrd/UserManagement.h 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/src/jrd/UserManagement.h 2010-07-13 12:31:35 UTC (rev 51337) @@ -28,6 +28,7 @@ #include "../common/classes/fb_string.h" #include "../jrd/ibase.h" #include "../jrd/DatabaseSnapshot.h" +#include "../jrd/recsrc/RecordSource.h" struct internal_user_data; @@ -37,6 +38,16 @@ class jrd_tra; class RecordBuffer; +class UsersTableScan: public VirtualTableScan +{ +public: + UsersTableScan(CompilerScratch* csb, const Firebird::string& name, UCHAR stream) + : VirtualTableScan(csb, name, stream) + {} + + bool retrieveRecord(thread_db* tdbb, jrd_rel* relation, FB_UINT64 position, Record* record) const; +}; + // User management argument for deferred work class UserManagement : public DataDump { @@ -51,7 +62,7 @@ // commit transaction in security database void commit(); // return users list for SEC$USERS - RecordBuffer* getList(thread_db* tdbb); + RecordBuffer* getList(thread_db* tdbb, jrd_rel* relation); private: FB_API_HANDLE database, transaction; Modified: firebird/trunk/src/jrd/constants.h =================================================================== --- firebird/trunk/src/jrd/constants.h 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/src/jrd/constants.h 2010-07-13 12:31:35 UTC (rev 51337) @@ -202,8 +202,7 @@ rel_external = 2, rel_virtual = 3, rel_global_temp_preserve = 4, - rel_global_temp_delete = 5, - rel_vrt_users = 6 + rel_global_temp_delete = 5 }; // procedure types Modified: firebird/trunk/src/jrd/met.epp =================================================================== --- firebird/trunk/src/jrd/met.epp 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/src/jrd/met.epp 2010-07-13 12:31:35 UTC (rev 51337) @@ -3607,9 +3607,6 @@ case rel_view: fb_assert(relation->rel_view_rse); break; - case rel_vrt_users: - relation->rel_flags |= REL_users; - break; case rel_virtual: relation->rel_flags |= REL_virtual; break; Modified: firebird/trunk/src/jrd/opt.cpp =================================================================== --- firebird/trunk/src/jrd/opt.cpp 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/src/jrd/opt.cpp 2010-07-13 12:31:35 UTC (rev 51337) @@ -56,6 +56,7 @@ #include "../jrd/btr.h" #include "../jrd/sort.h" #include "../jrd/rse.h" +#include "../jrd/ini.h" #include "../jrd/intl.h" #include "../jrd/gdsassert.h" #include "../jrd/btr_proto.h" @@ -76,6 +77,8 @@ #include "../jrd/dbg_proto.h" #include "../jrd/DataTypeUtil.h" #include "../jrd/VirtualTable.h" +#include "../jrd/DatabaseSnapshot.h" +#include "../jrd/UserManagement.h" #include "../common/classes/array.h" #include "../common/classes/objects_array.h" #include "../jrd/recsrc/RecordSource.h" @@ -3045,9 +3048,9 @@ DEV_BLKCHK(*return_boolean, type_nod); } - CompilerScratch* csb = opt->opt_csb; - CompilerScratch::csb_repeat* csb_tail = &csb->csb_rpt[stream]; - jrd_rel* relation = csb_tail->csb_relation; + CompilerScratch* const csb = opt->opt_csb; + CompilerScratch::csb_repeat* const csb_tail = &csb->csb_rpt[stream]; + jrd_rel* const relation = csb_tail->csb_relation; fb_assert(relation); @@ -3074,15 +3077,17 @@ // External table rsb = FB_NEW(*tdbb->getDefaultPool()) ExternalTableScan(csb, alias, stream); } - else if (relation->isUsers()) - { - // Users table - rsb = FB_NEW(*tdbb->getDefaultPool()) UsersTableScan(csb, alias, stream); - } else if (relation->isVirtual()) { - // Virtual table - rsb = FB_NEW(*tdbb->getDefaultPool()) VirtualTableScan(csb, alias, stream); + // Virtual table: monitoring or security + if (relation->rel_id == rel_sec_users) + { + rsb = FB_NEW(*tdbb->getDefaultPool()) UsersTableScan(csb, alias, stream); + } + else + { + rsb = FB_NEW(*tdbb->getDefaultPool()) MonitoringTableScan(csb, alias, stream); + } } else { Modified: firebird/trunk/src/jrd/recsrc/RecordSource.h =================================================================== --- firebird/trunk/src/jrd/recsrc/RecordSource.h 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/src/jrd/recsrc/RecordSource.h 2010-07-13 12:31:35 UTC (rev 51337) @@ -28,11 +28,6 @@ #include "../jrd/rse.h" #include "../jrd/inf_pub.h" -namespace Ods -{ - struct btree_page; -} - namespace Jrd { class thread_db; @@ -281,11 +276,6 @@ class VirtualTableScan : public RecordStream { - struct Impure : public RecordSource::Impure - { - RecordBuffer* irsb_record_buffer; - }; - public: VirtualTableScan(CompilerScratch* csb, const Firebird::string& name, UCHAR stream); @@ -298,29 +288,10 @@ void dump(thread_db* tdbb, Firebird::UCharBuffer& buffer) const; - private: - const Firebird::string m_name; - }; + protected: + virtual bool retrieveRecord(thread_db* tdbb, jrd_rel* relation, + FB_UINT64 position, Record* record) const = 0; - class UsersTableScan : public RecordStream - { - struct Impure : public RecordSource::Impure - { - RecordBuffer* irsb_record_buffer; - }; - - public: - UsersTableScan(CompilerScratch* csb, const Firebird::string& name, UCHAR stream); - - void open(thread_db* tdbb) const; - void close(thread_db* tdbb) const; - - bool getRecord(thread_db* tdbb) const; - bool refetchRecord(thread_db* tdbb) const; - bool lockRecord(thread_db* tdbb) const; - - void dump(thread_db* tdbb, Firebird::UCharBuffer& buffer) const; - private: const Firebird::string m_name; }; Modified: firebird/trunk/src/jrd/recsrc/VirtualTableScan.cpp =================================================================== --- firebird/trunk/src/jrd/recsrc/VirtualTableScan.cpp 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/src/jrd/recsrc/VirtualTableScan.cpp 2010-07-13 12:31:35 UTC (rev 51337) @@ -68,9 +68,6 @@ } rpb->rpb_number.setValue(BOF_NUMBER); - - DatabaseSnapshot* const snapshot = DatabaseSnapshot::create(tdbb); - impure->irsb_record_buffer = snapshot->getData(relation); } void VirtualTableScan::close(thread_db* tdbb) const @@ -84,7 +81,6 @@ if (impure->irsb_flags & irsb_open) { impure->irsb_flags &= ~irsb_open; - impure->irsb_record_buffer = NULL; } } @@ -102,9 +98,7 @@ rpb->rpb_number.increment(); - fb_assert(impure->irsb_record_buffer); - - if (impure->irsb_record_buffer->fetch(rpb->rpb_number.getValue(), rpb->rpb_record)) + if (retrieveRecord(tdbb, rpb->rpb_relation, rpb->rpb_number.getValue(), rpb->rpb_record)) { rpb->rpb_number.setValid(true); return true; Modified: firebird/trunk/src/jrd/relations.h =================================================================== --- firebird/trunk/src/jrd/relations.h 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/src/jrd/relations.h 2010-07-13 12:31:35 UTC (rev 51337) @@ -606,7 +606,7 @@ END_RELATION // Relation 44 (SEC$USERS) -RELATION(nam_sec_users, rel_sec_users, ODS_12_0, rel_vrt_users) +RELATION(nam_sec_users, rel_sec_users, ODS_12_0, rel_virtual) FIELD(f_sec_user_name, nam_user_name, fld_user, 1, ODS_12_0) FIELD(f_sec_group_name, nam_group_name, fld_user, 1, ODS_12_0) FIELD(f_sec_uid, nam_uid, fld_uid, 1, ODS_12_0) Modified: firebird/trunk/src/jrd/types.h =================================================================== --- firebird/trunk/src/jrd/types.h 2010-07-13 11:03:55 UTC (rev 51336) +++ firebird/trunk/src/jrd/types.h 2010-07-13 12:31:35 UTC (rev 51337) @@ -112,7 +112,6 @@ TYPE ("VIRTUAL", rel_virtual, nam_r_type) TYPE ("GLOBAL_TEMPORARY_PRESERVE", rel_global_temp_preserve, nam_r_type) TYPE ("GLOBAL_TEMPORARY_DELETE", rel_global_temp_delete, nam_r_type) -TYPE ("USERS LIST", rel_vrt_users, nam_r_type) TYPE ("LEGACY", prc_legacy, nam_prc_type) TYPE ("SELECTABLE", prc_selectable, nam_prc_type) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-07-15 00:47:30
|
Revision: 51342 http://firebird.svn.sourceforge.net/firebird/?rev=51342&view=rev Author: asfernandes Date: 2010-07-15 00:47:24 +0000 (Thu, 15 Jul 2010) Log Message: ----------- Misc Modified Paths: -------------- firebird/trunk/builds/posix/Makefile.in.firebird firebird/trunk/src/jrd/UserManagement.cpp firebird/trunk/src/jrd/svc.cpp firebird/trunk/src/utilities/gsec/gsec.cpp firebird/trunk/src/utilities/gsec/secur_proto.h firebird/trunk/src/utilities/gsec/security.epp Modified: firebird/trunk/builds/posix/Makefile.in.firebird =================================================================== --- firebird/trunk/builds/posix/Makefile.in.firebird 2010-07-14 10:29:09 UTC (rev 51341) +++ firebird/trunk/builds/posix/Makefile.in.firebird 2010-07-15 00:47:24 UTC (rev 51342) @@ -76,7 +76,7 @@ # use the static files as a last resort. # # The bootstrap version of gpre (gpre_boot) is used to build all the -# engine file. +# engine file. # During this phase of the build process the limited version of alt.bin # is used. The full version of alt.bin is compiled later in the build # process after the security database is available. After the Modified: firebird/trunk/src/jrd/UserManagement.cpp =================================================================== --- firebird/trunk/src/jrd/UserManagement.cpp 2010-07-14 10:29:09 UTC (rev 51341) +++ firebird/trunk/src/jrd/UserManagement.cpp 2010-07-15 00:47:24 UTC (rev 51342) @@ -196,33 +196,53 @@ int attachment_charset = ttype_none; if (u->user_name_entered) + { putField(threadDbb, record, DumpField(f_sec_user_name, VALUE_STRING, strlen(u->user_name), u->user_name), attachment_charset); + } + if (u->group_name_entered) + { putField(threadDbb, record, DumpField(f_sec_group_name, VALUE_STRING, strlen(u->group_name), u->group_name), attachment_charset); + } + if (u->uid_entered) + { putField(threadDbb, record, DumpField(f_sec_uid, VALUE_INTEGER, sizeof(int), &u->uid), attachment_charset); + } + if (u->gid_entered) + { putField(threadDbb, record, DumpField(f_sec_gid, VALUE_INTEGER, sizeof(int), &u->gid), attachment_charset); + } + if (u->first_name_entered) + { putField(threadDbb, record, DumpField(f_sec_first_name, VALUE_STRING, strlen(u->first_name), u->first_name), attachment_charset); + } + if (u->middle_name_entered) + { putField(threadDbb, record, DumpField(f_sec_middle_name, VALUE_STRING, strlen(u->middle_name), u->middle_name), attachment_charset); + } + if (u->last_name_entered) + { putField(threadDbb, record, DumpField(f_sec_last_name, VALUE_STRING, strlen(u->last_name), u->last_name), attachment_charset); + } buffer->store(record); } Modified: firebird/trunk/src/jrd/svc.cpp =================================================================== --- firebird/trunk/src/jrd/svc.cpp 2010-07-14 10:29:09 UTC (rev 51341) +++ firebird/trunk/src/jrd/svc.cpp 2010-07-15 00:47:24 UTC (rev 51342) @@ -1925,7 +1925,8 @@ // Only need to add username and password information to those calls which need // to make a database connection - const bool flNeedUser = (svc_id == isc_action_svc_backup || + const bool flNeedUser = + svc_id == isc_action_svc_backup || svc_id == isc_action_svc_restore || svc_id == isc_action_svc_nbak || svc_id == isc_action_svc_nrest || @@ -1936,15 +1937,16 @@ svc_id == isc_action_svc_trace_stop || svc_id == isc_action_svc_trace_suspend || svc_id == isc_action_svc_trace_resume || - svc_id == isc_action_svc_trace_list); + svc_id == isc_action_svc_trace_list; - const bool flGsecUser = (svc_id == isc_action_svc_add_user || + const bool flGsecUser = + svc_id == isc_action_svc_add_user || svc_id == isc_action_svc_delete_user || svc_id == isc_action_svc_modify_user || svc_id == isc_action_svc_display_user || svc_id == isc_action_svc_display_user_adm || svc_id == isc_action_svc_set_mapping || - svc_id == isc_action_svc_drop_mapping); + svc_id == isc_action_svc_drop_mapping; if (flNeedUser || flGsecUser) { @@ -1975,7 +1977,6 @@ } } - // All services except for get_ib_log require switches spb.rewind(); if ((!svc_switches.hasData()) && svc_id != isc_action_svc_get_fb_log) Modified: firebird/trunk/src/utilities/gsec/gsec.cpp =================================================================== --- firebird/trunk/src/utilities/gsec/gsec.cpp 2010-07-14 10:29:09 UTC (rev 51341) +++ firebird/trunk/src/utilities/gsec/gsec.cpp 2010-07-15 00:47:24 UTC (rev 51342) @@ -278,7 +278,7 @@ uSvc->started(); if (! useServices) { - ret = SECURITY_exec_line(status, tdsec->tsec_real_user, + ret = SECURITY_exec_line(status, tdsec->tsec_real_user, db_handle, user_data, data_print, NULL); if (ret) { Modified: firebird/trunk/src/utilities/gsec/secur_proto.h =================================================================== --- firebird/trunk/src/utilities/gsec/secur_proto.h 2010-07-14 10:29:09 UTC (rev 51341) +++ firebird/trunk/src/utilities/gsec/secur_proto.h 2010-07-15 00:47:24 UTC (rev 51342) @@ -33,4 +33,3 @@ void* callback_arg); #endif // UTILITIES_SECUR_PROTO_H - Modified: firebird/trunk/src/utilities/gsec/security.epp =================================================================== --- firebird/trunk/src/utilities/gsec/security.epp 2010-07-14 10:29:09 UTC (rev 51341) +++ firebird/trunk/src/utilities/gsec/security.epp 2010-07-15 00:47:24 UTC (rev 51342) @@ -85,7 +85,7 @@ } -static bool storePasswd(ISC_STATUS* isc_status, FB_API_HANDLE DB, FB_API_HANDLE trans, +static bool storePasswd(ISC_STATUS* isc_status, FB_API_HANDLE DB, FB_API_HANDLE trans, ISC_QUAD& blobId, const Firebird::string& passwd) { UserBlob blob(isc_status); @@ -98,6 +98,7 @@ if (!blob.putData(passwd.length(), passwd.c_str())) { + blob.close(); return false; } @@ -105,7 +106,7 @@ } SSHORT SECURITY_exec_line(ISC_STATUS* isc_status, - const char *realUser, + const char* realUser, FB_API_HANDLE DB, FB_API_HANDLE trans, internal_user_data* io_user_data, @@ -544,7 +545,7 @@ } SSHORT SECURITY_exec_line(ISC_STATUS* isc_status, - const char *realUser, + const char* realUser, FB_API_HANDLE DB, internal_user_data* io_user_data, FPTR_SECURITY_CALLBACK display_func, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2010-07-23 12:04:26
|
Revision: 51355 http://firebird.svn.sourceforge.net/firebird/?rev=51355&view=rev Author: alexpeshkoff Date: 2010-07-23 12:04:18 +0000 (Fri, 23 Jul 2010) Log Message: ----------- Implemented self-registering plugins format (same plugin can be easily linked statically or as dynamic library, depending upon platform requirements). Self-registering plugins need not export any functions, instead they call fb_register_plugin() on startup. Reworked all user management to use self-registering plugins. Removed system table RDB$USERS. PLG$USERS is not created automatically by plugin, but will be later (work in progress). Modified Paths: -------------- firebird/trunk/builds/posix/Makefile.in.client.gsec firebird/trunk/builds/posix/Makefile.in.embed.util firebird/trunk/builds/posix/Makefile.in.fbserver firebird/trunk/builds/posix/Makefile.in.firebird firebird/trunk/builds/posix/Makefile.in.smp_server firebird/trunk/builds/posix/firebird.vers firebird/trunk/builds/posix/make.defaults firebird/trunk/builds/posix/make.rules firebird/trunk/builds/posix/make.shared.variables firebird/trunk/configure.in firebird/trunk/src/auth/Auth.cpp firebird/trunk/src/auth/Auth.h firebird/trunk/src/auth/AuthInterface.h firebird/trunk/src/auth/SecurityDatabase/LegacyClient.cpp firebird/trunk/src/auth/SecurityDatabase/LegacyClient.h firebird/trunk/src/common/classes/Interface.h firebird/trunk/src/dbs/security.sql firebird/trunk/src/include/FirebirdPluginApi.h firebird/trunk/src/include/gen/ids.h firebird/trunk/src/jrd/PluginManager.h firebird/trunk/src/jrd/fields.h firebird/trunk/src/jrd/gds.cpp firebird/trunk/src/jrd/idx.h firebird/trunk/src/jrd/ini.epp firebird/trunk/src/jrd/jrd_pwd.h firebird/trunk/src/jrd/names.h firebird/trunk/src/jrd/os/posix/mod_loader.cpp firebird/trunk/src/jrd/pwd.cpp firebird/trunk/src/jrd/relations.h firebird/trunk/src/plugins/udr_engine/UdrEngine.cpp firebird/trunk/src/remote/interface.cpp firebird/trunk/src/remote/server.cpp Added Paths: ----------- firebird/trunk/builds/posix/Makefile.in.user.management firebird/trunk/src/auth/AuthDbg.cpp firebird/trunk/src/auth/AuthDbg.h firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.h firebird/trunk/src/common/classes/ImplementHelper.h firebird/trunk/src/misc/smallog.cpp firebird/trunk/src/utilities/gsec/security.cpp Removed Paths: ------------- firebird/trunk/src/utilities/gsec/security.epp Property Changed: ---------------- firebird/trunk/builds/posix/Makefile.in.client.gsec firebird/trunk/builds/posix/Makefile.in.embed.util firebird/trunk/builds/posix/Makefile.in.fbserver firebird/trunk/builds/posix/Makefile.in.firebird firebird/trunk/builds/posix/Makefile.in.smp_server firebird/trunk/builds/posix/firebird.vers firebird/trunk/builds/posix/make.defaults firebird/trunk/builds/posix/make.rules firebird/trunk/builds/posix/make.shared.variables firebird/trunk/configure.in firebird/trunk/src/auth/Auth.cpp firebird/trunk/src/auth/Auth.h firebird/trunk/src/auth/AuthInterface.h firebird/trunk/src/auth/SecurityDatabase/LegacyClient.cpp firebird/trunk/src/auth/SecurityDatabase/LegacyClient.h firebird/trunk/src/common/classes/Interface.h firebird/trunk/src/dbs/security.sql firebird/trunk/src/include/FirebirdPluginApi.h firebird/trunk/src/include/gen/ids.h firebird/trunk/src/jrd/PluginManager.h firebird/trunk/src/jrd/fields.h firebird/trunk/src/jrd/gds.cpp firebird/trunk/src/jrd/idx.h firebird/trunk/src/jrd/ini.epp firebird/trunk/src/jrd/jrd_pwd.h firebird/trunk/src/jrd/names.h firebird/trunk/src/jrd/os/posix/mod_loader.cpp firebird/trunk/src/jrd/pwd.cpp firebird/trunk/src/jrd/relations.h firebird/trunk/src/plugins/udr_engine/UdrEngine.cpp firebird/trunk/src/remote/interface.cpp Modified: firebird/trunk/builds/posix/Makefile.in.client.gsec =================================================================== --- firebird/trunk/builds/posix/Makefile.in.client.gsec 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/builds/posix/Makefile.in.client.gsec 2010-07-23 12:04:18 UTC (rev 51355) @@ -29,8 +29,7 @@ @SET_MAKE@ -GSEC_Other_Sources = jrd/isc_file.cpp jrd/ThreadData.cpp jrd/enc.cpp \ - jrd/sha.cpp jrd/guid.cpp +GSEC_Other_Sources = jrd/isc_file.cpp jrd/ThreadData.cpp GSEC_Files = gsec.cpp call_service.cpp gsecMain.cpp security.cpp GSEC_Sources = $(addprefix utilities/gsec/, $(GSEC_Files)) $(GSEC_Other_Sources) GSEC_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(GSEC_Sources)))) Property changes on: firebird/trunk/builds/posix/Makefile.in.client.gsec ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: firebird/trunk/builds/posix/Makefile.in.embed.util =================================================================== --- firebird/trunk/builds/posix/Makefile.in.embed.util 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/builds/posix/Makefile.in.embed.util 2010-07-23 12:04:18 UTC (rev 51355) @@ -70,7 +70,7 @@ DROP_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(DROP_Sources)))) $(FBCOMMON_ClientObjects) -GSEC_Other_Sources = jrd/enc.cpp jrd/sha.cpp jrd/guid.cpp \ +GSEC_Other_Sources = \ jrd/isc_file.cpp common/config/config.cpp common/config/config_file.cpp \ common/config/ConfigCache.cpp common/config/dir_list.cpp \ jrd/ThreadData.cpp $(OS_SPECIFIC_Sources) Property changes on: firebird/trunk/builds/posix/Makefile.in.embed.util ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: firebird/trunk/builds/posix/Makefile.in.fbserver =================================================================== --- firebird/trunk/builds/posix/Makefile.in.fbserver 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/builds/posix/Makefile.in.fbserver 2010-07-23 12:04:18 UTC (rev 51355) @@ -39,10 +39,15 @@ @SET_MAKE@ +SERVER_Other_sources = jrd/pwd.cpp jrd/sha.cpp +SERVER_Other Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(SERVER_Other_sources)))) + SERVER_Files = $(OS_ServerFiles) server.cpp -SERVER_Sources = $(addprefix remote/, $(SERVER_Files)) jrd/pwd.cpp -SERVER_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(SERVER_Sources)))) $(LIBFBSERVER_Objects) $(COMMON_Objects) +SERVER_Sources = $(addprefix remote/, $(SERVER_Files)) +SERVER_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(SERVER_Sources)))) \ + $(LIBFBSERVER_Objects) $(COMMON_Objects) $(SERVER_Other Objects) + .PHONY: fbserver Property changes on: firebird/trunk/builds/posix/Makefile.in.fbserver ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: firebird/trunk/builds/posix/Makefile.in.firebird =================================================================== --- firebird/trunk/builds/posix/Makefile.in.firebird 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/builds/posix/Makefile.in.firebird 2010-07-23 12:04:18 UTC (rev 51355) @@ -134,7 +134,7 @@ .PHONY: all firebird firebird_boot firebird_basic .PHONY: firebird_embedded firebird_server classic_programs super_programs .PHONY: firebird_super firebird_classic btyacc_binary -.PHONY: fbtrace +.PHONY: plugins2 # The main targets are firebird_embedded or firebird_server @@ -145,8 +145,8 @@ firebird : firebird_@FIREBIRD_ARCH_TYPE@ $(PLATFORM_POSTBUILD_TARGET) -firebird_classic firebird_embedded: firebird_basic classic_targets fbtrace -firebird_super firebird_server: firebird_basic super_targets fbtrace +firebird_classic firebird_embedded: firebird_basic classic_targets plugins2 +firebird_super firebird_server: firebird_basic super_targets plugins2 @@ -414,8 +414,9 @@ #--------------------------------------------------------------------------- -fbtrace: +plugins2: $(MAKE) $(CPU_OPTION) -f $(GEN_ROOT)/Makefile.fbtrace + $(MAKE) $(CPU_OPTION) -f $(GEN_ROOT)/Makefile.user.management #--------------------------------------------------------------------------- Property changes on: firebird/trunk/builds/posix/Makefile.in.firebird ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: firebird/trunk/builds/posix/Makefile.in.smp_server =================================================================== --- firebird/trunk/builds/posix/Makefile.in.smp_server 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/builds/posix/Makefile.in.smp_server 2010-07-23 12:04:18 UTC (rev 51355) @@ -42,8 +42,8 @@ SERVER_JrdFiles = ThreadData.cpp divorce.cpp dsc.cpp enc.cpp isc_file.cpp isc.cpp \ sdl.cpp status.cpp SERVER_Files = $(OS_ServerFiles) server.cpp -SERVER_Other_sources = common/cvt.cpp common/classes/DbImplementation.cpp \ -jrd/pwd.cpp jrd/sha.cpp jrd/guid.cpp auth/Auth.cpp +SERVER_Other_sources = common/cvt.cpp common/classes/DbImplementation.cpp auth/Auth.cpp \ +jrd/pwd.cpp jrd/sha.cpp jrd/guid.cpp SERVER_Sources = $(addprefix remote/, $(SERVER_Files)) $(addprefix jrd/, $(SERVER_JrdFiles)) $(SERVER_Other_sources) REMOTE_CommonSources = $(addprefix remote/, $(REMOTE_CommonFiles)) Property changes on: firebird/trunk/builds/posix/Makefile.in.smp_server ___________________________________________________________________ Added: svn:mime-type + text/plain Added: firebird/trunk/builds/posix/Makefile.in.user.management =================================================================== --- firebird/trunk/builds/posix/Makefile.in.user.management (rev 0) +++ firebird/trunk/builds/posix/Makefile.in.user.management 2010-07-23 12:04:18 UTC (rev 51355) @@ -0,0 +1,81 @@ +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# You may obtain a copy of the Licence at +# http://www.gnu.org/licences/lgpl.html +# +# As a special exception this file can also be included in modules +# with other source code as long as that source code has been +# released under an Open Source Initiative certificed licence. +# More information about OSI certification can be found at: +# http://www.opensource.org +# +# This module is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public Licence for more details. +# +# This module was created by members of the firebird development +# team. All individual contributions remain the Copyright (C) of +# those individuals and all rights are reserved. Contributors to +# this file are either listed below or can be obtained from a CVS +# history command. +# +# Created by: Mark O'Donohue <mar...@lu...> +# +# Contributor(s): +# +# +# +ROOT=.. +ObjModuleType=std + +include $(ROOT)/gen/make.defaults +include $(ROOT)/gen/make.platform +include $(ROOT)/gen/make.rules +include $(ROOT)/gen/make.shared.variables + +@SET_MAKE@ + + +USER_MANAGEMENT_Files = LegacyManagement.epp + +USER_MANAGEMENT_Sources = $(addprefix auth/SecurityDatabase/, $(USER_MANAGEMENT_Files)) + +USER_MANAGEMENT_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(USER_MANAGEMENT_Sources)))) + + +MANAGEMENT_OTHER_Sources = jrd/enc.cpp jrd/sha.cpp jrd/guid.cpp common/classes/alloc.cpp \ +common/classes/locks.cpp common/classes/UserBlob.cpp common/classes/init.cpp common/classes/fb_string.cpp \ +common/fb_exception.cpp common/thd.cpp common/StatusArg.cpp + + +MANAGEMENT_OTHER_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(MANAGEMENT_OTHER_Sources)))) + + +MANAGEMENT_Objects = $(USER_MANAGEMENT_Objects) $(MANAGEMENT_OTHER_Objects) +#$(FBCLASSES_ClientObjects) $(FBCOMMON_ClientObjects) +# $(CONFIG_Objects) \ +# $(FBCLASSES_MsgObjects) \ +# $(FBCONFIG_Objects) + + +AllObjects = $(MANAGEMENT_Objects) +Dependencies = $(AllObjects:.o=.d) + + +.PHONY: all user_management + + +all : user_management + +user_management: $(MANAGEMENT) + +$(MANAGEMENT): $(MANAGEMENT_Objects) + $(LINK_PLUGIN) $(call LIB_LINK_SONAME,$(MANAGEMENT).0) -o $@ $^ $(LINK_PLUG_LIBS) + + +include $(ROOT)/gen/make.shared.targets + +-include $(Dependencies) Property changes on: firebird/trunk/builds/posix/Makefile.in.user.management ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: firebird/trunk/builds/posix/firebird.vers =================================================================== --- firebird/trunk/builds/posix/firebird.vers 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/builds/posix/firebird.vers 2010-07-23 12:04:18 UTC (rev 51355) @@ -333,6 +333,11 @@ fb_shutdown fb_shutdown_callback +# Plugins support + +fb_register_plugin +fb_query_plugin + # Other misc functions isc_ftof Property changes on: firebird/trunk/builds/posix/firebird.vers ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: firebird/trunk/builds/posix/make.defaults =================================================================== --- firebird/trunk/builds/posix/make.defaults 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/builds/posix/make.defaults 2010-07-23 12:04:18 UTC (rev 51355) @@ -317,6 +317,9 @@ $(call LIB_LINK_SONAME,$(SharedLibrarySoName)) $(call LIB_LINK_RPATH,lib) LINK_EMBED_LIBS = -L$(LIB) $(LIB_GUI) $(SO_LINK_LIBS) $(ICU_LIBS) +LINK_PLUGIN = $(LIB_LINK) $(LINK_EMPTY_SYMBOLS) $(LIB_LINK_OPTIONS) $(call LIB_LINK_RPATH,lib) +LINK_PLUG_LIBS = -L$(LIB) $(SO_LINK_LIBS) + # From utilities CREATE_DB = $(BIN)/create_db$(EXEC_EXT) GDS_DROP = $(BIN)/gds_drop$(EXEC_EXT) @@ -339,6 +342,7 @@ INSTSVC = $(BIN)/instsvc$(EXEC_EXT) ISC_GDB = $(FIREBIRD)/security2.fdb ISC_GBAK = $(BIN)/security.gbak +MANAGEMENT = $(PLUGINS)/$(LIB_PREFIX)user_management.$(SHRLIB_EXT) # From qli QLI = $(BIN)/qli$(EXEC_EXT) Property changes on: firebird/trunk/builds/posix/make.defaults ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: firebird/trunk/builds/posix/make.rules =================================================================== --- firebird/trunk/builds/posix/make.rules 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/builds/posix/make.rules 2010-07-23 12:04:18 UTC (rev 51355) @@ -127,7 +127,7 @@ $(OBJ)/jrd/fun.epp $(OBJ)/jrd/dyn.epp $(OBJ)/jrd/dfw.epp $(OBJ)/jrd/dyn_util.epp \ $(OBJ)/jrd/pcmet.epp $(OBJ)/jrd/met.epp $(OBJ)/jrd/dpm.epp $(OBJ)/utilities/rebuild/rstore.epp \ $(OBJ)/utilities/rebuild/rmet.epp $(OBJ)/utilities/gstat/dba.epp $(OBJ)/utilities/stats.epp \ - $(OBJ)/utilities/gsec/security.epp $(OBJ)/alice/alice_meta.epp $(OBJ)/qli/meta.epp \ + $(OBJ)/auth/SecurityDatabase/LegacyManagement.epp $(OBJ)/alice/alice_meta.epp $(OBJ)/qli/meta.epp \ $(OBJ)/qli/proc.epp $(OBJ)/qli/show.epp $(OBJ)/qli/help.epp $(OBJ)/misc/codes.epp \ $(OBJ)/gpre/gpre_meta.epp $(OBJ)/dsql/blob.epp $(OBJ)/dsql/array.epp \ $(OBJ)/dsql/PackageNodes.epp $(OBJ)/dsql/metd.epp $(OBJ)/dsql/DdlNodes.epp $(OBJ)/isql/show.epp \ Property changes on: firebird/trunk/builds/posix/make.rules ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: firebird/trunk/builds/posix/make.shared.variables =================================================================== --- firebird/trunk/builds/posix/make.shared.variables 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/builds/posix/make.shared.variables 2010-07-23 12:04:18 UTC (rev 51355) @@ -14,7 +14,7 @@ JRD_ClientFiles = alt.cpp db_alias.cpp dsc.cpp \ - enc.cpp gds.cpp isc.cpp isc_file.cpp isc_ipc.cpp \ + gds.cpp isc.cpp isc_file.cpp isc_ipc.cpp \ perf.cpp sdl.cpp status.cpp \ ThreadData.cpp ThreadStart.cpp utl.cpp \ $(WHY_Sources) @@ -41,7 +41,7 @@ sdw.cpp shut.cpp sort.cpp sqz.cpp \ svc.cpp SysFunction.cpp TempSpace.cpp tpc.cpp tra.cpp validation.cpp \ ValueImpl.cpp ValuesImpl.cpp vio.cpp \ - nodebug.cpp nbak.cpp sha.cpp $(Physical_IO_Module) TextType.cpp \ + nodebug.cpp nbak.cpp $(Physical_IO_Module) TextType.cpp \ unicode_util.cpp RuntimeStatistics.cpp DebugInterface.cpp \ extds/ExtDS.cpp extds/InternalDS.cpp extds/IscDS.cpp \ trace/TraceConfigStorage.cpp trace/TraceLog.cpp \ @@ -114,7 +114,7 @@ INTERFACE_Sources = $(addprefix remote/, $(INTERFACE_Files)) \ - auth/Auth.cpp auth/SecurityDatabase/LegacyClient.cpp + auth/Auth.cpp auth/AuthDbg.cpp auth/SecurityDatabase/LegacyClient.cpp jrd/enc.cpp INTERFACE_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(INTERFACE_Sources)))) ifeq ($(PLATFORM),win32) @@ -357,7 +357,7 @@ # MOD 29-July-2002 # Stub for services entrypoints missing in static library -STUB_Sources = jrd/svc_stub.cpp utilities/gsec/security.epp +STUB_Sources = jrd/svc_stub.cpp utilities/gsec/security.cpp STUB_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(STUB_Sources)))) Property changes on: firebird/trunk/builds/posix/make.shared.variables ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: firebird/trunk/configure.in =================================================================== --- firebird/trunk/configure.in 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/configure.in 2010-07-23 12:04:18 UTC (rev 51355) @@ -1371,6 +1371,7 @@ gen/Makefile.embed.qli:${MAKE_SRC_DIR}/Makefile.in.embed.qli gen/Makefile.embed.gpre:${MAKE_SRC_DIR}/Makefile.in.embed.gpre gen/Makefile.fbtrace:${MAKE_SRC_DIR}/Makefile.in.fbtrace +gen/Makefile.user.management:${MAKE_SRC_DIR}/Makefile.in.user.management gen/Makefile.install:builds/install/arch-specific/${INSTALL_PREFIX}/Makefile.in Makefile:Makefile.in ) Property changes on: firebird/trunk/configure.in ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: firebird/trunk/src/auth/Auth.cpp =================================================================== --- firebird/trunk/src/auth/Auth.cpp 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/src/auth/Auth.cpp 2010-07-23 12:04:18 UTC (rev 51355) @@ -28,137 +28,10 @@ #include "firebird.h" #include "../auth/Auth.h" #include "../jrd/ibase.h" +#include "../common/classes/ImplementHelper.h" -#ifdef AUTH_DEBUG - -namespace -{ - void debugName(const char** data, unsigned short* dataSize) - { - // Construct a copy of the literal so we don't violate the constness. - // The caller can do anything with the pointer unless we change getName() signature. - static char name[] = "DEBUG_AUTH"; - *data = name; - *dataSize = strlen(name); - } -} - namespace Auth { -ServerInstance* DebugServer::instance() -{ - return interfaceAlloc<DebugServerInstance>(); -} - -ClientInstance* DebugClient::instance() -{ - return interfaceAlloc<DebugClientInstance>(); -} - -void DebugServer::getName(const char** data, unsigned short* dataSize) -{ - debugName(data, dataSize); -} - -void DebugClient::getName(const char** data, unsigned short* dataSize) -{ - debugName(data, dataSize); -} - -void DebugServer::release() -{ - interfaceFree(this); -} - -void DebugClient::release() -{ - interfaceFree(this); -} - -DebugServerInstance::DebugServerInstance() - : str(*getDefaultMemoryPool()) -{ } - -Result DebugServerInstance::startAuthentication(bool isService, const char* dbName, - const unsigned char* dpb, unsigned int dpbSize, - WriterInterface* writerInterface) -{ - str.erase(); - Firebird::ClumpletReader rdr(isService ? - Firebird::ClumpletReader::spbList : - Firebird::ClumpletReader::dpbList, dpb, dpbSize); - - if (rdr.find(isService ? isc_spb_trusted_auth : isc_dpb_trusted_auth)) - { - str.assign(rdr.getBytes(), rdr.getClumpLength()); - } - - str += '_'; - return AUTH_MORE_DATA; -} - -Result DebugServerInstance::contAuthentication(WriterInterface* writerInterface, - const unsigned char* data, unsigned int size) -{ - //fprintf(stderr, "DebugServerInstance::contAuthentication: %.*s\n", size, data); - writerInterface->add(Firebird::string((const char*) data, size).c_str(), "DEBUG", ""); - return AUTH_SUCCESS; -} - -void DebugServerInstance::getData(const unsigned char** data, unsigned short* dataSize) -{ - *data = reinterpret_cast<const unsigned char*>(str.c_str()); - *dataSize = str.length(); - //fprintf(stderr, "DebugServerInstance::getData: %.*s\n", *dataSize, *data); -} - -void DebugServerInstance::release() -{ - interfaceFree(this); -} - -DebugClientInstance::DebugClientInstance() - : str(*getDefaultMemoryPool()) -{ } - -Result DebugClientInstance::startAuthentication(bool isService, const char*, DpbInterface* dpb) -{ - str = "HAND"; - if (dpb) - { - dpb->add(isService ? isc_spb_trusted_auth : isc_dpb_trusted_auth, - str.c_str(), str.length()); - return AUTH_SUCCESS; - } - return AUTH_MORE_DATA; -} - -Result DebugClientInstance::contAuthentication(const unsigned char* data, unsigned int size) -{ - //fprintf(stderr, "DebugClientInstance::contAuthentication: %.*s\n", size, data); - str.assign(data, size); - str += "SHAKE"; - return AUTH_CONTINUE; -} - -void DebugClientInstance::getData(const unsigned char** data, unsigned short* dataSize) -{ - *data = reinterpret_cast<const unsigned char*>(str.c_str()); - *dataSize = str.length(); - //fprintf(stderr, "DebugClientInstance::getData: %.*s\n", *dataSize, *data); -} - -void DebugClientInstance::release() -{ - interfaceFree(this); -} - -} // namespace Auth - -#endif // AUTH_DEBUG - -namespace Auth { - WriterImplementation::WriterImplementation(Firebird::MemoryPool& pool, bool svcFlag) : Firebird::PermanentStorage(pool), body(getPool()), sequence(0), tag(svcFlag ? isc_spb_auth_block : isc_dpb_auth_block) @@ -202,16 +75,13 @@ } -bool legacy(Plugin* plugin) +bool legacy(Firebird::Plugin* plugin) { const char* legacyTrusted = "WIN_SSPI"; - const short legLength = strlen(legacyTrusted); - const char* nm; - USHORT len; + const unsigned short legLength = strlen(legacyTrusted); + const char* nm = plugin->name(); - plugin->getName(&nm, &len); - - return len == legLength && memcmp(legacyTrusted, nm, legLength) == 0; + return strlen(nm) == legLength && memcmp(legacyTrusted, nm, legLength) == 0; } } // namespace Auth Property changes on: firebird/trunk/src/auth/Auth.cpp ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: firebird/trunk/src/auth/Auth.h =================================================================== --- firebird/trunk/src/auth/Auth.h 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/src/auth/Auth.h 2010-07-23 12:04:18 UTC (rev 51355) @@ -38,7 +38,7 @@ namespace Auth { -bool legacy(Plugin* plugin); +bool legacy(Firebird::Plugin* plugin); class WriterImplementation : public WriterInterface, public Firebird::PermanentStorage { @@ -69,7 +69,7 @@ Firebird::ClumpletWriter* body; }; -//#define AUTH_DEBUG +#define AUTH_DEBUG #ifdef AUTH_DEBUG @@ -80,7 +80,6 @@ { public: ServerInstance* instance(); - void getName(const char** data, unsigned short* dataSize); void release(); }; @@ -88,7 +87,6 @@ { public: ClientInstance* instance(); - void getName(const char** data, unsigned short* dataSize); void release(); }; Property changes on: firebird/trunk/src/auth/Auth.h ___________________________________________________________________ Added: svn:mime-type + text/plain Added: firebird/trunk/src/auth/AuthDbg.cpp =================================================================== --- firebird/trunk/src/auth/AuthDbg.cpp (rev 0) +++ firebird/trunk/src/auth/AuthDbg.cpp 2010-07-23 12:04:18 UTC (rev 51355) @@ -0,0 +1,133 @@ +/* + * PROGRAM: Firebird authentication + * MODULE: Auth.cpp + * DESCRIPTION: Implementation of interfaces, passed to plugins + * Plugins loader + * + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl. + * + * Software distributed under the License is distributed AS IS, + * 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 was created by Alex Peshkov + * for the Firebird Open Source RDBMS project. + * + * Copyright (c) 2010 Alex Peshkov <peshkoff at mail.ru> + * and all contributors signed below. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + */ + +#include "firebird.h" +#include "../auth/AuthDbg.h" +#include "../jrd/ibase.h" +#include "../common/classes/ImplementHelper.h" + +#ifdef AUTH_DEBUG + +namespace { + char name[] = "DEBUG_AUTH"; + Firebird::PluginHelper<Auth::DebugServer, Firebird::Plugin::AuthServer, name> debugServer; + Firebird::PluginHelper<Auth::DebugClient, Firebird::Plugin::AuthClient, name> debugClient; +} + +namespace Auth { + +ServerInstance* DebugServer::instance() +{ + return Firebird::interfaceAlloc<DebugServerInstance>(); +} + +ClientInstance* DebugClient::instance() +{ + return Firebird::interfaceAlloc<DebugClientInstance>(); +} + +DebugServerInstance::DebugServerInstance() + : str(*getDefaultMemoryPool()) +{ } + +Result DebugServerInstance::startAuthentication(bool isService, const char* dbName, + const unsigned char* dpb, unsigned int dpbSize, + WriterInterface* writerInterface) +{ + str.erase(); + Firebird::ClumpletReader rdr(isService ? + Firebird::ClumpletReader::spbList : + Firebird::ClumpletReader::dpbList, dpb, dpbSize); + + if (rdr.find(isService ? isc_spb_trusted_auth : isc_dpb_trusted_auth)) + { + str.assign(rdr.getBytes(), rdr.getClumpLength()); + } + + str += '_'; + return AUTH_MORE_DATA; +} + +Result DebugServerInstance::contAuthentication(WriterInterface* writerInterface, + const unsigned char* data, unsigned int size) +{ + //fprintf(stderr, "DebugServerInstance::contAuthentication: %.*s\n", size, data); + writerInterface->add(Firebird::string((const char*) data, size).c_str(), "DEBUG", ""); + return AUTH_SUCCESS; +} + +void DebugServerInstance::getData(const unsigned char** data, unsigned short* dataSize) +{ + *data = reinterpret_cast<const unsigned char*>(str.c_str()); + *dataSize = str.length(); + //fprintf(stderr, "DebugServerInstance::getData: %.*s\n", *dataSize, *data); +} + +void DebugServerInstance::release() +{ + Firebird::interfaceFree(this); +} + +DebugClientInstance::DebugClientInstance() + : str(*getDefaultMemoryPool()) +{ } + +Result DebugClientInstance::startAuthentication(bool isService, const char*, DpbInterface* dpb) +{ + str = "HAND"; + if (dpb) + { + dpb->add(isService ? isc_spb_trusted_auth : isc_dpb_trusted_auth, + str.c_str(), str.length()); + return AUTH_SUCCESS; + } + return AUTH_MORE_DATA; +} + +Result DebugClientInstance::contAuthentication(const unsigned char* data, unsigned int size) +{ + //fprintf(stderr, "DebugClientInstance::contAuthentication: %.*s\n", size, data); + str.assign(data, size); + str += "SHAKE"; + return AUTH_CONTINUE; +} + +void DebugClientInstance::getData(const unsigned char** data, unsigned short* dataSize) +{ + *data = reinterpret_cast<const unsigned char*>(str.c_str()); + *dataSize = str.length(); + //fprintf(stderr, "DebugClientInstance::getData: %.*s\n", *dataSize, *data); +} + +void DebugClientInstance::release() +{ + Firebird::interfaceFree(this); +} + +} // namespace Auth + +#endif // AUTH_DEBUG Property changes on: firebird/trunk/src/auth/AuthDbg.cpp ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: firebird/trunk/src/auth/AuthDbg.h =================================================================== --- firebird/trunk/src/auth/AuthDbg.h (rev 0) +++ firebird/trunk/src/auth/AuthDbg.h 2010-07-23 12:04:18 UTC (rev 51355) @@ -0,0 +1,95 @@ +/* + * PROGRAM: Firebird authentication + * MODULE: Auth.h + * DESCRIPTION: Implementation of interfaces, passed to plugins + * Plugins loader + * + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl. + * + * Software distributed under the License is distributed AS IS, + * 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 was created by Alex Peshkov + * for the Firebird Open Source RDBMS project. + * + * Copyright (c) 2010 Alex Peshkov <peshkoff at mail.ru> + * and all contributors signed below. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + * + * + */ + +#ifndef FB_AUTHDBG_H +#define FB_AUTHDBG_H + +//#define AUTH_DEBUG + +#ifdef AUTH_DEBUG + +#include "../auth/AuthInterface.h" +#include "../common/classes/ClumpletWriter.h" +#include "../common/classes/init.h" +#include "../common/classes/array.h" +#include "../common/classes/fb_string.h" + +namespace Auth { + +// The idea of debug plugin is to send some data from server to client, +// modify them on client and return result (which becomes login name) to the server + +class DebugServer : public ServerPlugin +{ +public: + ServerInstance* instance(); +}; + +class DebugClient : public ClientPlugin +{ +public: + ClientInstance* instance(); +}; + +class DebugServerInstance : public ServerInstance +{ +public: + DebugServerInstance(); + + Result startAuthentication(bool isService, const char* dbName, + const unsigned char* dpb, unsigned int dpbSize, + WriterInterface* writerInterface); + Result contAuthentication(WriterInterface* writerInterface, + const unsigned char* data, unsigned int size); + void getData(const unsigned char** data, unsigned short* dataSize); + void release(); + +private: + Firebird::string str; +}; + +class DebugClientInstance : public ClientInstance +{ +public: + DebugClientInstance(); + + Result startAuthentication(bool isService, const char* dbName, DpbInterface* dpb); + Result contAuthentication(const unsigned char* data, unsigned int size); + void getData(const unsigned char** data, unsigned short* dataSize); + void release(); + +private: + Firebird::string str; +}; + +} // namespace Auth + +#endif // AUTH_DEBUG + +#endif // FB_AUTHDBG_H Property changes on: firebird/trunk/src/auth/AuthDbg.h ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: firebird/trunk/src/auth/AuthInterface.h =================================================================== --- firebird/trunk/src/auth/AuthInterface.h 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/src/auth/AuthInterface.h 2010-07-23 12:04:18 UTC (rev 51355) @@ -31,14 +31,14 @@ #include "../common/classes/Interface.h" +// This is temporal measure - see later +struct internal_user_data; +#include "../utilities/gsec/secur_proto.h" + namespace Auth { enum Result {AUTH_SUCCESS, AUTH_CONTINUE, AUTH_FAILED, AUTH_MORE_DATA}; -class InterfaceBase : public Firebird::Interface -{ -}; - class WriterInterface { public: @@ -54,15 +54,9 @@ virtual void drop() = 0; }; -class Plugin : public InterfaceBase +class ServerInstance : public Firebird::Interface { public: - virtual void getName(const char** data, unsigned short* dataSize) = 0; -}; - -class ServerInstance : public InterfaceBase -{ -public: virtual Result startAuthentication(bool isService, const char* dbName, const unsigned char* dpb, unsigned int dpbSize, WriterInterface* writerInterface) = 0; @@ -71,13 +65,13 @@ virtual void getData(const unsigned char** data, unsigned short* dataSize) = 0; }; -class ServerPlugin : public Plugin +class ServerPlugin : public Firebird::Plugin { public: virtual ServerInstance* instance() = 0; }; -class ClientInstance : public InterfaceBase +class ClientInstance : public Firebird::Interface { public: virtual Result startAuthentication(bool isService, const char* dbName, DpbInterface* dpb) = 0; @@ -85,12 +79,22 @@ virtual void getData(const unsigned char** data, unsigned short* dataSize) = 0; }; -class ClientPlugin : public Plugin +class ClientPlugin : public Firebird::Plugin { public: virtual ClientInstance* instance() = 0; }; +class ManagementPlugin : public Firebird::Plugin +{ +public: + // work in progress - we must avoid both internal_user_data and callback function + virtual int execLine(ISC_STATUS* isc_status, const char *realUser, + FB_API_HANDLE db, FB_API_HANDLE trans, + internal_user_data* io_user_data, + FPTR_SECURITY_CALLBACK display_func, void* callback_arg) = 0; +}; + } // namespace Auth Property changes on: firebird/trunk/src/auth/AuthInterface.h ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyClient.cpp =================================================================== --- firebird/trunk/src/auth/SecurityDatabase/LegacyClient.cpp 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/src/auth/SecurityDatabase/LegacyClient.cpp 2010-07-23 12:04:18 UTC (rev 51355) @@ -28,7 +28,13 @@ #include "firebird.h" #include "../jrd/ibase.h" #include "../auth/SecurityDatabase/LegacyClient.h" +#include "../common/classes/ImplementHelper.h" +namespace { + char name[] = "LEGACY_AUTH"; + Firebird::PluginHelper<Auth::SecurityDatabaseClient, Firebird::Plugin::AuthClient, name> client; +} + namespace Auth { ClientInstance* SecurityDatabaseClient::instance() @@ -36,19 +42,6 @@ return Firebird::interfaceAlloc<SecurityDatabaseClientInstance>(); } -void SecurityDatabaseClient::getName(const char** data, unsigned short* dataSize) -{ - // Do not violate the constness. - static char name[] = "LEGACY_AUTH"; - *data = name; - *dataSize = strlen(name); -} - -void SecurityDatabaseClient::release() -{ - interfaceFree(this); -} - Result SecurityDatabaseClientInstance::startAuthentication(bool, const char*, DpbInterface* dpb) { return dpb->find(isc_dpb_user_name) && Property changes on: firebird/trunk/src/auth/SecurityDatabase/LegacyClient.cpp ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyClient.h =================================================================== --- firebird/trunk/src/auth/SecurityDatabase/LegacyClient.h 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/src/auth/SecurityDatabase/LegacyClient.h 2010-07-23 12:04:18 UTC (rev 51355) @@ -38,8 +38,6 @@ { public: ClientInstance* instance(); - void getName(const char** data, unsigned short* dataSize); - void release(); }; class SecurityDatabaseClientInstance : public ClientInstance Property changes on: firebird/trunk/src/auth/SecurityDatabase/LegacyClient.h ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp (from rev 51339, firebird/trunk/src/utilities/gsec/security.epp) =================================================================== --- firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp (rev 0) +++ firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp 2010-07-23 12:04:18 UTC (rev 51355) @@ -0,0 +1,553 @@ +/* + * + * PROGRAM: Security data base manager + * MODULE: security.epp + * DESCRIPTION: Security routines + * + * The contents of this file are subject to the Interbase Public + * License Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy + * of the License at http://www.Inprise.com/IPL.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 was created by Inprise Corporation + * and its predecessors. Portions created by Inprise Corporation are + * Copyright (C) Inprise Corporation. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + */ + +#include "firebird.h" +#include "../common/classes/alloc.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include "../jrd/common.h" +#include "../jrd/ibase.h" +#include "../jrd/jrd_pwd.h" +#include "../jrd/enc_proto.h" +#include "../jrd/gds_proto.h" +#include "../jrd/isc_proto.h" +#include "../utilities/gsec/gsec.h" +#include "../common/utils_proto.h" +#include "../common/classes/init.h" +#include "../common/classes/UserBlob.h" +#include "../auth/SecurityDatabase/LegacyManagement.h" +#include "../common/classes/ImplementHelper.h" + +DATABASE DB = STATIC FILENAME "security2.fdb"; + +namespace { + +Firebird::GlobalPtr<Firebird::Mutex> execLineMutex; // protects various gpre generated structures + +// register plugin +char name[] = "LEGACY_AUTH"; +Firebird::PluginHelper<Auth::SecurityDatabaseManagement, Firebird::Plugin::UserManagement, name> manage; + +bool grantRevokeAdmin(ISC_STATUS* isc_status, FB_API_HANDLE DB, FB_API_HANDLE trans, + const internal_user_data* io_user_data) +{ + if (!io_user_data->admin_entered) + { + return true; + } + + Firebird::string sql; + + sql.printf((io_user_data->admin ? "GRANT %s TO \"%s\"" : "REVOKE %s FROM \"%s\""), + "RDB$ADMIN", io_user_data->user_name); + isc_dsql_execute_immediate(isc_status, &DB, &trans, sql.length(), sql.c_str(), SQL_DIALECT_V6, NULL); + + if (isc_status[1] && io_user_data->admin == 0) + { + isc_req_handle request = 0; + + FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) R IN RDB$USER_PRIVILEGES + WITH R.RDB$USER EQ io_user_data->user_name + AND R.RDB$RELATION_NAME EQ 'RDB$ADMIN' + AND R.RDB$PRIVILEGE EQ 'M' + sql.printf("REVOKE RDB$ADMIN FROM \"%s\" GRANTED BY \"%s\"", + io_user_data->user_name, R.RDB$GRANTOR); + END_FOR + + if (request) + { + ISC_STATUS_ARRAY s; + if (isc_release_request(s, &request) != FB_SUCCESS) + { + return false; + } + } + + isc_dsql_execute_immediate(isc_status, &DB, &trans, sql.length(), sql.c_str(), SQL_DIALECT_V6, NULL); + } + + return isc_status[1] == 0; +} + +/* +bool storePasswd(ISC_STATUS* isc_status, FB_API_HANDLE DB, FB_API_HANDLE trans, + ISC_QUAD& blobId, const Firebird::string& passwd) +{ + UserBlob blob(isc_status); + const UCHAR blob_desc[] = {isc_bpb_version1, isc_bpb_type, 1, isc_blob_untyped}; + + if (!blob.create(DB, trans, blobId, sizeof(blob_desc), blob_desc)) + { + return false; + } + + if (!blob.putData(passwd.length(), passwd.c_str())) + { + return false; + } + + return blob.close(); +} + */ + +} // anonymous namespace + +namespace Auth { + +// work in progress - we must avoid both internal_user_data and callback function + +int SecurityDatabaseManagement::execLine(ISC_STATUS* isc_status, + const char *realUser, + FB_API_HANDLE DB, + FB_API_HANDLE trans, + internal_user_data* io_user_data, + FPTR_SECURITY_CALLBACK display_func, + void* callback_arg) +{ +/************************************* + * + * S E C U R I T Y _ e x e c _ l i n e + * + ************************************** + * + * Functional description + * Process a command line for the security data base manager. + * This is used to add and delete users from the user information + * database (security2.fdb). It also displays information + * about current users and allows modification of current + * users' parameters. + * Returns 0 on success, otherwise returns a Gsec message number + * and the status vector containing the error info. + * The syntax is: + * + * Adding a new user: + * + * gsec -add <name> [ <parameter> ... ] -- command line + * add <name> [ <parameter> ... ] -- interactive + * + * Deleting a current user: + * + * gsec -delete <name> -- command line + * delete <name> -- interactive + * + * Displaying all current users: + * + * gsec -display -- command line + * display -- interactive + * + * Displaying one user: + * + * gsec -display <name> -- command line + * display <name> -- interactive + * + * Modifying a user's parameters: + * + * gsec -modify <name> <parameter> [ <parameter> ... ] -- command line + * modify <name> <parameter> [ <parameter> ... ] -- interactive + * + * Get help: + * + * gsec -help -- command line + * ? -- interactive + * help -- interactive + * + * Quit interactive session: + * + * quit -- interactive + * + * where <parameter> can be one of: + * + * -uid <uid> + * -gid <gid> + * -fname <firstname> + * -mname <middlename> + * -lname <lastname> + * + **************************************/ + Firebird::MutexLockGuard guard(execLineMutex); + + SCHAR encrypted1[Auth::MAX_PASSWORD_LENGTH + 2]; + Firebird::string encrypted2; + bool found; + int ret = 0; + + // check for non-printable characters in user name + for (const TEXT* p = io_user_data->user_name; *p; p++) + { + if (! isprint(*p)) { + return GsecMsg75; // Add special error message for this case ? + } + } + + isc_req_handle request = 0; + isc_req_handle request2 = 0; + + switch (io_user_data->operation) + { + case MAP_DROP_OPER: + case MAP_SET_OPER: + if (realUser) + { + ret = GsecMsg104; + break; + } + { + Firebird::string sql; + sql.printf("ALTER ROLE RDB$ADMIN %s AUTO ADMIN MAPPING", + io_user_data->operation == MAP_SET_OPER ? "SET" : "DROP"); + isc_dsql_execute_immediate(isc_status, &DB, &trans, sql.length(), sql.c_str(), 1, NULL); + if (isc_status[1] != 0) + { + ret = GsecMsg97; + } + } + break; + case ADD_OPER: + if (realUser) + { + ret = GsecMsg104; + break; + } + // this checks the "entered" flags for each parameter (except the name) + // and makes all non-entered parameters null valued + + STORE (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN PLG$USERS USING + strcpy(U.PLG$USER_NAME, io_user_data->user_name); + if (io_user_data->uid_entered) + { + U.PLG$UID = io_user_data->uid; + U.PLG$UID.NULL = ISC_FALSE; + } + else + U.PLG$UID.NULL = ISC_TRUE; + if (io_user_data->gid_entered) + { + U.PLG$GID = io_user_data->gid; + U.PLG$GID.NULL = ISC_FALSE; + } + else + U.PLG$GID.NULL = ISC_TRUE; + if (io_user_data->group_name_entered) + { + strcpy(U.PLG$GROUP_NAME, io_user_data->group_name); + U.PLG$GROUP_NAME.NULL = ISC_FALSE; + } + else + U.PLG$GROUP_NAME.NULL = ISC_TRUE; + if (io_user_data->password_entered) + { + ENC_crypt(encrypted1, sizeof encrypted1, io_user_data->password, Auth::PASSWORD_SALT); + Auth::SecurityDatabase::hash(encrypted2, io_user_data->user_name, &encrypted1[2]); + strcpy(U.PLG$PASSWD, encrypted2.c_str()); + U.PLG$PASSWD.NULL = ISC_FALSE; + } + else + U.PLG$PASSWD.NULL = ISC_TRUE; + if (io_user_data->first_name_entered) + { + strcpy(U.PLG$FIRST_NAME, io_user_data->first_name); + U.PLG$FIRST_NAME.NULL = ISC_FALSE; + } + else + U.PLG$FIRST_NAME.NULL = ISC_TRUE; + if (io_user_data->middle_name_entered) + { + strcpy(U.PLG$MIDDLE_NAME, io_user_data->middle_name); + U.PLG$MIDDLE_NAME.NULL = ISC_FALSE; + } + else + U.PLG$MIDDLE_NAME.NULL = ISC_TRUE; + if (io_user_data->last_name_entered) + { + strcpy(U.PLG$LAST_NAME, io_user_data->last_name); + U.PLG$LAST_NAME.NULL = ISC_FALSE; + } + else + U.PLG$LAST_NAME.NULL = ISC_TRUE; + END_STORE + ON_ERROR + ret = GsecMsg19; // gsec - add record error + END_ERROR; + if (ret == 0 && !grantRevokeAdmin(isc_status, DB, trans, io_user_data)) + { + ret = GsecMsg19; // gsec - add record error + } + break; + + case MOD_OPER: + if (realUser && strcmp(realUser, io_user_data->user_name)) + { + ret = GsecMsg104; + break; + } + + // this updates an existing record, replacing all fields that are + // entered, and for those that were specified but not entered, it + // changes the current value to the null value + + found = false; + FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN PLG$USERS + WITH U.PLG$USER_NAME EQ io_user_data->user_name + found = true; + MODIFY U USING + if (io_user_data->uid_entered) + { + U.PLG$UID = io_user_data->uid; + U.PLG$UID.NULL = ISC_FALSE; + } + else if (io_user_data->uid_specified) + U.PLG$UID.NULL = ISC_TRUE; + if (io_user_data->gid_entered) + { + U.PLG$GID = io_user_data->gid; + U.PLG$GID.NULL = ISC_FALSE; + } + else if (io_user_data->gid_specified) + U.PLG$GID.NULL = ISC_TRUE; + if (io_user_data->group_name_entered) + { + strcpy(U.PLG$GROUP_NAME, io_user_data->group_name); + U.PLG$GROUP_NAME.NULL = ISC_FALSE; + } + else if (io_user_data->group_name_specified) + U.PLG$GROUP_NAME.NULL = ISC_TRUE; + if (io_user_data->password_entered) + { + ENC_crypt(encrypted1, sizeof encrypted1, io_user_data->password, Auth::PASSWORD_SALT); + Auth::SecurityDatabase::hash(encrypted2, io_user_data->user_name, &encrypted1[2]); + strcpy(U.PLG$PASSWD, encrypted2.c_str()); + U.PLG$PASSWD.NULL = ISC_FALSE; + } + else if (io_user_data->password_specified) + U.PLG$PASSWD.NULL = ISC_TRUE; + if (io_user_data->first_name_entered) + { + strcpy(U.PLG$FIRST_NAME, io_user_data->first_name); + U.PLG$FIRST_NAME.NULL = ISC_FALSE; + } + else if (io_user_data->first_name_specified) + U.PLG$FIRST_NAME.NULL = ISC_TRUE; + if (io_user_data->middle_name_entered) + { + strcpy(U.PLG$MIDDLE_NAME, io_user_data->middle_name); + U.PLG$MIDDLE_NAME.NULL = ISC_FALSE; + } + else if (io_user_data->middle_name_specified) + U.PLG$MIDDLE_NAME.NULL = ISC_TRUE; + if (io_user_data->last_name_entered) + { + strcpy(U.PLG$LAST_NAME, io_user_data->last_name); + U.PLG$LAST_NAME.NULL = ISC_FALSE; + } + else if (io_user_data->last_name_specified) + U.PLG$LAST_NAME.NULL = ISC_TRUE; + END_MODIFY + ON_ERROR + ret = GsecMsg20; + END_ERROR; + END_FOR + ON_ERROR + ret = GsecMsg21; + END_ERROR; + if (!ret && !found) + ret = GsecMsg22; + if (ret == 0 && !grantRevokeAdmin(isc_status, DB, trans, io_user_data)) + { + ret = GsecMsg21; + } + break; + + case DEL_OPER: + if (realUser) + { + ret = GsecMsg104; + break; + } + + // looks up the specified user record and deletes it + + found = false; + // Do not allow SYSDBA user to be deleted + if (!fb_utils::stricmp(io_user_data->user_name, SYSDBA_USER_NAME)) + ret = GsecMsg23; + else + { + FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN PLG$USERS + WITH U.PLG$USER_NAME EQ io_user_data->user_name + found = true; + ERASE U + ON_ERROR + ret = GsecMsg23; // gsec - delete record error + END_ERROR; + END_FOR + ON_ERROR + ret = GsecMsg24; // gsec - find/delete record error + END_ERROR; + } + + if (!ret && !found) + ret = GsecMsg22; // gsec - record not found for user: + + io_user_data->admin = 0; + io_user_data->admin_entered = true; + if (ret == 0 && ! grantRevokeAdmin(isc_status, DB, trans, io_user_data)) + { + ret = GsecMsg24; + } + break; + + case DIS_OPER: + case OLD_DIS_OPER: + if (realUser) + { + if (io_user_data->user_name_entered && strcmp(realUser, io_user_data->user_name)) + { + ret = GsecMsg104; + break; + } + if (!io_user_data->user_name_entered) + { + if (strlen(realUser) > sizeof(io_user_data->user_name) - 1) + { + ret = GsecMsg104; + break; + } + strcpy(io_user_data->user_name, realUser); + io_user_data->user_name_entered = true; + } + } + + // gets either the desired record, or all records, and displays them + + found = false; + if (!io_user_data->user_name_entered) + { + FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN PLG$USERS + io_user_data->uid = U.PLG$UID; + io_user_data->uid_entered = !U.PLG$UID.NULL; + io_user_data->gid = U.PLG$GID; + io_user_data->gid_entered = !U.PLG$GID.NULL; + strcpy(io_user_data->user_name, U.PLG$USER_NAME); + io_user_data->user_name_entered = !U.PLG$USER_NAME.NULL; + strcpy(io_user_data->group_name, U.PLG$GROUP_NAME); + io_user_data->group_name_entered = !U.PLG$GROUP_NAME.NULL; + io_user_data->password[0] = 0; + io_user_data->password_entered = false; + strcpy(io_user_data->first_name, U.PLG$FIRST_NAME); + io_user_data->first_name_entered = !U.PLG$FIRST_NAME.NULL; + strcpy(io_user_data->middle_name, U.PLG$MIDDLE_NAME); + io_user_data->middle_name_entered = !U.PLG$MIDDLE_NAME.NULL; + strcpy(io_user_data->last_name, U.PLG$LAST_NAME); + io_user_data->last_name_entered = !U.PLG$LAST_NAME.NULL; + + io_user_data->admin = 0; + FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request2) P IN RDB$USER_PRIVILEGES + WITH P.RDB$USER EQ U.PLG$USER_NAME + AND P.RDB$RELATION_NAME EQ 'RDB$ADMIN' + AND P.RDB$PRIVILEGE EQ 'M' + io_user_data->admin = 1; + END_FOR + + display_func(callback_arg, io_user_data, !found); + + found = true; + END_FOR + ON_ERROR + ret = GsecMsg28; // gsec - find/display record error + END_ERROR; + } + else + { + FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN PLG$USERS + WITH U.PLG$USER_NAME EQ io_user_data->user_name + io_user_data->uid = U.PLG$UID; + io_user_data->uid_entered = !U.PLG$UID.NULL; + io_user_data->gid = U.PLG$GID; + io_user_data->gid_entered = !U.PLG$GID.NULL; + strcpy(io_user_data->user_name, U.PLG$USER_NAME); + io_user_data->user_name_entered = !U.PLG$USER_NAME.NULL; + strcpy(io_user_data->group_name, U.PLG$GROUP_NAME); + io_user_data->group_name_entered = !U.PLG$GROUP_NAME.NULL; + io_user_data->password[0] = 0; + io_user_data->password_entered = false; + strcpy(io_user_data->first_name, U.PLG$FIRST_NAME); + io_user_data->first_name_entered = !U.PLG$FIRST_NAME.NULL; + strcpy(io_user_data->middle_name, U.PLG$MIDDLE_NAME); + io_user_data->middle_name_entered = !U.PLG$MIDDLE_NAME.NULL; + strcpy(io_user_data->last_name, U.PLG$LAST_NAME); + io_user_data->last_name_entered = !U.PLG$LAST_NAME.NULL; + + io_user_data->admin = 0; + FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request2) P IN RDB$USER_PRIVILEGES + WITH P.RDB$USER EQ U.PLG$USER_NAME + AND P.RDB$RELATION_NAME EQ 'RDB$ADMIN' + AND P.RDB$PRIVILEGE EQ 'M' + io_user_data->admin = 1; + END_FOR + + display_func(callback_arg, io_user_data, !found); + + found = true; + END_FOR + ON_ERROR + ret = GsecMsg28; // gsec - find/display record error + END_ERROR; + } + break; + + default: + ret = GsecMsg16; // gsec - error in switch specifications + break; + } + + if (request) + { + ISC_STATUS_ARRAY s; + if (isc_release_request(s, &request) != FB_SUCCESS) + { + if (! ret) + { + ret = GsecMsg94; // error releasing request in security database + } + } + } + + if (request2) + { + ISC_STATUS_ARRAY s; + if (isc_release_request(s, &request2) != FB_SUCCESS) + { + if (! ret) + { + ret = GsecMsg94; // error releasing request in security database + } + } + } + + return ret; +} + +} // namespace Auth Property changes on: firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.h =================================================================== --- firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.h (rev 0) +++ firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.h 2010-07-23 12:04:18 UTC (rev 51355) @@ -0,0 +1,47 @@ +/* + * PROGRAM: Firebird authentication + * MODULE: LegacyManagement.h + * DESCRIPTION: Performs legacy actions with security database + * + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl. + * + * Software distributed under the License is distributed AS IS, + * 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 was created by Alex Peshkov + * for the Firebird Open Source RDBMS project. + * + * Copyright (c) 2010 Alex Peshkov <peshkoff at mail.ru> + * and all contributors signed below. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + */ + +#ifndef AUTH_LEGACY_MANAGEMENT_H +#define AUTH_LEGACY_MANAGEMENT_H + +#include "../auth/AuthInterface.h" + + +namespace Auth { + +class SecurityDatabaseManagement : public ManagementPlugin +{ +public: + // work in progress - we must avoid both internal_user_data and callback function + int execLine(ISC_STATUS* isc_status, const char *realUser, + FB_API_HANDLE db, FB_API_HANDLE trans, + internal_user_data* io_user_data, + FPTR_SECURITY_CALLBACK display_func, void* callback_arg); +}; + +} // namespace Auth + +#endif // AUTH_LEGACY_MANAGEMENT_H Property changes on: firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.h ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: firebird/trunk/src/common/classes/ImplementHelper.h =================================================================== --- firebird/trunk/src/common/classes/ImplementHelper.h (rev 0) +++ firebird/trunk/src/common/classes/ImplementHelper.h 2010-07-23 12:04:18 UTC (rev 51355) @@ -0,0 +1,107 @@ +/* + * PROGRAM: Firebird interface. + * MODULE: ImplementHelper.h + * DESCRIPTION: Tools to help write plugins. + * + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl. + * + * Software distributed under the License is distributed AS IS, + * 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 was created by Alex Peshkov + * for the Firebird Open Source RDBMS project. + * + * Copyright (c) 2010 Alex Peshkov <peshkoff at mail.ru> + * and all contributors signed below. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + * + * + */ + +#ifndef FB_COMMON_CLASSES_IMPLEMENT_HELPER +#define FB_COMMON_CLASSES_IMPLEMENT_HELPER + +#include "../common/classes/Interface.h" + +//#include "../jrd/gds_proto.h" +#include "../common/classes/alloc.h" + +namespace Firebird { + +// If you need interface on stack, use it in template AutoPtr<YourInterface, AutoInterface> +// as second parameter +class AutoInterface +{ +public: + static void clear(Interface* ptr) + { + if (ptr) + { + ptr->release(); + } + } +}; + +template <typename T> +T* interfaceAlloc() +{ + /*** + void* ptr = gds__alloc(sizeof(T)); + return new(ptr) T; + ***/ + return FB_NEW(*getDefaultMemoryPool()) T; +} + +template <typename T> +void interfaceFree(T* ptr) +{ + /*** + delete((void*) 0) ptr; + gds__free(ptr); + ***/ + delete ptr; +} + +// Template to create statis instance of plugin +template <typename C, unsigned int T, char NM[]> +class PluginHelper : public C +{ +public: + PluginHelper() + { + fb_register_plugin(this); + } + virtual const char* name() const + { + return NM; + } + virtual unsigned int type() const + { + return T; + } + + virtual void link(Plugin* chain) + { + pp = chain; + } + virtual Plugin* next() const + { + return pp; + } + +private: + Plugin* pp; +}; + +} // namespace Firebird + + +#endif // FB_COMMON_CLASSES_IMPLEMENT_HELPER Property changes on: firebird/trunk/src/common/classes/ImplementHelper.h ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: firebird/trunk/src/common/classes/Interface.h =================================================================== --- firebird/trunk/src/common/classes/Interface.h 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/src/common/classes/Interface.h 2010-07-23 12:04:18 UTC (rev 51355) @@ -29,11 +29,9 @@ #ifndef FB_COMMON_CLASSES_INTERFACE #define FB_COMMON_CLASSES_INTERFACE -//#include "../jrd/gds_proto.h" -#include "../common/classes/alloc.h" - namespace Firebird { +// Regular interface, typically returned by plugin or other interface class Interface { public: @@ -45,39 +43,31 @@ ~Interface() { } }; -class AutoInterface +// Plugin - single static instance of each plugin is created when plugin library is loaded +class Plugin { public: - static void clear(Interface* ptr) - { - if (ptr) - { - ptr->release(); - } - } + virtual const char* name() const = 0; + virtual unsigned int type() const = 0; + + virtual void link(Plugin* chain) = 0; + virtual Plugin* next() const = 0; + +// static const unsigned int YValve = 1; +// static const unsigned int Engine = 2; +// static const unsigned int Redirector = 3; + static const unsigned int AuthServer = 4; + static const unsigned int AuthClient = 5; + static const unsigned int UserManagement = 6; }; -template <typename T> -T* interfaceAlloc() -{ - /*** - void* ptr = gds__alloc(sizeof(T)); - return new(ptr) T; - ***/ - return FB_NEW(*getDefaultMemoryPool()) T; -} +} // namespace Firebird -template <typename T> -void interfaceFree(T* ptr) +extern "C" { - /*** - delete((void*) 0) ptr; - gds__free(ptr); - ***/ - delete ptr; + // additional API functions + void ISC_EXPORT fb_register_plugin ( Firebird::Plugin* plugin ); + Firebird::Plugin* ISC_EXPORT fb_query_plugin (unsigned int type, const char* name); } -} // namespace Auth - - #endif // FB_COMMON_CLASSES_INTERFACE Property changes on: firebird/trunk/src/common/classes/Interface.h ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: firebird/trunk/src/dbs/security.sql =================================================================== --- firebird/trunk/src/dbs/security.sql 2010-07-22 09:36:15 UTC (rev 51354) +++ firebird/trunk/src/dbs/security.sql 2010-07-23 12:04:18 UTC (rev 51355) @@ -15,15 +15,36 @@ * * All Rights Reserved. * Contributor(s): ______________________________________. - * + * * 2004.09.14 Alex Peshkoff - security changes, preventing ordinary users * from access to other users crypted passwords and enabling modification * of there own password. Originally suggested by Ivan Prenosil * (see http://www.volny.cz/iprenosil/interbase/ for details). */ +/* Domain definitions */ +CREATE DOMAIN PLG$PASSWD AS VARCHAR(64) CHARACTER SET BINARY; + +COMMIT; + + +/* Table: RDB$USERS */ +CREATE TABLE PLG$USERS ( + PLG$USER_NAME SEC$USER_N... [truncated message content] |
From: <hv...@us...> - 2010-07-23 14:06:35
|
Revision: 51361 http://firebird.svn.sourceforge.net/firebird/?rev=51361&view=rev Author: hvlad Date: 2010-07-23 14:06:29 +0000 (Fri, 23 Jul 2010) Log Message: ----------- Make Windows build work (MSVC8 only) after Alex changes. Some corrections is still required. Modified Paths: -------------- firebird/trunk/builds/win32/defs/fbclient.def firebird/trunk/builds/win32/make_boot.bat firebird/trunk/builds/win32/msvc8/gsec.vcproj firebird/trunk/builds/win32/msvc8/utilities.vcproj firebird/trunk/builds/win32/preprocess.bat firebird/trunk/src/auth/SecurityDatabase/LegacyClient.cpp firebird/trunk/src/auth/trusted/AuthSspi.cpp firebird/trunk/src/auth/trusted/AuthSspi.h firebird/trunk/src/jrd/pwd.cpp firebird/trunk/src/remote/os/win32/srvr_w32.cpp Modified: firebird/trunk/builds/win32/defs/fbclient.def =================================================================== --- firebird/trunk/builds/win32/defs/fbclient.def 2010-07-23 14:01:54 UTC (rev 51360) +++ firebird/trunk/builds/win32/defs/fbclient.def 2010-07-23 14:06:29 UTC (rev 51361) @@ -350,6 +350,9 @@ _isc_expand_dpb=isc_expand_dpb _isc_event_block=isc_event_block + fb_register_plugin + fb_query_plugin + ;----------------- ; OTHER FUNCTIONS ;----------------- Modified: firebird/trunk/builds/win32/make_boot.bat =================================================================== --- firebird/trunk/builds/win32/make_boot.bat 2010-07-23 14:01:54 UTC (rev 51360) +++ firebird/trunk/builds/win32/make_boot.bat 2010-07-23 14:06:29 UTC (rev 51361) @@ -23,15 +23,16 @@ @echo Creating directories @rmdir /s /q %FB_GEN_DIR% 2>nul :: Remove previously generated output, and recreate the directory hierarchy. Note the exceptions to the rule! -for %%v in ( alice burp dsql gpre isql journal jrd misc msgs qli examples ) do ( +for %%v in ( alice auth burp dsql gpre isql journal jrd misc msgs qli examples ) do ( if NOT "%%v"=="journal" (@mkdir %FB_GEN_DIR%\%%v ) ) @rmdir /s /q %FB_GEN_DIR%\utilities 2>nul @mkdir %FB_GEN_DIR%\utilities 2>nul @mkdir %FB_GEN_DIR%\utilities\gstat 2>nul -@mkdir %FB_GEN_DIR%\utilities\gsec 2>nul +@mkdir %FB_GEN_DIR%\auth\SecurityDatabase 2>nul + ::======= call :btyacc if "%ERRLEV%"=="1" goto :END Modified: firebird/trunk/builds/win32/msvc8/gsec.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc8/gsec.vcproj 2010-07-23 14:01:54 UTC (rev 51360) +++ firebird/trunk/builds/win32/msvc8/gsec.vcproj 2010-07-23 14:06:29 UTC (rev 51361) @@ -332,7 +332,7 @@ > </File> <File - RelativePath="..\..\..\gen\$(PlatformName)\utilities\gsec\security.cpp" + RelativePath="..\..\..\src\utilities\gsec\security.cpp" > </File> </Filter> Modified: firebird/trunk/builds/win32/msvc8/utilities.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc8/utilities.vcproj 2010-07-23 14:01:54 UTC (rev 51360) +++ firebird/trunk/builds/win32/msvc8/utilities.vcproj 2010-07-23 14:06:29 UTC (rev 51361) @@ -273,6 +273,10 @@ RelativePath="..\..\..\src\utilities\gsec\gsec.cpp" > </File> + <File + RelativePath="..\..\..\src\utilities\gsec\security.cpp" + > + </File> <Filter Name="epp files" Filter="epp" @@ -289,16 +293,12 @@ RelativePath="..\..\..\src\utilities\rstore.epp" > </File> - <File - RelativePath="..\..\..\src\utilities\security.epp" - > - </File> </Filter> <Filter Name="Generated files" > <File - RelativePath="..\..\..\gen\$(PlatformName)\utilities\gsec\security.cpp" + RelativePath="..\..\..\gen\Win32\auth\SecurityDatabase\LegacyManagement.cpp" > </File> </Filter> Modified: firebird/trunk/builds/win32/preprocess.bat =================================================================== --- firebird/trunk/builds/win32/preprocess.bat 2010-07-23 14:01:54 UTC (rev 51360) +++ firebird/trunk/builds/win32/preprocess.bat 2010-07-23 14:06:29 UTC (rev 51361) @@ -74,6 +74,7 @@ :MASTER_PROCESS @set GPRE=%FB_GEN_DIR%\gpre_embed @for %%i in (alice_meta) do @call :PREPROCESS alice %%i +@for %%i in (LegacyManagement) do @call :PREPROCESS auth/SecurityDatabase %%i @for %%i in (backup, restore, OdsDetection) do @call :PREPROCESS burp %%i @for %%i in (array, blob) do @call :PREPROCESS dsql %%i @for %%i in (metd) do @call :PREPROCESS dsql %%i -gds_cxx @@ -85,7 +86,6 @@ @for %%i in (help, meta, proc, show) do @call :PREPROCESS qli %%i @for %%i in (extract, isql, show) do @call :PREPROCESS isql %%i @for %%i in (dba) do @call :PREPROCESS utilities/gstat %%i -@for %%i in (security) do @call :PREPROCESS utilities/gsec %%i @for %%i in (stats) do @call :PREPROCESS utilities %%i @goto :EOF Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyClient.cpp =================================================================== --- firebird/trunk/src/auth/SecurityDatabase/LegacyClient.cpp 2010-07-23 14:01:54 UTC (rev 51360) +++ firebird/trunk/src/auth/SecurityDatabase/LegacyClient.cpp 2010-07-23 14:06:29 UTC (rev 51361) @@ -31,8 +31,10 @@ #include "../common/classes/ImplementHelper.h" namespace { +#ifndef WIN_NT char name[] = "LEGACY_AUTH"; Firebird::PluginHelper<Auth::SecurityDatabaseClient, Firebird::Plugin::AuthClient, name> client; +#endif } namespace Auth { Modified: firebird/trunk/src/auth/trusted/AuthSspi.cpp =================================================================== --- firebird/trunk/src/auth/trusted/AuthSspi.cpp 2010-07-23 14:01:54 UTC (rev 51360) +++ firebird/trunk/src/auth/trusted/AuthSspi.cpp 2010-07-23 14:06:29 UTC (rev 51361) @@ -31,7 +31,16 @@ #include "../common/classes/ClumpletReader.h" #include "../common/classes/Interface.h" +#include "../common/classes/ImplementHelper.h" +namespace { +#ifndef WIN_NT + char name[] = "WIN_SSPI"; + Firebird::PluginHelper<Auth::WinSspiServer, Firebird::Plugin::AuthServer, name> server; + Firebird::PluginHelper<Auth::WinSspiClient, Firebird::Plugin::AuthClient, name> client; +#endif +} + using namespace Firebird; namespace @@ -336,26 +345,7 @@ return interfaceAlloc<WinSspiClientInstance>(); } -void WinSspiServer::getName(const char** data, unsigned short* dataSize) -{ - authName(data, dataSize); -} -void WinSspiClient::getName(const char** data, unsigned short* dataSize) -{ - authName(data, dataSize); -} - -void WinSspiServer::release() -{ - interfaceFree(this); -} - -void WinSspiClient::release() -{ - interfaceFree(this); -} - WinSspiServerInstance::WinSspiServerInstance() : sspiData(*getDefaultMemoryPool()) { } Modified: firebird/trunk/src/auth/trusted/AuthSspi.h =================================================================== --- firebird/trunk/src/auth/trusted/AuthSspi.h 2010-07-23 14:01:54 UTC (rev 51360) +++ firebird/trunk/src/auth/trusted/AuthSspi.h 2010-07-23 14:06:29 UTC (rev 51361) @@ -99,16 +99,12 @@ { public: ServerInstance* instance(); - void getName(const char** data, unsigned short* dataSize); - void release(); }; class WinSspiClient : public ClientPlugin { public: ClientInstance* instance(); - void getName(const char** data, unsigned short* dataSize); - void release(); }; class WinSspiServerInstance : public ServerInstance Modified: firebird/trunk/src/jrd/pwd.cpp =================================================================== --- firebird/trunk/src/jrd/pwd.cpp 2010-07-23 14:01:54 UTC (rev 51360) +++ firebird/trunk/src/jrd/pwd.cpp 2010-07-23 14:06:29 UTC (rev 51361) @@ -48,9 +48,10 @@ namespace { // register plugin - +#ifndef WIN_NT char name[] = "LEGACY_AUTH"; PluginHelper<Auth::SecurityDatabaseServer, Firebird::Plugin::AuthServer, name> server; +#endif // temporal implementation of timer Modified: firebird/trunk/src/remote/os/win32/srvr_w32.cpp =================================================================== --- firebird/trunk/src/remote/os/win32/srvr_w32.cpp 2010-07-23 14:01:54 UTC (rev 51360) +++ firebird/trunk/src/remote/os/win32/srvr_w32.cpp 2010-07-23 14:06:29 UTC (rev 51361) @@ -109,7 +109,36 @@ #include "../../../common/classes/FpeControl.h" #include "../jrd/ibase.h" +// hvlad: following code registering plugins is temporary and should be +// moved at appropriate places +#include "../common/classes/ImplementHelper.h" +#include "../auth/trusted/AuthSspi.h" +#include "../auth/SecurityDatabase/LegacyClient.h" +#include "../auth/SecurityDatabase/LegacyManagement.h" +#include "../jrd/jrd_pwd.h" + +namespace { + + // from AuthSspi + char name1[] = "WIN_SSPI"; + Firebird::PluginHelper<Auth::WinSspiServer, Firebird::Plugin::AuthServer, name1> server1; + Firebird::PluginHelper<Auth::WinSspiClient, Firebird::Plugin::AuthClient, name1> client1; + + // from LegacyClient + char name2[] = "LEGACY_AUTH"; + Firebird::PluginHelper<Auth::SecurityDatabaseClient, Firebird::Plugin::AuthClient, name2> client2; + + // from LegacyManagement + char name3[] = "LEGACY_AUTH"; + Firebird::PluginHelper<Auth::SecurityDatabaseManagement, Firebird::Plugin::UserManagement, name3> manage3; + + // from pwd + char name4[] = "LEGACY_AUTH"; + Firebird::PluginHelper<Auth::SecurityDatabaseServer, Firebird::Plugin::AuthServer, name4> server4; +} + + static THREAD_ENTRY_DECLARE inet_connect_wait_thread(THREAD_ENTRY_PARAM); static THREAD_ENTRY_DECLARE wnet_connect_wait_thread(THREAD_ENTRY_PARAM); static THREAD_ENTRY_DECLARE xnet_connect_wait_thread(THREAD_ENTRY_PARAM); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-07-26 02:38:13
|
Revision: 51368 http://firebird.svn.sourceforge.net/firebird/?rev=51368&view=rev Author: asfernandes Date: 2010-07-26 02:37:57 +0000 (Mon, 26 Jul 2010) Log Message: ----------- Refactor CREATE/ALTER/DROP/RECREATE TABLE and DROP VIEW commands Modified Paths: -------------- firebird/trunk/lang_helpers/gds_codes.ftn firebird/trunk/lang_helpers/gds_codes.pas firebird/trunk/src/common/classes/ByteChunk.h firebird/trunk/src/common/classes/objects_array.h firebird/trunk/src/dsql/BlrWriter.h firebird/trunk/src/dsql/DdlNodes.epp firebird/trunk/src/dsql/DdlNodes.h firebird/trunk/src/dsql/Nodes.h firebird/trunk/src/dsql/PackageNodes.epp firebird/trunk/src/dsql/PackageNodes.h firebird/trunk/src/dsql/ddl.cpp firebird/trunk/src/dsql/ddl_proto.h firebird/trunk/src/dsql/dsql.h firebird/trunk/src/dsql/node.h firebird/trunk/src/dsql/parse.y firebird/trunk/src/dsql/pass1.cpp firebird/trunk/src/gpre/gpre.h firebird/trunk/src/include/gen/codetext.h firebird/trunk/src/include/gen/iberror.h firebird/trunk/src/include/gen/msgs.h firebird/trunk/src/include/gen/sql_code.h firebird/trunk/src/include/gen/sql_state.h firebird/trunk/src/jrd/constants.h firebird/trunk/src/jrd/drq.h firebird/trunk/src/jrd/dyn.epp firebird/trunk/src/jrd/dyn_def.epp firebird/trunk/src/jrd/dyn_del.epp firebird/trunk/src/jrd/dyn_df_proto.h firebird/trunk/src/jrd/dyn_dl_proto.h firebird/trunk/src/jrd/dyn_md_proto.h firebird/trunk/src/jrd/dyn_mod.epp firebird/trunk/src/jrd/dyn_ut_proto.h firebird/trunk/src/jrd/dyn_util.epp firebird/trunk/src/msgs/facilities2.sql firebird/trunk/src/msgs/messages2.sql firebird/trunk/src/msgs/system_errors2.sql Modified: firebird/trunk/lang_helpers/gds_codes.ftn =================================================================== --- firebird/trunk/lang_helpers/gds_codes.ftn 2010-07-26 02:14:48 UTC (rev 51367) +++ firebird/trunk/lang_helpers/gds_codes.ftn 2010-07-26 02:37:57 UTC (rev 51368) @@ -1996,6 +1996,86 @@ PARAMETER (GDS__dsql_invalid_type_neg = 336397256) INTEGER*4 GDS__dsql_max_distinct_items PARAMETER (GDS__dsql_max_distinct_items = 336397257) + INTEGER*4 GDS__dsql_alter_charset_failed + PARAMETER (GDS__dsql_alter_charset_failed = 336397258) + INTEGER*4 GDS__dsql_comment_on_failed + PARAMETER (GDS__dsql_comment_on_failed = 336397259) + INTEGER*4 GDS__dsql_create_func_failed + PARAMETER (GDS__dsql_create_func_failed = 336397260) + INTEGER*4 GDS__dsql_alter_func_failed + PARAMETER (GDS__dsql_alter_func_failed = 336397261) + INTEGER*4 GDS__dsql_create_alter_func_failed + PARAMETER (GDS__dsql_create_alter_func_failed = 336397262) + INTEGER*4 GDS__dsql_drop_func_failed + PARAMETER (GDS__dsql_drop_func_failed = 336397263) + INTEGER*4 GDS__dsql_recreate_func_failed + PARAMETER (GDS__dsql_recreate_func_failed = 336397264) + INTEGER*4 GDS__dsql_create_proc_failed + PARAMETER (GDS__dsql_create_proc_failed = 336397265) + INTEGER*4 GDS__dsql_alter_proc_failed + PARAMETER (GDS__dsql_alter_proc_failed = 336397266) + INTEGER*4 GDS__dsql_create_alter_proc_failed + PARAMETER (GDS__dsql_create_alter_proc_failed = 336397267) + INTEGER*4 GDS__dsql_drop_proc_failed + PARAMETER (GDS__dsql_drop_proc_failed = 336397268) + INTEGER*4 GDS__dsql_recreate_proc_failed + PARAMETER (GDS__dsql_recreate_proc_failed = 336397269) + INTEGER*4 GDS__dsql_create_trigger_failed + PARAMETER (GDS__dsql_create_trigger_failed = 336397270) + INTEGER*4 GDS__dsql_alter_trigger_failed + PARAMETER (GDS__dsql_alter_trigger_failed = 336397271) + INTEGER*4 GDS__dsql_create_alter_trigger_failed + PARAMETER (GDS__dsql_create_alter_trigger_failed = 336397272) + INTEGER*4 GDS__dsql_drop_trigger_failed + PARAMETER (GDS__dsql_drop_trigger_failed = 336397273) + INTEGER*4 GDS__dsql_recreate_trigger_failed + PARAMETER (GDS__dsql_recreate_trigger_failed = 336397274) + INTEGER*4 GDS__dsql_create_collation_failed + PARAMETER (GDS__dsql_create_collation_failed = 336397275) + INTEGER*4 GDS__dsql_drop_collation_failed + PARAMETER (GDS__dsql_drop_collation_failed = 336397276) + INTEGER*4 GDS__dsql_create_domain_failed + PARAMETER (GDS__dsql_create_domain_failed = 336397277) + INTEGER*4 GDS__dsql_alter_domain_failed + PARAMETER (GDS__dsql_alter_domain_failed = 336397278) + INTEGER*4 GDS__dsql_drop_domain_failed + PARAMETER (GDS__dsql_drop_domain_failed = 336397279) + INTEGER*4 GDS__dsql_create_except_failed + PARAMETER (GDS__dsql_create_except_failed = 336397280) + INTEGER*4 GDS__dsql_alter_except_failed + PARAMETER (GDS__dsql_alter_except_failed = 336397281) + INTEGER*4 GDS__dsql_create_alter_except_failed + PARAMETER (GDS__dsql_create_alter_except_failed = 336397282) + INTEGER*4 GDS__dsql_recreate_except_failed + PARAMETER (GDS__dsql_recreate_except_failed = 336397283) + INTEGER*4 GDS__dsql_drop_except_failed + PARAMETER (GDS__dsql_drop_except_failed = 336397284) + INTEGER*4 GDS__dsql_create_sequence_failed + PARAMETER (GDS__dsql_create_sequence_failed = 336397285) + INTEGER*4 GDS__dsql_create_table_failed + PARAMETER (GDS__dsql_create_table_failed = 336397286) + INTEGER*4 GDS__dsql_alter_table_failed + PARAMETER (GDS__dsql_alter_table_failed = 336397287) + INTEGER*4 GDS__dsql_drop_table_failed + PARAMETER (GDS__dsql_drop_table_failed = 336397288) + INTEGER*4 GDS__dsql_recreate_table_failed + PARAMETER (GDS__dsql_recreate_table_failed = 336397289) + INTEGER*4 GDS__dsql_create_pack_failed + PARAMETER (GDS__dsql_create_pack_failed = 336397290) + INTEGER*4 GDS__dsql_alter_pack_failed + PARAMETER (GDS__dsql_alter_pack_failed = 336397291) + INTEGER*4 GDS__dsql_create_alter_pack_failed + PARAMETER (GDS__dsql_create_alter_pack_failed = 336397292) + INTEGER*4 GDS__dsql_drop_pack_failed + PARAMETER (GDS__dsql_drop_pack_failed = 336397293) + INTEGER*4 GDS__dsql_recreate_pack_failed + PARAMETER (GDS__dsql_recreate_pack_failed = 336397294) + INTEGER*4 GDS__dsql_create_pack_body_failed + PARAMETER (GDS__dsql_create_pack_body_failed = 336397295) + INTEGER*4 GDS__dsql_drop_pack_body_failed + PARAMETER (GDS__dsql_drop_pack_body_failed = 336397296) + INTEGER*4 GDS__dsql_recreate_pack_body_failed + PARAMETER (GDS__dsql_recreate_pack_body_failed = 336397297) INTEGER*4 GDS__gsec_cant_open_db PARAMETER (GDS__gsec_cant_open_db = 336723983) INTEGER*4 GDS__gsec_switches_error Modified: firebird/trunk/lang_helpers/gds_codes.pas =================================================================== --- firebird/trunk/lang_helpers/gds_codes.pas 2010-07-26 02:14:48 UTC (rev 51367) +++ firebird/trunk/lang_helpers/gds_codes.pas 2010-07-26 02:37:57 UTC (rev 51368) @@ -1005,6 +1005,46 @@ gds_dsql_nostring_neg_dial3 = 336397255; gds_dsql_invalid_type_neg = 336397256; gds_dsql_max_distinct_items = 336397257; + gds_dsql_alter_charset_failed = 336397258; + gds_dsql_comment_on_failed = 336397259; + gds_dsql_create_func_failed = 336397260; + gds_dsql_alter_func_failed = 336397261; + gds_dsql_create_alter_func_failed = 336397262; + gds_dsql_drop_func_failed = 336397263; + gds_dsql_recreate_func_failed = 336397264; + gds_dsql_create_proc_failed = 336397265; + gds_dsql_alter_proc_failed = 336397266; + gds_dsql_create_alter_proc_failed = 336397267; + gds_dsql_drop_proc_failed = 336397268; + gds_dsql_recreate_proc_failed = 336397269; + gds_dsql_create_trigger_failed = 336397270; + gds_dsql_alter_trigger_failed = 336397271; + gds_dsql_create_alter_trigger_failed = 336397272; + gds_dsql_drop_trigger_failed = 336397273; + gds_dsql_recreate_trigger_failed = 336397274; + gds_dsql_create_collation_failed = 336397275; + gds_dsql_drop_collation_failed = 336397276; + gds_dsql_create_domain_failed = 336397277; + gds_dsql_alter_domain_failed = 336397278; + gds_dsql_drop_domain_failed = 336397279; + gds_dsql_create_except_failed = 336397280; + gds_dsql_alter_except_failed = 336397281; + gds_dsql_create_alter_except_failed = 336397282; + gds_dsql_recreate_except_failed = 336397283; + gds_dsql_drop_except_failed = 336397284; + gds_dsql_create_sequence_failed = 336397285; + gds_dsql_create_table_failed = 336397286; + gds_dsql_alter_table_failed = 336397287; + gds_dsql_drop_table_failed = 336397288; + gds_dsql_recreate_table_failed = 336397289; + gds_dsql_create_pack_failed = 336397290; + gds_dsql_alter_pack_failed = 336397291; + gds_dsql_create_alter_pack_failed = 336397292; + gds_dsql_drop_pack_failed = 336397293; + gds_dsql_recreate_pack_failed = 336397294; + gds_dsql_create_pack_body_failed = 336397295; + gds_dsql_drop_pack_body_failed = 336397296; + gds_dsql_recreate_pack_body_failed = 336397297; gds_gsec_cant_open_db = 336723983; gds_gsec_switches_error = 336723984; gds_gsec_no_op_spec = 336723985; Modified: firebird/trunk/src/common/classes/ByteChunk.h =================================================================== --- firebird/trunk/src/common/classes/ByteChunk.h 2010-07-26 02:14:48 UTC (rev 51367) +++ firebird/trunk/src/common/classes/ByteChunk.h 2010-07-26 02:37:57 UTC (rev 51368) @@ -24,6 +24,7 @@ #define COMMON_BYTE_CHUNK_H #include "../common/classes/array.h" +#include "../common/classes/fb_string.h" namespace Firebird { @@ -46,8 +47,22 @@ { } - const UCHAR* const data; - const size_t length; + // String buffer. + ByteChunk(string& str) + : data((UCHAR*) str.c_str()), + length(str.length()) + { + } + + // Empty. + ByteChunk() + : data(NULL), + length(0) + { + } + + const UCHAR* data; + size_t length; }; } // namespace Firebird Modified: firebird/trunk/src/common/classes/objects_array.h =================================================================== --- firebird/trunk/src/common/classes/objects_array.h 2010-07-26 02:14:48 UTC (rev 51367) +++ firebird/trunk/src/common/classes/objects_array.h 2010-07-26 02:37:57 UTC (rev 51368) @@ -279,6 +279,11 @@ size_t getCount() const {return inherited::getCount();} size_t getCapacity() const {return inherited::getCapacity();} + bool hasData() const + { + return getCount() != 0; + } + bool isEmpty() const { return getCount() == 0; Modified: firebird/trunk/src/dsql/BlrWriter.h =================================================================== --- firebird/trunk/src/dsql/BlrWriter.h 2010-07-26 02:14:48 UTC (rev 51367) +++ firebird/trunk/src/dsql/BlrWriter.h 2010-07-26 02:37:57 UTC (rev 51368) @@ -36,6 +36,9 @@ class BlrWriter : public Firebird::PermanentStorage { public: + typedef Firebird::HalfStaticArray<UCHAR, 1024> BlrData; + typedef Firebird::HalfStaticArray<UCHAR, 128> DebugData; + explicit BlrWriter(MemoryPool& p) : PermanentStorage(p), blrData(p), @@ -44,6 +47,10 @@ { } + virtual ~BlrWriter() + { + } + void appendUChar(const UCHAR byte) { blrData.add(byte); @@ -126,8 +133,8 @@ void putDebugArgument(UCHAR, USHORT, const TEXT*); void appendDebugInfo(); - Firebird::HalfStaticArray<UCHAR, 1024>& getBlrData() { return blrData; } - Firebird::HalfStaticArray<UCHAR, 128>& getDebugData() { return debugData; } + BlrData& getBlrData() { return blrData; } + DebugData& getDebugData() { return debugData; } ULONG getBaseOffset() const { return baseOffset; } void setBaseOffset(ULONG value) { baseOffset = value; } @@ -138,8 +145,8 @@ virtual bool isDdlDyn() = 0; private: - Firebird::HalfStaticArray<UCHAR, 1024> blrData; - Firebird::HalfStaticArray<UCHAR, 128> debugData; + BlrData blrData; + DebugData debugData; ULONG baseOffset; // place to go back and stuff in blr length }; Modified: firebird/trunk/src/dsql/DdlNodes.epp =================================================================== --- firebird/trunk/src/dsql/DdlNodes.epp 2010-07-26 02:14:48 UTC (rev 51367) +++ firebird/trunk/src/dsql/DdlNodes.epp 2010-07-26 02:37:57 UTC (rev 51368) @@ -19,10 +19,12 @@ */ #include "firebird.h" +#include "dyn_consts.h" #include "../jrd/common.h" #include "../dsql/DdlNodes.h" #include "../dsql/node.h" #include "../jrd/blr.h" +#include "../jrd/btr.h" #include "../jrd/dyn.h" #include "../jrd/flags.h" #include "../jrd/intl.h" @@ -30,6 +32,7 @@ #include "../jrd/msg_encode.h" #include "../jrd/obj.h" #include "../jrd/tra.h" +#include "../jrd/os/path_utils.h" #include "../jrd/IntlManager.h" #include "../jrd/PreparedStatement.h" #include "../jrd/blb_proto.h" @@ -39,7 +42,9 @@ #include "../jrd/dyn_ut_proto.h" #include "../jrd/exe_proto.h" #include "../jrd/intl_proto.h" +#include "../jrd/isc_f_proto.h" #include "../jrd/met_proto.h" +#include "../jrd/scl_proto.h" #include "../jrd/vio_proto.h" #include "../dsql/ddl_proto.h" #include "../dsql/errd_proto.h" @@ -49,14 +54,39 @@ #include "../dsql/pass1_proto.h" #include "../common/StatusArg.h" -using namespace Firebird; - namespace Jrd { using namespace Firebird; using namespace Dsql; -static void rethrowMetaException(const status_exception& ex, ISC_STATUS code, bool metaDataException); +static void checkForeignKeyTempScope(thread_db* tdbb, jrd_tra* transaction, + const MetaName& childRelName, const MetaName& masterIndexName); +static void checkSpTrigDependency(thread_db* tdbb, jrd_tra* transaction, + const MetaName& relationName, const MetaName& fieldName); +static void checkViewDependency(thread_db* tdbb, jrd_tra* transaction, + const MetaName& relationName, const MetaName& fieldName); +static void clearPermanentField(dsql_rel* relation, bool permanent); +static void deleteKeyConstraint(thread_db* tdbb, jrd_tra* transaction, + const MetaName& relationName, const MetaName& constraintName, const MetaName& indexName); +static bool fieldExists(thread_db* tdbb, jrd_tra* transaction, const MetaName& relationName, + const MetaName& fieldName); +static void makeRelationScopeName(const MetaName& name, const rel_t type, string& message); +static void modifyLocalFieldPosition(thread_db* tdbb, jrd_tra* transaction, + const MetaName& relationName, const MetaName& fieldName, USHORT newPosition, + USHORT existingPosition); +static rel_t relationType(SSHORT relationTypeNull, SSHORT relationType); +static void saveRelation(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, + const dsql_str* relationName, bool creating); +static void updateRdbFields(const TypeClause& type, + SSHORT& fieldType, + SSHORT& fieldLength, + SSHORT& fieldSubTypeNull, SSHORT& fieldSubType, + SSHORT& fieldScaleNull, SSHORT& fieldScale, + SSHORT& characterSetIdNull, SSHORT& characterSetId, + SSHORT& characterLengthNull, SSHORT& characterLength, + SSHORT& fieldPrecisionNull, SSHORT& fieldPrecision, + SSHORT& collationIdNull, SSHORT& collationId, + SSHORT& segmentLengthNull, SSHORT& segmentLength); DATABASE DB = STATIC "ODS.RDB"; @@ -64,25 +94,376 @@ //---------------------- -// Rethrow an exception with isc_no_meta_update and code prefix when necessary. -static void rethrowMetaException(const status_exception& ex, ISC_STATUS code, bool metaDataException) +// Check temporary table reference rules between given child relation and master +// relation (owner of given PK/UK index). +static void checkForeignKeyTempScope(thread_db* tdbb, jrd_tra* transaction, + const MetaName& childRelName, const MetaName& masterIndexName) { - Arg::StatusVector newVector; - const ISC_STATUS* status = ex.value(); + AutoCacheRequest request(tdbb, drq_l_rel_info, DYN_REQUESTS); + bool error = false; + string master, child; - if (metaDataException) + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + RLC_M IN RDB$RELATION_CONSTRAINTS CROSS + REL_C IN RDB$RELATIONS CROSS + REL_M IN RDB$RELATIONS + WITH (RLC_M.RDB$CONSTRAINT_TYPE EQ UNIQUE_CNSTRT OR + RLC_M.RDB$CONSTRAINT_TYPE EQ PRIMARY_KEY) AND + RLC_M.RDB$INDEX_NAME EQ masterIndexName.c_str() AND + REL_C.RDB$RELATION_NAME EQ childRelName.c_str() AND + REL_M.RDB$RELATION_NAME EQ RLC_M.RDB$RELATION_NAME { - if (status[1] != isc_no_meta_update) - newVector << Arg::Gds(isc_no_meta_update); + const rel_t masterType = relationType(REL_M.RDB$RELATION_TYPE.NULL, REL_M.RDB$RELATION_TYPE); + fb_assert(masterType == rel_persistent || + masterType == rel_global_temp_preserve || + masterType == rel_global_temp_delete); - if (code != 0) - newVector << Arg::Gds(code); + const rel_t childType = relationType(REL_C.RDB$RELATION_TYPE.NULL, REL_C.RDB$RELATION_TYPE); + fb_assert(childType == rel_persistent || + childType == rel_global_temp_preserve || + childType == rel_global_temp_delete); + + error = masterType != childType && + !(masterType == rel_global_temp_preserve && childType == rel_global_temp_delete); + + if (error) + { + makeRelationScopeName(masterIndexName, masterType, master); + makeRelationScopeName(childRelName, childType, child); + } } + END_FOR - newVector.append(Arg::StatusVector(status)); - status_exception::raise(newVector); + if (error) + { + // Msg 232 : "%s can't reference %s" + status_exception::raise(Arg::Gds(ENCODE_ISC_MSG(232, DYN_MSG_FAC)) << child << master); + } } +// Check temporary table reference rules between just created child relation and all +// its master relations. +static void checkRelationTempScope(thread_db* tdbb, jrd_tra* transaction, + const MetaName& childRelName, const rel_t childType) +{ + if (childType != rel_persistent && + childType != rel_global_temp_preserve && + childType != rel_global_temp_delete) + { + return; + } + + AutoCacheRequest request(tdbb, drq_l_rel_info2, DYN_REQUESTS); + bool error = false; + string master, child; + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + RLC_C IN RDB$RELATION_CONSTRAINTS CROSS + IND_C IN RDB$INDICES CROSS + IND_M IN RDB$INDICES CROSS + REL_M IN RDB$RELATIONS + WITH RLC_C.RDB$CONSTRAINT_TYPE EQ FOREIGN_KEY AND + RLC_C.RDB$RELATION_NAME EQ childRelName.c_str() AND + IND_C.RDB$INDEX_NAME EQ RLC_C.RDB$INDEX_NAME AND + IND_M.RDB$INDEX_NAME EQ IND_C.RDB$FOREIGN_KEY AND + IND_M.RDB$RELATION_NAME EQ REL_M.RDB$RELATION_NAME + { + const rel_t masterType = relationType(REL_M.RDB$RELATION_TYPE.NULL, REL_M.RDB$RELATION_TYPE); + fb_assert(masterType == rel_persistent || + masterType == rel_global_temp_preserve || + masterType == rel_global_temp_delete); + + error = masterType != childType && + !(masterType == rel_global_temp_preserve && childType == rel_global_temp_delete); + + if (error) + { + makeRelationScopeName(REL_M.RDB$RELATION_NAME, masterType, master); + makeRelationScopeName(childRelName, childType, child); + } + } + END_FOR + + if (error) + { + // Msg 232 : "%s can't reference %s" + status_exception::raise(Arg::Gds(ENCODE_ISC_MSG(232, DYN_MSG_FAC)) << child << master); + } +} + +// Checks to see if the given field is referenced in a stored procedure or trigger. +// If the field is referenced, throw. +static void checkSpTrigDependency(thread_db* tdbb, jrd_tra* transaction, + const MetaName& relationName, const MetaName& fieldName) +{ + AutoRequest request; + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + FIRST 1 + DEP IN RDB$DEPENDENCIES + WITH DEP.RDB$DEPENDED_ON_NAME EQ relationName.c_str() AND + DEP.RDB$FIELD_NAME EQ fieldName.c_str() + { + MetaName depName(DEP.RDB$DEPENDENT_NAME); + + // msg 206: Column %s from table %s is referenced in %s. + status_exception::raise( + Arg::Gds(ENCODE_ISC_MSG(206, DYN_MSG_FAC)) << fieldName << relationName << depName); + } + END_FOR +} + +// Checks to see if the given field is referenced in a view. If it is, throw. +static void checkViewDependency(thread_db* tdbb, jrd_tra* transaction, + const MetaName& relationName, const MetaName& fieldName) +{ + AutoRequest request; + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + FIRST 1 + X IN RDB$RELATION_FIELDS CROSS + Y IN RDB$RELATION_FIELDS CROSS + Z IN RDB$VIEW_RELATIONS + WITH X.RDB$RELATION_NAME EQ relationName.c_str() AND + X.RDB$FIELD_NAME EQ fieldName.c_str() AND + X.RDB$FIELD_NAME EQ Y.RDB$BASE_FIELD AND + X.RDB$FIELD_SOURCE EQ Y.RDB$FIELD_SOURCE AND + Y.RDB$RELATION_NAME EQ Z.RDB$VIEW_NAME AND + X.RDB$RELATION_NAME EQ Z.RDB$RELATION_NAME AND + Y.RDB$VIEW_CONTEXT EQ Z.RDB$VIEW_CONTEXT + { + MetaName viewName(Z.RDB$VIEW_NAME); + + // msg 206: Column %s from table %s is referenced in %s. + status_exception::raise( + Arg::Gds(ENCODE_ISC_MSG(206, DYN_MSG_FAC)) << fieldName << relationName << viewName); + } + END_FOR +} + +// Removes temporary pool pointers from field, stored in permanent cache. +static void clearPermanentField(dsql_rel* relation, bool permanent) +{ + if (relation && relation->rel_fields && permanent) + { + relation->rel_fields->fld_procedure = NULL; + relation->rel_fields->fld_ranges = NULL; + relation->rel_fields->fld_character_set = NULL; + relation->rel_fields->fld_sub_type_name = NULL; + relation->rel_fields->fld_relation = relation; + } +} + +// Delete a record from RDB$RELATION_CONSTRAINTS based on a constraint name. +// +// On deleting from RDB$RELATION_CONSTRAINTS, 2 system triggers fire: +// +// (A) pre delete trigger: pre_delete_constraint, will: +// +// 1. delete a record first from RDB$REF_CONSTRAINTS where +// RDB$REF_CONSTRAINTS.RDB$CONSTRAINT_NAME = +// RDB$RELATION_CONSTRAINTS.RDB$CONSTRAINT_NAME +// +// (B) post delete trigger: post_delete_constraint will: +// +// 1. also delete a record from RDB$INDICES where +// RDB$INDICES.RDB$INDEX_NAME = +// RDB$RELATION_CONSTRAINTS.RDB$INDEX_NAME +// +// 2. also delete a record from RDB$INDEX_SEGMENTS where +// RDB$INDEX_SEGMENTS.RDB$INDEX_NAME = +// RDB$RELATION_CONSTRAINTS.RDB$INDEX_NAME +static void deleteKeyConstraint(thread_db* tdbb, jrd_tra* transaction, + const MetaName& relationName, const MetaName& constraintName, const MetaName& indexName) +{ + SET_TDBB(tdbb); + + AutoCacheRequest request(tdbb, drq_e_rel_const, DYN_REQUESTS); + bool found = false; + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + RC IN RDB$RELATION_CONSTRAINTS + WITH RC.RDB$CONSTRAINT_NAME EQ constraintName.c_str() AND + RC.RDB$CONSTRAINT_TYPE EQ FOREIGN_KEY AND + RC.RDB$RELATION_NAME EQ relationName.c_str() AND + RC.RDB$INDEX_NAME EQ indexName.c_str() + { + found = true; + ERASE RC; + } + END_FOR + + if (!found) + { + // msg 130: "CONSTRAINT %s does not exist." + status_exception::raise( + Arg::Gds(ENCODE_ISC_MSG(130, DYN_MSG_FAC)) << constraintName); + } +} + +// Checks to see if the given field already exists in a relation. +static bool fieldExists(thread_db* tdbb, jrd_tra* transaction, const MetaName& relationName, + const MetaName& fieldName) +{ + AutoRequest request; + bool found = false; + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + FLD IN RDB$RELATION_FIELDS + WITH FLD.RDB$RELATION_NAME EQ relationName.c_str() AND + FLD.RDB$FIELD_NAME EQ fieldName.c_str() + { + found = true; + } + END_FOR + + return found; +} + +// Make string with relation name and type of its temporary scope. +static void makeRelationScopeName(const MetaName& name, const rel_t type, string& message) +{ + const char* scope = NULL; + + if (type == rel_global_temp_preserve) + scope = REL_SCOPE_GTT_PRESERVE; + else if (type == rel_global_temp_delete) + scope = REL_SCOPE_GTT_DELETE; + else + scope = REL_SCOPE_PERSISTENT; + + message.printf(scope, name.c_str()); +} + +// Alters the position of a field with respect to the +// other fields in the relation. This will only affect +// the order in which the fields will be returned when either +// viewing the relation or performing select * from the relation. +// +// The rules of engagement are as follows: +// if new_position > original position +// increase RDB$FIELD_POSITION for all fields with RDB$FIELD_POSITION +// between the new_position and existing position of the field +// then update the position of the field being altered. +// just update the position +// +// if new_position < original position +// decrease RDB$FIELD_POSITION for all fields with RDB$FIELD_POSITION +// between the new_position and existing position of the field +// then update the position of the field being altered. +// +// if new_position == original_position -- no_op +static void modifyLocalFieldPosition(thread_db* tdbb, jrd_tra* transaction, + const MetaName& relationName, const MetaName& fieldName, USHORT newPosition, + USHORT existingPosition) +{ + // Make sure that there are no duplicate field positions and no gaps in the position sequence. + // (gaps are introduced when fields are removed) + + AutoRequest request; + USHORT newPos = 0; + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + FLD IN RDB$RELATION_FIELDS + WITH FLD.RDB$RELATION_NAME EQ relationName.c_str() + SORTED BY ASCENDING FLD.RDB$FIELD_POSITION + { + if (FLD.RDB$FIELD_POSITION != newPos) + { + MODIFY FLD USING + FLD.RDB$FIELD_POSITION = newPos; + END_MODIFY + } + + ++newPos; + } + END_FOR + + // Find the position of the last field in the relation. + SLONG maxPosition = -1; + DYN_UTIL_generate_field_position(tdbb, NULL, relationName, &maxPosition); + + // If the existing position of the field is less than the new position of + // the field, subtract 1 to move the fields to their new positions otherwise, + // increase the value in RDB$FIELD_POSITION by one. + + bool moveDown = false; + if (existingPosition < newPosition) + moveDown = true; + + // Retrieve the records for the fields which have a position between the + // existing field position and the new field position. + + request.reset(); + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + FLD IN RDB$RELATION_FIELDS + WITH FLD.RDB$RELATION_NAME EQ relationName.c_str() AND + FLD.RDB$FIELD_POSITION >= MIN(newPosition, existingPosition) AND + FLD.RDB$FIELD_POSITION <= MAX(newPosition, existingPosition) + { + MODIFY FLD USING + // If the field is the one we want, change the position, otherwise + // increase the value of RDB$FIELD_POSITION. + if (fieldName == FLD.RDB$FIELD_NAME) + { + if (newPosition > maxPosition) + { + // This prevents gaps in the position sequence of the fields. + FLD.RDB$FIELD_POSITION = maxPosition; + } + else + FLD.RDB$FIELD_POSITION = newPosition; + } + else + { + if (moveDown) + FLD.RDB$FIELD_POSITION = FLD.RDB$FIELD_POSITION - 1; + else + FLD.RDB$FIELD_POSITION = FLD.RDB$FIELD_POSITION + 1; + } + + FLD.RDB$FIELD_POSITION.NULL = FALSE; + END_MODIFY + } + END_FOR +} + +// Convert RDB$RELATION_TYPE to rel_t type. +static rel_t relationType(SSHORT relationTypeNull, SSHORT relationType) +{ + return relationTypeNull ? rel_persistent : rel_t(relationType); +} + +// Save the name of the relation or view currently being defined. This is done to support definition +// of triggers which will depend on the metadata created in this statement. +static void saveRelation(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, + const dsql_str* relationName, bool creating) +{ + //// TODO: Verify "creating" usage when using this function for views. + + DsqlCompiledStatement* statement = dsqlScratch->getStatement(); + + if (dsqlScratch->flags & DsqlCompilerScratch::FLAG_METADATA_SAVED) + return; + + dsqlScratch->flags |= DsqlCompilerScratch::FLAG_METADATA_SAVED; + + dsql_rel* relation; + + if (!creating) + relation = METD_get_relation(dsqlScratch->getTransaction(), dsqlScratch, relationName); + else + { + MemoryPool& pool = *tdbb->getDefaultPool(); + relation = FB_NEW(pool) dsql_rel(pool); + relation->rel_name = relationName->str_data; + relation->rel_flags = REL_creating; + } + + dsqlScratch->relation = relation; +} + // Update RDB$FIELDS received by reference. static void updateRdbFields(const TypeClause& type, SSHORT& fieldType, @@ -169,6 +550,25 @@ //---------------------- +// Delete a security class. +bool DdlNode::deleteSecurityClass(thread_db* tdbb, jrd_tra* transaction, + const MetaName& secClass) +{ + AutoCacheRequest request(tdbb, drq_e_class, DYN_REQUESTS); + bool found = false; + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + SC IN RDB$SECURITY_CLASSES + WITH SC.RDB$SECURITY_CLASS EQ secClass.c_str() + { + found = true; + ERASE SC; + } + END_FOR + + return found; +} + void DdlNode::executeDdlTrigger(thread_db* tdbb, jrd_tra* transaction, DdlTriggerWhen when, int action, const MetaName& objectName, const string& sqlText) { @@ -192,14 +592,12 @@ savePoint.release(); // everything is ok } - void DdlNode::executeDdlTrigger(thread_db* tdbb, jrd_tra* transaction, DdlNode::DdlTriggerWhen when, int action, const MetaName& objectName) { executeDdlTrigger(tdbb, transaction, when, action, objectName, sqlText); } - void DdlNode::putType(const TypeClause& type, bool useSubType) { #ifdef DEV_BUILD @@ -300,51 +698,105 @@ } } - void DdlNode::resetContextStack() { dsqlScratch->context->clear(); dsqlScratch->contextNumber = 0; } - -void DdlNode::storeGlobalField(thread_db* tdbb, jrd_tra* transaction, const TypeClause& field, - MetaName& name) +void DdlNode::storeGlobalField(thread_db* tdbb, jrd_tra* transaction, MetaName& name, + const TypeClause& field, const string& computedSource, const BlrWriter::BlrData& computedValue) { - bool endStore = false; + Attachment* attachment = transaction->tra_attachment; - try + const dsql_nod* elements = field.legacyField->fld_ranges; + const USHORT dims = elements ? elements->nod_count / 2 : 0; + + if (dims > MAX_ARRAY_DIMENSIONS) { - if (name.isEmpty()) - DYN_UTIL_generate_field_name(tdbb, NULL, name); + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-604) << + Arg::Gds(isc_dsql_max_arr_dim_exceeded)); + } - AutoCacheRequest requestHandle(tdbb, drq_s_fld_src, DYN_REQUESTS); + if (name.isEmpty()) + DYN_UTIL_generate_field_name(tdbb, NULL, name); - STORE (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction) - FLD IN RDB$FIELDS + AutoCacheRequest requestHandle(tdbb, drq_s_fld_src, DYN_REQUESTS); + + STORE (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction) + FLD IN RDB$FIELDS + { + FLD.RDB$SYSTEM_FLAG = 0; + strcpy(FLD.RDB$FIELD_NAME, name.c_str()); + + FLD.RDB$COMPUTED_SOURCE.NULL = TRUE; + FLD.RDB$COMPUTED_BLR.NULL = TRUE; + FLD.RDB$DIMENSIONS.NULL = TRUE; + + updateRdbFields(field, + FLD.RDB$FIELD_TYPE, + FLD.RDB$FIELD_LENGTH, + FLD.RDB$FIELD_SUB_TYPE.NULL, FLD.RDB$FIELD_SUB_TYPE, + FLD.RDB$FIELD_SCALE.NULL, FLD.RDB$FIELD_SCALE, + FLD.RDB$CHARACTER_SET_ID.NULL, FLD.RDB$CHARACTER_SET_ID, + FLD.RDB$CHARACTER_LENGTH.NULL, FLD.RDB$CHARACTER_LENGTH, + FLD.RDB$FIELD_PRECISION.NULL, FLD.RDB$FIELD_PRECISION, + FLD.RDB$COLLATION_ID.NULL, FLD.RDB$COLLATION_ID, + FLD.RDB$SEGMENT_LENGTH.NULL, FLD.RDB$SEGMENT_LENGTH); + + if (dims != 0) { - FLD.RDB$SYSTEM_FLAG = 0; - strcpy(FLD.RDB$FIELD_NAME, name.c_str()); + FLD.RDB$DIMENSIONS.NULL = FALSE; + FLD.RDB$DIMENSIONS = dims; + } - updateRdbFields(field, - FLD.RDB$FIELD_TYPE, - FLD.RDB$FIELD_LENGTH, - FLD.RDB$FIELD_SUB_TYPE.NULL, FLD.RDB$FIELD_SUB_TYPE, - FLD.RDB$FIELD_SCALE.NULL, FLD.RDB$FIELD_SCALE, - FLD.RDB$CHARACTER_SET_ID.NULL, FLD.RDB$CHARACTER_SET_ID, - FLD.RDB$CHARACTER_LENGTH.NULL, FLD.RDB$CHARACTER_LENGTH, - FLD.RDB$FIELD_PRECISION.NULL, FLD.RDB$FIELD_PRECISION, - FLD.RDB$COLLATION_ID.NULL, FLD.RDB$COLLATION_ID, - FLD.RDB$SEGMENT_LENGTH.NULL, FLD.RDB$SEGMENT_LENGTH); + if (computedSource.hasData()) + { + FLD.RDB$COMPUTED_SOURCE.NULL = FALSE; + attachment->storeMetaDataBlob(tdbb, transaction, &FLD.RDB$COMPUTED_SOURCE, + computedSource); + } - endStore = true; + if (computedValue.hasData()) + { + FLD.RDB$COMPUTED_BLR.NULL = FALSE; + attachment->storeBinaryBlob(tdbb, transaction, &FLD.RDB$COMPUTED_BLR, + computedValue); } - END_STORE } - catch (const status_exception& ex) + END_STORE + + if (elements) // Is the type an array? { - // STORE RDB$FIELDS failed - rethrowMetaException(ex, ENCODE_ISC_MSG(13, DYN_MSG_FAC), endStore); + AutoCacheRequest request(tdbb, drq_s_fld_dym, DYN_REQUESTS); + + SSHORT position = 0; + const dsql_nod* const* ptr = elements->nod_arg; + for (const dsql_nod* const* const end = ptr + elements->nod_count; ptr < end; ++ptr, ++position) + { + const dsql_nod* element = *ptr++; + const SLONG lrange = element->getSlong(); + element = *ptr; + const SLONG hrange = element->getSlong(); + + if (lrange >= hrange) + { + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-604) << + Arg::Gds(isc_dsql_arr_range_error)); + } + + STORE (REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + DIM IN RDB$FIELD_DIMENSIONS + { + strcpy(DIM.RDB$FIELD_NAME, name.c_str()); + DIM.RDB$DIMENSION = position; + DIM.RDB$UPPER_BOUND = hrange; + DIM.RDB$LOWER_BOUND = lrange; + } + END_STORE + } } } @@ -358,11 +810,10 @@ { } - -void TypeClause::resolve(DsqlCompilerScratch* dsqlScratch) +void TypeClause::resolve(DsqlCompilerScratch* dsqlScratch, bool modifying) { - DDL_resolve_intl_type(dsqlScratch, legacyField, - (collate.isEmpty() ? NULL : MAKE_cstring(collate.c_str()))); + DDL_resolve_intl_type2(dsqlScratch, legacyField, + (collate.isEmpty() ? NULL : MAKE_cstring(collate.c_str())), modifying); type = legacyField->fld_dtype; length = legacyField->fld_length; @@ -385,7 +836,6 @@ typeOfName = legacyField->fld_type_of_name; } - void TypeClause::print(string& text) const { text.printf("typeOfTable: '%s' typeOfName: '%s' notNull: %d fieldSource: '%s'", @@ -405,7 +855,6 @@ { } - void ParameterClause::print(string& text) const { string s; @@ -426,7 +875,6 @@ charSet.c_str(), defaultCollation.c_str()); } - void AlterCharSetNode::execute(thread_db* tdbb, jrd_tra* transaction) { METD_drop_charset(transaction, charSet); @@ -467,16 +915,12 @@ END_FOR if (!charSetFound) - { - status_exception::raise(Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_charset_not_found) << Arg::Str(charSet)); - } + status_exception::raise(Arg::Gds(isc_charset_not_found) << Arg::Str(charSet)); if (!collationFound) { - status_exception::raise(Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_collation_not_found) << Arg::Str(defaultCollation) << - Arg::Str(charSet)); + status_exception::raise( + Arg::Gds(isc_collation_not_found) << Arg::Str(defaultCollation) << Arg::Str(charSet)); } executeDdlTrigger(tdbb, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_CHARACTER_SET, charSet); @@ -496,7 +940,6 @@ objType, objName.c_str(), text.c_str()); } - // select rdb$relation_name from rdb$relation_fields where rdb$field_name = 'RDB$DESCRIPTION'; // gives the list of objects that accept descriptions. At FB2 time, the only // subobjects with descriptions are relation's fields and procedure's parameters. @@ -691,7 +1134,6 @@ } } - DdlNode* CreateAlterFunctionNode::internalDsqlPass() { DsqlCompiledStatement* const statement = dsqlScratch->getStatement(); @@ -762,7 +1204,6 @@ return DdlNode::internalDsqlPass(); } - void CreateAlterFunctionNode::execute(thread_db* tdbb, jrd_tra* transaction) { fb_assert(create || alter); @@ -781,15 +1222,9 @@ else { if (create) // create or alter - { executeCreate(tdbb, transaction); - } else - { - status_exception::raise( - Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_dyn_func_not_found) << Arg::Str(name)); - } + status_exception::raise(Arg::Gds(isc_dyn_func_not_found) << Arg::Str(name)); } } else @@ -817,7 +1252,6 @@ } } - void CreateAlterFunctionNode::executeCreate(thread_db* tdbb, jrd_tra* transaction) { Attachment* attachment = transaction->getAttachment(); @@ -918,7 +1352,6 @@ executeAlter(tdbb, transaction, false, false); } - bool CreateAlterFunctionNode::executeAlter(thread_db* tdbb, jrd_tra* transaction, bool secondPass, bool runTriggers) { @@ -935,9 +1368,8 @@ { if (!FUN.RDB$SYSTEM_FLAG.NULL && FUN.RDB$SYSTEM_FLAG) { - status_exception::raise(Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_dyn_cannot_mod_sysfunc) << - FUN.RDB$FUNCTION_NAME); + status_exception::raise( + Arg::Gds(isc_dyn_cannot_mod_sysfunc) << FUN.RDB$FUNCTION_NAME); } if (!secondPass && runTriggers && package.isEmpty()) @@ -1031,7 +1463,6 @@ return modified; } - void CreateAlterFunctionNode::storeArgument(thread_db* tdbb, jrd_tra* transaction, unsigned pos, const ParameterClause& parameter) { @@ -1099,7 +1530,7 @@ else { MetaName fieldName; - storeGlobalField(tdbb, transaction, parameter, fieldName); + storeGlobalField(tdbb, transaction, fieldName, parameter); strcpy(ARG.RDB$FIELD_SOURCE, fieldName.c_str()); } } @@ -1155,7 +1586,6 @@ END_STORE } - void CreateAlterFunctionNode::compile(thread_db* tdbb, jrd_tra* /*transaction*/) { if (invalid) @@ -1327,7 +1757,6 @@ END_FOR } - void DropFunctionNode::print(string& text, Array<dsql_nod*>& /*nodes*/) const { text.printf( @@ -1336,14 +1765,12 @@ name.c_str()); } - DdlNode* DropFunctionNode::internalDsqlPass() { dsqlScratch->flags |= (DsqlCompilerScratch::FLAG_BLOCK | DsqlCompilerScratch::FLAG_FUNCTION); return DdlNode::internalDsqlPass(); } - void DropFunctionNode::execute(thread_db* tdbb, jrd_tra* transaction) { // run all statements under savepoint control @@ -1360,10 +1787,7 @@ FUN.RDB$PACKAGE_NAME EQUIV NULLIF(package.c_str(), '') { if (!FUN.RDB$SYSTEM_FLAG.NULL && FUN.RDB$SYSTEM_FLAG) - { - status_exception::raise(Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_dyn_cannot_mod_sysfunc) << FUN.RDB$FUNCTION_NAME); - } + status_exception::raise(Arg::Gds(isc_dyn_cannot_mod_sysfunc) << FUN.RDB$FUNCTION_NAME); if (package.isEmpty()) executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_DROP_FUNCTION, name); @@ -1371,18 +1795,14 @@ ERASE FUN; if (!FUN.RDB$SECURITY_CLASS.NULL) - DYN_delete_security_class2(transaction, FUN.RDB$SECURITY_CLASS); + deleteSecurityClass(tdbb, transaction, FUN.RDB$SECURITY_CLASS); found = true; } END_FOR if (!found && !silent) - { - status_exception::raise( - Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_dyn_func_not_found) << Arg::Str(name)); - } + status_exception::raise(Arg::Gds(isc_dyn_func_not_found) << Arg::Str(name)); if (package.isEmpty()) { @@ -1426,7 +1846,6 @@ text.printf("RecreateFunctionNode\n"); } - DdlNode* RecreateFunctionNode::internalDsqlPass() { createNode->dsqlPass(dsqlScratch); @@ -1434,14 +1853,13 @@ return DdlNode::internalDsqlPass(); } - void RecreateFunctionNode::execute(thread_db* tdbb, jrd_tra* transaction) { // run all statements under savepoint control AutoSavePoint savePoint(tdbb, transaction); - dropNode.executeDdl(tdbb, transaction); - createNode->executeDdl(tdbb, transaction); + dropNode.execute(tdbb, transaction); + createNode->execute(tdbb, transaction); savePoint.release(); // everything is ok } @@ -1488,7 +1906,6 @@ } } - DdlNode* CreateAlterProcedureNode::internalDsqlPass() { DsqlCompiledStatement* statement = dsqlScratch->getStatement(); @@ -1565,7 +1982,6 @@ return DdlNode::internalDsqlPass(); } - void CreateAlterProcedureNode::execute(thread_db* tdbb, jrd_tra* transaction) { fb_assert(create || alter); @@ -1584,11 +2000,7 @@ if (create) // create or alter executeCreate(tdbb, transaction); else - { - status_exception::raise( - Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_dyn_proc_not_found) << Arg::Str(name)); - } + status_exception::raise(Arg::Gds(isc_dyn_proc_not_found) << Arg::Str(name)); } } else @@ -1614,7 +2026,6 @@ } } - void CreateAlterProcedureNode::executeCreate(thread_db* tdbb, jrd_tra* transaction) { Attachment* attachment = transaction->getAttachment(); @@ -1704,7 +2115,6 @@ executeAlter(tdbb, transaction, false, false); } - bool CreateAlterProcedureNode::executeAlter(thread_db* tdbb, jrd_tra* transaction, bool secondPass, bool runTriggers) { @@ -1721,8 +2131,7 @@ { if (!P.RDB$SYSTEM_FLAG.NULL && P.RDB$SYSTEM_FLAG) { - status_exception::raise(Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_dyn_cannot_mod_sysproc) << P.RDB$PROCEDURE_NAME); + status_exception::raise(Arg::Gds(isc_dyn_cannot_mod_sysproc) << P.RDB$PROCEDURE_NAME); } if (!secondPass && runTriggers && package.isEmpty()) @@ -1852,7 +2261,6 @@ return modified; } - void CreateAlterProcedureNode::storeParameter(thread_db* tdbb, jrd_tra* transaction, USHORT type, unsigned pos, const ParameterClause& parameter) { @@ -1905,7 +2313,7 @@ else { MetaName fieldName; - storeGlobalField(tdbb, transaction, parameter, fieldName); + storeGlobalField(tdbb, transaction, fieldName, parameter); strcpy(PRM.RDB$FIELD_SOURCE, fieldName.c_str()); } } @@ -1958,7 +2366,6 @@ END_STORE } - void CreateAlterProcedureNode::compile(thread_db* tdbb, jrd_tra* /*transaction*/) { if (invalid) @@ -2132,7 +2539,6 @@ END_FOR } - void DropProcedureNode::print(string& text, Array<dsql_nod*>& /*nodes*/) const { text.printf( @@ -2141,14 +2547,12 @@ name.c_str()); } - DdlNode* DropProcedureNode::internalDsqlPass() { dsqlScratch->flags |= (DsqlCompilerScratch::FLAG_BLOCK | DsqlCompilerScratch::FLAG_PROCEDURE); return DdlNode::internalDsqlPass(); } - void DropProcedureNode::execute(thread_db* tdbb, jrd_tra* transaction) { // run all statements under savepoint control @@ -2165,10 +2569,7 @@ PRC.RDB$PACKAGE_NAME EQUIV NULLIF(package.c_str(), '') { if (!PRC.RDB$SYSTEM_FLAG.NULL && PRC.RDB$SYSTEM_FLAG) - { - status_exception::raise(Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_dyn_cannot_mod_sysproc) << PRC.RDB$PROCEDURE_NAME); - } + status_exception::raise(Arg::Gds(isc_dyn_cannot_mod_sysproc) << PRC.RDB$PROCEDURE_NAME); if (package.isEmpty()) executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_DROP_PROCEDURE, name); @@ -2176,18 +2577,14 @@ ERASE PRC; if (!PRC.RDB$SECURITY_CLASS.NULL) - DYN_delete_security_class2(transaction, PRC.RDB$SECURITY_CLASS); + deleteSecurityClass(tdbb, transaction, PRC.RDB$SECURITY_CLASS); found = true; } END_FOR if (!found && !silent) - { - status_exception::raise( - Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_dyn_proc_not_found) << Arg::Str(name)); - } + status_exception::raise(Arg::Gds(isc_dyn_proc_not_found) << Arg::Str(name)); if (package.isEmpty()) { @@ -2231,7 +2628,6 @@ text.printf("RecreateProcedureNode\n"); } - DdlNode* RecreateProcedureNode::internalDsqlPass() { dropNode.dsqlPass(dsqlScratch); @@ -2239,14 +2635,13 @@ return DdlNode::internalDsqlPass(); } - void RecreateProcedureNode::execute(thread_db* tdbb, jrd_tra* transaction) { // run all statements under savepoint control AutoSavePoint savePoint(tdbb, transaction); - dropNode.executeDdl(tdbb, transaction); - createNode->executeDdl(tdbb, transaction); + dropNode.execute(tdbb, transaction); + createNode->execute(tdbb, transaction); savePoint.release(); // everything is ok } @@ -2255,15 +2650,156 @@ //---------------------- +void TriggerDefinition::store(thread_db* tdbb, jrd_tra* transaction) +{ + if (name.isEmpty()) + DYN_UTIL_generate_trigger_name(tdbb, transaction, name); + + AutoCacheRequest requestHandle(tdbb, drq_s_triggers2, DYN_REQUESTS); + + STORE (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction) + TRG IN RDB$TRIGGERS + { + TRG.RDB$SYSTEM_FLAG = SSHORT(systemFlag); + TRG.RDB$FLAGS = TRG_sql | (fkTrigger ? TRG_ignore_perm : 0); + strcpy(TRG.RDB$TRIGGER_NAME, name.c_str()); + + TRG.RDB$RELATION_NAME.NULL = relationName.isEmpty(); + strcpy(TRG.RDB$RELATION_NAME, relationName.c_str()); + + fb_assert(type.specified); + TRG.RDB$TRIGGER_TYPE = type.value; + + TRG.RDB$TRIGGER_SEQUENCE = (!position.specified ? 0 : position.value); + TRG.RDB$TRIGGER_INACTIVE = (!active.specified ? 0 : (USHORT) !active.value); + } + END_STORE + + modify(tdbb, transaction); +} + +bool TriggerDefinition::modify(thread_db* tdbb, jrd_tra* transaction) +{ + Attachment* attachment = transaction->getAttachment(); + bool modified = false; + + // ASF: Unregistered bug (2.0, 2.1, 2.5, 3.0): CREATE OR ALTER TRIGGER accepts different table + // than one used in already created trigger. + + AutoCacheRequest requestHandle(tdbb, drq_m_trigger2, DYN_REQUESTS); + + FOR (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction) + TRG IN RDB$TRIGGERS + WITH TRG.RDB$TRIGGER_NAME EQ name.c_str() + { + if (type.specified && type.value != (FB_UINT64) TRG.RDB$TRIGGER_TYPE && + TRG.RDB$RELATION_NAME.NULL) + { + status_exception::raise( + Arg::Gds(isc_dsql_command_err) << + Arg::Gds(isc_dsql_db_trigger_type_cant_change)); + } + + if (systemFlag == fb_sysflag_user && !TRG.RDB$SYSTEM_FLAG.NULL) + { + switch (TRG.RDB$SYSTEM_FLAG) + { + case fb_sysflag_check_constraint: + case fb_sysflag_referential_constraint: + case fb_sysflag_view_check: + status_exception::raise(Arg::Gds(isc_dyn_cant_modify_auto_trig)); + break; + + case fb_sysflag_system: + status_exception::raise( + Arg::Gds(isc_dyn_cannot_mod_systrig) << TRG.RDB$TRIGGER_NAME); + break; + + default: + break; + } + } + + preModify(tdbb, transaction); + + MODIFY TRG + if (blrData.length > 0 || external) + { + fb_assert(!(blrData.length > 0 && external)); + + TRG.RDB$ENGINE_NAME.NULL = TRUE; + TRG.RDB$ENTRYPOINT.NULL = TRUE; + TRG.RDB$TRIGGER_SOURCE.NULL = TRUE; + TRG.RDB$TRIGGER_BLR.NULL = TRUE; + TRG.RDB$DEBUG_INFO.NULL = TRUE; + } + + if (type.specified) + TRG.RDB$TRIGGER_TYPE = type.value; + + if (position.specified) + TRG.RDB$TRIGGER_SEQUENCE = position.value; + if (active.specified) + TRG.RDB$TRIGGER_INACTIVE = (USHORT) !active.value; + + if (external) + { + TRG.RDB$ENGINE_NAME.NULL = FALSE; + strcpy(TRG.RDB$ENGINE_NAME, external->engine.c_str()); + + if (external->name.length() >= sizeof(TRG.RDB$ENTRYPOINT)) + { + status_exception::raise( + Arg::Gds(isc_arith_except) << + Arg::Gds(isc_string_truncation)); + } + + TRG.RDB$ENTRYPOINT.NULL = (SSHORT) external->name.isEmpty(); + strcpy(TRG.RDB$ENTRYPOINT, external->name.c_str()); + } + else if (blrData.length > 0) + { + TRG.RDB$TRIGGER_BLR.NULL = FALSE; + attachment->storeBinaryBlob(tdbb, transaction, &TRG.RDB$TRIGGER_BLR, blrData); + } + + if (debugData.length > 0) + { + TRG.RDB$DEBUG_INFO.NULL = FALSE; + attachment->storeBinaryBlob(tdbb, transaction, &TRG.RDB$DEBUG_INFO, debugData); + } + + if (source.hasData()) + { + TRG.RDB$TRIGGER_SOURCE.NULL = FALSE; + attachment->storeMetaDataBlob(tdbb, transaction, &TRG.RDB$TRIGGER_SOURCE, source); + } + + TRG.RDB$VALID_BLR = TRUE; + + modified = true; + END_MODIFY + } + END_FOR + + if (modified) + postModify(tdbb, transaction); + + return modified; +} + + +//---------------------- + + void CreateAlterTriggerNode::print(string& text, Array<dsql_nod*>& /*nodes*/) const { text.printf( "CreateAlterTriggerNode\n" " name: '%s' create: %d alter: %d relationName: '%s'\n" " type: %d, %d active: %d, %d position: %d, %d\n", - name.c_str(), create, alter, relationName.c_str(), - type.specified, type.value, active.specified, active.value, - position.specified, position.value); + name.c_str(), create, alter, relationName.c_str(), type.specified, type.value, + active.specified, active.value, position.specified, position.value); if (external) { @@ -2274,7 +2810,6 @@ } } - DdlNode* CreateAlterTriggerNode::internalDsqlPass() { DsqlCompiledStatement* statement = dsqlScratch->getStatement(); @@ -2299,7 +2834,6 @@ return DdlNode::internalDsqlPass(); } - void CreateAlterTriggerNode::execute(thread_db* tdbb, jrd_tra* transaction) { fb_assert(create || alter); @@ -2331,27 +2865,22 @@ END_FOR if (!type.specified) - { - status_exception::raise( - Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_dyn_trig_not_found) << Arg::Str(name)); - } + status_exception::raise(Arg::Gds(isc_dyn_trig_not_found) << Arg::Str(name)); } compile(tdbb, transaction); + blrData = dsqlScratch->getBlrData(); + debugData = dsqlScratch->getDebugData(); + if (alter) { - if (!executeAlter(tdbb, transaction, true)) + if (!modify(tdbb, transaction)) { if (create) // create or alter executeCreate(tdbb, transaction); else - { - status_exception::raise( - Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_dyn_trig_not_found) << Arg::Str(name)); - } + status_exception::raise(Arg::Gds(isc_dyn_trig_not_found) << Arg::Str(name)); } } else @@ -2360,166 +2889,13 @@ savePoint.release(); // everything is ok } - void CreateAlterTriggerNode::executeCreate(thread_db* tdbb, jrd_tra* transaction) { executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_TRIGGER, name); - - AutoCacheRequest requestHandle(tdbb, drq_s_triggers2, DYN_REQUESTS); - bool endStore = false; - - try - { - STORE (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction) - TRG IN RDB$TRIGGERS - { - TRG.RDB$SYSTEM_FLAG = 0; - TRG.RDB$FLAGS = TRG_sql; // ASF: For FK triggers, TRG_ignore_perm will also be needed. - strcpy(TRG.RDB$TRIGGER_NAME, name.c_str()); - - TRG.RDB$RELATION_NAME.NULL = relationName.isEmpty(); - strcpy(TRG.RDB$RELATION_NAME, relationName.c_str()); - - fb_assert(type.specified); - TRG.RDB$TRIGGER_TYPE = type.value; - - TRG.RDB$TRIGGER_SEQUENCE = (!position.specified ? 0 : position.value); - TRG.RDB$TRIGGER_INACTIVE = (!active.specified ? 0 : (USHORT) !active.value); - - endStore = true; - } - END_STORE - } - catch (const status_exception& ex) - { - rethrowMetaException(ex, ENCODE_ISC_MSG(31, DYN_MSG_FAC), endStore); // DEFINE TRIGGER failed - } - - executeAlter(tdbb, transaction, false); - + store(tdbb, transaction); executeDdlTrigger(tdbb, transaction, DTW_AFTER, DDL_TRIGGER_CREATE_TRIGGER, name); } - -bool CreateAlterTriggerNode::executeAlter(thread_db* tdbb, jrd_tra* transaction, bool runTriggers) -{ - Attachment* attachment = transaction->getAttachment(); - bool modified = false; - - // ASF: Unregistered bug (2.0, 2.1, 2.5, 3.0): CREATE OR ALTER TRIGGER accepts different table - // than one used in already created trigger. - - AutoCacheRequest requestHandle(tdbb, drq_m_trigger2, DYN_REQUESTS); - - try - { - FOR (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction) - TRG IN RDB$TRIGGERS - WITH TRG.RDB$TRIGGER_NAME EQ name.c_str() - { - if (type.specified && type.value != (FB_UINT64) TRG.RDB$TRIGGER_TYPE && - ((create && relationName.isEmpty()) || TRG.RDB$RELATION_NAME.NULL)) - { - status_exception::raise( - Arg::Gds(isc_dsql_command_err) << - Arg::Gds(isc_dsql_db_trigger_type_cant_change)); - } - - if (!TRG.RDB$SYSTEM_FLAG.NULL) - { - switch (TRG.RDB$SYSTEM_FLAG) - { - case fb_sysflag_check_constraint: - case fb_sysflag_referential_constraint: - case fb_sysflag_view_check: - status_exception::raise(Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_dyn_cant_modify_auto_trig)); - break; - - case fb_sysflag_system: - status_exception::raise(Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_dyn_cannot_mod_systrig) << TRG.RDB$TRIGGER_NAME); - break; - - default: - break; - } - } - - if (runTriggers) - executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_TRIGGER, name); - - MODIFY TRG - if (body || external) - { - fb_assert(!(body && external)); - - TRG.RDB$ENGINE_NAME.NULL = TRUE; - TRG.RDB$ENTRYPOINT.NULL = TRUE; - TRG.RDB$TRIGGER_SOURCE.NULL = TRUE; - TRG.RDB$TRIGGER_BLR.NULL = TRUE; - TRG.RDB$DEBUG_INFO.NULL = TRUE; - } - - if (type.specified) - TRG.RDB$TRIGGER_TYPE = type.value; - - if (position.specified) - TRG.RDB$TRIGGER_SEQUENCE = position.value; - if (active.specified) - TRG.RDB$TRIGGER_INACTIVE = (USHORT) !active.value; - - if (external) - { - TRG.RDB$ENGINE_NAME.NULL = FALSE; - strcpy(TRG.RDB$ENGINE_NAME, external->engine.c_str()); - - if (external->name.length() >= sizeof(TRG.RDB$ENTRYPOINT)) - { - status_exception::raise( - Arg::Gds(isc_arith_except) << - Arg::Gds(isc_string_truncation)); - } - - TRG.RDB$ENTRYPOINT.NULL = (SSHORT) external->name.isEmpty(); - strcpy(TRG.RDB$ENTRYPOINT, external->name.c_str()); - } - else if (body) - { - TRG.RDB$TRIGGER_BLR.NULL = FALSE; - attachment->storeBinaryBlob(tdbb, transaction, &TRG.RDB$TRIGGER_BLR, - dsqlScratch->getBlrData()); - - TRG.RDB$DEBUG_INFO.NULL = FALSE; - attachment->storeBinaryBlob(tdbb, transaction, &TRG.RDB$DEBUG_INFO, - dsqlScratch->getDebugData()); - } - - if (source.hasData()) - { - TRG.RDB$TRIGGER_SOURCE.NULL = FALSE; - attachment->storeMetaDataBlob(tdbb, transaction, &TRG.RDB$TRIGGER_SOURCE, source); - } - - TRG.RDB$VALID_BLR = TRUE; - - modified = true; - END_MODIFY - } - END_FOR - } - catch (const status_exception& ex) - { - rethrowMetaException(ex, ENCODE_ISC_MSG(102, DYN_MSG_FAC), modified); // MODIFY TRIGGER failed - } - - if (modified && runTriggers) - executeDdlTrigger(tdbb, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_TRIGGER, name); - - return modified; -} - - void CreateAlterTriggerNode::compile(thread_db* tdbb, jrd_tra* /*transaction*/) { if (invalid) @@ -2629,14 +3005,12 @@ name.c_str()); } - DdlNode* DropTriggerNode::internalDsqlPass() { dsqlScratch->flags |= (DsqlCompilerScratch::FLAG_BLOCK | DsqlCompilerScratch::FLAG_TRIGGER); return DdlNode::internalDsqlPass(); } - void DropTriggerNode::execute(thread_db* tdbb, jrd_tra* transaction) { // run all statements under savepoint control @@ -2657,13 +3031,12 @@ case fb_sysflag_check_constraint: case fb_sysflag_referential_constraint: case fb_sysflag_view_check: - status_exception::raise(Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_dyn_cant_modify_auto_trig)); + status_exception::raise(Arg::Gds(isc_dyn_cant_modify_auto_trig)); break; case fb_sysflag_system: - status_exception::raise(Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_dyn_cannot_mod_systrig) << X.RDB$TRIGGER_NAME); + status_exception::raise( + Arg::Gds(isc_dyn_cannot_mod_systrig) << X.RDB$TRIGGER_NAME); break; default: @@ -2683,11 +3056,7 @@ END_FOR if (!found && !silent) - { - status_exception::raise( - Arg::Gds(isc_no_meta_update) << - Arg::Gds(isc_dyn_trig_not_found) << Arg::Str(name)); - } + status_exception::raise(Arg::Gds(isc_dyn_trig_not_found) << Arg::Str(name)); requestHandle.reset(tdbb, drq_e_trg_msgs3, DYN_REQUESTS); @@ -2758,7 +3127,6 @@ text.printf("RecreateTriggerNode\n"); } - DdlNode* RecreateTriggerNode::internalDsqlPass() { dropNode.dsqlPass(dsqlScratch); @@ -2766,14 +3134,13 @@ return DdlNode::internalDsqlPass(); } - void RecreateTriggerNode::execute(thread_db* tdbb, jrd_tra* transaction) { // run all statements under savepoint control AutoSavePoint savePoint(tdbb, transaction); - dropNode.executeDdl(tdbb, transaction); - createNode->executeDdl(tdbb, transaction); + dropNode.execute(tdbb, transaction); + createNode->execute(tdbb, transaction); savePoint.release(); // everything is ok } @@ -2805,170 +3172,147 @@ executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_COLLATION, name); - bool endStore = false; + AutoCacheRequest request(tdbb, drq_s_colls, DYN_REQUESTS); - try + STORE(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + X IN RDB$COLLATIONS { - AutoCacheRequest request(tdbb, drq_s_colls, DYN_REQUESTS); + X.RDB$CHARACTER_SET_ID = forCharSetId; + strcpy(X.RDB$COLLATION_NAME, name.c_str()); + X.RDB$SYSTEM_FLAG = 0; - STORE(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) - X IN RDB$COLLATIONS - { - X.RDB$CHARACTER_SET_ID = forCharSetId; - strcpy(X.RDB$COLLATION_NAME, name.c_str()); - X.RDB$SYSTEM_FLAG = 0; + X.RDB$SPECIFIC_ATTRIBUTES.NULL = TRUE; + X.RDB$BASE_COLLATION_NAME.NULL = TRUE; - X.RDB$SPECIFIC_ATTRIBUTES.NULL = TRUE; - X.RDB$BASE_COLLATION_NAME.NULL = TRUE; + CharSet* cs = INTL_charset_lookup(tdbb, forCharSetId); + SubtypeInfo info; - CharSet* cs = INTL_charset_lookup(tdbb, forCharSetId); - SubtypeInfo info; - - if (fromName.hasData()) + if (fromName.hasData()) + { + if (MET_get_char_coll_subtype_info(tdbb, + INTL_CS_COLL_TO_TTYPE(forCharSetId, fromCollationId), &info) && + info.specificAttributes.hasData()) { - if (MET_get_char_coll_subtype_info(tdbb, - INTL_CS_COLL_TO_TTYPE(forCharSetId, fromCollationId), &info) && - info.specificAttributes.hasData()) - { - UCharBuffer temp; - ULONG size = info.specificAttributes.getCount() * cs->maxBytesPerChar(); - - size = INTL_convert_bytes(tdbb, forCharSetId, temp.getBuffer(size), size, - CS_METADATA, info.specificAttributes.begin(), - info.specificAttributes.getCount(), status_exception::raise); - temp.shrink(size); - info.specificAttributes = temp; - } - - strcpy(X.RDB$BASE_COLLATION_NAME, info.baseCollationName.c_str()); - X.RDB$BASE_COLLATION_NAME.NULL = FALSE; - } - else if (fromExternal.hasData()) - { - strcpy(X.RDB$BASE_COLLATION_NAME, fromExternal.c_str()); - X.RDB$BASE_COLLATION_NAME.NULL = FALSE; - } - - if (specificAttributes.hasData()) - { UCharBuffer temp; - ULONG size = specificAttributes.getCount() * cs->maxBytesPerChar(); + ULONG size = info.specificAttributes.getCount() * cs->maxBytesPerChar(); size = INTL_convert_bytes(tdbb, forCharSetId, temp.getBuffer(size), size, - attachment->att_charset, specificAttributes.begin(), - specificAttributes.getCount(), status_exception::raise); + CS_METADATA, info.specificAttributes.begin(), + info.specificAttributes.getCount(), status_exception::raise); temp.shrink(size); - specificAttributes = temp; + info.specificAttributes = temp; } - info.charsetName = forCharSet.c_str(); - info.collationName = name; - if (X.RDB$BASE_COLLATION_NAME.NULL) - info.baseCollationName = info.collationName; - else - info.baseCollationName = X.RDB$BASE_COLLATION_NAME; - info.ignoreAttributes = false; + strcpy(X.RDB$BASE_COLLATION_NAME, info.baseCollationName.c_str()); + X.RDB$BASE_COLLATION_NAME.NULL = FALSE; + } + else if (fromExternal.hasData()) + { + strcpy(X.RDB$BASE_COLLATION_NAME, fromExternal.c_str()); + X.RDB$BASE_COLLATION_NAME.NULL = FALSE; + } - if (!IntlManager::collationInstalled(info.baseCollationName.c_str(), - info.charsetName.c_str())) - { - // msg: 223: "Collation @1 not installed for character set @2" - status_exception::raise( - Arg::Gds(isc_no_meta_update) << - Arg::Gds(ENCODE_ISC_MSG(223, DYN_MSG_FAC)) << - info.baseCollationName << info.charsetName); - } + if (specificAttributes.hasData()) + ... [truncated message content] |
From: <asf...@us...> - 2010-08-02 02:22:33
|
Revision: 51383 http://firebird.svn.sourceforge.net/firebird/?rev=51383&view=rev Author: asfernandes Date: 2010-08-02 02:22:26 +0000 (Mon, 02 Aug 2010) Log Message: ----------- Refactor CREATE/ALTER/CREATE OR ALTER/RECREATE VIEW and cleanup related to previously refactors Modified Paths: -------------- firebird/trunk/lang_helpers/gds_codes.ftn firebird/trunk/lang_helpers/gds_codes.pas firebird/trunk/src/dsql/DdlNodes.epp firebird/trunk/src/dsql/DdlNodes.h firebird/trunk/src/dsql/ddl.cpp firebird/trunk/src/dsql/dsql.h firebird/trunk/src/dsql/metd.epp firebird/trunk/src/dsql/metd_proto.h firebird/trunk/src/dsql/node.h firebird/trunk/src/dsql/parse.y firebird/trunk/src/dsql/pass1.cpp firebird/trunk/src/include/gen/codetext.h firebird/trunk/src/include/gen/iberror.h firebird/trunk/src/include/gen/msgs.h firebird/trunk/src/include/gen/sql_code.h firebird/trunk/src/include/gen/sql_state.h firebird/trunk/src/jrd/drq.h firebird/trunk/src/jrd/dyn.epp firebird/trunk/src/jrd/dyn_def.epp firebird/trunk/src/jrd/dyn_del.epp firebird/trunk/src/jrd/dyn_df_proto.h firebird/trunk/src/jrd/dyn_dl_proto.h firebird/trunk/src/jrd/dyn_md_proto.h firebird/trunk/src/jrd/dyn_mod.epp firebird/trunk/src/jrd/dyn_ut_proto.h firebird/trunk/src/jrd/dyn_util.epp firebird/trunk/src/msgs/facilities2.sql firebird/trunk/src/msgs/messages2.sql firebird/trunk/src/msgs/system_errors2.sql Modified: firebird/trunk/lang_helpers/gds_codes.ftn =================================================================== --- firebird/trunk/lang_helpers/gds_codes.ftn 2010-08-01 20:43:29 UTC (rev 51382) +++ firebird/trunk/lang_helpers/gds_codes.ftn 2010-08-02 02:22:26 UTC (rev 51383) @@ -2076,6 +2076,16 @@ PARAMETER (GDS__dsql_drop_pack_body_failed = 336397296) INTEGER*4 GDS__dsql_recreate_pack_body_failed PARAMETER (GDS__dsql_recreate_pack_body_failed = 336397297) + INTEGER*4 GDS__dsql_create_view_failed + PARAMETER (GDS__dsql_create_view_failed = 336397298) + INTEGER*4 GDS__dsql_alter_view_failed + PARAMETER (GDS__dsql_alter_view_failed = 336397299) + INTEGER*4 GDS__dsql_create_alter_view_failed + PARAMETER (GDS__dsql_create_alter_view_failed = 336397300) + INTEGER*4 GDS__dsql_recreate_view_failed + PARAMETER (GDS__dsql_recreate_view_failed = 336397301) + INTEGER*4 GDS__dsql_drop_view_failed + PARAMETER (GDS__dsql_drop_view_failed = 336397302) INTEGER*4 GDS__gsec_cant_open_db PARAMETER (GDS__gsec_cant_open_db = 336723983) INTEGER*4 GDS__gsec_switches_error Modified: firebird/trunk/lang_helpers/gds_codes.pas =================================================================== --- firebird/trunk/lang_helpers/gds_codes.pas 2010-08-01 20:43:29 UTC (rev 51382) +++ firebird/trunk/lang_helpers/gds_codes.pas 2010-08-02 02:22:26 UTC (rev 51383) @@ -1045,6 +1045,11 @@ gds_dsql_create_pack_body_failed = 336397295; gds_dsql_drop_pack_body_failed = 336397296; gds_dsql_recreate_pack_body_failed = 336397297; + gds_dsql_create_view_failed = 336397298; + gds_dsql_alter_view_failed = 336397299; + gds_dsql_create_alter_view_failed = 336397300; + gds_dsql_recreate_view_failed = 336397301; + gds_dsql_drop_view_failed = 336397302; gds_gsec_cant_open_db = 336723983; gds_gsec_switches_error = 336723984; gds_gsec_no_op_spec = 336723985; Modified: firebird/trunk/src/dsql/DdlNodes.epp =================================================================== --- firebird/trunk/src/dsql/DdlNodes.epp 2010-08-01 20:43:29 UTC (rev 51382) +++ firebird/trunk/src/dsql/DdlNodes.epp 2010-08-02 02:22:26 UTC (rev 51383) @@ -75,8 +75,9 @@ const MetaName& relationName, const MetaName& fieldName, USHORT newPosition, USHORT existingPosition); static rel_t relationType(SSHORT relationTypeNull, SSHORT relationType); +static void saveField(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, const MetaName& fieldName); static void saveRelation(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, - const dsql_str* relationName, bool creating); + const MetaName& relationName, bool view, bool creating); static void updateRdbFields(const TypeClause& type, SSHORT& fieldType, SSHORT& fieldLength, @@ -435,13 +436,27 @@ return relationTypeNull ? rel_persistent : rel_t(relationType); } +// Save the name of a field in the relation or view currently being defined. This is done to support +// definition of triggers which will depend on the metadata created in this statement. +static void saveField(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, const MetaName& fieldName) +{ + dsql_rel* relation = dsqlScratch->relation; + if (!relation) + return; + + MemoryPool& p = relation->rel_flags & REL_new_relation ? + *tdbb->getDefaultPool() : dsqlScratch->getAttachment()->dbb_pool; + dsql_fld* field = FB_NEW(p) dsql_fld(p); + field->fld_name = fieldName.c_str(); + field->fld_next = relation->rel_fields; + relation->rel_fields = field; +} + // Save the name of the relation or view currently being defined. This is done to support definition // of triggers which will depend on the metadata created in this statement. static void saveRelation(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, - const dsql_str* relationName, bool creating) + const MetaName& relationName, bool view, bool creating) { - //// TODO: Verify "creating" usage when using this function for views. - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); if (dsqlScratch->flags & DsqlCompilerScratch::FLAG_METADATA_SAVED) @@ -451,14 +466,15 @@ dsql_rel* relation; - if (!creating) + if (!view && !creating) relation = METD_get_relation(dsqlScratch->getTransaction(), dsqlScratch, relationName); else { MemoryPool& pool = *tdbb->getDefaultPool(); relation = FB_NEW(pool) dsql_rel(pool); - relation->rel_name = relationName->str_data; - relation->rel_flags = REL_creating; + relation->rel_name = relationName; + if (!view) + relation->rel_flags = REL_creating; } dsqlScratch->relation = relation; @@ -511,8 +527,11 @@ fieldScaleNull = FALSE; fieldScale = 0; - characterLengthNull = FALSE; - characterLength = type.charLength; + if (type.charLength != 0) + { + characterLengthNull = FALSE; + characterLength = type.charLength; + } characterSetIdNull = FALSE; characterSetId = type.charSetId; @@ -815,6 +834,11 @@ DDL_resolve_intl_type2(dsqlScratch, legacyField, (collate.isEmpty() ? NULL : MAKE_cstring(collate.c_str())), modifying); + setup(dsqlScratch); +} + +void TypeClause::setup(DsqlCompilerScratch* dsqlScratch) +{ type = legacyField->fld_dtype; length = legacyField->fld_length; scale = legacyField->fld_scale; @@ -2655,7 +2679,7 @@ if (name.isEmpty()) DYN_UTIL_generate_trigger_name(tdbb, transaction, name); - AutoCacheRequest requestHandle(tdbb, drq_s_triggers2, DYN_REQUESTS); + AutoCacheRequest requestHandle(tdbb, drq_s_triggers, DYN_REQUESTS); STORE (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction) TRG IN RDB$TRIGGERS @@ -3403,7 +3427,8 @@ AutoCacheRequest request2(tdbb, drq_l_rfld_coll, DYN_REQUESTS); FOR (REQUEST_HANDLE request2 TRANSACTION_HANDLE transaction) - RF IN RDB$RELATION_FIELDS CROSS F IN RDB$FIELDS + RF IN RDB$RELATION_FIELDS + CROSS F IN RDB$FIELDS WITH RF.RDB$FIELD_SOURCE EQ F.RDB$FIELD_NAME AND F.RDB$CHARACTER_SET_ID EQ COLL.RDB$CHARACTER_SET_ID AND RF.RDB$COLLATION_ID EQ COLL.RDB$COLLATION_ID @@ -4205,7 +4230,7 @@ FOR (REQUEST_HANDLE request TRANSACTION_HANDLE transaction) RFR IN RDB$RELATION_FIELDS WITH RFR.RDB$FIELD_SOURCE = FLD.RDB$FIELD_NAME AND - RFR.RDB$GENERATOR_NAME NOT MISSING + RFR.RDB$GENERATOR_NAME NOT MISSING { // Domain @1 must be of exact number type with zero scale because it's used // in an identity column. @@ -4673,6 +4698,175 @@ //---------------------- +void RelationNode::FieldDefinition::modify(thread_db* tdbb, jrd_tra* transaction) +{ + Attachment* attachment = transaction->tra_attachment; + + AutoRequest request; + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + RFR IN RDB$RELATION_FIELDS + WITH RFR.RDB$RELATION_NAME EQ relationName.c_str() AND + RFR.RDB$FIELD_NAME EQ name.c_str() + { + // ASF: This is prepared only to modify view fields! + + MODIFY RFR + strcpy(RFR.RDB$FIELD_SOURCE, fieldSource.c_str()); + + RFR.RDB$COLLATION_ID.NULL = TRUE; + RFR.RDB$GENERATOR_NAME.NULL = TRUE; + RFR.RDB$IDENTITY_TYPE.NULL = TRUE; + RFR.RDB$NULL_FLAG.NULL = TRUE; + RFR.RDB$DEFAULT_SOURCE.NULL = TRUE; + RFR.RDB$DEFAULT_VALUE.NULL = TRUE; + RFR.RDB$FIELD_POSITION.NULL = TRUE; + + RFR.RDB$VIEW_CONTEXT.NULL = TRUE; + RFR.RDB$BASE_FIELD.NULL = TRUE; + ///RFR.RDB$UPDATE_FLAG.NULL = TRUE; + + if (collationId.specified) + { + RFR.RDB$COLLATION_ID.NULL = FALSE; + RFR.RDB$COLLATION_ID = collationId.value; + } + + SLONG fieldPos = -1; + + if (position.specified) + fieldPos = position.value; + else + { + DYN_UTIL_generate_field_position(tdbb, NULL, name, &fieldPos); + if (fieldPos >= 0) + ++fieldPos; + } + + if (fieldPos >= 0) + { + RFR.RDB$FIELD_POSITION.NULL = FALSE; + RFR.RDB$FIELD_POSITION = SSHORT(fieldPos); + } + + if (baseField.hasData()) + { + RFR.RDB$BASE_FIELD.NULL = FALSE; + strcpy(RFR.RDB$BASE_FIELD, baseField.c_str()); + } + + if (viewContext.specified) + { + fb_assert(baseField.hasData()); + + RFR.RDB$VIEW_CONTEXT.NULL = FALSE; + RFR.RDB$VIEW_CONTEXT = viewContext.value; + + DYN_UTIL_find_field_source(tdbb, transaction, relationName, viewContext.value, + baseField.c_str(), RFR.RDB$FIELD_SOURCE); + } + END_MODIFY + } + END_FOR +} + +void RelationNode::FieldDefinition::store(thread_db* tdbb, jrd_tra* transaction) +{ + Attachment* attachment = transaction->tra_attachment; + + AutoCacheRequest request(tdbb, drq_s_lfields, DYN_REQUESTS); + + STORE(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + RFR IN RDB$RELATION_FIELDS + { + strcpy(RFR.RDB$FIELD_NAME, name.c_str()); + strcpy(RFR.RDB$RELATION_NAME, relationName.c_str()); + strcpy(RFR.RDB$FIELD_SOURCE, fieldSource.c_str()); + RFR.RDB$SYSTEM_FLAG = 0; + + RFR.RDB$COLLATION_ID.NULL = TRUE; + RFR.RDB$GENERATOR_NAME.NULL = TRUE; + RFR.RDB$IDENTITY_TYPE.NULL = TRUE; + RFR.RDB$NULL_FLAG.NULL = TRUE; + RFR.RDB$DEFAULT_SOURCE.NULL = TRUE; + RFR.RDB$DEFAULT_VALUE.NULL = TRUE; + RFR.RDB$FIELD_POSITION.NULL = TRUE; + + RFR.RDB$VIEW_CONTEXT.NULL = TRUE; + RFR.RDB$BASE_FIELD.NULL = TRUE; + ///RFR.RDB$UPDATE_FLAG.NULL = TRUE; + + if (collationId.specified) + { + RFR.RDB$COLLATION_ID.NULL = FALSE; + RFR.RDB$COLLATION_ID = collationId.value; + } + + if (identitySequence.hasData()) + { + RFR.RDB$GENERATOR_NAME.NULL = FALSE; + strcpy(RFR.RDB$GENERATOR_NAME, identitySequence.c_str()); + + RFR.RDB$IDENTITY_TYPE.NULL = FALSE; + RFR.RDB$IDENTITY_TYPE = IDENT_TYPE_BY_DEFAULT; + } + + if (notNullFlag.specified) + { + RFR.RDB$NULL_FLAG.NULL = FALSE; + RFR.RDB$NULL_FLAG = notNullFlag.value; + } + + if (defaultSource.hasData()) + { + RFR.RDB$DEFAULT_SOURCE.NULL = FALSE; + attachment->storeMetaDataBlob(tdbb, transaction, &RFR.RDB$DEFAULT_SOURCE, + defaultSource); + } + + if (defaultValue.length > 0) + { + RFR.RDB$DEFAULT_VALUE.NULL = FALSE; + attachment->storeBinaryBlob(tdbb, transaction, &RFR.RDB$DEFAULT_VALUE, defaultValue); + } + + SLONG fieldPos = -1; + + if (position.specified) + fieldPos = position.value; + else + { + DYN_UTIL_generate_field_position(tdbb, NULL, name, &fieldPos); + if (fieldPos >= 0) + ++fieldPos; + } + + if (fieldPos >= 0) + { + RFR.RDB$FIELD_POSITION.NULL = FALSE; + RFR.RDB$FIELD_POSITION = SSHORT(fieldPos); + } + + if (baseField.hasData()) + { + RFR.RDB$BASE_FIELD.NULL = FALSE; + strcpy(RFR.RDB$BASE_FIELD, baseField.c_str()); + } + + if (viewContext.specified) + { + fb_assert(baseField.hasData()); + + RFR.RDB$VIEW_CONTEXT.NULL = FALSE; + RFR.RDB$VIEW_CONTEXT = viewContext.value; + + DYN_UTIL_find_field_source(tdbb, transaction, relationName, viewContext.value, + baseField.c_str(), RFR.RDB$FIELD_SOURCE); + } + } + END_STORE +} + // Delete local field. // // The rules for dropping a regular column: @@ -4828,6 +5022,29 @@ } } +void RelationNode::storePrivileges(thread_db* tdbb, jrd_tra* transaction) +{ + Attachment* attachment = transaction->tra_attachment; + + AutoCacheRequest request(tdbb, drq_s_usr_prvs, DYN_REQUESTS); + + for (const TEXT* p = ALL_PRIVILEGES; *p; ++p) + { + STORE(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + X IN RDB$USER_PRIVILEGES + { + strcpy(X.RDB$RELATION_NAME, name.c_str()); + strcpy(X.RDB$USER, attachment->att_user->usr_user_name.c_str()); + X.RDB$USER_TYPE = obj_user; + X.RDB$OBJECT_TYPE = obj_relation; + X.RDB$PRIVILEGE[0] = *p; + X.RDB$PRIVILEGE[1] = 0; + X.RDB$GRANT_OPTION = 1; + } + END_STORE + } +} + void RelationNode::defineField(thread_db* tdbb, jrd_tra* transaction, const dsql_nod* element, SSHORT position, const dsql_nod* pkCols) { @@ -4887,157 +5104,109 @@ } } - AutoCacheRequest request(tdbb, drq_s_lfields2, DYN_REQUESTS); + FieldDefinition fieldDefinition(*tdbb->getDefaultPool()); + fieldDefinition.relationName = name; + fieldDefinition.name = field->fld_name; + fieldDefinition.notNullFlag = notNullFlag; - STORE(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) - RFR IN RDB$RELATION_FIELDS - { - const dsql_nod* domainNode = element->nod_arg[Dsql::e_dfl_domain]; - MetaName fieldSource; + if (position >= 0) + fieldDefinition.position = position; - if (domainNode) - { - const dsql_nod* node1 = domainNode->nod_arg[Dsql::e_dom_name]; - const dsql_str* domainName = (dsql_str*) node1->nod_arg[Dsql::e_fln_name]; + const dsql_nod* domainNode = element->nod_arg[Dsql::e_dfl_domain]; - // Get the domain information. - if (!METD_get_domain(transaction, field, domainName->str_data)) - { - // Specified domain or source field does not exist - status_exception::raise( - Arg::Gds(isc_sqlerr) << Arg::Num(-607) << - Arg::Gds(isc_dsql_command_err) << - Arg::Gds(isc_dsql_domain_not_found) << domainName->str_data); - } + if (domainNode) + { + const dsql_nod* node1 = domainNode->nod_arg[Dsql::e_dom_name]; + const dsql_str* domainName = (dsql_str*) node1->nod_arg[Dsql::e_fln_name]; - fieldSource = domainName->str_data; - } - else + // Get the domain information. + if (!METD_get_domain(transaction, field, domainName->str_data)) { - string computedSource; - BlrWriter::BlrData computedValue; - - if (element->nod_arg[e_dfl_computed]) - { - field->fld_flags |= FLD_computed; - - defineComputed(tdbb, field, element->nod_arg[e_dfl_computed], - computedSource, computedValue); - } - - TypeClause fieldType(field, NULL); // Don't use the collate in the generated domain. - fieldType.resolve(dsqlScratch); - - // Generate a domain. - storeGlobalField(tdbb, transaction, fieldSource, fieldType, - computedSource, computedValue); - } - - if ((relation->rel_flags & REL_external) && - (field->fld_dtype == dtype_blob || field->fld_dtype == dtype_array || - field->fld_dimensions)) - { - const char* typeName = (field->fld_dtype == dtype_blob ? "BLOB" : "ARRAY"); - + // Specified domain or source field does not exist status_exception::raise( Arg::Gds(isc_sqlerr) << Arg::Num(-607) << Arg::Gds(isc_dsql_command_err) << - Arg::Gds(isc_dsql_type_not_supp_ext_tab) << typeName << name << field->fld_name); + Arg::Gds(isc_dsql_domain_not_found) << domainName->str_data); } - strcpy(RFR.RDB$FIELD_NAME, field->fld_name.c_str()); - strcpy(RFR.RDB$FIELD_SOURCE, fieldSource.c_str()); - strcpy(RFR.RDB$RELATION_NAME, name.c_str()); - RFR.RDB$SYSTEM_FLAG = 0; + fieldDefinition.fieldSource = domainName->str_data; + } + else + { + string computedSource; + BlrWriter::BlrData computedValue; - RFR.RDB$NULL_FLAG.NULL = TRUE; - RFR.RDB$BASE_FIELD.NULL = TRUE; - RFR.RDB$UPDATE_FLAG.NULL = TRUE; - RFR.RDB$FIELD_POSITION.NULL = TRUE; - RFR.RDB$VIEW_CONTEXT.NULL = TRUE; - RFR.RDB$DEFAULT_VALUE.NULL = TRUE; - RFR.RDB$DEFAULT_SOURCE.NULL = TRUE; - RFR.RDB$COLLATION_ID.NULL = TRUE; - RFR.RDB$GENERATOR_NAME.NULL = TRUE; - RFR.RDB$IDENTITY_TYPE.NULL = TRUE; - - if (element->nod_arg[Dsql::e_dfl_collate]) + if (element->nod_arg[e_dfl_computed]) { - DDL_resolve_intl_type(dsqlScratch, field, (dsql_str*) element->nod_arg[Dsql::e_dfl_collate]); + field->fld_flags |= FLD_computed; - RFR.RDB$COLLATION_ID.NULL = FALSE; - RFR.RDB$COLLATION_ID = SSHORT(field->fld_collation_id); + defineComputed(tdbb, field, element->nod_arg[e_dfl_computed], + computedSource, computedValue); } - if (element->nod_arg[Dsql::e_dfl_identity]) - { - dsc desc; - MET_get_domain(tdbb, fieldSource, &desc, NULL); + TypeClause fieldType(field, NULL); // Don't use the collate in the generated domain. + fieldType.resolve(dsqlScratch); - if (!desc.isExact() || desc.dsc_scale != 0) - { - // Identity column @1 of table @2 must be exact numeric with zero scale. - status_exception::raise( - Arg::Gds(ENCODE_ISC_MSG(273, DYN_MSG_FAC)) << field->fld_name << name); - } + // Generate a domain. + storeGlobalField(tdbb, transaction, fieldDefinition.fieldSource, fieldType, + computedSource, computedValue); + } - MetaName sequenceName; - DYN_UTIL_generate_generator_name(tdbb, sequenceName); + if ((relation->rel_flags & REL_external) && + (field->fld_dtype == dtype_blob || field->fld_dtype == dtype_array || + field->fld_dimensions)) + { + const char* typeName = (field->fld_dtype == dtype_blob ? "BLOB" : "ARRAY"); - CreateSequenceNode::store(tdbb, transaction, sequenceName, - fb_sysflag_identity_generator); + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-607) << + Arg::Gds(isc_dsql_command_err) << + Arg::Gds(isc_dsql_type_not_supp_ext_tab) << typeName << name << field->fld_name); + } - RFR.RDB$GENERATOR_NAME.NULL = FALSE; - strcpy(RFR.RDB$GENERATOR_NAME, sequenceName.c_str()); + if (element->nod_arg[Dsql::e_dfl_collate]) + DDL_resolve_intl_type(dsqlScratch, field, (dsql_str*) element->nod_arg[Dsql::e_dfl_collate]); - RFR.RDB$IDENTITY_TYPE.NULL = FALSE; - RFR.RDB$IDENTITY_TYPE = IDENT_TYPE_BY_DEFAULT; - } + if (element->nod_arg[Dsql::e_dfl_identity]) + { + dsc desc; + MET_get_domain(tdbb, fieldDefinition.fieldSource, &desc, NULL); - if (notNullFlag) + if (!desc.isExact() || desc.dsc_scale != 0) { - RFR.RDB$NULL_FLAG.NULL = FALSE; - RFR.RDB$NULL_FLAG = TRUE; + // Identity column @1 of table @2 must be exact numeric with zero scale. + status_exception::raise( + Arg::Gds(ENCODE_ISC_MSG(273, DYN_MSG_FAC)) << field->fld_name << name); } - if (element->nod_arg[Dsql::e_dfl_default]) - { - string defaultSource; - BlrWriter::BlrData defaultValue; + DYN_UTIL_generate_generator_name(tdbb, fieldDefinition.identitySequence); - if (defineDefault(tdbb, field, element->nod_arg[Dsql::e_dfl_default], defaultSource, - defaultValue) && - notNullFlag) - { - status_exception::raise( - Arg::Gds(isc_sqlerr) << Arg::Num(-204) << - Arg::Gds(isc_bad_default_value) << - Arg::Gds(isc_invalid_clause) << "default null not null"); - } + CreateSequenceNode::store(tdbb, transaction, fieldDefinition.identitySequence, + fb_sysflag_identity_generator); + } - RFR.RDB$DEFAULT_SOURCE.NULL = FALSE; - attachment->storeMetaDataBlob(tdbb, transaction, &RFR.RDB$DEFAULT_SOURCE, defaultSource); + BlrWriter::BlrData defaultValue; - RFR.RDB$DEFAULT_VALUE.NULL = FALSE; - attachment->storeBinaryBlob(tdbb, transaction, &RFR.RDB$DEFAULT_VALUE, defaultValue); - } - - if (position == -1) + if (element->nod_arg[Dsql::e_dfl_default]) + { + if (defineDefault(tdbb, field, element->nod_arg[Dsql::e_dfl_default], + fieldDefinition.defaultSource, defaultValue) && + notNullFlag) { - SLONG fieldPos = -1; - DYN_UTIL_generate_field_position(tdbb, NULL, name, &fieldPos); - if (fieldPos >= 0) - position = SSHORT(fieldPos + 1); + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-204) << + Arg::Gds(isc_bad_default_value) << + Arg::Gds(isc_invalid_clause) << "default null not null"); } - - if (position >= 0) - { - RFR.RDB$FIELD_POSITION.NULL = FALSE; - RFR.RDB$FIELD_POSITION = position; - } } - END_STORE + fieldDefinition.defaultValue = defaultValue; + + if (element->nod_arg[Dsql::e_dfl_collate]) + fieldDefinition.collationId = field->fld_collation_id; + + fieldDefinition.store(tdbb, transaction); + // Define the field constraints. for (ObjectsArray<Constraint>::iterator constraint(constraints.begin()); constraint != constraints.end(); @@ -5130,7 +5299,7 @@ if (field->fld_dtype <= dtype_any_text) { field->fld_character_set_id = DSC_GET_CHARSET(&desc); - field->fld_collation_id= DSC_GET_COLLATE(&desc); + field->fld_collation_id = DSC_GET_COLLATE(&desc); } else field->fld_sub_type = desc.dsc_sub_type; @@ -5639,9 +5808,7 @@ void RelationNode::defineCheckConstraintTrigger(Constraint& constraint, dsql_nod* node, FB_UINT64 triggerType) { - // See hack at pass1_field. - AutoSetRestore2<dsql_nod*, DsqlCompiledStatement> autoDdlNode(dsqlScratch->getStatement(), - &DsqlCompiledStatement::getDdlNode, &DsqlCompiledStatement::setDdlNode, node); + AutoSetRestore<bool> autoCheckConstraintTrigger(&dsqlScratch->checkConstraintTrigger, true); Constraint::BlrWriter& blrWriter = constraint.blrWritersHolder.add(); blrWriter.init(dsqlScratch); @@ -6085,7 +6252,7 @@ { Attachment* attachment = transaction->tra_attachment; - saveRelation(tdbb, dsqlScratch, MAKE_cstring(name.c_str()), true); + saveRelation(tdbb, dsqlScratch, name, false, true); if (externalFile) { @@ -6145,24 +6312,8 @@ } END_STORE - for (const TEXT* p = ALL_PRIVILEGES; *p; ++p) - { - request.reset(tdbb, drq_s_usr_prvs, DYN_REQUESTS); + storePrivileges(tdbb, transaction); - STORE(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) - X IN RDB$USER_PRIVILEGES - { - strcpy(X.RDB$RELATION_NAME, name.c_str()); - strcpy(X.RDB$USER, attachment->att_user->usr_user_name.c_str()); - X.RDB$USER_TYPE = obj_user; - X.RDB$OBJECT_TYPE = obj_relation; - X.RDB$PRIVILEGE[0] = *p; - X.RDB$PRIVILEGE[1] = 0; - X.RDB$GRANT_OPTION = 1; - } - END_STORE - } - ObjectsArray<Constraint> constraints; const dsql_nod* pkCols = findPkColumns(); SSHORT position = 0; @@ -6241,7 +6392,7 @@ { Attachment* attachment = transaction->tra_attachment; - saveRelation(tdbb, dsqlScratch, MAKE_cstring(name.c_str()), false); + saveRelation(tdbb, dsqlScratch, name, false, false); if (!dsqlScratch->relation) { @@ -7076,8 +7227,7 @@ void DropRelationNode::execute(thread_db* tdbb, jrd_tra* transaction) { - AutoPtr<dsql_str> nameStr(MAKE_string(name.c_str(), name.length())); - const dsql_rel* relation = METD_get_relation(transaction, dsqlScratch, nameStr); + const dsql_rel* relation = METD_get_relation(transaction, dsqlScratch, name); if (!relation && silent) return; @@ -7141,6 +7291,927 @@ //---------------------- +void CreateAlterViewNode::print(string& text, Array<dsql_nod*>& /*nodes*/) const +{ + text.printf( + "CreateAlterViewNode\n" + " name: '%s'\n", + name.c_str()); +} + +void CreateAlterViewNode::execute(thread_db* tdbb, jrd_tra* transaction) +{ + Attachment* attachment = transaction->tra_attachment; + + const dsql_rel* modifyingView = NULL; + + if (alter) + { + modifyingView = METD_get_relation(dsqlScratch->getTransaction(), dsqlScratch, name); + + if (!modifyingView && !create) + status_exception::raise(Arg::Gds(isc_dyn_view_not_found) << name); + } + + saveRelation(tdbb, dsqlScratch, name, true, modifyingView == NULL); + + // run all statements under savepoint control + AutoSavePoint savePoint(tdbb, transaction); + + const int ddlTriggerAction = (modifyingView ? DDL_TRIGGER_ALTER_VIEW : DDL_TRIGGER_CREATE_VIEW); + + executeDdlTrigger(tdbb, transaction, DTW_BEFORE, ddlTriggerAction, name); + + if (!modifyingView) + DYN_UTIL_check_unique_name(tdbb, transaction, name, obj_relation); + + // Compile the SELECT statement into a record selection expression, making sure to bump the + // context number since view contexts start at 1 (except for computed fields) -- note that + // calling PASS1_rse directly rather than PASS1_statement saves the context stack. + + DDL_reset_context_stack(dsqlScratch); + ++dsqlScratch->contextNumber; + selectExpr->nod_flags |= NOD_SELECT_VIEW_FIELDS; + dsql_nod* rse = PASS1_rse(dsqlScratch, selectExpr, NULL); + + dsqlScratch->getBlrData().clear(); + dsqlScratch->appendUChar(dsqlScratch->isVersion4() ? blr_version4 : blr_version5); + + // ASF: Call GEN_hidden_variables could be a optimization for views to not have + // blr_dcl_variables inside RSE loops, but this is currently not possible because it will + // mix the variables from view fields and view body. + + GEN_expr(dsqlScratch, rse); + dsqlScratch->appendUChar(blr_eoc); + + // Store the blr and source string for the view definition. + + if (modifyingView) + { + AutoCacheRequest request(tdbb, drq_m_view, DYN_REQUESTS); + bool found = false; + + FOR (REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + REL IN RDB$RELATIONS + WITH REL.RDB$RELATION_NAME EQ name.c_str() AND + REL.RDB$VIEW_BLR NOT MISSING + { + found = true; + + MODIFY REL + attachment->storeMetaDataBlob(tdbb, transaction, &REL.RDB$VIEW_SOURCE, source); + attachment->storeBinaryBlob(tdbb, transaction, &REL.RDB$VIEW_BLR, + dsqlScratch->getBlrData()); + END_MODIFY + } + END_FOR + + if (!found) + status_exception::raise(Arg::Gds(isc_dyn_view_not_found) << name); + + AutoRequest request2; + + FOR (REQUEST_HANDLE request2 TRANSACTION_HANDLE transaction) + VR IN RDB$VIEW_RELATIONS + WITH VR.RDB$VIEW_NAME EQ name.c_str() + { + ERASE VR; + } + END_FOR + + request2.reset(); + + FOR (REQUEST_HANDLE request2 TRANSACTION_HANDLE transaction) + TRG IN RDB$TRIGGERS + WITH TRG.RDB$RELATION_NAME EQ name.c_str() AND + TRG.RDB$SYSTEM_FLAG EQ fb_sysflag_view_check + { + ERASE TRG; + } + END_FOR + } + else + { + AutoCacheRequest request(tdbb, drq_s_rels, DYN_REQUESTS); + + STORE(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + REL IN RDB$RELATIONS + { + strcpy(REL.RDB$RELATION_NAME, name.c_str()); + REL.RDB$SYSTEM_FLAG = 0; + REL.RDB$FLAGS = REL_sql; + REL.RDB$RELATION_TYPE = SSHORT(rel_view); + + attachment->storeMetaDataBlob(tdbb, transaction, &REL.RDB$VIEW_SOURCE, source); + attachment->storeBinaryBlob(tdbb, transaction, &REL.RDB$VIEW_BLR, dsqlScratch->getBlrData()); + } + END_STORE + + storePrivileges(tdbb, transaction); + } + + // Define the view source relations from the statement contexts and union contexts. + + while (dsqlScratch->derivedContext.hasData()) + dsqlScratch->context->push(dsqlScratch->derivedContext.pop()); + + while (dsqlScratch->unionContext.hasData()) + dsqlScratch->context->push(dsqlScratch->unionContext.pop()); + + AutoCacheRequest request(tdbb, drq_s_view_rels, DYN_REQUESTS); + + for (DsqlContextStack::iterator temp(*dsqlScratch->context); temp.hasData(); ++temp) + { + const dsql_ctx* context = temp.object(); + const dsql_rel* relation = context->ctx_relation; + const dsql_prc* procedure = context->ctx_procedure; + + if (relation || procedure) + { + const MetaName& refName = relation ? relation->rel_name : procedure->prc_name.identifier; + const char* contextName = context->ctx_alias ? context->ctx_alias : refName.c_str(); + + ViewContextType ctxType; + if (relation) + { + if (!(relation->rel_flags & REL_view)) + ctxType = VCT_TABLE; + else + ctxType = VCT_VIEW; + } + else //if (procedure) + ctxType = VCT_PROCEDURE; + + STORE(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + VRL IN RDB$VIEW_RELATIONS + { + strcpy(VRL.RDB$VIEW_NAME, name.c_str()); + strcpy(VRL.RDB$RELATION_NAME, refName.c_str()); + VRL.RDB$CONTEXT_TYPE = SSHORT(ctxType); + VRL.RDB$VIEW_CONTEXT = context->ctx_context; + strcpy(VRL.RDB$CONTEXT_NAME, contextName); + + if (procedure && procedure->prc_name.package.hasData()) + { + VRL.RDB$PACKAGE_NAME.NULL = FALSE; + strcpy(VRL.RDB$PACKAGE_NAME, procedure->prc_name.package.c_str()); + } + else + VRL.RDB$PACKAGE_NAME.NULL = TRUE; + } + END_STORE + } + } + + // Check privileges on base tables and views. + + request.reset(tdbb, drq_l_view_rels, DYN_REQUESTS); + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + VRL IN RDB$VIEW_RELATIONS CROSS + PREL IN RDB$RELATIONS OVER RDB$RELATION_NAME + WITH VRL.RDB$PACKAGE_NAME MISSING AND + VRL.RDB$VIEW_NAME EQ name.c_str() + { + // CVC: This never matches so it causes unnecessary calls to verify, + // so I included a call to strip trailing blanks. + fb_utils::exact_name_limit(PREL.RDB$OWNER_NAME, sizeof(PREL.RDB$OWNER_NAME)); + + if (attachment->att_user->usr_user_name != PREL.RDB$OWNER_NAME) + { + SecurityClass::flags_t priv; + + // I think this should be the responsability of DFW or the user will find ways to + // circumvent DYN. + if (!DYN_UTIL_get_prot(tdbb, transaction, PREL.RDB$RELATION_NAME, "", &priv)) + { + // ASF: DYN_UTIL_get_prot will throw instead of return false. + fb_assert(false); + } + + if (!(priv & SCL_read)) + { + // msg 32: no permission for %s access to %s %s + status_exception::raise( + Arg::Gds(isc_no_priv) << Arg::Str("SELECT") << // Non-Translatable + // Remember, a view may be based on a view. + "TABLE/VIEW" << // Non-Translatable + // We want to print the name of the base table or view. + MetaName(PREL.RDB$RELATION_NAME)); + } + } + } + END_FOR + + // If there are field names defined for the view, match them in order with the items from the + // SELECT. Otherwise use all the fields from the rse node that was created from the select + // expression. + + const dsql_nod* const* ptr = NULL; + const dsql_nod* const* end = NULL; + + if (viewFields) + { + ptr = viewFields->nod_arg; + end = ptr + viewFields->nod_count; + } + + // Go through the fields list, defining or modifying the local fields; + // If an expression is specified rather than a field, define a global + // field for the computed value as well. + + dsql_nod* items = rse->nod_arg[Dsql::e_rse_items]; + dsql_nod** itemsPtr = items->nod_arg; + SortedArray<dsql_fld*> modifiedFields; + bool updatable = true; + SSHORT position = 0; + + for (const dsql_nod* const* const itemsEnd = itemsPtr + items->nod_count; + itemsPtr < itemsEnd; ++itemsPtr, ++position) + { + dsql_nod* fieldNode = *itemsPtr; + + // Determine the proper field name, replacing the default if necessary. + + const dsql_nod* nameNode = fieldNode; + const dsql_str* aliasName = NULL; + + while (nameNode->nod_type == Dsql::nod_alias || + nameNode->nod_type == Dsql::nod_derived_field || + nameNode->nod_type == Dsql::nod_map) + { + switch (nameNode->nod_type) + { + case Dsql::nod_alias: + if (!aliasName) + aliasName = (dsql_str*) nameNode->nod_arg[Dsql::e_alias_alias]; + nameNode = nameNode->nod_arg[Dsql::e_alias_value]; + break; + + case Dsql::nod_derived_field: + if (!aliasName) + aliasName = (dsql_str*) nameNode->nod_arg[Dsql::e_derived_field_name]; + nameNode = nameNode->nod_arg[Dsql::e_derived_field_value]; + break; + + case Dsql::nod_map: + { + const dsql_map* map = (dsql_map*) nameNode->nod_arg[Dsql::e_map_map]; + nameNode = map->map_node; + break; + } + + default: + break; + } + } + + const dsql_fld* nameField = NULL; + + if (nameNode->nod_type == Dsql::nod_field) + nameField = (dsql_fld*) nameNode->nod_arg[Dsql::e_fld_field]; + + const TEXT* fieldStr = NULL; + + if (aliasName) + fieldStr = aliasName->str_data; + else if (nameField) + fieldStr = nameField->fld_name.c_str(); + + // Check if this is a field or an expression. + + if (fieldNode->nod_type == Dsql::nod_alias) + fieldNode = fieldNode->nod_arg[Dsql::e_alias_value]; + + dsql_fld* field = NULL; + const dsql_ctx* context = NULL; + + if (fieldNode->nod_type == Dsql::nod_field) + { + field = (dsql_fld*) fieldNode->nod_arg[Dsql::e_fld_field]; + context = (dsql_ctx*) fieldNode->nod_arg[Dsql::e_fld_context]; + } + else + updatable = false; + + // If this is an expression, check to make sure there is a name specified. + + if (!ptr && !fieldStr) + { + // must specify field name for view select expression + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-607) << + Arg::Gds(isc_dsql_command_err) << + Arg::Gds(isc_specify_field_err)); + } + + // CVC: Small modification here to catch any mismatch between number of + // explicit field names in a view and number of fields in the select expression, + // see comment below. This closes Firebird Bug #223059. + if (ptr) + { + if (ptr < end) + { + const dsql_str* fieldName = (dsql_str*) (*ptr)->nod_arg[1]; + fieldStr = fieldName->str_data; + } + + ++ptr; + } + + // If not an expression, point to the proper base relation field, + // else make up an SQL field with generated global field for calculations. + + dsql_fld* relField = NULL; + + if (modifyingView) // if we're modifying a view + { + for (relField = modifyingView->rel_fields; relField; relField = relField->fld_next) + { + if (relField->fld_name == fieldStr) + { + if (modifiedFields.exist(relField)) + { + // column @1 appears more than once in ALTER VIEW + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + Arg::Gds(isc_dsql_command_err) << + Arg::Gds(isc_dsql_col_more_than_once_view) << Arg::Str(fieldStr)); + } + + modifiedFields.add(relField); + break; + } + } + } + + FieldDefinition fieldDefinition(*tdbb->getDefaultPool()); + fieldDefinition.relationName = name; + fieldDefinition.name = fieldStr; + fieldDefinition.position = position; + + // CVC: Not sure if something should be done now that isc_dyn_view_context is used here, + // but if alter view is going to work, maybe we need here the context type and package, too. + if (field) + { + TypeClause fieldType(field, NULL); + fieldType.resolve(dsqlScratch); + + fieldDefinition.viewContext = context->ctx_context; + fieldDefinition.baseField = field->fld_name; + + if (field->fld_dtype <= dtype_any_text) + fieldDefinition.collationId = field->fld_collation_id; + + if (relField) // modifying a view + { + // We're now modifying a field and it will be based on another one. So if the old + // field was an expression, delete it now. + + AutoRequest request2; + + FOR(REQUEST_HANDLE request2 TRANSACTION_HANDLE transaction) + RFL IN RDB$RELATION_FIELDS CROSS + FLD IN RDB$FIELDS + WITH RFL.RDB$FIELD_NAME EQ fieldStr AND + RFL.RDB$RELATION_NAME EQ name.c_str() AND + RFL.RDB$BASE_FIELD MISSING AND + FLD.RDB$FIELD_NAME EQ RFL.RDB$FIELD_SOURCE + { + bool wasInternalDomain = fb_utils::implicit_domain(FLD.RDB$FIELD_NAME); + fb_assert(wasInternalDomain); + + if (wasInternalDomain) + ERASE FLD; + } + END_FOR + + fieldDefinition.modify(tdbb, transaction); + } + else + fieldDefinition.store(tdbb, transaction); + } + else + { + dsqlScratch->getBlrData().clear(); + dsqlScratch->appendUChar(dsqlScratch->isVersion4() ? blr_version4 : blr_version5); + GEN_expr(dsqlScratch, fieldNode); + dsqlScratch->appendUChar(blr_eoc); + + // Get the type of the expression. + dsc desc; + MAKE_desc(dsqlScratch, &desc, fieldNode, NULL); + + dsql_fld newField(*tdbb->getDefaultPool()); + newField.fld_dtype = desc.dsc_dtype; + newField.fld_length = desc.dsc_length; + newField.fld_scale = desc.dsc_scale; + + if (desc.isText() || (desc.isBlob() && desc.getBlobSubType() == isc_blob_text)) + { + newField.fld_character_set_id = desc.getCharSet(); + newField.fld_collation_id = desc.getTextType(); + } + + if (desc.isText()) + { + newField.fld_character_length = newField.fld_length; + newField.fld_length *= METD_get_charset_bpc( + dsqlScratch->getTransaction(), newField.fld_character_set_id); + } + else + newField.fld_sub_type = desc.dsc_sub_type; + + TypeClause fieldType(&newField, NULL); + fieldType.setup(dsqlScratch); + + if (relField) // modifying a view + { + AutoRequest request2; + + FOR(REQUEST_HANDLE request2 TRANSACTION_HANDLE transaction) + RFL IN RDB$RELATION_FIELDS CROSS + FLD IN RDB$FIELDS + WITH RFL.RDB$FIELD_NAME EQ fieldStr AND + RFL.RDB$RELATION_NAME EQ name.c_str() AND + RFL.RDB$BASE_FIELD MISSING AND + FLD.RDB$FIELD_NAME EQ RFL.RDB$FIELD_SOURCE + { + bool wasInternalDomain = fb_utils::implicit_domain(FLD.RDB$FIELD_NAME); + fb_assert(wasInternalDomain); + + if (wasInternalDomain) + { + fieldDefinition.fieldSource = FLD.RDB$FIELD_NAME; + + MODIFY FLD + updateRdbFields(fieldType, + FLD.RDB$FIELD_TYPE, + FLD.RDB$FIELD_LENGTH, + FLD.RDB$FIELD_SUB_TYPE.NULL, FLD.RDB$FIELD_SUB_TYPE, + FLD.RDB$FIELD_SCALE.NULL, FLD.RDB$FIELD_SCALE, + FLD.RDB$CHARACTER_SET_ID.NULL, FLD.RDB$CHARACTER_SET_ID, + FLD.RDB$CHARACTER_LENGTH.NULL, FLD.RDB$CHARACTER_LENGTH, + FLD.RDB$FIELD_PRECISION.NULL, FLD.RDB$FIELD_PRECISION, + FLD.RDB$COLLATION_ID.NULL, FLD.RDB$COLLATION_ID, + FLD.RDB$SEGMENT_LENGTH.NULL, FLD.RDB$SEGMENT_LENGTH); + + FLD.RDB$COMPUTED_BLR.NULL = FALSE; + attachment->storeBinaryBlob(tdbb, transaction, &FLD.RDB$COMPUTED_BLR, + dsqlScratch->getBlrData()); + END_MODIFY + } + } + END_FOR + + if (fieldDefinition.fieldSource.isEmpty()) + { + storeGlobalField(tdbb, transaction, fieldDefinition.fieldSource, fieldType, + "", dsqlScratch->getBlrData()); + } + + fieldDefinition.modify(tdbb, transaction); + } + else + { + storeGlobalField(tdbb, transaction, fieldDefinition.fieldSource, fieldType, + "", dsqlScratch->getBlrData()); + + fieldDefinition.store(tdbb, transaction); + } + } + + if (fieldStr) + saveField(tdbb, dsqlScratch, fieldStr); + } + + // CVC: This message was not catching the case when + // #fields < items in select list, see comment above. + + if (ptr != end) + { + // number of fields does not match select list + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-607) << + Arg::Gds(isc_dsql_command_err) << + Arg::Gds(isc_num_field_err)); + } + + if (modifyingView) // modifying a view + { + // Delete the old fields not present in the new definition. + for (dsql_fld* relField = modifyingView->rel_fields; relField; relField = relField->fld_next) + { + if (!modifiedFields.exist(relField)) + deleteLocalField(tdbb, transaction, name, relField->fld_name); + } + } + + // Setup to define triggers for WITH CHECK OPTION. + + if (withCheckOption) + { + if (!updatable) + { + // Only simple column names permitted for VIEW WITH CHECK OPTION + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-607) << + Arg::Gds(isc_dsql_command_err) << + Arg::Gds(isc_col_name_err)); + } + + dsql_nod* querySpec = selectExpr->nod_arg[Dsql::e_sel_query_spec]; + + if (querySpec->nod_type == Dsql::nod_list) + { + // Only one table allowed for VIEW WITH CHECK OPTION + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-607) << + Arg::Gds(isc_dsql_command_err) << + Arg::Gds(isc_table_view_err)); + } + + if (querySpec->nod_arg[Dsql::e_qry_from]->nod_count != 1) + { + // Only one table allowed for VIEW WITH CHECK OPTION + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-607) << + Arg::Gds(isc_dsql_command_err) << + Arg::Gds(isc_table_view_err)); + } + + if (!querySpec->nod_arg[Dsql::e_qry_where]) + { + // No where clause for VIEW WITH CHECK OPTION + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-607) << + Arg::Gds(isc_dsql_command_err) << + Arg::Gds(isc_where_err)); + } + + if (querySpec->nod_arg[Dsql::e_qry_distinct] || querySpec->nod_arg[Dsql::e_qry_group] || + querySpec->nod_arg[Dsql::e_qry_having]) + { + // DISTINCT, GROUP or HAVING not permitted for VIEW WITH CHECK OPTION + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-607) << + Arg::Gds(isc_dsql_command_err) << + Arg::Gds(isc_distinct_err)); + } + + createCheckTriggers(tdbb, transaction, items); + } + + DDL_reset_context_stack(dsqlScratch); + + executeDdlTrigger(tdbb, transaction, DTW_AFTER, ddlTriggerAction, name); + + savePoint.release(); // everything is ok + + // Update DSQL cache + METD_drop_relation(transaction, name); + MET_dsql_cache_release(tdbb, SYM_relation, name); +} + +// Generate triggers to implement the WITH CHECK OPTION clause for a VIEW. +void CreateAlterViewNode::createCheckTriggers(thread_db* tdbb, jrd_tra* transaction, dsql_nod* items) +{ + // Specify that the trigger should abort if the condition is not met. + dsql_nod* actionNode = MAKE_node(Dsql::nod_list, 1); + actionNode->nod_arg[0] = MAKE_node(Dsql::nod_gdscode, 1); + actionNode->nod_arg[0]->nod_arg[0] = (dsql_nod*) MAKE_cstring("check_constraint"); + + // Create the UPDATE trigger. + + dsql_nod* baseAndNode = NULL; + dsql_nod* baseRelation = NULL; + defineUpdateAction(dsqlScratch, &baseAndNode, &baseRelation, items); + fb_assert(baseAndNode); + fb_assert(baseRelation); + + dsql_nod* rse = MAKE_node(Dsql::nod_rse, e_rse_count); + rse->nod_arg[e_rse_boolean] = baseAndNode; + dsql_nod* temp = MAKE_node(Dsql::nod_list, 1); + rse->nod_arg[e_rse_streams] = temp; + temp->nod_arg[0] = baseRelation; + + createCheckTrigger(tdbb, dsqlScratch, rse, items, actionNode, PRE_MODIFY_TRIGGER); + createCheckTrigger(tdbb, dsqlScratch, NULL, items, actionNode, PRE_STORE_TRIGGER); +} + +// Define a trigger for a VIEW WITH CHECK OPTION. +void CreateAlterViewNode::createCheckTrigger(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, + dsql_nod* rse, dsql_nod* items, dsql_nod* actions, TriggerType triggerType) +{ + AutoSetRestore<bool> autoCheckConstraintTrigger(&dsqlScratch->checkConstraintTrigger, true); + + const dsql_nod* querySpec = selectExpr->nod_arg[Dsql::e_sel_query_spec]; + dsql_nod* relationNode = dsqlNode; + + // Generate the trigger blr. + + dsqlScratch->getBlrData().clear(); + dsqlScratch->getDebugData().clear(); + dsqlScratch->appendUChar(dsqlScratch->isVersion4() ? blr_version4 : blr_version5); + + dsqlScratch->appendUChar(blr_begin); + + // Create the "OLD" and "NEW" contexts for the trigger -- the new one could be a dummy place + // holder to avoid resolving fields to that context but prevent relations referenced in + // the trigger actions from referencing the predefined "1" context. + + dsql_ctx* savContext = NULL; + dsql_ctx* context = NULL; + + if (dsqlScratch->contextNumber) + { + // If an alias is specified for the single base table involved, + // save and then add the context. + + context = dsqlScratch->context->object(); + + if (context->ctx_alias) + { + MemoryPool& pool = *tdbb->getDefaultPool(); + savContext = FB_NEW(pool) dsql_ctx(pool); + *savContext = *context; + } + } + + DDL_reset_context_stack(dsqlScratch); + + dsql_nod* tempAlias = relationNode->nod_arg[Dsql::e_rln_alias]; + + relationNode->nod_arg[Dsql::e_rln_alias] = (dsql_nod*) MAKE_cstring(OLD_CONTEXT); + dsql_ctx* oldContext = PASS1_make_context(dsqlScratch, relationNode); + oldContext->ctx_flags |= CTX_system; + + relationNode->nod_arg[Dsql::e_rln_alias] = (dsql_nod*) MAKE_cstring(NEW_CONTEXT); + dsql_ctx* newContext = PASS1_make_context(dsqlScratch, relationNode); + newContext->ctx_flags |= CTX_system; + + relationNode->nod_arg[Dsql::e_rln_alias] = tempAlias; + + if (savContext) + { + savContext->ctx_context = dsqlScratch->contextNumber++; + context->ctx_scope_level = dsqlScratch->scopeLevel; + dsqlScratch->context->push(savContext); + } + + // Generate the condition for firing the trigger. + + dsql_nod* condition; + + if (triggerType == PRE_MODIFY_TRIGGER) + { + dsqlScratch->appendUChar(blr_for); + + dsql_nod* temp = rse->nod_arg[Dsql::e_rse_streams]; + temp->nod_arg[0] = PASS1_node(dsqlScratch, temp->nod_arg[0]); + temp = rse->nod_arg[Dsql::e_rse_boolean]; + + rse->nod_arg[Dsql::e_rse_boolean] = PASS1_node(dsqlScratch, temp); + GEN_expr(dsqlScratch, rse); + + condition = replaceFieldNames(querySpec->nod_arg[Dsql::e_qry_where], items, + viewFields, false, NEW_CONTEXT); + } + else if (triggerType == PRE_STORE_TRIGGER) + { + condition = replaceFieldNames(querySpec->nod_arg[Dsql::e_qry_where], items, + viewFields, true, NEW_CONTEXT); + } + else + { + fb_assert(false); + } + + dsqlScratch->appendUChar(blr_if); + GEN_expr(dsqlScratch, PASS1_node(dsqlScratch, condition)); + dsqlScratch->appendUChar(blr_begin); + dsqlScratch->appendUChar(blr_end); + + // Generate the action statements for the trigger. + + dsql_nod** ptr = actions->nod_arg; + + for (const dsql_nod* const* const end = ptr + actions->nod_count; ptr != end; ++ptr) + GEN_statement(dsqlScratch, PASS1_statement(dsqlScratch, *ptr)); + + dsqlScratch->appendUChar(blr_end); // of begin + dsqlScratch->appendUChar(blr_eoc); + + DDL_reset_context_stack(dsqlScratch); + + TriggerDefinition trigger(*tdbb->getDefaultPool()); + trigger.systemFlag = fb_sysflag_view_check; + trigger.relationName = name; + trigger.type = triggerType; + trigger.blrData = dsqlScratch->getBlrData(); + trigger.store(tdbb, dsqlScratch->getTransaction()); +} + +// Define an action statement which, given a view definition, will map an update to a record from +// a view of a single relation into the base relation. +void CreateAlterViewNode::defineUpdateAction(DsqlCompilerScratch* dsqlScratch, + dsql_nod** baseAndNode, dsql_nod** baseRelation, dsql_nod* items) +{ + // Check whether this is an updatable view definition. + + dsql_nod* querySpec = NULL; + dsql_nod* fromList = NULL; + + if (!(querySpec = selectExpr->nod_arg[Dsql::e_sel_query_spec]) || + !(fromList = querySpec->nod_arg[Dsql::e_qry_from]) || + fromList->nod_count != 1) + { + // The caller seems throwing proper errors for all the above conditions. + // But just in case it doesn't, here we have the final attempt to prevent the bad things. + fb_assert(false); + } + + // Use the relation referenced in the select statement for rse. + + dsql_nod* relationNode = MAKE_node(Dsql::nod_relation_name, (int) Dsql::e_rln_count); + relationNode->nod_arg[Dsql::e_rln_name] = fromList->nod_arg[0]->nod_arg[Dsql::e_rln_name]; + relationNode->nod_arg[Dsql::e_rln_alias] = (dsql_nod*) MAKE_cstring(TEMP_CONTEXT); + *baseRelation = relationNode; + + // Get the list of values and fields to compare to -- if there is no list of fields, get all + // fields in the base relation that are not computed. + + dsql_nod* valuesNode = viewFields; + dsql_nod* fieldsNode = querySpec->nod_arg[Dsql::e_qry_list]; + + if (!fieldsNode) + { + const dsql_rel* relation = METD_get_relation(dsqlScratch->getTransaction(), + dsqlScratch, name); + DsqlNodStack field_stack; + + for (const dsql_fld* field = relation->rel_fields; field; field = field->fld_next) + { + if (!(field->fld_flags & FLD_computed)) + field_stack.push(MAKE_field_name(field->fld_name.c_str())); + } + + fieldsNode = MAKE_list(field_stack); + } + + if (!valuesNode) + valuesNode = fieldsNode; + + // Generate the list of assignments to fields in the base relation. + + dsql_nod** ptr = fieldsNode->nod_arg; + const dsql_nod* const* const end = ptr + fieldsNode->nod_count; + dsql_nod** ptr2 = valuesNode->nod_arg; + const dsql_nod* const* const end2 = ptr2 + valuesNode->nod_count; + dsql_nod* andNode = MAKE_node(Dsql::nod_and, 2); + int andArg = 0; + + for (; (ptr < end) && (ptr2 < end2); ptr++, ptr2++) + { + dsql_nod* fieldNode = *ptr; + if (fieldNode->nod_type == Dsql::nod_alias) + fieldNode = fieldNode->nod_arg[Dsql::e_alias_value]; + + // Generate the actual comparisons. + + if (fieldNode->nod_type == Dsql::nod_field_name) + { + fieldNode->nod_arg[Dsql::e_fln_context] = (dsql_nod*) MAKE_cstring(TEMP_CONTEXT); + + dsql_nod* oldValueNode = MAKE_node(Dsql::nod_field_name, (int) Dsql::e_fln_count); + oldValueNode->nod_arg[Dsql::e_fln_name] = (*ptr2)->nod_arg[Dsql::e_fln_name]; + oldValueNode->nod_arg[Dsql::e_fln_context] = (dsql_nod*) MAKE_cstring(OLD_CONTEXT); + + dsql_nod* eqlNode = MAKE_node(Dsql::nod_eql, 2); + eqlNode->nod_arg[0] = oldValueNode; + eqlNode->nod_arg[1] = fieldNode; + + dsql_nod* nullNode1 = MAKE_node(Dsql::nod_missing, 1); + nullNode1->nod_arg[0] = oldValueNode; + dsql_nod* nullNode2 = MAKE_node(Dsql::nod_missing, 1); + nullNode2->nod_arg[0] = fieldNode; + + dsql_nod* andNode2 = MAKE_node(Dsql::nod_and, 2); + andNode2->nod_arg[0] = nullNode1; + andNode2->nod_arg[1] = nullNode2; + + dsql_nod* orNode = MAKE_node(Dsql::nod_or, 2); + orNode->nod_arg[0] = eqlNode; + orNode->nod_arg[1] = andNode2; + + if (andArg <= 1) + andNode->nod_arg[andArg++] = orNode; + else + { + dsql_nod* oldAnd = andNode; + andNode = MAKE_node(Dsql::nod_and, (int) 2); + andNode->nod_arg[0] = oldAnd; + andNode->nod_arg[1] = orNode; + } + } + } + + if (andArg <= 1) + { + andNode->nod_arg[andArg] = replaceFieldNames(querySpec->nod_arg[Dsql::e_qry_where], + items, NULL, false, TEMP_CONTEXT); + } + else + { + dsql_nod* oldAnd = andNode; + andNode = MAKE_node(Dsql::nod_and, 2); + andNode->nod_arg[0] = oldAnd; + andNode->nod_arg[1] = replaceFieldNames(querySpec->nod_arg[Dsql::e_qry_where], + items, NULL, false, TEMP_CONTEXT); + } + + *baseAndNode = andNode; +} + +// Given an input node tree, find any field name nodes and replace them according to the mapping +// provided. This is used to create view WITH CHECK OPTION. +dsql_nod* CreateAlterViewNode::replaceFieldNames(dsql_nod* input, dsql_nod* searchFields, + dsql_nod* replaceFields, bool nullThem, const char* contextName) +{ + if (!input || input->getType() != dsql_type_nod) + return input; + + const dsql_nod* const* const endo = input->nod_arg + input->nod_count; + + for (dsql_nod** ptr = input->nod_arg; ptr < endo; ++ptr) + { + if ((*ptr)->nod_type == Dsql::nod_select_expr) + { + // No subqueries permitted for VIEW WITH CHECK OPTION + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-607) << + Arg::Gds(isc_dsql_command_err) << + Arg::Gds(isc_subquery_err)); + } + + if ((*ptr)->nod_type == Dsql::nod_field_name) + { + // Found a field node, check if it needs to be replaced. + + const dsql_str* fieldName = (dsql_str*) (*ptr)->nod_arg[Dsql::e_fln_name]; + dsql_nod** search = searchFields->nod_arg; + const dsql_nod* const* const end = search + searchFields->nod_count; + dsql_nod** replace = NULL; + + if (replaceFields) + replace = replaceFields->nod_arg; + + bool found = false; + + for (; search < end; ++search, replaceFields ? ++replace : NULL) + { + const dsql_str* replaceName = NULL; + if (replaceFields) + replaceName = (dsql_str*) (*replace)->nod_arg[Dsql::e_fln_name]; + + const dsql_nod* fieldNode = *search; + const dsql_fld* field = (dsql_fld*) fieldNode->nod_arg[Dsql::e_fld_field]; + + if (field->fld_name == fieldName->str_data) + { + found = true; + + if (replaceFields) + (*ptr)->nod_arg[e_fln_name] = (*replace)->nod_arg[Dsql::e_fln_name]; + + (*ptr)->nod_arg[Dsql::e_fln_context] = (dsql_nod*) MAKE_cstring(contextName); + + } + + if (nullThem && replaceFields && + strcmp(fieldName->str_data, replaceName->str_data) == 0) + { + found = true; + } + } + + if (nullThem && !found) + (*ptr) = MAKE_node(Dsql::nod_null, 0); + } + else + { + // Recursively go through the input tree looking for field name nodes. + replaceFieldNames(*ptr, searchFields, replaceFields, nullThem, contextName); + } + } + + return input; +} + + +//---------------------- + + // Store an index. void CreateIndexNode::store(thread_db* tdbb, jrd_tra* transaction, MetaName& name, Definition& definition, MetaName* referredIndexName) Modified: firebird/trunk/src/dsql/DdlNodes.h =================================================================== --- firebird/trunk/src/dsql/DdlNodes.h 2010-08-01 20:43:29 UTC (rev 51382) +++ firebird/trunk/src/dsql/DdlNodes.h 2010-08-02 02:22:26 UTC (rev 51383) @@ -68,6 +68,7 @@ public: void resolve(DsqlCompilerScratch* dsqlScratch, bool modifying = false); + void setup(DsqlCompilerScratch* dsqlScratch); public: virtual void print(Firebird::string& text) const; @@ -961,6 +962,36 @@ class RelationNode : public DdlNode { public: + class FieldDefinition + { + public: + FieldDefinition(MemoryPool& p) + : name(p), + relationName(p), + fieldSource(p), + identitySequence(p), + defaultSource(p), + baseField(p) + { + } + + void modify(thread_db* tdbb, jrd_tra* transaction); + void store(thread_db* tdbb, jrd_tra* transaction); + + public: + Firebird::MetaName name; + Firebird::MetaName relationName; + Firebird::MetaName fieldSource; + Firebird::MetaName identitySequence; + Nullable<USHORT> collationId; + Nullable<bool> notNullFlag; + Nullable<USHORT> position; + Firebird::string defaultSource; + Firebird::ByteChunk defaultValue; + Nullable<USHORT> viewContext; + Firebird::MetaName baseField; + }; + struct Constraint : public PermanentStorage { enum Type { TYPE_CHECK, TYPE_NOT_NULL, TYPE_PK, TYPE_UNIQUE, TYPE_FK }; @@ -1039,6 +1070,7 @@ const Firebird::MetaName& relationName, const Firebird::MetaName& fieldName); protected: + void storePrivileges(thread_db* tdbb, jrd_tra* transaction); void defineField(thread_db* tdbb, jrd_tra* transaction, const dsql_nod* element, SSHORT position, const dsql_nod* pkcols); void defineComputed(thread_db* tdbb, dsql_fld* field, dsql_nod* node, @@ -1159,10 +1191,10 @@ { public: explicit RecreateRelationNode(MemoryPool& p, const Firebird::string& sqlText, - CreateRelationNode* aCreateNode) + RelationNode* aCreateNode, bool view) : DdlNode(p, sqlText), createNode(aCreateNode), - dropNode(p, sqlText, createNode->name, false) + dropNode(p, sqlText, createNode->name, view) { dropNode.silent = true; } @@ -1174,17 +1206,67 @@ protected: virtual void putErrorPrefix(Firebird::Arg::StatusVector& statusVector) { - statusVector << Firebird::Arg::Gds(isc_dsql_recreate_table_failed) << createNode->name; + ISC_STATUS code = dropNode.view ? + isc_dsql_recreate_table_failed : isc_dsql_recreate_table_failed; + statusVector << Firebird::Arg::Gds(code) << createNode->name; } virtual DdlNode* internalDsqlPass(); private: - CreateRelationNode* createNode; + RelationNode* createNode; DropRelationNode dropNode; }; +class CreateAlterViewNode : public RelationNode +{ +public: + explicit CreateAlterViewNode(MemoryPool& p, const Firebird::string& sqlText, + dsql_nod* aDsqlNode, dsql_nod* aViewFields, dsql_nod* aSelectExpr) + : RelationNode(p, sqlText, aDsqlNode), + create(true), + alter(false), + viewFields(aViewFields), + selectExpr(aSelectExpr), + source(p), + withCheckOption(false) + { + } + +public: + virtual void print(Firebird::string& text, Firebird::Array<dsql_nod*>& nodes) const; + virtual void execute(thread_db* tdbb, jrd_tra* transaction); + +protected: + virtual void putErrorPrefix(Firebird::Arg::StatusVector& statusVector) + { + statusVector << + Firebird::Arg::Gds(createAlterCode(create, alter, + isc_dsql_create_view_failed, isc_dsql_alter_view_failed, + isc_dsql_create_alter_view_failed)) << + name; + } + +private: + void createCheckTriggers(thread_db* tdbb, jrd_tra* transaction, dsql_nod* items); + void createCheckTrigger(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, + dsql_nod* rse, dsql_nod* items, dsql_nod* actions, TriggerType triggerType); + void defineUpdateAction(DsqlCompilerScratch* dsqlScratch, dsql_nod** baseAndNode, + dsql_nod** baseRelation, dsql_nod* items); + static dsql_nod* replaceFieldNames(dsql_nod* input, dsql_nod* searchFields, + dsql_nod* replaceFields, bool nullThem, const char* contextName); + +public: + bool create; + bool alter; + dsql_nod* viewFields; + dsql_nod* selectExpr; + Firebird::string source; + bool withCheckOption; +}; + + class CreateIndexNode { public: Modified: firebird/trunk/src/dsql/ddl.cpp =================================================================== --- firebird/trunk/src/dsql/ddl.cpp 2010-08-01 20:43:29 UTC (rev 51382) +++ firebird/trunk/src/dsql/ddl.cpp 2010-08-02 02:22:26 UTC (rev 51383) @@ -113,7 +113,6 @@ static void assign_field_length(dsql_fld*, USHORT); -static void create_view_triggers(DsqlCompilerScratch*, dsql_nod*, dsql_nod*); static void define_computed(DsqlCompilerScratch*, dsql_nod*, dsql_fld*, dsql_nod*); static void define_database(DsqlCompilerScratch*); static void define_filter(DsqlCompilerScratch*); @@ -122,10 +121,6 @@ static void define_index(DsqlCompilerScratch*); static void define_shadow(DsqlCompilerScratch*); static void define_udf(DsqlCompilerScratch*); -static void define_update_action(DsqlCompilerScratch*, dsql_nod**, dsql_nod**, dsql_nod*); -static void define_view(DsqlCompilerScratch*, NOD_TYPE); -static void define_view_trigger(DsqlCompilerScratch*, dsql_nod*, dsql_nod*, dsql_nod*); -static void delete_relation_view(DsqlCompilerScratch*, dsql_nod*, bool); static void generate_dyn(DsqlCompilerScratch*, dsql_nod*); static void grant_revoke(DsqlCompilerScratch*); static void modify_database(DsqlCompilerScratch*); @@ -139,11 +134,8 @@ static void modify_udf(DsqlCompilerScratch*); static void modify_map(DsqlCompilerScratch*); static void process_role_nm_list(DsqlCompilerScratch*, SSHORT, const dsql_nod*, const dsql_nod*, NOD_TYPE, const dsql_nod*); -static void put_descriptor(DsqlCompilerScratch*, const dsc*); static void put_field(DsqlCompilerScratch*, dsql_fld*, bool); static dsql_nod* replace_field_names(dsql_nod*, dsql_nod*, dsql_nod*, bool, const char*); -static void save_field(DsqlCompilerScratch*, const SCHAR*); -static void save_relation(DsqlCompilerScratch*, const dsql_str*); static void set_statistics(DsqlCompilerScratch*); static void define_user(DsqlCompilerScratch*, UCHAR); static void put_grantor(DsqlCompilerScratch* dsqlScratch, const dsql_nod* grantor); @@ -189,14 +181,6 @@ switch (type) { - case nod_mod_view: - case nod_replace_view: - case nod_redef_view: - string = (dsql_str*) statement->getDdlNode()->nod_arg[e_alt_name]; - sym_type = SYM_relation; - METD_drop_relation(request->getTransaction(), string->str_data); - break; - case nod_del_udf: case nod_mod_udf: // Signal UDF for obsolescence @@ -329,7 +313,7 @@ if (field->fld_type_of_table) { dsql_rel* relation = METD_get_relation(dsqlScratch->getTransaction(), dsqlScratch, - field->fld_type_of_table); + field->fld_type_of_table->str_data); const dsql_fld* fld = NULL; if (relation) @@ -633,61 +617,6 @@ } -static void create_view_triggers(DsqlCompilerScratch* dsqlScratch, dsql_nod* element, dsql_nod* items) -{ -/************************************** - * - * c r e a t e _ v i e w _ t r i g g e r s - * - ************************************** - * - * Function - * Generate triggers to implement the WITH CHECK OPTION - * clause for a VIEW - * - **************************************/ - - dsql_nod* ddl_node = dsqlScratch->getStatement()->getDdlNode(); - - if (!element->nod_arg[e_cnstr_table]) { - element->nod_arg[e_cnstr_table] = ddl_node->nod_arg[e_drl_name]; - } - - // specify that the trigger should abort if the condition is not met - - dsql_nod* list_node = MAKE_node(nod_list, 1); - element->nod_arg[e_cnstr_actions] = list_node; - list_node->nod_arg[0] = MAKE_node(nod_gdscode, 1); - - dsql_nod** errorcode_node = &lis... [truncated message content] |
From: <ale...@us...> - 2010-08-09 13:56:28
|
Revision: 51416 http://firebird.svn.sourceforge.net/firebird/?rev=51416&view=rev Author: alexpeshkoff Date: 2010-08-09 13:56:20 +0000 (Mon, 09 Aug 2010) Log Message: ----------- Damian's patch for additional CPUs under linux Modified Paths: -------------- firebird/trunk/configure.in firebird/trunk/src/common/classes/DbImplementation.cpp firebird/trunk/src/jrd/common.h Modified: firebird/trunk/configure.in =================================================================== --- firebird/trunk/configure.in 2010-08-09 11:50:12 UTC (rev 51415) +++ firebird/trunk/configure.in 2010-08-09 13:56:20 UTC (rev 51416) @@ -275,6 +275,28 @@ SHRLIB_EXT=so ;; + hppa*-*-linux*) + MAKEFILE_PREFIX=linux_generic + INSTALL_PREFIX=linux + PLATFORM=LINUX + AC_DEFINE(LINUX, 1, [Define this if OS is Linux]) + AC_DEFINE(HPPA, 1, [Define this if CPU is HPPA]) + LOCK_MANAGER_FLG=Y + EDITLINE_FLG=Y + SHRLIB_EXT=so + ;; + + alpha*-*-linux*) + MAKEFILE_PREFIX=linux_generic + INSTALL_PREFIX=linux + PLATFORM=LINUX + AC_DEFINE(LINUX, 1, [Define this if OS is Linux]) + AC_DEFINE(ALPHA, 1, [Define this if CPU is Alpha]) + LOCK_MANAGER_FLG=Y + EDITLINE_FLG=Y + SHRLIB_EXT=so + ;; + *-*-linux* | *-*-gnu*) MAKEFILE_PREFIX=linux_generic INSTALL_PREFIX=linux Modified: firebird/trunk/src/common/classes/DbImplementation.cpp =================================================================== --- firebird/trunk/src/common/classes/DbImplementation.cpp 2010-08-09 11:50:12 UTC (rev 51415) +++ firebird/trunk/src/common/classes/DbImplementation.cpp 2010-08-09 13:56:20 UTC (rev 51416) @@ -46,6 +46,7 @@ static const UCHAR CpuSh = 11; static const UCHAR CpuSheb = 12; static const UCHAR CpuHppa = 13; +static const UCHAR CpuAlpha = 14; static const UCHAR OsWindows = 0; static const UCHAR OsLinux = 1; @@ -82,7 +83,8 @@ "s390x", "SH", "SHEB", - "HPPA" + "HPPA", + "Alpha" }; const char* operatingSystem[] = { @@ -109,22 +111,22 @@ // This table lists pre-fb3 imlementation codes const UCHAR backwardTable[FB_NELEM(hardware) * FB_NELEM(operatingSystem)] = { -// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA -/* Windows */ 50, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* Linux */ 60, 66, 65, 69, 0, 71, 72, 75, 76, 79, 78, 80, 81, 0, -/* Darwin */ 70, 73, 0, 63, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* Solaris */ 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* HPUX */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, -/* AIX */ 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* MVS */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* FreeBSD */ 61, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* NetBSD */ 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha +/* Windows */ 50, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +/* Linux */ 60, 66, 65, 69, 0, 71, 72, 75, 76, 79, 78, 80, 81, 0, 0, +/* Darwin */ 70, 73, 0, 63, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +/* Solaris */ 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +/* HPUX */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, +/* AIX */ 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +/* MVS */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +/* FreeBSD */ 61, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +/* NetBSD */ 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; const UCHAR backEndianess[FB_NELEM(hardware)] = { -// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA - 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, +// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha + 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0 }; } // anonymous namespace Modified: firebird/trunk/src/jrd/common.h =================================================================== --- firebird/trunk/src/jrd/common.h 2010-08-09 11:50:12 UTC (rev 51415) +++ firebird/trunk/src/jrd/common.h 2010-08-09 13:56:20 UTC (rev 51416) @@ -182,6 +182,16 @@ #define RISC_ALIGNMENT #endif /* sheb */ +#ifdef HPPA +#define FB_CPU CpuHppa +#define RISC_ALIGNMENT +#endif /* hppa */ + +#ifdef ALPHA +#define FB_CPU CpuAlpha +#define RISC_ALIGNMENT +#endif + #endif /* LINUX */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-08-09 15:49:01
|
Revision: 51418 http://firebird.svn.sourceforge.net/firebird/?rev=51418&view=rev Author: asfernandes Date: 2010-08-09 15:48:51 +0000 (Mon, 09 Aug 2010) Log Message: ----------- Const correction for EVL, EXE and they subsystems. Adjustments to CMP and OPT. Modified Paths: -------------- firebird/trunk/builds/win32/msvc10/common.vcxproj firebird/trunk/builds/win32/msvc10/common.vcxproj.filters firebird/trunk/builds/win32/msvc10/common_classic.vcxproj firebird/trunk/builds/win32/msvc10/common_classic.vcxproj.filters firebird/trunk/builds/win32/msvc10/common_static.vcxproj firebird/trunk/builds/win32/msvc10/common_static.vcxproj.filters firebird/trunk/builds/win32/msvc8/common.vcproj firebird/trunk/builds/win32/msvc8/common_classic.vcproj firebird/trunk/builds/win32/msvc8/common_static.vcproj firebird/trunk/builds/win32/msvc9/common.vcproj firebird/trunk/builds/win32/msvc9/common_classic.vcproj firebird/trunk/builds/win32/msvc9/common_static.vcproj firebird/trunk/src/dsql/AggNodes.cpp firebird/trunk/src/dsql/AggNodes.h firebird/trunk/src/dsql/ExprNodes.cpp firebird/trunk/src/dsql/ExprNodes.h firebird/trunk/src/dsql/Nodes.h firebird/trunk/src/dsql/StmtNodes.cpp firebird/trunk/src/dsql/StmtNodes.h firebird/trunk/src/dsql/WinNodes.cpp firebird/trunk/src/dsql/WinNodes.h firebird/trunk/src/jrd/ExtEngineManager.cpp firebird/trunk/src/jrd/ExtEngineManager.h firebird/trunk/src/jrd/Function.epp firebird/trunk/src/jrd/Function.h firebird/trunk/src/jrd/Optimizer.cpp firebird/trunk/src/jrd/Optimizer.h firebird/trunk/src/jrd/SysFunction.cpp firebird/trunk/src/jrd/SysFunction.h firebird/trunk/src/jrd/blb.cpp firebird/trunk/src/jrd/blb_proto.h firebird/trunk/src/jrd/btr.cpp firebird/trunk/src/jrd/btr_proto.h firebird/trunk/src/jrd/cmp.cpp firebird/trunk/src/jrd/evl.cpp firebird/trunk/src/jrd/evl_proto.h firebird/trunk/src/jrd/exe.cpp firebird/trunk/src/jrd/exe.h firebird/trunk/src/jrd/exe_proto.h firebird/trunk/src/jrd/execute_statement.cpp firebird/trunk/src/jrd/execute_statement.h firebird/trunk/src/jrd/extds/ExtDS.cpp firebird/trunk/src/jrd/extds/ExtDS.h firebird/trunk/src/jrd/fun.epp firebird/trunk/src/jrd/fun_proto.h firebird/trunk/src/jrd/met.epp firebird/trunk/src/jrd/opt.cpp firebird/trunk/src/jrd/par.cpp firebird/trunk/src/jrd/recsrc/AggregatedStream.cpp firebird/trunk/src/jrd/recsrc/Cursor.cpp firebird/trunk/src/jrd/recsrc/Cursor.h firebird/trunk/src/jrd/recsrc/FilteredStream.cpp firebird/trunk/src/jrd/recsrc/HashJoin.cpp firebird/trunk/src/jrd/recsrc/MergeJoin.cpp firebird/trunk/src/jrd/recsrc/ProcedureScan.cpp firebird/trunk/src/jrd/recsrc/RecordSource.h firebird/trunk/src/jrd/recsrc/RecursiveStream.cpp firebird/trunk/src/jrd/recsrc/SortedStream.cpp firebird/trunk/src/jrd/recsrc/Union.cpp firebird/trunk/src/jrd/recsrc/WindowedStream.cpp firebird/trunk/src/jrd/req.h firebird/trunk/src/jrd/trace/TraceJrdHelpers.h Added Paths: ----------- firebird/trunk/src/common/classes/NestConst.h Modified: firebird/trunk/builds/win32/msvc10/common.vcxproj =================================================================== --- firebird/trunk/builds/win32/msvc10/common.vcxproj 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/builds/win32/msvc10/common.vcxproj 2010-08-09 15:48:51 UTC (rev 51418) @@ -199,6 +199,7 @@ <ClInclude Include="..\..\..\src\common\classes\GenericMap.h" /> <ClInclude Include="..\..\..\src\common\classes\MetaName.h" /> <ClInclude Include="..\..\..\src\common\classes\MsgPrint.h" /> + <ClInclude Include="..\..\..\src\common\classes\NestConst.h" /> <ClInclude Include="..\..\..\src\common\classes\SafeArg.h" /> <ClInclude Include="..\..\..\src\common\StatusArg.h" /> <ClInclude Include="..\..\..\src\common\StatusHolder.h" /> Modified: firebird/trunk/builds/win32/msvc10/common.vcxproj.filters =================================================================== --- firebird/trunk/builds/win32/msvc10/common.vcxproj.filters 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/builds/win32/msvc10/common.vcxproj.filters 2010-08-09 15:48:51 UTC (rev 51418) @@ -180,6 +180,9 @@ <ClInclude Include="..\..\..\src\common\classes\MsgPrint.h"> <Filter>Header files</Filter> </ClInclude> + <ClInclude Include="..\..\..\src\common\classes\NestConst.h"> + <Filter>Header files</Filter> + </ClInclude> <ClInclude Include="..\..\..\src\common\classes\SafeArg.h"> <Filter>Header files</Filter> </ClInclude> Modified: firebird/trunk/builds/win32/msvc10/common_classic.vcxproj =================================================================== --- firebird/trunk/builds/win32/msvc10/common_classic.vcxproj 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/builds/win32/msvc10/common_classic.vcxproj 2010-08-09 15:48:51 UTC (rev 51418) @@ -198,6 +198,7 @@ <ClInclude Include="..\..\..\src\common\classes\GenericMap.h" /> <ClInclude Include="..\..\..\src\common\classes\MetaName.h" /> <ClInclude Include="..\..\..\src\common\classes\MsgPrint.h" /> + <ClInclude Include="..\..\..\src\common\classes\NestConst.h" /> <ClInclude Include="..\..\..\src\common\classes\SafeArg.h" /> <ClInclude Include="..\..\..\src\common\StatusArg.h" /> <ClInclude Include="..\..\..\src\common\StatusHolder.h" /> Modified: firebird/trunk/builds/win32/msvc10/common_classic.vcxproj.filters =================================================================== --- firebird/trunk/builds/win32/msvc10/common_classic.vcxproj.filters 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/builds/win32/msvc10/common_classic.vcxproj.filters 2010-08-09 15:48:51 UTC (rev 51418) @@ -177,6 +177,9 @@ <ClInclude Include="..\..\..\src\common\classes\MsgPrint.h"> <Filter>Header files</Filter> </ClInclude> + <ClInclude Include="..\..\..\src\common\classes\NestConst.h"> + <Filter>Header files</Filter> + </ClInclude> <ClInclude Include="..\..\..\src\common\classes\SafeArg.h"> <Filter>Header files</Filter> </ClInclude> Modified: firebird/trunk/builds/win32/msvc10/common_static.vcxproj =================================================================== --- firebird/trunk/builds/win32/msvc10/common_static.vcxproj 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/builds/win32/msvc10/common_static.vcxproj 2010-08-09 15:48:51 UTC (rev 51418) @@ -193,6 +193,7 @@ <ClInclude Include="..\..\..\src\common\classes\init.h" /> <ClInclude Include="..\..\..\src\common\classes\MetaName.h" /> <ClInclude Include="..\..\..\src\common\classes\MsgPrint.h" /> + <ClInclude Include="..\..\..\src\common\classes\NestConst.h" /> <ClInclude Include="..\..\..\src\common\classes\SafeArg.h" /> <ClInclude Include="..\..\..\src\common\StatusArg.h" /> <ClInclude Include="..\..\..\src\common\StatusHolder.h" /> Modified: firebird/trunk/builds/win32/msvc10/common_static.vcxproj.filters =================================================================== --- firebird/trunk/builds/win32/msvc10/common_static.vcxproj.filters 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/builds/win32/msvc10/common_static.vcxproj.filters 2010-08-09 15:48:51 UTC (rev 51418) @@ -156,6 +156,9 @@ <ClInclude Include="..\..\..\src\common\classes\MsgPrint.h"> <Filter>Header files</Filter> </ClInclude> + <ClInclude Include="..\..\..\src\common\classes\NestConst.h"> + <Filter>Header files</Filter> + </ClInclude> <ClInclude Include="..\..\..\src\common\classes\SafeArg.h"> <Filter>Header files</Filter> </ClInclude> Modified: firebird/trunk/builds/win32/msvc8/common.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc8/common.vcproj 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/builds/win32/msvc8/common.vcproj 2010-08-09 15:48:51 UTC (rev 51418) @@ -501,6 +501,10 @@ > </File> <File + RelativePath="..\..\..\src\common\classes\NestConst.h" + > + </File> + <File RelativePath="..\..\..\src\common\classes\SafeArg.h" > </File> Modified: firebird/trunk/builds/win32/msvc8/common_classic.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc8/common_classic.vcproj 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/builds/win32/msvc8/common_classic.vcproj 2010-08-09 15:48:51 UTC (rev 51418) @@ -497,6 +497,10 @@ > </File> <File + RelativePath="..\..\..\src\common\classes\NestConst.h" + > + </File> + <File RelativePath="..\..\..\src\common\classes\SafeArg.h" > </File> Modified: firebird/trunk/builds/win32/msvc8/common_static.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc8/common_static.vcproj 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/builds/win32/msvc8/common_static.vcproj 2010-08-09 15:48:51 UTC (rev 51418) @@ -470,6 +470,10 @@ > </File> <File + RelativePath="..\..\..\src\common\classes\NestConst.h" + > + </File> + <File RelativePath="..\..\..\src\common\classes\SafeArg.h" > </File> Modified: firebird/trunk/builds/win32/msvc9/common.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc9/common.vcproj 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/builds/win32/msvc9/common.vcproj 2010-08-09 15:48:51 UTC (rev 51418) @@ -502,6 +502,10 @@ > </File> <File + RelativePath="..\..\..\src\common\classes\NestConst.h" + > + </File> + <File RelativePath="..\..\..\src\common\classes\SafeArg.h" > </File> Modified: firebird/trunk/builds/win32/msvc9/common_classic.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc9/common_classic.vcproj 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/builds/win32/msvc9/common_classic.vcproj 2010-08-09 15:48:51 UTC (rev 51418) @@ -498,6 +498,10 @@ > </File> <File + RelativePath="..\..\..\src\common\classes\NestConst.h" + > + </File> + <File RelativePath="..\..\..\src\common\classes\SafeArg.h" > </File> Modified: firebird/trunk/builds/win32/msvc9/common_static.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc9/common_static.vcproj 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/builds/win32/msvc9/common_static.vcproj 2010-08-09 15:48:51 UTC (rev 51418) @@ -471,6 +471,10 @@ > </File> <File + RelativePath="..\..\..\src\common\classes\NestConst.h" + > + </File> + <File RelativePath="..\..\..\src\common\classes\SafeArg.h" > </File> Added: firebird/trunk/src/common/classes/NestConst.h =================================================================== --- firebird/trunk/src/common/classes/NestConst.h (rev 0) +++ firebird/trunk/src/common/classes/NestConst.h 2010-08-09 15:48:51 UTC (rev 51418) @@ -0,0 +1,52 @@ +/* + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl. + * + * Software distributed under the License is distributed AS IS, + * 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 was created by Adriano dos Santos Fernandes + * for the Firebird Open Source RDBMS project. + * + * Copyright (c) 2010 Adriano dos Santos Fernandes <adr...@gm...> + * and all contributors signed below. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + */ + +#ifndef COMMON_NEST_CONST_H +#define COMMON_NEST_CONST_H + +// Encloses a pointer to cascade parent object constness. +template <typename T> +class NestConst +{ +public: + NestConst(T* aPtr = NULL) + : ptr(aPtr) + { + } + + NestConst<T>& operator =(T* aPtr) + { + ptr = aPtr; + return *this; + } + + operator T*() { return ptr; } + operator const T*() const { return ptr; } + + T* operator ->() { return ptr; } + const T* operator ->() const { return ptr; } + +private: + T* ptr; +}; + +#endif // COMMON_NEST_CONST_H Property changes on: firebird/trunk/src/common/classes/NestConst.h ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: firebird/trunk/src/dsql/AggNodes.cpp =================================================================== --- firebird/trunk/src/dsql/AggNodes.cpp 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/src/dsql/AggNodes.cpp 2010-08-09 15:48:51 UTC (rev 51418) @@ -553,7 +553,7 @@ } } -ExprNode* AvgAggNode::copy(thread_db* tdbb, NodeCopier& copier) const +ExprNode* AvgAggNode::copy(thread_db* tdbb, NodeCopier& copier) { AvgAggNode* node = FB_NEW(*tdbb->getDefaultPool()) AvgAggNode(*tdbb->getDefaultPool(), distinct, dialect1); @@ -679,7 +679,7 @@ desc->makeBlob(desc->getBlobSubType(), desc->getTextType()); } -ExprNode* ListAggNode::copy(thread_db* tdbb, NodeCopier& copier) const +ExprNode* ListAggNode::copy(thread_db* tdbb, NodeCopier& copier) { ListAggNode* node = FB_NEW(*tdbb->getDefaultPool()) ListAggNode(*tdbb->getDefaultPool(), distinct); @@ -805,7 +805,7 @@ desc->dsc_flags = 0; } -ExprNode* CountAggNode::copy(thread_db* tdbb, NodeCopier& copier) const +ExprNode* CountAggNode::copy(thread_db* tdbb, NodeCopier& copier) { CountAggNode* node = FB_NEW(*tdbb->getDefaultPool()) CountAggNode(*tdbb->getDefaultPool(), distinct); @@ -1040,7 +1040,7 @@ ERR_post(Arg::Gds(isc_datype_notsup)); // data type not supported for arithmetic } -ExprNode* SumAggNode::copy(thread_db* tdbb, NodeCopier& copier) const +ExprNode* SumAggNode::copy(thread_db* tdbb, NodeCopier& copier) { SumAggNode* node = FB_NEW(*tdbb->getDefaultPool()) SumAggNode(*tdbb->getDefaultPool(), distinct, dialect1); @@ -1123,7 +1123,7 @@ CMP_get_desc(tdbb, csb, arg, desc); } -ExprNode* MaxMinAggNode::copy(thread_db* tdbb, NodeCopier& copier) const +ExprNode* MaxMinAggNode::copy(thread_db* tdbb, NodeCopier& copier) { MaxMinAggNode* node = FB_NEW(*tdbb->getDefaultPool()) MaxMinAggNode(*tdbb->getDefaultPool(), type); Modified: firebird/trunk/src/dsql/AggNodes.h =================================================================== --- firebird/trunk/src/dsql/AggNodes.h 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/src/dsql/AggNodes.h 2010-08-09 15:48:51 UTC (rev 51418) @@ -39,7 +39,7 @@ virtual void make(dsc* desc, dsql_nod* nullReplacement); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); - virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; + virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier); virtual ExprNode* pass2(thread_db* tdbb, CompilerScratch* csb); virtual void aggInit(thread_db* tdbb, jrd_req* request) const; @@ -65,7 +65,7 @@ virtual bool setParameterType(DsqlCompilerScratch* dsqlScratch, dsql_nod* node, bool forceVarChar) const; virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); - virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; + virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier); virtual void checkOrderedWindowCapable() const { @@ -84,7 +84,7 @@ private: dsql_nod* dsqlDelimiter; - jrd_nod* delimiter; + NestConst<jrd_nod> delimiter; }; class CountAggNode : public AggNode @@ -97,7 +97,7 @@ virtual void make(dsc* desc, dsql_nod* nullReplacement); virtual void genBlr(); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); - virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; + virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier); virtual void aggInit(thread_db* tdbb, jrd_req* request) const; virtual void aggPass(thread_db* tdbb, jrd_req* request, dsc* desc) const; @@ -116,7 +116,7 @@ virtual void make(dsc* desc, dsql_nod* nullReplacement); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); - virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; + virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier); virtual void aggInit(thread_db* tdbb, jrd_req* request) const; virtual void aggPass(thread_db* tdbb, jrd_req* request, dsc* desc) const; @@ -141,7 +141,7 @@ virtual void make(dsc* desc, dsql_nod* nullReplacement); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); - virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; + virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier); virtual void aggInit(thread_db* tdbb, jrd_req* request) const; virtual void aggPass(thread_db* tdbb, jrd_req* request, dsc* desc) const; Modified: firebird/trunk/src/dsql/ExprNodes.cpp =================================================================== --- firebird/trunk/src/dsql/ExprNodes.cpp 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/src/dsql/ExprNodes.cpp 2010-08-09 15:48:51 UTC (rev 51418) @@ -57,9 +57,15 @@ reinterpret_cast<ExprNode*>(node->nod_arg[0]) : NULL; } -ExprNode* ExprNode::fromLegacy(const jrd_nod* node) +const ExprNode* ExprNode::fromLegacy(const jrd_nod* node) { return node->nod_type == nod_class_exprnode_jrd ? + reinterpret_cast<const ExprNode*>(node->nod_arg[0]) : NULL; +} + +ExprNode* ExprNode::fromLegacy(jrd_nod* node) +{ + return node->nod_type == nod_class_exprnode_jrd ? reinterpret_cast<ExprNode*>(node->nod_arg[0]) : NULL; } @@ -111,14 +117,14 @@ ExprNode* ExprNode::pass1(thread_db* tdbb, CompilerScratch* csb) { - for (jrd_nod*** i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i) + for (NestConst<jrd_nod>** i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i) **i = CMP_pass1(tdbb, csb, **i); return this; } ExprNode* ExprNode::pass2(thread_db* tdbb, CompilerScratch* csb) { - for (jrd_nod*** i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i) + for (NestConst<jrd_nod>** i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i) **i = CMP_pass2(tdbb, csb, **i, node); return this; } @@ -127,7 +133,7 @@ { bool ret = false; - for (jrd_nod*** i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i) + for (NestConst<jrd_nod>** i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i) ret |= visitor.visit(**i); return ret; @@ -203,7 +209,7 @@ DataTypeUtil(tdbb).makeConcatenate(desc, &desc1, &desc2); } -ExprNode* ConcatenateNode::copy(thread_db* tdbb, NodeCopier& copier) const +ExprNode* ConcatenateNode::copy(thread_db* tdbb, NodeCopier& copier) { ConcatenateNode* node = FB_NEW(*tdbb->getDefaultPool()) ConcatenateNode(*tdbb->getDefaultPool()); node->arg1 = copier.copy(tdbb, arg1); @@ -591,7 +597,7 @@ fb_assert(false); } -ExprNode* OverNode::copy(thread_db* /*tdbb*/, NodeCopier& /*copier*/) const +ExprNode* OverNode::copy(thread_db* /*tdbb*/, NodeCopier& /*copier*/) { fb_assert(false); return NULL; @@ -687,7 +693,7 @@ CMP_get_desc(tdbb, csb, escape, &tempDesc); } -ExprNode* SubstringSimilarNode::copy(thread_db* tdbb, NodeCopier& copier) const +ExprNode* SubstringSimilarNode::copy(thread_db* tdbb, NodeCopier& copier) { SubstringSimilarNode* node = FB_NEW(*tdbb->getDefaultPool()) SubstringSimilarNode( *tdbb->getDefaultPool()); @@ -947,7 +953,7 @@ delete *pArgs; } -ExprNode* SysFuncCallNode::copy(thread_db* tdbb, NodeCopier& copier) const +ExprNode* SysFuncCallNode::copy(thread_db* tdbb, NodeCopier& copier) { SysFuncCallNode* node = FB_NEW(*tdbb->getDefaultPool()) SysFuncCallNode( *tdbb->getDefaultPool(), name); @@ -1169,7 +1175,7 @@ desc->clear(); } -ExprNode* UdfCallNode::copy(thread_db* tdbb, NodeCopier& copier) const +ExprNode* UdfCallNode::copy(thread_db* tdbb, NodeCopier& copier) { UdfCallNode* node = FB_NEW(*tdbb->getDefaultPool()) UdfCallNode(*tdbb->getDefaultPool(), name); node->args = copier.copy(tdbb, args); Modified: firebird/trunk/src/dsql/ExprNodes.h =================================================================== --- firebird/trunk/src/dsql/ExprNodes.h 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/src/dsql/ExprNodes.h 2010-08-09 15:48:51 UTC (rev 51418) @@ -47,7 +47,7 @@ virtual void make(dsc* desc, dsql_nod* nullReplacement); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); - virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; + virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier); virtual ExprNode* pass2(thread_db* tdbb, CompilerScratch* csb); virtual dsc* execute(thread_db* tdbb, jrd_req* request) const; @@ -57,8 +57,8 @@ public: dsql_nod* dsqlArg1; dsql_nod* dsqlArg2; - jrd_nod* arg1; - jrd_nod* arg2; + NestConst<jrd_nod> arg1; + NestConst<jrd_nod> arg2; }; @@ -83,7 +83,7 @@ virtual void make(dsc* desc, dsql_nod* nullReplacement); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); - virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; + virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier); virtual dsc* execute(thread_db* tdbb, jrd_req* request) const; protected: @@ -112,7 +112,7 @@ virtual void make(dsc* desc, dsql_nod* nullReplacement); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); - virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; + virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier); virtual ExprNode* pass1(thread_db* tdbb, CompilerScratch* csb); virtual ExprNode* pass2(thread_db* tdbb, CompilerScratch* csb); virtual dsc* execute(thread_db* tdbb, jrd_req* request) const; @@ -124,9 +124,9 @@ dsql_nod* dsqlExpr; dsql_nod* dsqlPattern; dsql_nod* dsqlEscape; - jrd_nod* expr; - jrd_nod* pattern; - jrd_nod* escape; + NestConst<jrd_nod> expr; + NestConst<jrd_nod> pattern; + NestConst<jrd_nod> escape; }; @@ -144,7 +144,7 @@ virtual void make(dsc* desc, dsql_nod* nullReplacement); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); - virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; + virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier); virtual bool dsqlMatch(const ExprNode* other, bool ignoreMapCast) const; virtual ExprNode* pass2(thread_db* tdbb, CompilerScratch* csb); virtual dsc* execute(thread_db* tdbb, jrd_req* request) const; @@ -156,7 +156,7 @@ Firebird::MetaName name; dsql_nod* dsqlArgs; bool dsqlSpecialSyntax; - jrd_nod* args; + NestConst<jrd_nod> args; const SysFunction* function; }; @@ -175,7 +175,7 @@ virtual void make(dsc* desc, dsql_nod* nullReplacement); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); - virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; + virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier); virtual bool dsqlMatch(const ExprNode* other, bool ignoreMapCast) const; virtual ExprNode* pass1(thread_db* tdbb, CompilerScratch* csb); virtual ExprNode* pass2(thread_db* tdbb, CompilerScratch* csb); @@ -187,7 +187,7 @@ public: Firebird::QualifiedName name; dsql_nod* dsqlArgs; - jrd_nod* args; + NestConst<jrd_nod> args; /*const*/ Function* function; private: Modified: firebird/trunk/src/dsql/Nodes.h =================================================================== --- firebird/trunk/src/dsql/Nodes.h 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/src/dsql/Nodes.h 2010-08-09 15:48:51 UTC (rev 51418) @@ -28,7 +28,7 @@ #include "../dsql/node.h" #include "../dsql/Visitors.h" #include "../common/classes/array.h" -//#include "../common/classes/ByteChunk.h" +#include "../common/classes/NestConst.h" namespace Jrd { @@ -199,7 +199,7 @@ virtual DmlNode* pass2(thread_db* tdbb, CompilerScratch* csb) = 0; protected: - jrd_nod* node; + NestConst<jrd_nod> node; }; @@ -273,7 +273,8 @@ } static ExprNode* fromLegacy(const dsql_nod* node); - static ExprNode* fromLegacy(const jrd_nod* node); + static const ExprNode* fromLegacy(const jrd_nod* node); + static ExprNode* fromLegacy(jrd_nod* node); virtual bool dsqlAggregateFinder(AggregateFinder& visitor) { @@ -341,7 +342,7 @@ virtual void make(dsc* desc, dsql_nod* nullReplacement) = 0; virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc) = 0; - virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const = 0; + virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) = 0; virtual dsc* execute(thread_db* tdbb, jrd_req* request) const = 0; protected: @@ -349,7 +350,7 @@ virtual bool dsqlVisit(NonConstDsqlNodeVisitor& visitor); virtual bool jrdVisit(JrdNodeVisitor& visitor); - void addChildNode(dsql_nod*& dsqlNode, jrd_nod*& jrdNode) + void addChildNode(dsql_nod*& dsqlNode, NestConst<jrd_nod>& jrdNode) { dsqlChildNodes.add(&dsqlNode); jrdChildNodes.add(&jrdNode); @@ -364,7 +365,7 @@ const Type type; const char* dsqlCompatDialectVerb; Firebird::Array<dsql_nod**> dsqlChildNodes; - Firebird::Array<jrd_nod**> jrdChildNodes; + Firebird::Array<NestConst<jrd_nod>*> jrdChildNodes; }; class AggNode : public TypedNode<ExprNode, ExprNode::TYPE_AGGREGATE> @@ -487,7 +488,7 @@ bool distinct; bool dialect1; dsql_nod* dsqlArg; - jrd_nod* arg; + NestConst<jrd_nod> arg; const AggregateSort* asb; bool indexed; }; @@ -553,7 +554,7 @@ { } - virtual jrd_nod* execute(thread_db* tdbb, jrd_req* request) const = 0; + virtual const jrd_nod* execute(thread_db* tdbb, jrd_req* request) const = 0; }; @@ -580,7 +581,7 @@ return this; } - jrd_nod* execute(thread_db* /*tdbb*/, jrd_req* /*request*/) const + const jrd_nod* execute(thread_db* /*tdbb*/, jrd_req* /*request*/) const { fb_assert(false); return NULL; Modified: firebird/trunk/src/dsql/StmtNodes.cpp =================================================================== --- firebird/trunk/src/dsql/StmtNodes.cpp 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/src/dsql/StmtNodes.cpp 2010-08-09 15:48:51 UTC (rev 51418) @@ -441,7 +441,7 @@ } -jrd_nod* IfNode::execute(thread_db* tdbb, jrd_req* request) const +const jrd_nod* IfNode::execute(thread_db* tdbb, jrd_req* request) const { if (request->req_operation == jrd_req::req_evaluate) { @@ -530,7 +530,7 @@ } -jrd_nod* InAutonomousTransactionNode::execute(thread_db* tdbb, jrd_req* request) const +const jrd_nod* InAutonomousTransactionNode::execute(thread_db* tdbb, jrd_req* request) const { Jrd::Attachment* attachment = request->req_attachment; SLONG* savNumber = request->getImpure<SLONG>(savNumberOffset); @@ -1090,7 +1090,7 @@ } -jrd_nod* ExceptionNode::execute(thread_db* tdbb, jrd_req* request) const +const jrd_nod* ExceptionNode::execute(thread_db* tdbb, jrd_req* request) const { if (request->req_operation == jrd_req::req_evaluate) { @@ -1428,7 +1428,7 @@ return this; } -jrd_nod* ForNode::execute(thread_db* tdbb, jrd_req* request) const +const jrd_nod* ForNode::execute(thread_db* tdbb, jrd_req* request) const { switch (request->req_operation) { @@ -1453,7 +1453,7 @@ case jrd_req::req_unwind: { - jrd_nod* parent = node->nod_parent; + const jrd_nod* parent = node->nod_parent; if (parent && parent->nod_type == nod_label && request->req_label == (USHORT)(IPTR) parent->nod_arg[e_lbl_label] && @@ -1549,7 +1549,7 @@ } -jrd_nod* PostEventNode::execute(thread_db* tdbb, jrd_req* request) const +const jrd_nod* PostEventNode::execute(thread_db* tdbb, jrd_req* request) const { jrd_tra* transaction = request->req_transaction; @@ -1654,7 +1654,7 @@ } -jrd_nod* SavepointNode::execute(thread_db* tdbb, jrd_req* request) const +const jrd_nod* SavepointNode::execute(thread_db* tdbb, jrd_req* request) const { jrd_tra* transaction = request->req_transaction; @@ -1833,7 +1833,7 @@ // Execute a SEND statement. -jrd_nod* SuspendNode::execute(thread_db* /*tdbb*/, jrd_req* request) const +const jrd_nod* SuspendNode::execute(thread_db* /*tdbb*/, jrd_req* request) const { switch (request->req_operation) { Modified: firebird/trunk/src/dsql/StmtNodes.h =================================================================== --- firebird/trunk/src/dsql/StmtNodes.h 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/src/dsql/StmtNodes.h 2010-08-09 15:48:51 UTC (rev 51418) @@ -60,15 +60,15 @@ virtual void genBlr(); virtual IfNode* pass1(thread_db* tdbb, CompilerScratch* csb); virtual IfNode* pass2(thread_db* tdbb, CompilerScratch* csb); - virtual jrd_nod* execute(thread_db* tdbb, jrd_req* request) const; + virtual const jrd_nod* execute(thread_db* tdbb, jrd_req* request) const; public: dsql_nod* dsqlCondition; dsql_nod* dsqlTrueAction; dsql_nod* dsqlFalseAction; - jrd_nod* condition; - jrd_nod* trueAction; - jrd_nod* falseAction; + NestConst<jrd_nod> condition; + NestConst<jrd_nod> trueAction; + NestConst<jrd_nod> falseAction; }; @@ -94,11 +94,11 @@ virtual void genBlr(); virtual InAutonomousTransactionNode* pass1(thread_db* tdbb, CompilerScratch* csb); virtual InAutonomousTransactionNode* pass2(thread_db* tdbb, CompilerScratch* csb); - virtual jrd_nod* execute(thread_db* tdbb, jrd_req* request) const; + virtual const jrd_nod* execute(thread_db* tdbb, jrd_req* request) const; public: dsql_nod* dsqlAction; - jrd_nod* action; + NestConst<jrd_nod> action; SLONG savNumberOffset; }; @@ -160,7 +160,7 @@ virtual void genBlr(); virtual ExceptionNode* pass1(thread_db* tdbb, CompilerScratch* csb); virtual ExceptionNode* pass2(thread_db* tdbb, CompilerScratch* csb); - virtual jrd_nod* execute(thread_db* tdbb, jrd_req* request) const; + virtual const jrd_nod* execute(thread_db* tdbb, jrd_req* request) const; private: void setError(thread_db* tdbb) const; @@ -169,8 +169,8 @@ Firebird::MetaName name; dsql_nod* dsqlMessageExpr; dsql_nod* dsqlParameters; - jrd_nod* messageExpr; - jrd_nod* parameters; + NestConst<jrd_nod> messageExpr; + NestConst<jrd_nod> parameters; PsqlException* exception; }; @@ -222,11 +222,11 @@ virtual void pass2Cursor(RecordSelExpr*& rsePtr, Cursor**& cursorPtr) { - rsePtr = (RecordSelExpr*) rse; + rsePtr = (RecordSelExpr*)(jrd_nod*) rse; cursorPtr = &cursor; } - virtual jrd_nod* execute(thread_db* tdbb, jrd_req* request) const; + virtual const jrd_nod* execute(thread_db* tdbb, jrd_req* request) const; public: dsql_nod* dsqlSelect; @@ -235,9 +235,9 @@ dsql_nod* dsqlAction; dsql_nod* dsqlLabel; bool dsqlForceSingular; - jrd_nod* stall; - jrd_nod* rse; - jrd_nod* statement; + NestConst<jrd_nod> stall; + NestConst<jrd_nod> rse; + NestConst<jrd_nod> statement; Cursor* cursor; }; @@ -265,13 +265,13 @@ virtual void genBlr(); virtual PostEventNode* pass1(thread_db* tdbb, CompilerScratch* csb); virtual PostEventNode* pass2(thread_db* tdbb, CompilerScratch* csb); - virtual jrd_nod* execute(thread_db* tdbb, jrd_req* request) const; + virtual const jrd_nod* execute(thread_db* tdbb, jrd_req* request) const; public: dsql_nod* dsqlEvent; dsql_nod* dsqlArgument; - jrd_nod* event; - jrd_nod* argument; + NestConst<jrd_nod> event; + NestConst<jrd_nod> argument; }; @@ -306,7 +306,7 @@ virtual void genBlr(); virtual SavepointNode* pass1(thread_db* tdbb, CompilerScratch* csb); virtual SavepointNode* pass2(thread_db* tdbb, CompilerScratch* csb); - virtual jrd_nod* execute(thread_db* tdbb, jrd_req* request) const; + virtual const jrd_nod* execute(thread_db* tdbb, jrd_req* request) const; public: Command command; @@ -336,12 +336,12 @@ virtual void genBlr(); virtual SuspendNode* pass1(thread_db* tdbb, CompilerScratch* csb); virtual SuspendNode* pass2(thread_db* tdbb, CompilerScratch* csb); - virtual jrd_nod* execute(thread_db* tdbb, jrd_req* request) const; + virtual const jrd_nod* execute(thread_db* tdbb, jrd_req* request) const; public: BlockNode* blockNode; - jrd_nod* message; - jrd_nod* statement; + NestConst<jrd_nod> message; + NestConst<jrd_nod> statement; }; Modified: firebird/trunk/src/dsql/WinNodes.cpp =================================================================== --- firebird/trunk/src/dsql/WinNodes.cpp 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/src/dsql/WinNodes.cpp 2010-08-09 15:48:51 UTC (rev 51418) @@ -74,7 +74,7 @@ if (count != 0) { - jrd_nod*** arg = node->jrdChildNodes.begin(); + NestConst<jrd_nod>** arg = node->jrdChildNodes.begin(); do { **arg++ = PAR_parse_node(tdbb, csb, VALUE); @@ -108,7 +108,7 @@ desc->makeInt64(0); } -ExprNode* DenseRankWinNode::copy(thread_db* tdbb, NodeCopier& /*copier*/) const +ExprNode* DenseRankWinNode::copy(thread_db* tdbb, NodeCopier& /*copier*/) { DenseRankWinNode* node = FB_NEW(*tdbb->getDefaultPool()) DenseRankWinNode(*tdbb->getDefaultPool()); return node; @@ -163,7 +163,7 @@ desc->makeInt64(0); } -ExprNode* RankWinNode::copy(thread_db* tdbb, NodeCopier& /*copier*/) const +ExprNode* RankWinNode::copy(thread_db* tdbb, NodeCopier& /*copier*/) { RankWinNode* node = FB_NEW(*tdbb->getDefaultPool()) RankWinNode(*tdbb->getDefaultPool()); return node; @@ -235,7 +235,7 @@ desc->makeInt64(0); } -ExprNode* RowNumberWinNode::copy(thread_db* tdbb, NodeCopier& /*copier*/) const +ExprNode* RowNumberWinNode::copy(thread_db* tdbb, NodeCopier& /*copier*/) { RowNumberWinNode* node = FB_NEW(*tdbb->getDefaultPool()) RowNumberWinNode(*tdbb->getDefaultPool()); return node; @@ -359,7 +359,7 @@ { } -ExprNode* LagWinNode::copy(thread_db* tdbb, NodeCopier& copier) const +ExprNode* LagWinNode::copy(thread_db* tdbb, NodeCopier& copier) { LagWinNode* node = FB_NEW(*tdbb->getDefaultPool()) LagWinNode(*tdbb->getDefaultPool()); node->arg = copier.copy(tdbb, arg); @@ -387,7 +387,7 @@ { } -ExprNode* LeadWinNode::copy(thread_db* tdbb, NodeCopier& copier) const +ExprNode* LeadWinNode::copy(thread_db* tdbb, NodeCopier& copier) { LeadWinNode* node = FB_NEW(*tdbb->getDefaultPool()) LeadWinNode(*tdbb->getDefaultPool()); node->arg = copier.copy(tdbb, arg); Modified: firebird/trunk/src/dsql/WinNodes.h =================================================================== --- firebird/trunk/src/dsql/WinNodes.h 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/src/dsql/WinNodes.h 2010-08-09 15:48:51 UTC (rev 51418) @@ -38,7 +38,7 @@ virtual void make(dsc* desc, dsql_nod* nullReplacement); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); - virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; + virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier); virtual void aggInit(thread_db* tdbb, jrd_req* request) const; virtual void aggPass(thread_db* tdbb, jrd_req* request, dsc* desc) const; @@ -56,7 +56,7 @@ virtual void make(dsc* desc, dsql_nod* nullReplacement); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); - virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; + virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier); virtual ExprNode* pass2(thread_db* tdbb, CompilerScratch* csb); virtual void aggInit(thread_db* tdbb, jrd_req* request) const; @@ -78,7 +78,7 @@ virtual void make(dsc* desc, dsql_nod* nullReplacement); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); - virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; + virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier); virtual void aggInit(thread_db* tdbb, jrd_req* request) const; virtual void aggPass(thread_db* tdbb, jrd_req* request, dsc* desc) const; @@ -120,8 +120,8 @@ const int direction; dsql_nod* dsqlRows; dsql_nod* dsqlOutExpr; - jrd_nod* rows; - jrd_nod* outExpr; + NestConst<jrd_nod> rows; + NestConst<jrd_nod> outExpr; }; // LAG function. @@ -131,7 +131,7 @@ explicit LagWinNode(MemoryPool& pool, dsql_nod* aArg = NULL, dsql_nod* aRows = NULL, dsql_nod* aOutExpr = NULL); - virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; + virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier); protected: virtual AggNode* dsqlCopy() const; @@ -144,7 +144,7 @@ explicit LeadWinNode(MemoryPool& pool, dsql_nod* aArg = NULL, dsql_nod* aRows = NULL, dsql_nod* aOutExpr = NULL); - virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; + virtual ExprNode* copy(thread_db* tdbb, NodeCopier& copier); protected: virtual AggNode* dsqlCopy() const; Modified: firebird/trunk/src/jrd/ExtEngineManager.cpp =================================================================== --- firebird/trunk/src/jrd/ExtEngineManager.cpp 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/src/jrd/ExtEngineManager.cpp 2010-08-09 15:48:51 UTC (rev 51418) @@ -388,7 +388,7 @@ } -void ExtEngineManager::Function::execute(thread_db* tdbb, jrd_nod* args, impure_value* impure) +void ExtEngineManager::Function::execute(thread_db* tdbb, const jrd_nod* args, impure_value* impure) { EngineAttachmentInfo* attInfo = extManager->getEngineAttachment(tdbb, engine); ContextManager<ExternalFunction> ctxManager(tdbb, attInfo, function, Modified: firebird/trunk/src/jrd/ExtEngineManager.h =================================================================== --- firebird/trunk/src/jrd/ExtEngineManager.h 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/src/jrd/ExtEngineManager.h 2010-08-09 15:48:51 UTC (rev 51418) @@ -130,7 +130,7 @@ const Jrd::Function* aUdf); ~Function(); - void execute(thread_db* tdbb, jrd_nod* args, impure_value* impure); + void execute(thread_db* tdbb, const jrd_nod* args, impure_value* impure); private: ExtEngineManager* extManager; Modified: firebird/trunk/src/jrd/Function.epp =================================================================== --- firebird/trunk/src/jrd/Function.epp 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/src/jrd/Function.epp 2010-08-09 15:48:51 UTC (rev 51418) @@ -657,7 +657,7 @@ } } -dsc* Function::execute(thread_db* tdbb, jrd_nod* args, impure_value* value) const +dsc* Function::execute(thread_db* tdbb, const jrd_nod* args, impure_value* value) const { if (isUndefined()) { Modified: firebird/trunk/src/jrd/Function.h =================================================================== --- firebird/trunk/src/jrd/Function.h 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/src/jrd/Function.h 2010-08-09 15:48:51 UTC (rev 51418) @@ -52,7 +52,7 @@ USHORT incrementAlterCount(); - dsc* execute(thread_db* tdbb, jrd_nod* args, impure_value* value) const; + dsc* execute(thread_db* tdbb, const jrd_nod* args, impure_value* value) const; void releaseLocks(thread_db* tdbb); void remove(thread_db* tdbb); ULONG allocateImpure(CompilerScratch* csb); Modified: firebird/trunk/src/jrd/Optimizer.cpp =================================================================== --- firebird/trunk/src/jrd/Optimizer.cpp 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/src/jrd/Optimizer.cpp 2010-08-09 15:48:51 UTC (rev 51418) @@ -55,7 +55,7 @@ namespace Jrd { -bool OPT_computable(CompilerScratch* csb, const jrd_nod* node, SSHORT stream, +bool OPT_computable(CompilerScratch* csb, jrd_nod* node, SSHORT stream, const bool idx_use, const bool allowOnlyCurrentStream) { /************************************** @@ -99,11 +99,11 @@ { case nod_procedure: { - const jrd_nod* const inputs = node->nod_arg[e_prc_inputs]; + jrd_nod* inputs = node->nod_arg[e_prc_inputs]; if (inputs) { fb_assert(inputs->nod_type == nod_asn_list); - const jrd_nod* const* ptr = inputs->nod_arg; + jrd_nod* const* ptr = inputs->nod_arg; for (const jrd_nod* const* const end = ptr + inputs->nod_count; ptr < end; ptr++) { if (!OPT_computable(csb, *ptr, stream, idx_use, allowOnlyCurrentStream)) { @@ -116,8 +116,8 @@ case nod_union: { - const jrd_nod* const clauses = node->nod_arg[e_uni_clauses]; - const jrd_nod* const* ptr = clauses->nod_arg; + jrd_nod* clauses = node->nod_arg[e_uni_clauses]; + jrd_nod* const* ptr = clauses->nod_arg; for (const jrd_nod* const* const end = ptr + clauses->nod_count; ptr < end; ptr += 2) { if (!OPT_computable(csb, *ptr, stream, idx_use, allowOnlyCurrentStream)) { @@ -129,9 +129,9 @@ case nod_class_exprnode_jrd: { - const ExprNode* exprNode = reinterpret_cast<const ExprNode*>(node->nod_arg[0]); + ExprNode* exprNode = reinterpret_cast<ExprNode*>(node->nod_arg[0]); - for (const jrd_nod* const* const* i = exprNode->jrdChildNodes.begin(); + for (NestConst<jrd_nod>** i = exprNode->jrdChildNodes.begin(); i != exprNode->jrdChildNodes.end(); ++i) { if (!OPT_computable(csb, **i, stream, idx_use, allowOnlyCurrentStream)) @@ -143,7 +143,7 @@ default: { - const jrd_nod* const* ptr = node->nod_arg; + jrd_nod* const* ptr = node->nod_arg; for (const jrd_nod* const* const end = ptr + node->nod_count; ptr < end; ptr++) { if (!OPT_computable(csb, *ptr, stream, idx_use, allowOnlyCurrentStream)) { @@ -155,8 +155,8 @@ } RecordSelExpr* rse; - const jrd_nod* sub; - const jrd_nod* value; + jrd_nod* sub; + jrd_nod* value; USHORT n; switch (node->nod_type) @@ -266,7 +266,7 @@ } // Set sub-streams of rse active - const jrd_nod* const* ptr; + jrd_nod* const* ptr; const jrd_nod* const* end; for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end; ptr++) @@ -430,8 +430,8 @@ { ExprNode* exprNode1 = reinterpret_cast<ExprNode*>(node1->nod_arg[0]); ExprNode* exprNode2 = reinterpret_cast<ExprNode*>(node2->nod_arg[0]); - Array<jrd_nod**>& children1 = exprNode1->jrdChildNodes; - Array<jrd_nod**>& children2 = exprNode2->jrdChildNodes; + Array<NestConst<jrd_nod>*>& children1 = exprNode1->jrdChildNodes; + Array<NestConst<jrd_nod>*>& children2 = exprNode2->jrdChildNodes; if (exprNode1->type != exprNode2->type || children1.getCount() != children2.getCount()) return false; @@ -462,7 +462,7 @@ case ExprNode::TYPE_CONCATENATE: case ExprNode::TYPE_SUBSTRING_SIMILAR: - for (jrd_nod*** i = children1.begin(), ***j = children2.begin(); + for (NestConst<jrd_nod>* const* i = children1.begin(), * const* j = children2.begin(); i != children1.end(); ++i, ++j) { if (!OPT_expression_equal2(tdbb, csb, **i, **j, stream)) @@ -640,8 +640,8 @@ case nod_list: { - jrd_nod** ptr1 = node1->nod_arg; - jrd_nod** ptr2 = node2->nod_arg; + jrd_nod* const* ptr1 = node1->nod_arg; + jrd_nod* const* ptr2 = node2->nod_arg; if (node1->nod_count != node2->nod_count) { @@ -1067,8 +1067,7 @@ return OPT_make_binary_node(node_type, node1, node2, false); } -void OptimizerRetrieval::findDependentFromStreams(const jrd_nod* node, - SortedStreamList* streamList) const +void OptimizerRetrieval::findDependentFromStreams(jrd_nod* node, SortedStreamList* streamList) const { /************************************** * @@ -1084,11 +1083,11 @@ if (node->nod_type == nod_procedure) { - const jrd_nod* const inputs = node->nod_arg[e_prc_inputs]; + jrd_nod* const inputs = node->nod_arg[e_prc_inputs]; if (inputs) { fb_assert(inputs->nod_type == nod_asn_list); - const jrd_nod* const* ptr = inputs->nod_arg; + jrd_nod* const* ptr = inputs->nod_arg; for (const jrd_nod* const* const end = ptr + inputs->nod_count; ptr < end; ptr++) { findDependentFromStreams(*ptr, streamList); @@ -1097,8 +1096,8 @@ } else if (node->nod_type == nod_union) { - const jrd_nod* const clauses = node->nod_arg[e_uni_clauses]; - const jrd_nod* const* ptr = clauses->nod_arg; + jrd_nod* const clauses = node->nod_arg[e_uni_clauses]; + jrd_nod* const* ptr = clauses->nod_arg; for (const jrd_nod* const* const end = ptr + clauses->nod_count; ptr < end; ptr += 2) { findDependentFromStreams(*ptr, streamList); @@ -1106,9 +1105,9 @@ } else if (node->nod_type == nod_class_exprnode_jrd) { - const ExprNode* exprNode = reinterpret_cast<const ExprNode*>(node->nod_arg[0]); + ExprNode* exprNode = reinterpret_cast<ExprNode*>(node->nod_arg[0]); - for (const jrd_nod* const* const* i = exprNode->jrdChildNodes.begin(); + for (NestConst<jrd_nod>* const* i = exprNode->jrdChildNodes.begin(); i != exprNode->jrdChildNodes.end(); ++i) { findDependentFromStreams(**i, streamList); @@ -1116,7 +1115,7 @@ } else { - const jrd_nod* const* ptr = node->nod_arg; + jrd_nod* const* ptr = node->nod_arg; for (const jrd_nod* const* const end = ptr + node->nod_count; ptr < end; ptr++) { findDependentFromStreams(*ptr, streamList); @@ -1229,7 +1228,7 @@ findDependentFromStreams(sub, streamList); } - const jrd_nod* const* ptr; + jrd_nod* const* ptr; const jrd_nod* const* end; for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end; ptr++) { @@ -1480,7 +1479,7 @@ bool usableIndex = true; index_desc::idx_repeat* idx_tail = idx->idx_rpt; - jrd_nod** ptr = sortPtr->nod_arg; + jrd_nod* const* ptr = sortPtr->nod_arg; for (const jrd_nod* const* const end = ptr + sortPtr->nod_count; ptr < end; ptr++, idx_tail++) { jrd_nod* node = *ptr; Modified: firebird/trunk/src/jrd/Optimizer.h =================================================================== --- firebird/trunk/src/jrd/Optimizer.h 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/src/jrd/Optimizer.h 2010-08-09 15:48:51 UTC (rev 51418) @@ -73,7 +73,7 @@ class IndexTableScan; class River; -bool OPT_computable(CompilerScratch*, const jrd_nod*, SSHORT, const bool, const bool); +bool OPT_computable(CompilerScratch*, jrd_nod*, SSHORT, const bool, const bool); bool OPT_expression_equal(thread_db*, CompilerScratch*, const index_desc*, jrd_nod*, USHORT); bool OPT_expression_equal2(thread_db*, CompilerScratch*, jrd_nod*, jrd_nod*, USHORT); double OPT_getRelationCardinality(thread_db*, jrd_rel*, const Format*); @@ -184,7 +184,7 @@ protected: jrd_nod* composeInversion(jrd_nod* node1, jrd_nod* node2, nod_t node_type) const; - void findDependentFromStreams(const jrd_nod* node, SortedStreamList* streamList) const; + void findDependentFromStreams(jrd_nod* node, SortedStreamList* streamList) const; const Firebird::string& getAlias(); InversionCandidate* generateInversion(IndexTableScan** rsb); IndexTableScan* generateNavigation(); Modified: firebird/trunk/src/jrd/SysFunction.cpp =================================================================== --- firebird/trunk/src/jrd/SysFunction.cpp 2010-08-09 14:50:11 UTC (rev 51417) +++ firebird/trunk/src/jrd/SysFunction.cpp 2010-08-09 15:48:51 UTC (rev 51418) @@ -147,44 +147,44 @@ void makeUuidToChar(DataTypeUtilBase* dataTypeUtil, const SysFunction* function, dsc* result, int argsCount, const dsc** args); // generic stdmath function -dsc* evlStdMath(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); +dsc* evlStdMath(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); // specific evl functions -dsc* evlAbs(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlAsciiChar(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlAsciiVal(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlAtan2(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlBin(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlBinShift(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlCeil(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlCharToUuid(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlDateAdd(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlDateDiff(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlExp(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlFloor(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlGenUuid(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlGetContext(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlSetContext(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlHash(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlLeft(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlLnLog10(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlLog(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlMaxMinValue(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlMod(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlOverlay(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlPad(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlPi(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlPosition(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlPower(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlRand(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlReplace(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlReverse(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlRight(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlRound(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlSign(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlSqrt(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlTrunc(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); -dsc* evlUuidToChar(thread_db* tdbb, const SysFunction* function, jrd_nod* args, impure_value* impure); +dsc* evlAbs(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlAsciiChar(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlAsciiVal(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlAtan2(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlBin(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlBinShift(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlCeil(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlCharToUuid(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlDateAdd(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlDateDiff(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlExp(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlFloor(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlGenUuid(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlGetContext(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlSetContext(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlHash(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlLeft(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlLnLog10(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlLog(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlMaxMinValue(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlMod(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlOverlay(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlPad(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlPi(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlPosition(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlPower(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlRand(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlReplace(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlReverse(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlRight(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlRound(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlSign(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlSqrt(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlTrunc(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); +dsc* evlUuidToChar(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure); const char @@ -1038,7 +1038,7 @@ } -dsc* evlStdMath(thread_db* tdbb, const SysFunction* function, jrd_nod* args, +dsc* evlStdMath(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 1); @@ -1139,7 +1139,7 @@ } -dsc* evlAbs(thread_db* tdbb, const SysFunction*, jrd_nod* args, +dsc* evlAbs(thread_db* tdbb, const SysFunction*, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 1); @@ -1185,7 +1185,7 @@ } -dsc* evlAsciiChar(thread_db* tdbb, const SysFunction*, jrd_nod* args, +dsc* evlAsciiChar(thread_db* tdbb, const SysFunction*, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 1); @@ -1207,7 +1207,7 @@ } -dsc* evlAsciiVal(thread_db* tdbb, const SysFunction*, jrd_nod* args, +dsc* evlAsciiVal(thread_db* tdbb, const SysFunction*, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 1); @@ -1233,7 +1233,7 @@ } -dsc* evlAtan2(thread_db* tdbb, const SysFunction*, jrd_nod* args, +dsc* evlAtan2(thread_db* tdbb, const SysFunction*, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 2); @@ -1255,7 +1255,7 @@ } -dsc* evlBin(thread_db* tdbb, const SysFunction* function, jrd_nod* args, +dsc* evlBin(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count >= 1); @@ -1304,7 +1304,7 @@ } -dsc* evlBinShift(thread_db* tdbb, const SysFunction* function, jrd_nod* args, +dsc* evlBinShift(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 2); @@ -1362,7 +1362,7 @@ } -dsc* evlCeil(thread_db* tdbb, const SysFunction*, jrd_nod* args, +dsc* evlCeil(thread_db* tdbb, const SysFunction*, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 1); @@ -1425,7 +1425,7 @@ } -dsc* evlCharToUuid(thread_db* tdbb, const SysFunction* function, jrd_nod* args, +dsc* evlCharToUuid(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 1); @@ -1530,7 +1530,7 @@ } -dsc* evlDateAdd(thread_db* tdbb, const SysFunction* function, jrd_nod* args, +dsc* evlDateAdd(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 3); @@ -1727,7 +1727,7 @@ } -dsc* evlDateDiff(thread_db* tdbb, const SysFunction* function, jrd_nod* args, +dsc* evlDateDiff(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 3); @@ -1940,7 +1940,7 @@ } -dsc* evlExp(thread_db* tdbb, const SysFunction*, jrd_nod* args, +dsc* evlExp(thread_db* tdbb, const SysFunction*, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 1); @@ -1964,7 +1964,7 @@ } -dsc* evlFloor(thread_db* tdbb, const SysFunction*, jrd_nod* args, +dsc* evlFloor(thread_db* tdbb, const SysFunction*, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 1); @@ -2019,7 +2019,7 @@ } -dsc* evlGenUuid(thread_db* tdbb, const SysFunction*, jrd_nod* args, +dsc* evlGenUuid(thread_db* tdbb, const SysFunction*, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 0); @@ -2037,7 +2037,7 @@ } -dsc* evlGetContext(thread_db* tdbb, const SysFunction*, jrd_nod* args, +dsc* evlGetContext(thread_db* tdbb, const SysFunction*, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 2); @@ -2183,7 +2183,7 @@ } -dsc* evlSetContext(thread_db* tdbb, const SysFunction*, jrd_nod* args, +dsc* evlSetContext(thread_db* tdbb, const SysFunction*, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 3); @@ -2284,7 +2284,7 @@ } -dsc* evlHash(thread_db* tdbb, const SysFunction*, jrd_nod* args, +dsc* evlHash(thread_db* tdbb, const SysFunction*, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 1); @@ -2346,7 +2346,7 @@ } -dsc* evlLeft(thread_db* tdbb, const SysFunction*, jrd_nod* args, +dsc* evlLeft(thread_db* tdbb, const SysFunction*, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 2); @@ -2369,7 +2369,7 @@ } -dsc* evlLnLog10(thread_db* tdbb, const SysFunction* function, jrd_nod* args, +dsc* evlLnLog10(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 1); @@ -2411,7 +2411,7 @@ } -dsc* evlLog(thread_db* tdbb, const SysFunction* function, jrd_nod* args, +dsc* evlLog(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 2); @@ -2450,7 +2450,7 @@ } -dsc* evlMaxMinValue(thread_db* tdbb, const SysFunction* function, jrd_nod* args, +dsc* evlMaxMinValue(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value*) { fb_assert(args->nod_count >= 1); @@ -2491,7 +2491,7 @@ } -dsc* evlMod(thread_db* tdbb, const SysFunction*, jrd_nod* args, +dsc* evlMod(thread_db* tdbb, const SysFunction*, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count == 2); @@ -2540,7 +2540,7 @@ } -dsc* evlOverlay(thread_db* tdbb, const SysFunction* function, jrd_nod* args, +dsc* evlOverlay(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count >= 3); @@ -2724,7 +2724,7 @@ } -dsc* evlPad(thread_db* tdbb, const SysFunction* function, jrd_nod* args, +dsc* evlPad(thread_db* tdbb, const SysFunction* function, const jrd_nod* args, impure_value* impure) { fb_assert(args->nod_count >= 2); @@ -2887,7 +2887,7 @@ } -dsc* evlPi(thread_db* tdbb, const SysFunction*, jrd_nod* args, +dsc* evl... [truncated message content] |
From: <fir...@us...> - 2010-08-11 03:16:25
|
Revision: 51430 http://firebird.svn.sourceforge.net/firebird/?rev=51430&view=rev Author: firebirds Date: 2010-08-11 03:16:18 +0000 (Wed, 11 Aug 2010) Log Message: ----------- nightly update Modified Paths: -------------- firebird/trunk/ChangeLog firebird/trunk/src/jrd/build_no.h firebird/trunk/src/misc/writeBuildNum.sh Modified: firebird/trunk/ChangeLog =================================================================== --- firebird/trunk/ChangeLog 2010-08-11 02:59:33 UTC (rev 51429) +++ firebird/trunk/ChangeLog 2010-08-11 03:16:18 UTC (rev 51430) @@ -1,3 +1,36 @@ + 2010-08-11 02:59 asfernandes + M src/dsql/ExprNodes.cpp + M src/dsql/ExprNodes.h + M src/dsql/StmtNodes.cpp + M src/jrd/exe.h + M src/jrd/met.epp + M src/jrd/nod.h + M src/jrd/par.cpp +Better internal handling of dependencies + + 2010-08-10 15:20 asfernandes + M src/dsql/DdlNodes.epp + M src/dsql/DdlNodes.h + M src/dsql/StmtNodes.h + M src/dsql/parse.y +Misc + + 2010-08-10 11:08 alexpeshkoff + A mkChangeLog.sh +BuildNum and ChangeLog generator + + 2010-08-10 10:42 alexpeshkoff + M src/misc/writeBuildNum.sh +misc + + 2010-08-10 07:49 alexpeshkoff + M ChangeLog +rolled back test change + + 2010-08-10 07:31 firebirds + M ChangeLog +nightly update - test commit, please ignore + 2010-08-10 00:37 asfernandes M src/dsql/DdlNodes.epp M src/jrd/btr.cpp Modified: firebird/trunk/src/jrd/build_no.h =================================================================== --- firebird/trunk/src/jrd/build_no.h 2010-08-11 02:59:33 UTC (rev 51429) +++ firebird/trunk/src/jrd/build_no.h 2010-08-11 03:16:18 UTC (rev 51430) @@ -3,16 +3,16 @@ *** DO NOT EDIT *** TO CHANGE ANY INFORMATION IN HERE PLEASE EDIT src/misc/writeBuildNum.sh - FORMAL BUILD NUMBER:28669 + FORMAL BUILD NUMBER:28675 */ -#define PRODUCT_VER_STRING "3.0.0.28669" -#define FILE_VER_STRING "WI-T3.0.0.28669" -#define LICENSE_VER_STRING "WI-T3.0.0.28669" -#define FILE_VER_NUMBER 3, 0, 0, 28669 +#define PRODUCT_VER_STRING "3.0.0.28675" +#define FILE_VER_STRING "WI-T3.0.0.28675" +#define LICENSE_VER_STRING "WI-T3.0.0.28675" +#define FILE_VER_NUMBER 3, 0, 0, 28675 #define FB_MAJOR_VER "3" #define FB_MINOR_VER "0" #define FB_REV_NO "0" -#define FB_BUILD_NO "28669" +#define FB_BUILD_NO "28675" #define FB_BUILD_TYPE "T" #define FB_BUILD_SUFFIX "Firebird 3.0 Unstable" Modified: firebird/trunk/src/misc/writeBuildNum.sh =================================================================== --- firebird/trunk/src/misc/writeBuildNum.sh 2010-08-11 02:59:33 UTC (rev 51429) +++ firebird/trunk/src/misc/writeBuildNum.sh 2010-08-11 03:16:18 UTC (rev 51430) @@ -9,7 +9,7 @@ MajorVer=3 MinorVer=0 RevNo=0 -BuildNum=28669 +BuildNum=28675 if [ "$SPECIAL_BUILD_SUFFIX" = "" ]; then # Normal builds This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fir...@us...> - 2010-08-12 03:13:33
|
Revision: 51437 http://firebird.svn.sourceforge.net/firebird/?rev=51437&view=rev Author: firebirds Date: 2010-08-12 03:13:26 +0000 (Thu, 12 Aug 2010) Log Message: ----------- nightly update Modified Paths: -------------- firebird/trunk/ChangeLog firebird/trunk/src/jrd/build_no.h firebird/trunk/src/misc/writeBuildNum.sh Modified: firebird/trunk/ChangeLog =================================================================== --- firebird/trunk/ChangeLog 2010-08-12 00:59:48 UTC (rev 51436) +++ firebird/trunk/ChangeLog 2010-08-12 03:13:26 UTC (rev 51437) @@ -1,3 +1,20 @@ + 2010-08-12 00:59 asfernandes + M src/dsql/ExprNodes.cpp + M src/jrd/JrdStatement.cpp + M src/jrd/JrdStatement.h + M src/jrd/exe.cpp + M src/jrd/exe.h +More consts + + 2010-08-11 15:33 asfernandes + M src/common/classes/NestConst.h + M src/dsql/StmtNodes.h +Misc + + 2010-08-11 15:22 firebirds + M src/misc/smallog.cpp +make output in brnches better + 2010-08-11 02:59 asfernandes M src/dsql/ExprNodes.cpp M src/dsql/ExprNodes.h Modified: firebird/trunk/src/jrd/build_no.h =================================================================== --- firebird/trunk/src/jrd/build_no.h 2010-08-12 00:59:48 UTC (rev 51436) +++ firebird/trunk/src/jrd/build_no.h 2010-08-12 03:13:26 UTC (rev 51437) @@ -3,16 +3,16 @@ *** DO NOT EDIT *** TO CHANGE ANY INFORMATION IN HERE PLEASE EDIT src/misc/writeBuildNum.sh - FORMAL BUILD NUMBER:28675 + FORMAL BUILD NUMBER:28678 */ -#define PRODUCT_VER_STRING "3.0.0.28675" -#define FILE_VER_STRING "WI-T3.0.0.28675" -#define LICENSE_VER_STRING "WI-T3.0.0.28675" -#define FILE_VER_NUMBER 3, 0, 0, 28675 +#define PRODUCT_VER_STRING "3.0.0.28678" +#define FILE_VER_STRING "WI-T3.0.0.28678" +#define LICENSE_VER_STRING "WI-T3.0.0.28678" +#define FILE_VER_NUMBER 3, 0, 0, 28678 #define FB_MAJOR_VER "3" #define FB_MINOR_VER "0" #define FB_REV_NO "0" -#define FB_BUILD_NO "28675" +#define FB_BUILD_NO "28678" #define FB_BUILD_TYPE "T" #define FB_BUILD_SUFFIX "Firebird 3.0 Unstable" Modified: firebird/trunk/src/misc/writeBuildNum.sh =================================================================== --- firebird/trunk/src/misc/writeBuildNum.sh 2010-08-12 00:59:48 UTC (rev 51436) +++ firebird/trunk/src/misc/writeBuildNum.sh 2010-08-12 03:13:26 UTC (rev 51437) @@ -9,7 +9,7 @@ MajorVer=3 MinorVer=0 RevNo=0 -BuildNum=28675 +BuildNum=28678 if [ "$SPECIAL_BUILD_SUFFIX" = "" ]; then # Normal builds This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fir...@us...> - 2010-08-13 03:16:40
|
Revision: 51440 http://firebird.svn.sourceforge.net/firebird/?rev=51440&view=rev Author: firebirds Date: 2010-08-13 03:16:33 +0000 (Fri, 13 Aug 2010) Log Message: ----------- nightly update Modified Paths: -------------- firebird/trunk/ChangeLog firebird/trunk/src/jrd/build_no.h firebird/trunk/src/misc/writeBuildNum.sh Modified: firebird/trunk/ChangeLog =================================================================== --- firebird/trunk/ChangeLog 2010-08-12 10:32:50 UTC (rev 51439) +++ firebird/trunk/ChangeLog 2010-08-13 03:16:33 UTC (rev 51440) @@ -1,3 +1,8 @@ + 2010-08-12 10:32 robocop + M src/jrd/exe.h + M src/jrd/par.cpp +Misc. + 2010-08-12 00:59 asfernandes M src/dsql/ExprNodes.cpp M src/jrd/JrdStatement.cpp Modified: firebird/trunk/src/jrd/build_no.h =================================================================== --- firebird/trunk/src/jrd/build_no.h 2010-08-12 10:32:50 UTC (rev 51439) +++ firebird/trunk/src/jrd/build_no.h 2010-08-13 03:16:33 UTC (rev 51440) @@ -3,16 +3,16 @@ *** DO NOT EDIT *** TO CHANGE ANY INFORMATION IN HERE PLEASE EDIT src/misc/writeBuildNum.sh - FORMAL BUILD NUMBER:28678 + FORMAL BUILD NUMBER:28679 */ -#define PRODUCT_VER_STRING "3.0.0.28678" -#define FILE_VER_STRING "WI-T3.0.0.28678" -#define LICENSE_VER_STRING "WI-T3.0.0.28678" -#define FILE_VER_NUMBER 3, 0, 0, 28678 +#define PRODUCT_VER_STRING "3.0.0.28679" +#define FILE_VER_STRING "WI-T3.0.0.28679" +#define LICENSE_VER_STRING "WI-T3.0.0.28679" +#define FILE_VER_NUMBER 3, 0, 0, 28679 #define FB_MAJOR_VER "3" #define FB_MINOR_VER "0" #define FB_REV_NO "0" -#define FB_BUILD_NO "28678" +#define FB_BUILD_NO "28679" #define FB_BUILD_TYPE "T" #define FB_BUILD_SUFFIX "Firebird 3.0 Unstable" Modified: firebird/trunk/src/misc/writeBuildNum.sh =================================================================== --- firebird/trunk/src/misc/writeBuildNum.sh 2010-08-12 10:32:50 UTC (rev 51439) +++ firebird/trunk/src/misc/writeBuildNum.sh 2010-08-13 03:16:33 UTC (rev 51440) @@ -9,7 +9,7 @@ MajorVer=3 MinorVer=0 RevNo=0 -BuildNum=28678 +BuildNum=28679 if [ "$SPECIAL_BUILD_SUFFIX" = "" ]; then # Normal builds This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fir...@us...> - 2010-08-14 03:14:23
|
Revision: 51447 http://firebird.svn.sourceforge.net/firebird/?rev=51447&view=rev Author: firebirds Date: 2010-08-14 03:14:17 +0000 (Sat, 14 Aug 2010) Log Message: ----------- nightly update Modified Paths: -------------- firebird/trunk/ChangeLog firebird/trunk/src/jrd/build_no.h firebird/trunk/src/misc/writeBuildNum.sh Modified: firebird/trunk/ChangeLog =================================================================== --- firebird/trunk/ChangeLog 2010-08-13 15:22:00 UTC (rev 51446) +++ firebird/trunk/ChangeLog 2010-08-14 03:14:17 UTC (rev 51447) @@ -1,3 +1,28 @@ + 2010-08-13 15:22 asfernandes + M src/common/classes/NestConst.h + M src/jrd/ExtEngineManager.cpp + M src/jrd/ExtEngineManager.h + M src/jrd/Function.h + M src/jrd/ValuesImpl.h + M src/jrd/cmp.cpp + M src/jrd/cmp_proto.h + M src/jrd/exe.h + M src/jrd/jrd.h + M src/jrd/met.epp + M src/jrd/par.cpp + M src/jrd/recsrc/ProcedureScan.cpp + M src/jrd/recsrc/RecordSource.cpp + M src/jrd/recsrc/RecordSource.h +More consts + + 2010-08-13 09:37 firebirds + M mkChangeLog.sh +per-branch consts + + 2010-08-13 08:41 firebirds + M src/misc/smallog.cpp +Better handling of commits to be skipped + 2010-08-12 10:32 robocop M src/jrd/exe.h M src/jrd/par.cpp @@ -49,10 +74,6 @@ M ChangeLog rolled back test change - 2010-08-10 07:31 firebirds - M ChangeLog -nightly update - test commit, please ignore - 2010-08-10 00:37 asfernandes M src/dsql/DdlNodes.epp M src/jrd/btr.cpp Modified: firebird/trunk/src/jrd/build_no.h =================================================================== --- firebird/trunk/src/jrd/build_no.h 2010-08-13 15:22:00 UTC (rev 51446) +++ firebird/trunk/src/jrd/build_no.h 2010-08-14 03:14:17 UTC (rev 51447) @@ -3,16 +3,16 @@ *** DO NOT EDIT *** TO CHANGE ANY INFORMATION IN HERE PLEASE EDIT src/misc/writeBuildNum.sh - FORMAL BUILD NUMBER:28679 + FORMAL BUILD NUMBER:28681 */ -#define PRODUCT_VER_STRING "3.0.0.28679" -#define FILE_VER_STRING "WI-T3.0.0.28679" -#define LICENSE_VER_STRING "WI-T3.0.0.28679" -#define FILE_VER_NUMBER 3, 0, 0, 28679 +#define PRODUCT_VER_STRING "3.0.0.28681" +#define FILE_VER_STRING "WI-T3.0.0.28681" +#define LICENSE_VER_STRING "WI-T3.0.0.28681" +#define FILE_VER_NUMBER 3, 0, 0, 28681 #define FB_MAJOR_VER "3" #define FB_MINOR_VER "0" #define FB_REV_NO "0" -#define FB_BUILD_NO "28679" +#define FB_BUILD_NO "28681" #define FB_BUILD_TYPE "T" #define FB_BUILD_SUFFIX "Firebird 3.0 Unstable" Modified: firebird/trunk/src/misc/writeBuildNum.sh =================================================================== --- firebird/trunk/src/misc/writeBuildNum.sh 2010-08-13 15:22:00 UTC (rev 51446) +++ firebird/trunk/src/misc/writeBuildNum.sh 2010-08-14 03:14:17 UTC (rev 51447) @@ -9,7 +9,7 @@ MajorVer=3 MinorVer=0 RevNo=0 -BuildNum=28679 +BuildNum=28681 if [ "$SPECIAL_BUILD_SUFFIX" = "" ]; then # Normal builds This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fir...@us...> - 2010-08-16 03:14:09
|
Revision: 51451 http://firebird.svn.sourceforge.net/firebird/?rev=51451&view=rev Author: firebirds Date: 2010-08-16 03:14:03 +0000 (Mon, 16 Aug 2010) Log Message: ----------- nightly update Modified Paths: -------------- firebird/trunk/ChangeLog firebird/trunk/src/jrd/build_no.h firebird/trunk/src/misc/writeBuildNum.sh Modified: firebird/trunk/ChangeLog =================================================================== --- firebird/trunk/ChangeLog 2010-08-16 01:47:24 UTC (rev 51450) +++ firebird/trunk/ChangeLog 2010-08-16 03:14:03 UTC (rev 51451) @@ -1,3 +1,7 @@ + 2010-08-16 01:47 asfernandes + M src/misc/blrtable.cpp +Fix wrong nod_type of scrollable cursors + 2010-08-13 15:22 asfernandes M src/common/classes/NestConst.h M src/jrd/ExtEngineManager.cpp Modified: firebird/trunk/src/jrd/build_no.h =================================================================== --- firebird/trunk/src/jrd/build_no.h 2010-08-16 01:47:24 UTC (rev 51450) +++ firebird/trunk/src/jrd/build_no.h 2010-08-16 03:14:03 UTC (rev 51451) @@ -3,16 +3,16 @@ *** DO NOT EDIT *** TO CHANGE ANY INFORMATION IN HERE PLEASE EDIT src/misc/writeBuildNum.sh - FORMAL BUILD NUMBER:28681 + FORMAL BUILD NUMBER:28682 */ -#define PRODUCT_VER_STRING "3.0.0.28681" -#define FILE_VER_STRING "WI-T3.0.0.28681" -#define LICENSE_VER_STRING "WI-T3.0.0.28681" -#define FILE_VER_NUMBER 3, 0, 0, 28681 +#define PRODUCT_VER_STRING "3.0.0.28682" +#define FILE_VER_STRING "WI-T3.0.0.28682" +#define LICENSE_VER_STRING "WI-T3.0.0.28682" +#define FILE_VER_NUMBER 3, 0, 0, 28682 #define FB_MAJOR_VER "3" #define FB_MINOR_VER "0" #define FB_REV_NO "0" -#define FB_BUILD_NO "28681" +#define FB_BUILD_NO "28682" #define FB_BUILD_TYPE "T" #define FB_BUILD_SUFFIX "Firebird 3.0 Unstable" Modified: firebird/trunk/src/misc/writeBuildNum.sh =================================================================== --- firebird/trunk/src/misc/writeBuildNum.sh 2010-08-16 01:47:24 UTC (rev 51450) +++ firebird/trunk/src/misc/writeBuildNum.sh 2010-08-16 03:14:03 UTC (rev 51451) @@ -9,7 +9,7 @@ MajorVer=3 MinorVer=0 RevNo=0 -BuildNum=28681 +BuildNum=28682 if [ "$SPECIAL_BUILD_SUFFIX" = "" ]; then # Normal builds This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-08-24 04:10:38
|
Revision: 51464 http://firebird.svn.sourceforge.net/firebird/?rev=51464&view=rev Author: asfernandes Date: 2010-08-24 03:25:01 +0000 (Tue, 24 Aug 2010) Log Message: ----------- Refactor nod_rse, nod_relation, nod_procedure, nod_union, nod_aggregate and nod_window. Modified Paths: -------------- firebird/trunk/builds/posix/make.shared.variables firebird/trunk/builds/win32/msvc10/engine.vcxproj firebird/trunk/builds/win32/msvc10/engine.vcxproj.filters firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj.filters firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj.filters firebird/trunk/builds/win32/msvc9/engine.vcproj firebird/trunk/builds/win32/msvc9/engine_classic.vcproj firebird/trunk/builds/win32/msvc9/engine_embed.vcproj firebird/trunk/src/dsql/ExprNodes.cpp firebird/trunk/src/dsql/Nodes.h firebird/trunk/src/dsql/StmtNodes.cpp firebird/trunk/src/dsql/StmtNodes.h firebird/trunk/src/dsql/Visitors.h firebird/trunk/src/jrd/Attachment.h firebird/trunk/src/jrd/Optimizer.cpp firebird/trunk/src/jrd/Optimizer.h firebird/trunk/src/jrd/Relation.h firebird/trunk/src/jrd/cmp.cpp firebird/trunk/src/jrd/cmp_proto.h firebird/trunk/src/jrd/exe.cpp firebird/trunk/src/jrd/exe.h firebird/trunk/src/jrd/jrd.h firebird/trunk/src/jrd/lls.h firebird/trunk/src/jrd/met.epp firebird/trunk/src/jrd/nod.h firebird/trunk/src/jrd/opt.cpp firebird/trunk/src/jrd/opt_proto.h firebird/trunk/src/jrd/par.cpp firebird/trunk/src/jrd/par_proto.h firebird/trunk/src/jrd/recsrc/RecordSource.h firebird/trunk/src/jrd/recsrc/Union.cpp firebird/trunk/src/misc/blrtable.cpp Added Paths: ----------- firebird/trunk/src/jrd/RecordSourceNodes.cpp firebird/trunk/src/jrd/RecordSourceNodes.h Modified: firebird/trunk/builds/posix/make.shared.variables =================================================================== --- firebird/trunk/builds/posix/make.shared.variables 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/builds/posix/make.shared.variables 2010-08-24 03:25:01 UTC (rev 51464) @@ -42,7 +42,7 @@ svc.cpp SysFunction.cpp TempSpace.cpp tpc.cpp tra.cpp validation.cpp \ ValueImpl.cpp ValuesImpl.cpp vio.cpp \ nodebug.cpp nbak.cpp $(Physical_IO_Module) TextType.cpp \ - unicode_util.cpp RuntimeStatistics.cpp DebugInterface.cpp \ + unicode_util.cpp RecordSourceNodes.cpp RuntimeStatistics.cpp DebugInterface.cpp \ extds/ExtDS.cpp extds/InternalDS.cpp extds/IscDS.cpp \ trace/TraceConfigStorage.cpp trace/TraceLog.cpp \ trace/TraceManager.cpp trace/TraceObjects.cpp \ Modified: firebird/trunk/builds/win32/msvc10/engine.vcxproj =================================================================== --- firebird/trunk/builds/win32/msvc10/engine.vcxproj 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/builds/win32/msvc10/engine.vcxproj 2010-08-24 03:25:01 UTC (rev 51464) @@ -221,6 +221,7 @@ <ClCompile Include="..\..\..\src\jrd\PreparedStatement.cpp" /> <ClCompile Include="..\..\..\src\jrd\RandomGenerator.cpp" /> <ClCompile Include="..\..\..\src\jrd\RecordBuffer.cpp" /> + <ClCompile Include="..\..\..\src\jrd\RecordSourceNodes.cpp" /> <ClCompile Include="..\..\..\src\jrd\Relation.cpp" /> <ClCompile Include="..\..\..\src\jrd\ResultSet.cpp" /> <ClCompile Include="..\..\..\src\jrd\rlck.cpp" /> @@ -427,6 +428,7 @@ <ClInclude Include="..\..\..\src\jrd\que.h" /> <ClInclude Include="..\..\..\src\jrd\RandomGenerator.h" /> <ClInclude Include="..\..\..\src\jrd\RecordBuffer.h" /> + <ClInclude Include="..\..\..\src\jrd\RecordSourceNodes.h" /> <ClInclude Include="..\..\..\src\jrd\recsrc\RecordSource.h" /> <ClInclude Include="..\..\..\src\jrd\Relation.h" /> <ClInclude Include="..\..\..\src\jrd\relations.h" /> Modified: firebird/trunk/builds/win32/msvc10/engine.vcxproj.filters =================================================================== --- firebird/trunk/builds/win32/msvc10/engine.vcxproj.filters 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/builds/win32/msvc10/engine.vcxproj.filters 2010-08-24 03:25:01 UTC (rev 51464) @@ -240,6 +240,9 @@ <ClCompile Include="..\..\..\src\jrd\RecordBuffer.cpp"> <Filter>JRD files</Filter> </ClCompile> + <ClCompile Include="..\..\..\src\jrd\RecordSourceNodes.cpp"> + <Filter>JRD files</Filter> + </ClCompile> <ClCompile Include="..\..\..\src\jrd\Relation.cpp"> <Filter>JRD files</Filter> </ClCompile> @@ -854,6 +857,9 @@ <ClInclude Include="..\..\..\src\jrd\RecordBuffer.h"> <Filter>Header files</Filter> </ClInclude> + <ClInclude Include="..\..\..\src\jrd\RecordSourceNodes.h"> + <Filter>Header files</Filter> + </ClInclude> <ClInclude Include="..\..\..\src\jrd\recsrc\RecordSource.h"> <Filter>Header files</Filter> </ClInclude> Modified: firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj =================================================================== --- firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj 2010-08-24 03:25:01 UTC (rev 51464) @@ -221,6 +221,7 @@ <ClCompile Include="..\..\..\src\jrd\PreparedStatement.cpp" /> <ClCompile Include="..\..\..\src\jrd\RandomGenerator.cpp" /> <ClCompile Include="..\..\..\src\jrd\RecordBuffer.cpp" /> + <ClCompile Include="..\..\..\src\jrd\RecordSourceNodes.cpp" /> <ClCompile Include="..\..\..\src\jrd\Relation.cpp" /> <ClCompile Include="..\..\..\src\jrd\ResultSet.cpp" /> <ClCompile Include="..\..\..\src\jrd\rlck.cpp" /> @@ -427,6 +428,7 @@ <ClInclude Include="..\..\..\src\jrd\que.h" /> <ClInclude Include="..\..\..\src\jrd\RandomGenerator.h" /> <ClInclude Include="..\..\..\src\jrd\RecordBuffer.h" /> + <ClInclude Include="..\..\..\src\jrd\RecordSourceNodes.h" /> <ClInclude Include="..\..\..\src\jrd\recsrc\RecordSource.h" /> <ClInclude Include="..\..\..\src\jrd\Relation.h" /> <ClInclude Include="..\..\..\src\jrd\relations.h" /> Modified: firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj.filters =================================================================== --- firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj.filters 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/builds/win32/msvc10/engine_classic.vcxproj.filters 2010-08-24 03:25:01 UTC (rev 51464) @@ -240,6 +240,9 @@ <ClCompile Include="..\..\..\src\jrd\RecordBuffer.cpp"> <Filter>JRD files</Filter> </ClCompile> + <ClCompile Include="..\..\..\src\jrd\RecordSourceNodes.cpp"> + <Filter>JRD files</Filter> + </ClCompile> <ClCompile Include="..\..\..\src\jrd\Relation.cpp"> <Filter>JRD files</Filter> </ClCompile> @@ -854,6 +857,9 @@ <ClInclude Include="..\..\..\src\jrd\RecordBuffer.h"> <Filter>Header files</Filter> </ClInclude> + <ClInclude Include="..\..\..\src\jrd\RecordSourceNodes.h"> + <Filter>Header files</Filter> + </ClInclude> <ClInclude Include="..\..\..\src\jrd\recsrc\RecordSource.h"> <Filter>Header files</Filter> </ClInclude> Modified: firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj =================================================================== --- firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj 2010-08-24 03:25:01 UTC (rev 51464) @@ -221,6 +221,7 @@ <ClCompile Include="..\..\..\src\jrd\PreparedStatement.cpp" /> <ClCompile Include="..\..\..\src\jrd\RandomGenerator.cpp" /> <ClCompile Include="..\..\..\src\jrd\RecordBuffer.cpp" /> + <ClCompile Include="..\..\..\src\jrd\RecordSourceNodes.cpp" /> <ClCompile Include="..\..\..\src\jrd\Relation.cpp" /> <ClCompile Include="..\..\..\src\jrd\ResultSet.cpp" /> <ClCompile Include="..\..\..\src\jrd\rlck.cpp" /> @@ -427,6 +428,7 @@ <ClInclude Include="..\..\..\src\jrd\que.h" /> <ClInclude Include="..\..\..\src\jrd\RandomGenerator.h" /> <ClInclude Include="..\..\..\src\jrd\RecordBuffer.h" /> + <ClInclude Include="..\..\..\src\jrd\RecordSourceNodes.h" /> <ClInclude Include="..\..\..\src\jrd\recsrc\RecordSource.h" /> <ClInclude Include="..\..\..\src\jrd\Relation.h" /> <ClInclude Include="..\..\..\src\jrd\relations.h" /> Modified: firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj.filters =================================================================== --- firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj.filters 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/builds/win32/msvc10/engine_embed.vcxproj.filters 2010-08-24 03:25:01 UTC (rev 51464) @@ -240,6 +240,9 @@ <ClCompile Include="..\..\..\src\jrd\RecordBuffer.cpp"> <Filter>JRD files</Filter> </ClCompile> + <ClCompile Include="..\..\..\src\jrd\RecordSourceNodes.cpp"> + <Filter>JRD files</Filter> + </ClCompile> <ClCompile Include="..\..\..\src\jrd\Relation.cpp"> <Filter>JRD files</Filter> </ClCompile> @@ -857,6 +860,9 @@ <ClInclude Include="..\..\..\src\jrd\recsrc\RecordSource.h"> <Filter>Header files</Filter> </ClInclude> + <ClInclude Include="..\..\..\src\jrd\RecordSourceNodes.h"> + <Filter>Header files</Filter> + </ClInclude> <ClInclude Include="..\..\..\src\jrd\Relation.h"> <Filter>Header files</Filter> </ClInclude> Modified: firebird/trunk/builds/win32/msvc9/engine.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc9/engine.vcproj 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/builds/win32/msvc9/engine.vcproj 2010-08-24 03:25:01 UTC (rev 51464) @@ -572,6 +572,10 @@ > </File> <File + RelativePath="..\..\..\src\jrd\RecordSourceNodes.cpp" + > + </File> + <File RelativePath="..\..\..\src\jrd\Relation.cpp" > </File> @@ -1392,6 +1396,10 @@ > </File> <File + RelativePath="..\..\..\src\jrd\RecordSourceNodes.h" + > + </File> + <File RelativePath="..\..\..\src\jrd\recsrc\RecordSource.h" > </File> Modified: firebird/trunk/builds/win32/msvc9/engine_classic.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc9/engine_classic.vcproj 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/builds/win32/msvc9/engine_classic.vcproj 2010-08-24 03:25:01 UTC (rev 51464) @@ -572,6 +572,10 @@ > </File> <File + RelativePath="..\..\..\src\jrd\RecordSourceNodes.cpp" + > + </File> + <File RelativePath="..\..\..\src\jrd\Relation.cpp" > </File> @@ -1392,6 +1396,10 @@ > </File> <File + RelativePath="..\..\..\src\jrd\RecordSourceNodes.h" + > + </File> + <File RelativePath="..\..\..\src\jrd\recsrc\RecordSource.h" > </File> Modified: firebird/trunk/builds/win32/msvc9/engine_embed.vcproj =================================================================== --- firebird/trunk/builds/win32/msvc9/engine_embed.vcproj 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/builds/win32/msvc9/engine_embed.vcproj 2010-08-24 03:25:01 UTC (rev 51464) @@ -572,6 +572,10 @@ > </File> <File + RelativePath="..\..\..\src\jrd\RecordSourceNodes.cpp" + > + </File> + <File RelativePath="..\..\..\src\jrd\Relation.cpp" > </File> @@ -1392,6 +1396,10 @@ > </File> <File + RelativePath="..\..\..\src\jrd\RecordSourceNodes.h" + > + </File> + <File RelativePath="..\..\..\src\jrd\recsrc\RecordSource.h" > </File> Modified: firebird/trunk/src/dsql/ExprNodes.cpp =================================================================== --- firebird/trunk/src/dsql/ExprNodes.cpp 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/src/dsql/ExprNodes.cpp 2010-08-24 03:25:01 UTC (rev 51464) @@ -709,7 +709,7 @@ // We need to take care of invariantness expressions to be able to pre-compile the pattern. node->nod_flags |= nod_invariant; - csb->csb_current_nodes.push(node); + csb->csb_current_nodes.push(node.getObject()); pattern = CMP_pass1(tdbb, csb, pattern); escape = CMP_pass1(tdbb, csb, escape); @@ -721,11 +721,11 @@ if ((node->nod_flags & nod_invariant) && (pattern->nod_type != nod_literal || escape->nod_type != nod_literal)) { - const jrd_node_base* const* ctx_node, *const *end; + const LegacyNodeOrRseNode* ctx_node, *end; for (ctx_node = csb->csb_current_nodes.begin(), end = csb->csb_current_nodes.end(); - ctx_node < end; ctx_node++) + ctx_node != end; ++ctx_node) { - if ((*ctx_node)->nod_type == nod_rse) + if (ctx_node->rseNode) break; } Modified: firebird/trunk/src/dsql/Nodes.h =================================================================== --- firebird/trunk/src/dsql/Nodes.h 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/src/dsql/Nodes.h 2010-08-24 03:25:01 UTC (rev 51464) @@ -38,7 +38,7 @@ class dsql_nod; class ExprNode; class jrd_nod; -class RecordSelExpr; +class RseNode; class SlidingWindow; class TypeClause; @@ -550,7 +550,7 @@ } public: - virtual void pass2Cursor(RecordSelExpr*& /*rsePtr*/, Cursor**& /*cursorPtr*/) + virtual void pass2Cursor(RseNode*& /*rsePtr*/, Cursor**& /*cursorPtr*/) { } Modified: firebird/trunk/src/dsql/StmtNodes.cpp =================================================================== --- firebird/trunk/src/dsql/StmtNodes.cpp 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/src/dsql/StmtNodes.cpp 2010-08-24 03:25:01 UTC (rev 51464) @@ -26,6 +26,7 @@ #include "../dsql/node.h" #include "../jrd/blr.h" #include "../jrd/tra.h" +#include "../jrd/RecordSourceNodes.h" #include "../jrd/recsrc/Cursor.h" #include "../jrd/cmp_proto.h" #include "../jrd/dfw_proto.h" @@ -1291,10 +1292,10 @@ csb->csb_blr_reader.peekByte() == (UCHAR) blr_singular || csb->csb_blr_reader.peekByte() == (UCHAR) blr_scrollable) { - node->rse = PAR_parse_node(tdbb, csb, TYPE_RSE); + node->rse = RseNode::getFrom(PAR_parse_node(tdbb, csb, TYPE_RSE)); } else - node->rse = PAR_rse(tdbb, csb, blrOp); + node->rse = RseNode::getFrom(PAR_rse(tdbb, csb, blrOp)); node->statement = PAR_parse_node(tdbb, csb, STATEMENT); @@ -1414,7 +1415,7 @@ StmtNode* ForNode::pass1(thread_db* tdbb, CompilerScratch* csb) { stall = CMP_pass1(tdbb, csb, stall); - rse = CMP_pass1(tdbb, csb, rse); + rse->pass1(tdbb, csb, csb->csb_view); statement = CMP_pass1(tdbb, csb, statement); return this; } @@ -1422,7 +1423,7 @@ StmtNode* ForNode::pass2(thread_db* tdbb, CompilerScratch* csb) { stall = CMP_pass2(tdbb, csb, stall, node); - rse = CMP_pass2(tdbb, csb, rse, node); + rse->pass2(tdbb, csb); statement = CMP_pass2(tdbb, csb, statement, node); return this; } Modified: firebird/trunk/src/dsql/StmtNodes.h =================================================================== --- firebird/trunk/src/dsql/StmtNodes.h 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/src/dsql/StmtNodes.h 2010-08-24 03:25:01 UTC (rev 51464) @@ -220,9 +220,9 @@ virtual StmtNode* pass1(thread_db* tdbb, CompilerScratch* csb); virtual StmtNode* pass2(thread_db* tdbb, CompilerScratch* csb); - virtual void pass2Cursor(RecordSelExpr*& rsePtr, Cursor**& cursorPtr) + virtual void pass2Cursor(RseNode*& rsePtr, Cursor**& cursorPtr) { - rsePtr = reinterpret_cast<RecordSelExpr*>(static_cast<jrd_nod*>(rse)); + rsePtr = rse; cursorPtr = cursor.getAddress(); } @@ -236,7 +236,7 @@ dsql_nod* dsqlLabel; bool dsqlForceSingular; NestConst<jrd_nod> stall; - NestConst<jrd_nod> rse; + NestConst<RseNode> rse; NestConst<jrd_nod> statement; NestConst<Cursor> cursor; }; Modified: firebird/trunk/src/dsql/Visitors.h =================================================================== --- firebird/trunk/src/dsql/Visitors.h 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/src/dsql/Visitors.h 2010-08-24 03:25:01 UTC (rev 51464) @@ -427,7 +427,7 @@ virtual USHORT getFieldId(jrd_nod* input); -protected: +public: CompilerScratch* csb; UCHAR* remap; jrd_nod* message; Modified: firebird/trunk/src/jrd/Attachment.h =================================================================== --- firebird/trunk/src/jrd/Attachment.h 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/src/jrd/Attachment.h 2010-08-24 03:25:01 UTC (rev 51464) @@ -65,7 +65,6 @@ class IndexLock; class ArrayField; struct sort_context; - class RecordSelExpr; class vcl; class TextType; class Parameter; Modified: firebird/trunk/src/jrd/Optimizer.cpp =================================================================== --- firebird/trunk/src/jrd/Optimizer.cpp 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/src/jrd/Optimizer.cpp 2010-08-24 03:25:01 UTC (rev 51464) @@ -36,6 +36,7 @@ #include "../jrd/rse.h" #include "../jrd/ods.h" #include "../jrd/Optimizer.h" +#include "../jrd/RecordSourceNodes.h" #include "../jrd/recsrc/RecordSource.h" #include "../dsql/ExprNodes.h" #include "../dsql/StmtNodes.h" @@ -89,44 +90,17 @@ DEV_BLKCHK(csb, type_csb); DEV_BLKCHK(node, type_nod); - if (node->nod_flags & nod_deoptimize) { + if (node->nod_flags & nod_deoptimize) return false; - } // Recurse thru interesting sub-nodes switch (node->nod_type) { - case nod_procedure: - { - jrd_nod* inputs = node->nod_arg[e_prc_inputs]; - if (inputs) - { - fb_assert(inputs->nod_type == nod_asn_list); - jrd_nod* const* ptr = inputs->nod_arg; - for (const jrd_nod* const* const end = ptr + inputs->nod_count; ptr < end; ptr++) - { - if (!OPT_computable(csb, *ptr, stream, idx_use, allowOnlyCurrentStream)) { - return false; - } - } - } - break; - } + case nod_class_recsrcnode_jrd: + return reinterpret_cast<RecordSourceNode*>(node->nod_arg[0])->computable( + csb, stream, idx_use, allowOnlyCurrentStream, NULL); - case nod_union: - { - jrd_nod* clauses = node->nod_arg[e_uni_clauses]; - jrd_nod* const* ptr = clauses->nod_arg; - for (const jrd_nod* const* const end = ptr + clauses->nod_count; ptr < end; ptr += 2) - { - if (!OPT_computable(csb, *ptr, stream, idx_use, allowOnlyCurrentStream)) { - return false; - } - } - break; - } - case nod_class_exprnode_jrd: { ExprNode* exprNode = reinterpret_cast<ExprNode*>(node->nod_arg[0]); @@ -146,17 +120,13 @@ jrd_nod* const* ptr = node->nod_arg; for (const jrd_nod* const* const end = ptr + node->nod_count; ptr < end; ptr++) { - if (!OPT_computable(csb, *ptr, stream, idx_use, allowOnlyCurrentStream)) { + if (!OPT_computable(csb, *ptr, stream, idx_use, allowOnlyCurrentStream)) return false; - } } break; } } - RecordSelExpr* rse; - jrd_nod* sub; - jrd_nod* value; USHORT n; switch (node->nod_type) @@ -166,15 +136,12 @@ if (allowOnlyCurrentStream) { if (n != stream && !(csb->csb_rpt[n].csb_flags & csb_sub_stream)) - { return false; - } } else { - if (n == stream) { + if (n == stream) return false; - } } return csb->csb_rpt[n].csb_flags & csb_active; @@ -225,115 +192,24 @@ case nod_total: case nod_count: case nod_from: - if ((sub = node->nod_arg[e_stat_default]) && - !OPT_computable(csb, sub, stream, idx_use, allowOnlyCurrentStream)) { - return false; - } - rse = (RecordSelExpr*) node->nod_arg[e_stat_rse]; - value = node->nod_arg[e_stat_value]; - break; + jrd_nod* sub; - case nod_rse: - rse = (RecordSelExpr*) node; - value = NULL; - break; - - case nod_aggregate: - rse = (RecordSelExpr*) node->nod_arg[e_agg_rse]; - rse->rse_sorted = node->nod_arg[e_agg_group]; - value = NULL; - break; - - case nod_window: - rse = (RecordSelExpr*) node->nod_arg[e_win_rse]; - value = NULL; - break; - - default: - return true; - } - - // Node is a record selection expression. - bool result = true; - - if ((sub = rse->rse_first) && !OPT_computable(csb, sub, stream, idx_use, allowOnlyCurrentStream)) { - return false; - } - - if ((sub = rse->rse_skip) && !OPT_computable(csb, sub, stream, idx_use, allowOnlyCurrentStream)) { - return false; - } - - // Set sub-streams of rse active - jrd_nod* const* ptr; - const jrd_nod* const* end; - - for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end; ptr++) - { - const jrd_nod* const node = *ptr; - - if (node->nod_type == nod_window) - { - const jrd_nod* windows = node->nod_arg[e_win_windows]; - - for (unsigned i = 0; i < windows->nod_count; ++i) + if ((sub = node->nod_arg[e_stat_default]) && + !OPT_computable(csb, sub, stream, idx_use, allowOnlyCurrentStream)) { - n = (USHORT)(IPTR) windows->nod_arg[i]->nod_arg[e_part_stream]; - csb->csb_rpt[n].csb_flags |= (csb_active | csb_sub_stream); + return false; } - } - else if (node->nod_type != nod_rse) - { - n = (USHORT)(IPTR) node->nod_arg[STREAM_INDEX(node)]; - csb->csb_rpt[n].csb_flags |= (csb_active | csb_sub_stream); - } - } - // Check sub-stream - if (((sub = rse->rse_boolean) && !OPT_computable(csb, sub, stream, idx_use, allowOnlyCurrentStream)) || - ((sub = rse->rse_sorted) && !OPT_computable(csb, sub, stream, idx_use, allowOnlyCurrentStream)) || - ((sub = rse->rse_projection) && !OPT_computable(csb, sub, stream, idx_use, allowOnlyCurrentStream))) - { - result = false; - } + fb_assert(node->nod_arg[e_stat_rse]->nod_type == nod_class_recsrcnode_jrd); + RseNode* rse = reinterpret_cast<RseNode*>(node->nod_arg[e_stat_rse]->nod_arg[0]); - for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end && result; ptr++) - { - if (!OPT_computable(csb, (*ptr), stream, idx_use, allowOnlyCurrentStream)) - { - result = false; + return rse->computable(csb, stream, idx_use, allowOnlyCurrentStream, + node->nod_arg[e_stat_value]); } } - // Check value expression, if any - if (result && value && !OPT_computable(csb, value, stream, idx_use, allowOnlyCurrentStream)) { - result = false; - } - - // Reset streams inactive - for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end; ptr++) - { - const jrd_nod* const node = *ptr; - - if (node->nod_type == nod_window) - { - const jrd_nod* windows = node->nod_arg[e_win_windows]; - - for (unsigned i = 0; i < windows->nod_count; ++i) - { - n = (USHORT)(IPTR) windows->nod_arg[i]->nod_arg[e_part_stream]; - csb->csb_rpt[n].csb_flags &= ~(csb_active | csb_sub_stream); - } - } - else if (node->nod_type != nod_rse) - { - n = (USHORT)(IPTR) (*ptr)->nod_arg[STREAM_INDEX((*ptr))]; - csb->csb_rpt[n].csb_flags &= ~(csb_active | csb_sub_stream); - } - } - - return result; + return true; } @@ -1067,6 +943,7 @@ return OPT_make_binary_node(node_type, node1, node2, false); } + void OptimizerRetrieval::findDependentFromStreams(jrd_nod* node, SortedStreamList* streamList) const { /************************************** @@ -1081,30 +958,8 @@ // Recurse thru interesting sub-nodes - if (node->nod_type == nod_procedure) + if (node->nod_type == nod_class_exprnode_jrd) { - jrd_nod* const inputs = node->nod_arg[e_prc_inputs]; - if (inputs) - { - fb_assert(inputs->nod_type == nod_asn_list); - jrd_nod* const* ptr = inputs->nod_arg; - for (const jrd_nod* const* const end = ptr + inputs->nod_count; ptr < end; ptr++) - { - findDependentFromStreams(*ptr, streamList); - } - } - } - else if (node->nod_type == nod_union) - { - jrd_nod* const clauses = node->nod_arg[e_uni_clauses]; - jrd_nod* const* ptr = clauses->nod_arg; - for (const jrd_nod* const* const end = ptr + clauses->nod_count; ptr < end; ptr += 2) - { - findDependentFromStreams(*ptr, streamList); - } - } - else if (node->nod_type == nod_class_exprnode_jrd) - { ExprNode* exprNode = reinterpret_cast<ExprNode*>(node->nod_arg[0]); for (NestConst<NestConst<jrd_nod> >* i = exprNode->jrdChildNodes.begin(); @@ -1113,19 +968,19 @@ findDependentFromStreams(**i, streamList); } } + else if (node->nod_type == nod_class_recsrcnode_jrd) + { + reinterpret_cast<RecordSourceNode*>(node->nod_arg[0])->findDependentFromStreams( + this, streamList); + } else { jrd_nod* const* ptr = node->nod_arg; + for (const jrd_nod* const* const end = ptr + node->nod_count; ptr < end; ptr++) - { findDependentFromStreams(*ptr, streamList); - } } - RecordSelExpr* rse; - jrd_nod* sub; - jrd_nod* value; - switch (node->nod_type) { case nod_field: @@ -1136,9 +991,8 @@ (csb->csb_rpt[fieldStream].csb_flags & csb_active) && !(csb->csb_rpt[fieldStream].csb_flags & csb_trigger)) { - if (!streamList->exist(fieldStream)) { + if (!streamList->exist(fieldStream)) streamList->add(fieldStream); - } } return; } @@ -1180,67 +1034,26 @@ case nod_total: case nod_count: case nod_from: - if (sub = node->nod_arg[e_stat_default]) { + { + jrd_nod* sub; + + if (sub = node->nod_arg[e_stat_default]) findDependentFromStreams(sub, streamList); - } - rse = (RecordSelExpr*) node->nod_arg[e_stat_rse]; - value = node->nod_arg[e_stat_value]; - break; - case nod_rse: - rse = (RecordSelExpr*) node; - value = NULL; - break; + fb_assert(node->nod_arg[e_stat_rse]->nod_type == nod_class_recsrcnode_jrd); + RseNode* rse = reinterpret_cast<RseNode*>(node->nod_arg[e_stat_rse]->nod_arg[0]); - case nod_aggregate: - rse = (RecordSelExpr*) node->nod_arg[e_agg_rse]; - rse->rse_sorted = node->nod_arg[e_agg_group]; - value = NULL; - break; + rse->findDependentFromStreams(this, streamList); - case nod_window: - rse = (RecordSelExpr*) node->nod_arg[e_win_rse]; - value = NULL; - break; + jrd_nod* value = node->nod_arg[e_stat_value]; - default: - return; - } + // Check value expression, if any + if (value) + findDependentFromStreams(value, streamList); - // Node is a record selection expression. - if (sub = rse->rse_first) { - findDependentFromStreams(sub, streamList); + break; + } } - - if (sub = rse->rse_skip) { - findDependentFromStreams(sub, streamList); - } - - if (sub = rse->rse_boolean) { - findDependentFromStreams(sub, streamList); - } - - if (sub = rse->rse_sorted) { - findDependentFromStreams(sub, streamList); - } - - if (sub = rse->rse_projection) { - findDependentFromStreams(sub, streamList); - } - - jrd_nod* const* ptr; - const jrd_nod* const* end; - for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end; ptr++) - { - findDependentFromStreams(*ptr, streamList); - } - - // Check value expression, if any - if (value) { - findDependentFromStreams(value, streamList); - } - - return; } const string& OptimizerRetrieval::getAlias() Modified: firebird/trunk/src/jrd/Optimizer.h =================================================================== --- firebird/trunk/src/jrd/Optimizer.h 2010-08-24 03:15:58 UTC (rev 51463) +++ firebird/trunk/src/jrd/Optimizer.h 2010-08-24 03:25:01 UTC (rev 51464) @@ -80,24 +80,6 @@ Firebird::string OPT_make_alias(thread_db*, const CompilerScratch*, const CompilerScratch::csb_repeat*); jrd_nod* OPT_make_binary_node(nod_t, jrd_nod*, jrd_nod*, bool); -inline int STREAM_INDEX(const jrd_nod* node) -{ - switch (node->nod_type) - { - case nod_relation: - return e_rel_stream; - case nod_procedure: - return e_prc_stream; - case nod_union: - return e_uni_stream; - case nod_aggregate: - return e_agg_stream; - default: - fb_assert(false); - return 0; // silence compiler warning. - } -} - enum segmentScanType { segmentScanNone, segmentScanGreater, @@ -146,8 +128,6 @@ Firebird::Array<IndexScratchSegment*> segments; }; -typedef Firebird::SortedArray<int> SortedStreamList; - class InversionCandidate { public: @@ -182,9 +162,10 @@ InversionCandidate* getCost(); InversionCandidate* getInversion(IndexTableScan** rsb); + void findDependentFromStreams(jrd_nod* node, SortedStreamList* streamList) const; + protected: jrd_nod* composeInversion(jrd_nod* node1, jrd_nod* node2, nod_t node_type) const; - void findDependentFromStreams(jrd_nod* node, SortedStreamList* streamList) const; const Firebird::string& getAlias(); InversionCandidate* generateInversion(IndexTableScan** rsb); IndexTableScan* generateNavigation(); Added: firebird/trunk/src/jrd/RecordSourceNodes.cpp =================================================================== --- firebird/trunk/src/jrd/RecordSourceNodes.cpp (rev 0) +++ firebird/trunk/src/jrd/RecordSourceNodes.cpp 2010-08-24 03:25:01 UTC (rev 51464) @@ -0,0 +1,2444 @@ +/* + * The contents of this file are subject to the Interbase Public + * License Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy + * of the License at http://www.Inprise.com/IPL.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 was created by Inprise Corporation + * and its predecessors. Portions created by Inprise Corporation are + * Copyright (C) Inprise Corporation. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + * Adriano dos Santos Fernandes + */ + +#include "firebird.h" +#include "../jrd/common.h" +#include "../jrd/align.h" +#include "../jrd/RecordSourceNodes.h" +#include "../jrd/DataTypeUtil.h" +#include "../jrd/Optimizer.h" +#include "../jrd/recsrc/RecordSource.h" +#include "../jrd/btr_proto.h" +#include "../jrd/cmp_proto.h" +#include "../jrd/dbg_proto.h" +#include "../jrd/dsc_proto.h" +#include "../jrd/met_proto.h" +#include "../jrd/opt_proto.h" +#include "../jrd/par_proto.h" + +using namespace Firebird; +using namespace Jrd; + + +static jrd_nod* parseMap(thread_db* tdbb, CompilerScratch* csb, USHORT stream); +static SSHORT strcmpSpace(const char* p, const char* q); +static void processSource(thread_db* tdbb, CompilerScratch* csb, RseNode* rse, + RecordSourceNode* source, jrd_nod** boolean, RecordSourceNodeStack& stack); +static void processMap(thread_db* tdbb, CompilerScratch* csb, jrd_nod* map, Format** input_format); +static void genDeliverUnmapped(thread_db* tdbb, NodeStack* deliverStack, jrd_nod* map, + NodeStack* parentStack, UCHAR shellStream); +static void markIndices(CompilerScratch::csb_repeat* csb_tail, SSHORT relation_id); +static void sortIndicesBySelectivity(CompilerScratch::csb_repeat* csb_tail); + + +//-------------------- + + +// Parse a relation reference. +RelationSourceNode* RelationSourceNode::parse(thread_db* tdbb, CompilerScratch* csb, + SSHORT blrOp, bool parseContext) +{ + SET_TDBB(tdbb); + + // Make a relation reference node + + RelationSourceNode* node = FB_NEW(*tdbb->getDefaultPool()) RelationSourceNode( + *tdbb->getDefaultPool()); + + // Find relation either by id or by name + string* alias_string = NULL; + MetaName name; + + switch (blrOp) + { + case blr_rid: + case blr_rid2: + { + const SSHORT id = csb->csb_blr_reader.getWord(); + + if (blrOp == blr_rid2) + { + alias_string = FB_NEW(csb->csb_pool) string(csb->csb_pool); + PAR_name(csb, *alias_string); + } + + if (!(node->relation = MET_lookup_relation_id(tdbb, id, false))) + name.printf("id %d", id); + + break; + } + + case blr_relation: + case blr_relation2: + { + PAR_name(csb, name); + + if (blrOp == blr_relation2) + { + alias_string = FB_NEW(csb->csb_pool) string(csb->csb_pool); + PAR_name(csb, *alias_string); + } + + node->relation = MET_lookup_relation(tdbb, name); + break; + } + + default: + fb_assert(false); + } + + if (!node->relation) + PAR_error(csb, Arg::Gds(isc_relnotdef) << Arg::Str(name), false); + + // if an alias was passed, store with the relation + + if (alias_string) + node->alias = stringDup(*tdbb->getDefaultPool(), *alias_string); + + // Scan the relation if it hasn't already been scanned for meta data + + if ((!(node->relation->rel_flags & REL_scanned) || (node->relation->rel_flags & REL_being_scanned)) && + ((node->relation->rel_flags & REL_force_scan) || !(csb->csb_g_flags & csb_internal))) + { + node->relation->rel_flags &= ~REL_force_scan; + MET_scan_relation(tdbb, node->relation); + } + else if (node->relation->rel_flags & REL_sys_triggers) + MET_parse_sys_trigger(tdbb, node->relation); + + // generate a stream for the relation reference, assuming it is a real reference + + if (parseContext) + { + node->stream = PAR_context(csb, &node->context); + fb_assert(node->stream <= MAX_STREAMS); + + csb->csb_rpt[node->stream].csb_relation = node->relation; + csb->csb_rpt[node->stream].csb_alias = alias_string; + + if (csb->csb_g_flags & csb_get_dependencies) + PAR_dependency(tdbb, csb, node->stream, (SSHORT) -1, ""); + } + else + delete alias_string; + + return node; +} + +RelationSourceNode* RelationSourceNode::copy(thread_db* tdbb, NodeCopier& copier) +{ + if (!copier.remap) + BUGCHECK(221); // msg 221 (CMP) copy: cannot remap + + RelationSourceNode* newSource = FB_NEW(*tdbb->getDefaultPool()) RelationSourceNode( + *tdbb->getDefaultPool()); + + // Last entry in the remap contains the the original stream number. + // Get that stream number so that the flags can be copied + // into the newly created child stream. + + const int relative_stream = stream ? copier.remap[stream - 1] : stream; + newSource->stream = copier.csb->nextStream(); + copier.remap[stream] = (UCHAR) newSource->stream; + + newSource->context = context; + newSource->relation = relation; + newSource->view = view; + + CompilerScratch::csb_repeat* element = CMP_csb_element(copier.csb, newSource->stream); + element->csb_relation = (jrd_rel*) newSource->relation; + element->csb_view = newSource->view; + element->csb_view_stream = copier.remap[0]; + + /** If there was a parent stream no., then copy the flags + from that stream to its children streams. (Bug 10164/10166) + For e.g. + consider a view V1 with 2 streams + stream #1 from table T1 + stream #2 from table T2 + consider a procedure P1 with 2 streams + stream #1 from table X + stream #2 from view V1 + + During pass1 of procedure request, the engine tries to expand + all the views into their base tables. It creates a compilier + scratch block which initially looks like this + stream 1 -------- X + stream 2 -------- V1 + while expanding V1 the engine calls copy() with nod_relation. + A new stream 3 is created. Now the CompilerScratch looks like + stream 1 -------- X + stream 2 -------- V1 map [2,3] + stream 3 -------- T1 + After T1 stream has been created the flags are copied from + stream #1 because V1's definition said the original stream + number for T1 was 1. However since its being merged with + the procedure request, stream #1 belongs to a different table. + The flags should be copied from stream 2 i.e. V1. We can get + this info from variable remap. + + Since we didn't do this properly before, V1's children got + tagged with whatever flags X possesed leading to various + errors. + + We now store the proper stream no in relative_stream and + later use it to copy the flags. -Sudesh (03/05/99) + **/ + + copier.csb->csb_rpt[newSource->stream].csb_flags |= + copier.csb->csb_rpt[relative_stream].csb_flags & csb_no_dbkey; + + return newSource; +} + +void RelationSourceNode::ignoreDbKey(thread_db* tdbb, CompilerScratch* csb, const jrd_rel* view) const +{ + csb->csb_rpt[stream].csb_flags |= csb_no_dbkey; + const CompilerScratch::csb_repeat* tail = &csb->csb_rpt[stream]; + const jrd_rel* relation = tail->csb_relation; + + if (relation) + { + CMP_post_access(tdbb, csb, relation->rel_security_name, + (tail->csb_view) ? tail->csb_view->rel_id : (view ? view->rel_id : 0), + SCL_read, SCL_object_table, relation->rel_name); + } +} + +void RelationSourceNode::pass1Source(thread_db* tdbb, CompilerScratch* csb, RseNode* rse, + jrd_nod** boolean, RecordSourceNodeStack& stack) +{ + stack.push(this); // Assume that the source will be used. Push it on the final stream stack. + + // We have a view or a base table; + // prepare to check protection of relation when a field in the stream of the + // relation is accessed. + + jrd_rel* const parent_view = csb->csb_view; + const USHORT view_stream = csb->csb_view_stream; + + jrd_rel* relationView = relation; + CMP_post_resource(&csb->csb_resources, relationView, Resource::rsc_relation, relationView->rel_id); + view = parent_view; + + CompilerScratch::csb_repeat* const element = CMP_csb_element(csb, stream); + element->csb_view = parent_view; + fb_assert(view_stream <= MAX_STREAMS); + element->csb_view_stream = (UCHAR) view_stream; + + // in the case where there is a parent view, find the context name + + if (parent_view) + { + const ViewContexts& ctx = parent_view->rel_view_contexts; + const USHORT key = context; + size_t pos; + + if (ctx.find(key, pos)) + { + element->csb_alias = FB_NEW(csb->csb_pool) + string(csb->csb_pool, ctx[pos]->vcx_context_name); + } + } + + // check for a view - if not, nothing more to do + + RseNode* view_rse = relationView->rel_view_rse; + if (!view_rse) + return; + + // we've got a view, expand it + + DEBUG; + stack.pop(); + UCHAR* map = CMP_alloc_map(tdbb, csb, stream); + + AutoSetRestore<USHORT> autoRemapVariable(&csb->csb_remap_variable, + (csb->csb_variables ? csb->csb_variables->count() : 0) + 1); + AutoSetRestore<jrd_rel*> autoView(&csb->csb_view, relationView); + AutoSetRestore<USHORT> autoViewStream(&csb->csb_view_stream, stream); + + // We don't expand the view in two cases: + // 1) If the view has a projection, sort, first/skip or explicit plan. + // 2) If it's part of an outer join. + + if (rse->rse_jointype || // view_rse->rse_jointype || ??? + view_rse->rse_sorted || view_rse->rse_projection || view_rse->rse_first || + view_rse->rse_skip || view_rse->rse_plan) + { + NodeCopier copier(csb, map); + RseNode* copy = view_rse->copy(tdbb, copier); + DEBUG; + copy->pass1(tdbb, csb, csb->csb_view); + stack.push(copy); + DEBUG; + return; + } + + // if we have a projection which we can bubble up to the parent rse, set the + // parent rse to our projection temporarily to flag the fact that we have already + // seen one so that lower-level views will not try to map their projection; the + // projection will be copied and correctly mapped later, but we don't have all + // the base streams yet + + if (view_rse->rse_projection) + rse->rse_projection = view_rse->rse_projection; + + // disect view into component relations + + NestConst<RecordSourceNode>* arg = view_rse->rse_relations.begin(); + for (const NestConst<RecordSourceNode>* const end = view_rse->rse_relations.end(); arg != end; ++arg) + { + // this call not only copies the node, it adds any streams it finds to the map + NodeCopier copier(csb, map); + RecordSourceNode* node = (*arg)->copy(tdbb, copier); + + // Now go out and process the base table itself. This table might also be a view, + // in which case we will continue the process by recursion. + processSource(tdbb, csb, rse, node, boolean, stack); + } + + // When there is a projection in the view, copy the projection up to the query RseNode. + // In order to make this work properly, we must remap the stream numbers of the fields + // in the view to the stream number of the base table. Note that the map at this point + // contains the stream numbers of the referenced relations, since it was added during the call + // to copy() above. After the copy() below, the fields in the projection will reference the + // base table(s) instead of the view's context (see bug #8822), so we are ready to context- + // recognize them in CMP_pass1() - that is, replace the field nodes with actual field blocks. + + if (view_rse->rse_projection) + { + rse->rse_projection = + CMP_pass1(tdbb, csb, NodeCopier::copy(tdbb, csb, view_rse->rse_projection, map)); + } + + // if we encounter a boolean, copy it and retain it by ANDing it in with the + // boolean on the parent view, if any + + if (view_rse->rse_boolean) + { + jrd_nod* node = CMP_pass1(tdbb, csb, NodeCopier::copy(tdbb, + csb, view_rse->rse_boolean, map)); + + if (*boolean) + { + // The order of the nodes here is important! The + // boolean from the view must appear first so that + // it gets expanded first in pass1. + + jrd_nod* additional = PAR_make_node(tdbb, 2); + additional->nod_type = nod_and; + additional->nod_arg[0] = node; + additional->nod_arg[1] = *boolean; + *boolean = additional; + } + else + *boolean = node; + } +} + +void RelationSourceNode::pass2Rse(thread_db* tdbb, CompilerScratch* csb) +{ + fb_assert(stream <= MAX_STREAMS); + csb->csb_rpt[stream].csb_flags |= csb_active; + + pass2(tdbb, csb); +} + +RecordSource* RelationSourceNode::compile(thread_db* tdbb, CompilerScratch* csb, OptimizerBlk* opt, + RseNode* rse, NodeStack* parent_stack, stream_array_t& beds, stream_array_t& key_streams, + stream_array_t& local_streams, NodeStack& conjunct_stack, stream_array_t& streams, + jrd_nod* sort, jrd_nod* aggregate, StreamsArray& outerStreams, SLONG conjunct_count, + bool innerSubStream) +{ + fb_assert(stream <= MAX_UCHAR); + fb_assert(beds[0] < MAX_STREAMS && beds[0] < MAX_UCHAR); // debug check + //if (beds[0] >= MAX_STREAMS) // all builds check + // ERR_post(Arg::Gds(isc_too_many_contexts)); + + beds[++beds[0]] = (UCHAR) stream; + + // we have found a base relation; record its stream + // number in the streams array as a candidate for + // merging into a river + + // TMN: Is the intention really to allow streams[0] to overflow? + // I must assume that is indeed not the intention (not to mention + // it would make code later on fail), so I added the following fb_assert. + fb_assert(streams[0] < MAX_STREAMS && streams[0] < MAX_UCHAR); + + streams[++streams[0]] = (UCHAR) stream; + + if (rse->rse_jointype == blr_left) + outerStreams.add(stream); + + // if we have seen any booleans or sort fields, we may be able to + // use an index to optimize them; retrieve the current format of + // all indices at this time so we can determine if it's possible + // AB: if a parent_stack was available and conjunct_count was 0 + // then no indices where retrieved. Added also OR check on + // parent_stack below. SF BUG # [ 508594 ] + + if (conjunct_count || sort || aggregate || parent_stack) + { + jrd_rel* relation = (jrd_rel*) this->relation; + + if (relation && !relation->rel_file && !relation->isVirtual()) + { + csb->csb_rpt[stream].csb_indices = + BTR_all(tdbb, relation, &csb->csb_rpt[stream].csb_idx, relation->getPages(tdbb)); + sortIndicesBySelectivity(&csb->csb_rpt[stream]); + markIndices(&csb->csb_rpt[stream], relation->rel_id); + } + else + csb->csb_rpt[stream].csb_indices = 0; + + const Format* format = CMP_format(tdbb, csb, stream); + csb->csb_rpt[stream].csb_cardinality = OPT_getRelationCardinality(tdbb, relation, format); + } + + return NULL; +} + + +//-------------------- + + +// Parse an procedural view reference. +ProcedureSourceNode* ProcedureSourceNode::parse(thread_db* tdbb, CompilerScratch* csb, + SSHORT blrOp) +{ + SET_TDBB(tdbb); + + jrd_prc* procedure = NULL; + string* alias_string = NULL; + QualifiedName name; + + switch (blrOp) + { + case blr_pid: + case blr_pid2: + { + const SSHORT pid = csb->csb_blr_reader.getWord(); + + if (blrOp == blr_pid2) + { + alias_string = FB_NEW(csb->csb_pool) string(csb->csb_pool); + PAR_name(csb, *alias_string); + } + + if (!(procedure = MET_lookup_procedure_id(tdbb, pid, false, false, 0))) + name.identifier.printf("id %d", pid); + + break; + } + + case blr_procedure: + case blr_procedure2: + case blr_procedure3: + case blr_procedure4: + { + if (blrOp == blr_procedure3 || blrOp == blr_procedure4) + PAR_name(csb, name.package); + + PAR_name(csb, name.identifier); + + if (blrOp == blr_procedure2 || blrOp == blr_procedure4) + { + alias_string = FB_NEW(csb->csb_pool) string(csb->csb_pool); + PAR_name(csb, *alias_string); + } + + procedure = MET_lookup_procedure(tdbb, name, false); + + break; + } + + default: + fb_assert(false); + } + + if (!procedure) + PAR_error(csb, Arg::Gds(isc_prcnotdef) << Arg::Str(name.toString())); + + if (procedure->prc_type == prc_executable) + { + const string name = procedure->getName().toString(); + + if (tdbb->getAttachment()->att_flags & ATT_gbak_attachment) + PAR_warning(Arg::Warning(isc_illegal_prc_type) << Arg::Str(name)); + else + PAR_error(csb, Arg::Gds(isc_illegal_prc_type) << Arg::Str(name)); + } + + ProcedureSourceNode* node = FB_NEW(*tdbb->getDefaultPool()) ProcedureSourceNode( + *tdbb->getDefaultPool()); + + node->procedure = procedure->getId(); + node->stream = PAR_context(csb, &node->context); + + csb->csb_rpt[node->stream].csb_procedure = procedure; + csb->csb_rpt[node->stream].csb_alias = alias_string; + + PAR_procedure_parms(tdbb, csb, procedure, node->in_msg.getAddress(), + node->inputs.getAddress(), true); + + if (csb->csb_g_flags & csb_get_dependencies) + PAR_dependency(tdbb, csb, node->stream, (SSHORT) -1, ""); + + return node; +} + +ProcedureSourceNode* ProcedureSourceNode::copy(thread_db* tdbb, NodeCopier& copier) +{ + if (!copier.remap) + BUGCHECK(221); // msg 221 (CMP) copy: cannot remap + + ProcedureSourceNode* newSource = FB_NEW(*tdbb->getDefaultPool()) ProcedureSourceNode( + *tdbb->getDefaultPool()); + + // dimitr: See the appropriate code and comment in NodeCopier (in nod_argument). + // We must copy the message first and only then use the new pointer to + // copy the inputs properly. + newSource->in_msg = copier.copy(tdbb, in_msg); + + { // scope + AutoSetRestore<jrd_nod*> autoMessage(&copier.message, newSource->in_msg); + newSource->inputs = copier.copy(tdbb, inputs); + } + + newSource->stream = copier.csb->nextStream(); + copier.remap[stream] = (UCHAR) newSource->stream; + newSource->context = context; + newSource->procedure = procedure; + newSource->view = view; + CompilerScratch::csb_repeat* element = CMP_csb_element(copier.csb, newSource->stream); + // SKIDDER: Maybe we need to check if we really found a procedure? + element->csb_procedure = MET_lookup_procedure_id(tdbb, newSource->procedure, false, false, 0); + element->csb_view = (jrd_rel*) newSource->view; + element->csb_view_stream = copier.remap[0]; + + copier.csb->csb_rpt[newSource->stream].csb_flags |= copier.csb->csb_rpt[stream].csb_flags & csb_no_dbkey; + + return newSource; +} + +void ProcedureSourceNode::pass1(thread_db* tdbb, CompilerScratch* csb, jrd_rel* view) +{ + inputs = CMP_pass1(tdbb, csb, inputs); + in_msg = CMP_pass1(tdbb, csb, in_msg); +} + +void ProcedureSourceNode::pass1Source(thread_db* tdbb, CompilerScratch* csb, RseNode* rse, + jrd_nod** boolean, RecordSourceNodeStack& stack) +{ + stack.push(this); // Assume that the source will be used. Push it on the final stream stack. + + pass1(tdbb, csb, csb->csb_view); + + jrd_prc* const proc = MET_lookup_procedure_id(tdbb, procedure, false, false, 0); + CMP_post_procedure_access(tdbb, csb, proc); + CMP_post_resource(&csb->csb_resources, proc, Resource::rsc_procedure, proc->getId()); + + jrd_rel* const parent_view = csb->csb_view; + const USHORT view_stream = csb->csb_view_stream; + view = parent_view; + + CompilerScratch::csb_repeat* const element = CMP_csb_element(csb, stream); + element->csb_view = parent_view; + fb_assert(view_stream <= MAX_STREAMS); + element->csb_view_stream = (UCHAR) view_stream; + + // in the case where there is a parent view, find the context name + + if (parent_view) + { + const ViewContexts& ctx = parent_view->rel_view_contexts; + const USHORT key = context; + size_t pos; + + if (ctx.find(key, pos)) + { + element->csb_alias = FB_NEW(csb->csb_pool) string( + csb->csb_pool, ctx[pos]->vcx_context_name); + } + } +} + +void ProcedureSourceNode::pass2(thread_db* tdbb, CompilerScratch* csb) +{ + CMP_pass2(tdbb, csb, inputs, NULL); + CMP_pass2(tdbb, csb, in_msg, NULL); +} + +void ProcedureSourceNode::pass2Rse(thread_db* tdbb, CompilerScratch* csb) +{ + fb_assert(stream <= MAX_STREAMS); + csb->csb_rpt[stream].csb_flags |= csb_active; + + pass2(tdbb, csb); +} + +RecordSource* ProcedureSourceNode::compile(thread_db* tdbb, CompilerScratch* csb, OptimizerBlk* opt, + RseNode* rse, NodeStack* parent_stack, stream_array_t& beds, stream_array_t& key_streams, + stream_array_t& local_streams, NodeStack& conjunct_stack, stream_array_t& streams, + jrd_nod* sort, jrd_nod* aggregate, StreamsArray& outerStreams, SLONG conjunct_count, + bool innerSubStream) +{ + fb_assert(stream <= MAX_UCHAR); + fb_assert(beds[0] < MAX_STREAMS && beds[0] < MAX_UCHAR); // debug check + //if (beds[0] >= MAX_STREAMS) // all builds check + // ERR_post(Arg::Gds(isc_too_many_contexts)); + + beds[++beds[0]] = (UCHAR) stream; + + RecordSource* rsb = generate(tdbb, opt); + fb_assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR); + local_streams[++local_streams[0]] = stream; + + return rsb; +} + +// Compile and optimize a record selection expression into a set of record source blocks (rsb's). +ProcedureScan* ProcedureSourceNode::generate(thread_db* tdbb, OptimizerBlk* opt) +{ + DEV_BLKCHK(opt, type_opt); + DEV_BLKCHK(node, type_nod); + SET_TDBB(tdbb); + + jrd_prc* const proc = MET_lookup_procedure_id(tdbb, procedure, false, false, 0); + + CompilerScratch* const csb = opt->opt_csb; + CompilerScratch::csb_repeat* const csb_tail = &csb->csb_rpt[stream]; + const string alias = OPT_make_alias(tdbb, csb, csb_tail); + + return FB_NEW(*tdbb->getDefaultPool()) ProcedureScan(csb, alias, stream, proc, inputs, in_msg); +} + +bool ProcedureSourceNode::computable(CompilerScratch* csb, SSHORT stream, bool idx_use, + bool allowOnlyCurrentStream, jrd_nod* value) +{ + if (inputs) + { + fb_assert(inputs->nod_type == nod_asn_list); + jrd_nod* const* ptr = inputs->nod_arg; + + for (const jrd_nod* const* const end = ptr + inputs->nod_count; ptr < end; ptr++) + { + if (!OPT_computable(csb, *ptr, stream, idx_use, allowOnlyCurrentStream)) + return false; + } + } + + return true; +} + +void ProcedureSourceNode::findDependentFromStreams(const OptimizerRetrieval* optRet, + SortedStreamList* streamList) +{ + if (inputs) + { + fb_assert(inputs->nod_type == nod_asn_list); + jrd_nod* const* ptr = inputs->nod_arg; + + for (const jrd_nod* const* const end = ptr + inputs->nod_count; ptr < end; ptr++) + optRet->findDependentFromStreams(*ptr, streamList); + } +} + + +//-------------------- + + +// Parse an aggregate reference. +AggregateSourceNode* AggregateSourceNode::parse(thread_db* tdbb, CompilerScratch* csb) +{ + SET_TDBB(tdbb); + + AggregateSourceNode* node = FB_NEW(*tdbb->getDefaultPool()) AggregateSourceNode( + *tdbb->getDefaultPool()); + + node->stream = PAR_context(csb, NULL); + fb_assert(node->stream <= MAX_STREAMS); + node->rse = RseNode::getFrom(PAR_parse_node(tdbb, csb, TYPE_RSE)); + node->group = PAR_parse_node(tdbb, csb, OTHER); + node->map = parseMap(tdbb, csb, node->stream); + + return node; +} + +AggregateSourceNode* AggregateSourceNode::copy(thread_db* tdbb, NodeCopier& copier) +{ + if (!copier.remap) + BUGCHECK(221); // msg 221 (CMP) copy: cannot remap + + AggregateSourceNode* newSource = FB_NEW(*tdbb->getDefaultPool()) AggregateSourceNode( + *tdbb->getDefaultPool()); + + fb_assert(stream <= MAX_STREAMS); + newSource->stream = copier.csb->nextStream(); + // fb_assert(newSource->stream <= MAX_UCHAR); + copier.remap[stream] = (UCHAR) newSource->stream; + CMP_csb_element(copier.csb, newSource->stream); + + copier.csb->csb_rpt[newSource->stream].csb_flags |= + copier.csb->csb_rpt[stream].csb_flags & csb_no_dbkey; + + newSource->rse = rse->copy(tdbb, copier); + newSource->group = copier.copy(tdbb, group); + newSource->map = copier.copy(tdbb, map); + + return newSource; +} + +void AggregateSourceNode::ignoreDbKey(thread_db* tdbb, CompilerScratch* csb, const jrd_rel* view) const +{ + rse->ignoreDbKey(tdbb, csb, view); +} + +void AggregateSourceNode::pass1(thread_db* tdbb, CompilerScratch* csb, jrd_rel* view) +{ + fb_assert(stream <= MAX_STREAMS); + csb->csb_rpt[stream].csb_flags |= csb_no_dbkey; + rse->ignoreDbKey(tdbb, csb, view); + rse->pass1(tdbb, csb, csb->csb_view); + map = CMP_pass1(tdbb, csb, map); + group = CMP_pass1(tdbb, csb, group); +} + +void AggregateSourceNode::pass1Source(thread_db* tdbb, CompilerScratch* csb, RseNode* rse, + jrd_nod** boolean, RecordSourceNodeStack& stack) +{ + stack.push(this); // Assume that the source will be used. Push it on the final stream stack. + + fb_assert(stream <= MAX_STREAMS); + pass1(tdbb, csb, csb->csb_view); +} + +void AggregateSourceNode::pass2(thread_db* tdbb, CompilerScratch* csb) +{ + rse->pass2Rse(tdbb, csb); + CMP_pass2(tdbb, csb, map, NULL); + CMP_pass2(tdbb, csb, group, NULL); + + fb_assert(stream <= MAX_STREAMS); + + if (map) + { + processMap(tdbb, csb, map, &csb->csb_rpt[stream].csb_internal_format); + csb->csb_rpt[stream].csb_format = csb->csb_rpt[stream].csb_internal_format; + } +} + +void AggregateSourceNode::pass2Rse(thread_db* tdbb, CompilerScratch* csb) +{ + fb_assert(stream <= MAX_STREAMS); + csb->csb_rpt[stream].csb_flags |= csb_active; + + pass2(tdbb, csb); +} + +bool AggregateSourceNode::containsStream(USHORT checkStream) const +{ + // for aggregates, check current RseNode, if not found then check + // the sub-rse + + if (checkStream == stream) + return true; // do not mark as variant + + if (rse->containsStream(checkStream)) + return true; // do not mark as variant + + return false; +} + +RecordSource* AggregateSourceNode::compile(thread_db* tdbb, CompilerScratch* csb, OptimizerBlk* opt, + RseNode* rse, NodeStack* parent_stack, stream_array_t& beds, stream_array_t& key_streams, + stream_array_t& local_streams, NodeStack& conjunct_stack, stream_array_t& streams, + jrd_nod* sort, jrd_nod* aggregate, StreamsArray& outerStreams, SLONG conjunct_count, + bool innerSubStream) +{ + fb_assert(stream <= MAX_UCHAR); + fb_assert(beds[0] < MAX_STREAMS && beds[0] < MAX_UCHAR); // debug check + //if (beds[0] >= MAX_STREAMS) // all builds check + // ERR_post(Arg::Gds(isc_too_many_contexts)); + + beds[++beds[0]] = (UCHAR) stream; + + NodeStack::const_iterator stack_end; + if (parent_stack) + stack_end = conjunct_stack.merge(*parent_stack); + + RecordSource* rsb = generate(tdbb, opt, &conjunct_stack, stream); + + if (parent_stack) + conjunct_stack.split(stack_end, *parent_stack); + + fb_assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR); + local_streams[++local_streams[0]] = stream; + + return rsb; +} + +// Generate an RecordSource (Record Source Block) for each aggregate operation. +// Generate an AggregateSort (Aggregate SortedStream Block) for each DISTINCT aggregate. +RecordSource* AggregateSourceNode::generate(thread_db* tdbb, OptimizerBlk* opt, + NodeStack* parent_stack, UCHAR shellStream) +{ + DEV_BLKCHK(opt, type_opt); + DEV_BLKCHK(node, type_nod); + SET_TDBB(tdbb); + + CompilerScratch* const csb = opt->opt_csb; + rse->rse_sorted = group; + + // AB: Try to distribute items from the HAVING CLAUSE to the WHERE CLAUSE. + // Zip thru stack of booleans looking for fields that belong to shellStream. + // Those fields are mappings. Mappings that hold a plain field may be used + // to distribute. Handle the simple cases only. + NodeStack deliverStack; + genDeliverUnmapped(tdbb, &deliverStack, map, parent_stack, shellStream); + + // try to optimize MAX and MIN to use an index; for now, optimize + // only the simplest case, although it is probably possible + // to use an index in more complex situations + jrd_nod** ptr; + AggNode* aggNode = NULL; + + if (map && map->nod_count == 1 && (ptr = map->nod_arg) && + (aggNode = ExprNode::as<AggNode>((*ptr)->nod_arg[e_asgn_from])) && + (aggNode->aggInfo.blr == blr_agg_min || aggNode->aggInfo.blr == blr_agg_max)) + { + // generate a sort block which the optimizer will try to map to an index + + jrd_nod* aggregate = PAR_make_node(tdbb, 3); + aggregate->nod_type = nod_sort; + aggregate->nod_count = 1; + aggregate->nod_arg[0] = aggNode->arg; + // in the max case, flag the sort as descending + if (aggNode->aggInfo.blr == blr_agg_max) + aggregate->nod_arg[1] = (jrd_nod*) TRUE; + // 10-Aug-2004. Nickolay Samofatov - Unneeded nulls seem to be skipped somehow. + aggregate->nod_arg[2] = (jrd_nod*)(IPTR) rse_nulls_default; + rse->rse_aggregate = aggregate; + } + + RecordSource* const next_rsb = OPT_compile(tdbb, csb, rse, &deliverStack); + + fb_assert(stream <= MAX_STREAMS); + fb_assert(stream <= MAX_UCHAR); + + // allocate and optimize the record source block + + AggregatedStream* const rsb = FB_NEW(*tdbb->getDefaultPool()) AggregatedStream(csb, stream, + group, map, next_rsb); + + if (rse->rse_aggregate) + { + // The rse_aggregate is still set. That means the optimizer + // was able to match the field to an index, so flag that fact + // so that it can be handled in EVL_group + aggNode->indexed = true; + } + + OPT_gen_aggregate_distincts(tdbb, csb, map); + + return rsb; +} + +bool AggregateSourceNode::computable(CompilerScratch* csb, SSHORT stream, bool idx_use, + bool allowOnlyCurrentStream, jrd_nod* value) +{ + rse->rse_sorted = group; + return rse->computable(csb, stream, idx_use, allowOnlyCurrentStream, NULL); +} + +void AggregateSourceNode::findDependentFromStreams(const OptimizerRetrieval* optRet, + SortedStreamList* streamList) +{ + rse->rse_sorted = group; + rse->findDependentFromStreams(optRet, streamList); +} + + +//-------------------- + + +// Parse a union reference. +UnionSourceNode* UnionSourceNode::parse(thread_db* tdbb, CompilerScratch* csb, SSHORT blrOp) +{ + SET_TDBB(tdbb); + + // Make the node, parse the context number, get a stream assigned, + // and get the number of sub-RseNode's. + + UnionSourceNode* node = FB_NEW(*tdbb->getDefaultPool()) UnionSourceNode( + *tdbb->getDefaultPool()); + + node->recursive = blrOp == blr_recurse; + + node->stream = PAR_context(csb, NULL); + fb_assert(node->stream <= MAX_STREAMS); + + // assign separate context for mapped record if union is recursive + USHORT map_stream = node->stream; + + if (node->recursive) + { + map_stream = PAR_context(csb, 0); + node->mapStream = map_stream; + } + + SSHORT count = (unsigned int) csb->csb_blr_reader.getByte(); + + // Pick up the sub-RseNode's and maps. + + while (--count >= 0) + { + node->clauses.push(RseNode::getFrom(PAR_parse_node(tdbb, csb, TYPE_RSE))); + node->maps.push(parseMap(tdbb, csb, map_stream)); + } + + return node; +} + +UnionSourceNode* UnionSourceNode::copy(thread_db* tdbb, NodeCopier& copier) +{ + if (!copier.remap) + BUGCHECK(221); // msg 221 (CMP) copy: cannot remap + + UnionSourceNode* newSource = FB_NEW(*tdbb->getDefaultPool()) UnionSourceNode( + *tdbb->getDefaultPool()); + newSource->recursive = recursive; + + fb_assert(stream <= MAX_STREAMS); + newSource->stream = copier.csb->nextStream(); + copier.remap[stream] = (UCHAR) newSource->stream; + CMP_csb_element(copier.csb, newSource->stream); + + USHORT oldStream = stream; + USHORT newStream = newSource->stream; + + if (newSource->recursive) + { + oldStream = mapStream; + fb_assert(oldStream <= MAX_STREAMS); + newStream = copier.csb->nextStream(); + newSource->mapStream = newStream; + copier.remap[oldStream] = (UCHAR) newStream; + CMP_csb_element(copier.csb, newStream); + } + + copier.csb->csb_rpt[newStream].csb_flags |= + copier.csb->csb_rpt[oldStream].csb_flags & csb_no_dbkey; + + NestConst<RseNode>* ptr = clauses.begin(); + NestConst<jrd_nod>* ptr2 = maps.begin(); + + for (NestConst<RseNode>* const end = clauses.end(); ptr != end; ++ptr, ++ptr2) + { + newSource->clauses.add((*ptr)->copy(tdbb, copier)); + newSource->maps.add(copier.copy(tdbb, *ptr2)); + } + + return newSource; +} + +void UnionSourceNode::ignoreDbKey(thread_db* tdbb, CompilerScratch* csb, const jrd_rel* view) const +{ + const NestConst<RseNode>* ptr = clauses.begin(); + + for (const NestConst<RseNode>* const end = clauses.end(); ptr != end; ++ptr) + (*ptr)->ignoreDbKey(tdbb, csb, view); +} + +void UnionSourceNode::pass1Source(thread_db* tdbb, CompilerScratch* csb, RseNode* rse, + jrd_nod** boolean, RecordSourceNodeStack& stack) +{ + stack.push(this); // Assume that the source will be used. Push it on the fina... [truncated message content] |
From: <fir...@us...> - 2010-08-25 03:15:31
|
Revision: 51474 http://firebird.svn.sourceforge.net/firebird/?rev=51474&view=rev Author: firebirds Date: 2010-08-25 03:15:25 +0000 (Wed, 25 Aug 2010) Log Message: ----------- nightly update Modified Paths: -------------- firebird/trunk/ChangeLog firebird/trunk/src/jrd/build_no.h firebird/trunk/src/misc/writeBuildNum.sh Modified: firebird/trunk/ChangeLog =================================================================== --- firebird/trunk/ChangeLog 2010-08-25 03:10:12 UTC (rev 51473) +++ firebird/trunk/ChangeLog 2010-08-25 03:15:25 UTC (rev 51474) @@ -1,3 +1,73 @@ + 2010-08-25 01:35 asfernandes + M src/jrd/RecordSourceNodes.cpp + M src/jrd/RecordSourceNodes.h + M src/jrd/opt.cpp +Misc + + 2010-08-25 01:01 asfernandes + M src/jrd/RecordSourceNodes.cpp +Remove do-nothing checks from the new file + + 2010-08-25 00:42 asfernandes + M src/jrd/cmp.cpp + M src/jrd/met.epp +Misc + + 2010-08-24 17:49 dimitr + M src/jrd/opt.cpp +Refactored the rivers management a bit. + + 2010-08-24 16:26 asfernandes + M src/jrd/cmp.cpp +Correction + + 2010-08-24 11:58 dimitr + M src/dsql/ExprNodes.cpp +Fixed incomplete processing of UDF arguments, causing server crashes. + + 2010-08-24 08:27 firebirds + M mkChangeLog.sh +Fixed correct buildno in 2.5 + + 2010-08-24 03:25 asfernandes + M builds/posix/make.shared.variables + M builds/win32/msvc10/engine.vcxproj + M builds/win32/msvc10/engine.vcxproj.filters + M builds/win32/msvc10/engine_classic.vcxproj + M builds/win32/msvc10/engine_classic.vcxproj.filters + M builds/win32/msvc10/engine_embed.vcxproj + M builds/win32/msvc10/engine_embed.vcxproj.filters + M builds/win32/msvc9/engine.vcproj + M builds/win32/msvc9/engine_classic.vcproj + M builds/win32/msvc9/engine_embed.vcproj + M src/dsql/ExprNodes.cpp + M src/dsql/Nodes.h + M src/dsql/StmtNodes.cpp + M src/dsql/StmtNodes.h + M src/dsql/Visitors.h + M src/jrd/Attachment.h + M src/jrd/Optimizer.cpp + M src/jrd/Optimizer.h + A src/jrd/RecordSourceNodes.cpp + A src/jrd/RecordSourceNodes.h + M src/jrd/Relation.h + M src/jrd/cmp.cpp + M src/jrd/cmp_proto.h + M src/jrd/exe.cpp + M src/jrd/exe.h + M src/jrd/jrd.h + M src/jrd/lls.h + M src/jrd/met.epp + M src/jrd/nod.h + M src/jrd/opt.cpp + M src/jrd/opt_proto.h + M src/jrd/par.cpp + M src/jrd/par_proto.h + M src/jrd/recsrc/RecordSource.h + M src/jrd/recsrc/Union.cpp + M src/misc/blrtable.cpp +Refactor nod_rse, nod_relation, nod_procedure, nod_union, nod_aggregate and nod_window. + 2010-08-16 01:47 asfernandes M src/misc/blrtable.cpp Fix wrong nod_type of scrollable cursors Modified: firebird/trunk/src/jrd/build_no.h =================================================================== --- firebird/trunk/src/jrd/build_no.h 2010-08-25 03:10:12 UTC (rev 51473) +++ firebird/trunk/src/jrd/build_no.h 2010-08-25 03:15:25 UTC (rev 51474) @@ -3,16 +3,16 @@ *** DO NOT EDIT *** TO CHANGE ANY INFORMATION IN HERE PLEASE EDIT src/misc/writeBuildNum.sh - FORMAL BUILD NUMBER:28682 + FORMAL BUILD NUMBER:28690 */ -#define PRODUCT_VER_STRING "3.0.0.28682" -#define FILE_VER_STRING "WI-T3.0.0.28682" -#define LICENSE_VER_STRING "WI-T3.0.0.28682" -#define FILE_VER_NUMBER 3, 0, 0, 28682 +#define PRODUCT_VER_STRING "3.0.0.28690" +#define FILE_VER_STRING "WI-T3.0.0.28690" +#define LICENSE_VER_STRING "WI-T3.0.0.28690" +#define FILE_VER_NUMBER 3, 0, 0, 28690 #define FB_MAJOR_VER "3" #define FB_MINOR_VER "0" #define FB_REV_NO "0" -#define FB_BUILD_NO "28682" +#define FB_BUILD_NO "28690" #define FB_BUILD_TYPE "T" #define FB_BUILD_SUFFIX "Firebird 3.0 Unstable" Modified: firebird/trunk/src/misc/writeBuildNum.sh =================================================================== --- firebird/trunk/src/misc/writeBuildNum.sh 2010-08-25 03:10:12 UTC (rev 51473) +++ firebird/trunk/src/misc/writeBuildNum.sh 2010-08-25 03:15:25 UTC (rev 51474) @@ -9,7 +9,7 @@ MajorVer=3 MinorVer=0 RevNo=0 -BuildNum=28682 +BuildNum=28690 if [ "$SPECIAL_BUILD_SUFFIX" = "" ]; then # Normal builds This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fir...@us...> - 2010-08-26 03:14:21
|
Revision: 51483 http://firebird.svn.sourceforge.net/firebird/?rev=51483&view=rev Author: firebirds Date: 2010-08-26 03:14:14 +0000 (Thu, 26 Aug 2010) Log Message: ----------- nightly update Modified Paths: -------------- firebird/trunk/ChangeLog firebird/trunk/src/jrd/build_no.h firebird/trunk/src/misc/writeBuildNum.sh Modified: firebird/trunk/ChangeLog =================================================================== --- firebird/trunk/ChangeLog 2010-08-25 15:52:46 UTC (rev 51482) +++ firebird/trunk/ChangeLog 2010-08-26 03:14:14 UTC (rev 51483) @@ -1,3 +1,39 @@ + 2010-08-25 15:52 asfernandes + M src/jrd/RecordSourceNodes.cpp + M src/jrd/RecordSourceNodes.h + M src/jrd/exe.h + M src/jrd/recsrc/RecordSource.h + M src/jrd/recsrc/WindowedStream.cpp +Rework WindowSourceNode to use type-safe partitions + + 2010-08-25 13:36 mapopa + M doc/README.build.msvc.html +Added links to visual c++ studio 2008 + + 2010-08-25 13:25 mapopa + M doc/README.build.msvc.html +Added unicode/classic innosetup note (we are not using unicode version for the moment , only for 3.0 maybe in the future) + + 2010-08-25 12:00 mapopa + M doc/README.build.msvc.html +added innosetup 5 to the build instructions + + 2010-08-25 10:16 mapopa + M doc/README.build.msvc.html +added sed instructions + + 2010-08-25 08:02 dimitr + M src/jrd/cmp.cpp +Fixed a few suspicious places related to the variable cloning. + + 2010-08-25 03:10 asfernandes + M src/jrd/RecordSourceNodes.cpp + M src/jrd/RecordSourceNodes.h + M src/jrd/exe.h + M src/jrd/opt.cpp + M src/jrd/rse.h +Move dozen of parameters of virtual/overriden function to OptimizerBlk + 2010-08-25 01:35 asfernandes M src/jrd/RecordSourceNodes.cpp M src/jrd/RecordSourceNodes.h Modified: firebird/trunk/src/jrd/build_no.h =================================================================== --- firebird/trunk/src/jrd/build_no.h 2010-08-25 15:52:46 UTC (rev 51482) +++ firebird/trunk/src/jrd/build_no.h 2010-08-26 03:14:14 UTC (rev 51483) @@ -3,16 +3,16 @@ *** DO NOT EDIT *** TO CHANGE ANY INFORMATION IN HERE PLEASE EDIT src/misc/writeBuildNum.sh - FORMAL BUILD NUMBER:28690 + FORMAL BUILD NUMBER:28697 */ -#define PRODUCT_VER_STRING "3.0.0.28690" -#define FILE_VER_STRING "WI-T3.0.0.28690" -#define LICENSE_VER_STRING "WI-T3.0.0.28690" -#define FILE_VER_NUMBER 3, 0, 0, 28690 +#define PRODUCT_VER_STRING "3.0.0.28697" +#define FILE_VER_STRING "WI-T3.0.0.28697" +#define LICENSE_VER_STRING "WI-T3.0.0.28697" +#define FILE_VER_NUMBER 3, 0, 0, 28697 #define FB_MAJOR_VER "3" #define FB_MINOR_VER "0" #define FB_REV_NO "0" -#define FB_BUILD_NO "28690" +#define FB_BUILD_NO "28697" #define FB_BUILD_TYPE "T" #define FB_BUILD_SUFFIX "Firebird 3.0 Unstable" Modified: firebird/trunk/src/misc/writeBuildNum.sh =================================================================== --- firebird/trunk/src/misc/writeBuildNum.sh 2010-08-25 15:52:46 UTC (rev 51482) +++ firebird/trunk/src/misc/writeBuildNum.sh 2010-08-26 03:14:14 UTC (rev 51483) @@ -9,7 +9,7 @@ MajorVer=3 MinorVer=0 RevNo=0 -BuildNum=28690 +BuildNum=28697 if [ "$SPECIAL_BUILD_SUFFIX" = "" ]; then # Normal builds This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-08-27 02:18:09
|
Revision: 51488 http://firebird.svn.sourceforge.net/firebird/?rev=51488&view=rev Author: asfernandes Date: 2010-08-27 02:18:00 +0000 (Fri, 27 Aug 2010) Log Message: ----------- 1) Separate DsqlCompilerScratch in its own files. 2) Move BlockNode functionality to it. 3) Move some related CTE functions to it. Modified Paths: -------------- firebird/trunk/builds/posix/make.shared.variables firebird/trunk/src/dsql/DSqlDataTypeUtil.cpp firebird/trunk/src/dsql/DdlNodes.epp firebird/trunk/src/dsql/DdlNodes.h firebird/trunk/src/dsql/Nodes.h firebird/trunk/src/dsql/StmtNodes.cpp firebird/trunk/src/dsql/StmtNodes.h firebird/trunk/src/dsql/dsql.h firebird/trunk/src/dsql/gen.cpp firebird/trunk/src/dsql/misc_func.cpp firebird/trunk/src/dsql/pass1.cpp firebird/trunk/src/dsql/pass1_proto.h Added Paths: ----------- firebird/trunk/src/dsql/DsqlCompilerScratch.cpp firebird/trunk/src/dsql/DsqlCompilerScratch.h Modified: firebird/trunk/builds/posix/make.shared.variables =================================================================== --- firebird/trunk/builds/posix/make.shared.variables 2010-08-26 15:40:51 UTC (rev 51487) +++ firebird/trunk/builds/posix/make.shared.variables 2010-08-27 02:18:00 UTC (rev 51488) @@ -81,7 +81,8 @@ DSQL_ServerFiles= metd.epp DSqlDataTypeUtil.cpp \ ddl.cpp dsql.cpp errd.cpp gen.cpp hsh.cpp make.cpp \ movd.cpp parse.cpp Parser.cpp pass1.cpp misc_func.cpp \ - DdlNodes.epp PackageNodes.epp AggNodes.cpp BlrWriter.cpp ExprNodes.cpp StmtNodes.cpp WinNodes.cpp + DdlNodes.epp PackageNodes.epp AggNodes.cpp BlrWriter.cpp DsqlCompilerScratch.cpp \ + ExprNodes.cpp StmtNodes.cpp WinNodes.cpp DSQL_Files = $(DSQL_ClientFiles) $(DSQL_ServerFiles) Modified: firebird/trunk/src/dsql/DSqlDataTypeUtil.cpp =================================================================== --- firebird/trunk/src/dsql/DSqlDataTypeUtil.cpp 2010-08-26 15:40:51 UTC (rev 51487) +++ firebird/trunk/src/dsql/DSqlDataTypeUtil.cpp 2010-08-27 02:18:00 UTC (rev 51488) @@ -24,7 +24,7 @@ #include "firebird.h" #include "../dsql/DSqlDataTypeUtil.h" -#include "../dsql/dsql.h" +#include "../dsql/DsqlCompilerScratch.h" #include "../dsql/metd_proto.h" UCHAR Jrd::DSqlDataTypeUtil::maxBytesPerChar(UCHAR charSet) Modified: firebird/trunk/src/dsql/DdlNodes.epp =================================================================== --- firebird/trunk/src/dsql/DdlNodes.epp 2010-08-26 15:40:51 UTC (rev 51487) +++ firebird/trunk/src/dsql/DdlNodes.epp 2010-08-27 02:18:00 UTC (rev 51488) @@ -1157,8 +1157,6 @@ DdlNode* CreateAlterFunctionNode::internalDsqlPass() { - DsqlCompiledStatement* const statement = dsqlScratch->getStatement(); - statement->setBlockNode(this); dsqlScratch->flags |= (DsqlCompilerScratch::FLAG_BLOCK | DsqlCompilerScratch::FLAG_FUNCTION); const dsql_nod* variables = localDeclList; @@ -1488,7 +1486,6 @@ unsigned pos, const ParameterClause& parameter) { Attachment* attachment = transaction->getAttachment(); - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); AutoCacheRequest requestHandle(tdbb, drq_s_func_args2, DYN_REQUESTS); @@ -1591,7 +1588,7 @@ dsqlScratch->getBlrData().clear(); - if (statement->getFlags() & DsqlCompiledStatement::FLAG_BLR_VERSION4) + if (dsqlScratch->isVersion4()) dsqlScratch->appendUChar(blr_version4); else dsqlScratch->appendUChar(blr_version5); @@ -1618,14 +1615,12 @@ compiled = true; invalid = true; - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - if (body) { dsqlScratch->beginDebug(); dsqlScratch->getBlrData().clear(); - if (statement->getFlags() & DsqlCompiledStatement::FLAG_BLR_VERSION4) + if (dsqlScratch->isVersion4()) dsqlScratch->appendUChar(blr_version4); else dsqlScratch->appendUChar(blr_version5); @@ -1650,7 +1645,7 @@ dsqlScratch->appendUChar(blr_short); dsqlScratch->appendUChar(0); - variables.add(MAKE_variable(parameter.legacyField, + dsqlScratch->variables.add(MAKE_variable(parameter.legacyField, parameter.name.c_str(), VAR_input, 0, (USHORT) (2 * i), 0)); } } @@ -1667,8 +1662,8 @@ dsqlScratch->appendUChar(0); dsql_nod* const var = MAKE_variable(returnType.legacyField, "", VAR_output, 1, 0, 0); - variables.add(var); - outputVariables.add(var); + dsqlScratch->variables.add(var); + dsqlScratch->outputVariables.add(var); if (parameters.getCount() != 0) { @@ -1695,14 +1690,15 @@ } } - dsql_var* const variable = (dsql_var*) outputVariables[0]->nod_arg[Dsql::e_var_variable]; - putLocalVariable(dsqlScratch, variable, 0, NULL); + dsql_var* const variable = + (dsql_var*) dsqlScratch->outputVariables[0]->nod_arg[Dsql::e_var_variable]; + dsqlScratch->putLocalVariable(variable, 0, NULL); // ASF: This is here to not change the old logic (proc_flag) // of previous calls to PASS1_node and PASS1_statement. dsqlScratch->setPsql(true); - putLocalVariables(dsqlScratch, localDeclList, 1); + dsqlScratch->putLocalVariables(localDeclList, 1); dsqlScratch->appendUChar(blr_stall); // put a label before body of procedure, @@ -1714,10 +1710,9 @@ GEN_statement(dsqlScratch, PASS1_statement(dsqlScratch, body)); - statement->setType(DsqlCompiledStatement::TYPE_DDL); + dsqlScratch->getStatement()->setType(DsqlCompiledStatement::TYPE_DDL); dsqlScratch->appendUChar(blr_end); - genReturn(dsqlScratch, false); - + dsqlScratch->genReturn(false); dsqlScratch->appendUChar(blr_end); dsqlScratch->appendUChar(blr_eoc); @@ -1902,8 +1897,6 @@ DdlNode* CreateAlterProcedureNode::internalDsqlPass() { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - statement->setBlockNode(this); dsqlScratch->flags |= (DsqlCompilerScratch::FLAG_BLOCK | DsqlCompilerScratch::FLAG_PROCEDURE); const dsql_nod* variables = localDeclList; @@ -2340,11 +2333,9 @@ string defaultSource = string(defaultString->str_data, defaultString->str_length); attachment->storeMetaDataBlob(tdbb, transaction, &PRM.RDB$DEFAULT_SOURCE, defaultSource); - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - dsqlScratch->getBlrData().clear(); - if (statement->getFlags() & DsqlCompiledStatement::FLAG_BLR_VERSION4) + if (dsqlScratch->isVersion4()) dsqlScratch->appendUChar(blr_version4); else dsqlScratch->appendUChar(blr_version5); @@ -2375,12 +2366,10 @@ invalid = true; - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - dsqlScratch->beginDebug(); dsqlScratch->getBlrData().clear(); - if (statement->getFlags() & DsqlCompiledStatement::FLAG_BLR_VERSION4) + if (dsqlScratch->isVersion4()) dsqlScratch->appendUChar(blr_version4); else dsqlScratch->appendUChar(blr_version5); @@ -2404,7 +2393,7 @@ dsqlScratch->appendUChar(blr_short); dsqlScratch->appendUChar(0); - variables.add(MAKE_variable(parameter.legacyField, + dsqlScratch->variables.add(MAKE_variable(parameter.legacyField, parameter.name.c_str(), VAR_input, 0, (USHORT) (2 * i), 0)); } } @@ -2429,8 +2418,8 @@ dsql_nod* const var = MAKE_variable(parameter.legacyField, parameter.name.c_str(), VAR_output, 1, (USHORT) (2 * i), i); - variables.add(var); - outputVariables.add(var); + dsqlScratch->variables.add(var); + dsqlScratch->outputVariables.add(var); } } @@ -2463,18 +2452,20 @@ } } - for (Array<dsql_nod*>::const_iterator i = outputVariables.begin(); i != outputVariables.end(); ++i) + for (Array<dsql_nod*>::const_iterator i = dsqlScratch->outputVariables.begin(); + i != dsqlScratch->outputVariables.end(); + ++i) { dsql_nod* parameter = *i; dsql_var* const variable = (dsql_var*) parameter->nod_arg[Dsql::e_var_variable]; - putLocalVariable(dsqlScratch, variable, 0, NULL); + dsqlScratch->putLocalVariable(variable, 0, NULL); } // ASF: This is here to not change the old logic (proc_flag) // of previous calls to PASS1_node and PASS1_statement. dsqlScratch->setPsql(true); - putLocalVariables(dsqlScratch, localDeclList, returns.getCount()); + dsqlScratch->putLocalVariables(localDeclList, returns.getCount()); dsqlScratch->appendUChar(blr_stall); // put a label before body of procedure, @@ -2486,10 +2477,9 @@ GEN_statement(dsqlScratch, PASS1_statement(dsqlScratch, body)); - statement->setType(DsqlCompiledStatement::TYPE_DDL); + dsqlScratch->getStatement()->setType(DsqlCompiledStatement::TYPE_DDL); dsqlScratch->appendUChar(blr_end); - genReturn(dsqlScratch, true); - + dsqlScratch->genReturn(true); dsqlScratch->appendUChar(blr_end); dsqlScratch->appendUChar(blr_eoc); @@ -2779,8 +2769,6 @@ DdlNode* CreateAlterTriggerNode::internalDsqlPass() { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - statement->setBlockNode(this); dsqlScratch->flags |= (DsqlCompilerScratch::FLAG_BLOCK | DsqlCompilerScratch::FLAG_TRIGGER); if (type.specified) @@ -2876,8 +2864,6 @@ if (body) { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - dsqlScratch->beginDebug(); dsqlScratch->getBlrData().clear(); @@ -2921,7 +2907,7 @@ // generate the trigger blr - if (statement->getFlags() & DsqlCompiledStatement::FLAG_BLR_VERSION4) + if (dsqlScratch->isVersion4()) dsqlScratch->appendUChar(blr_version4); else dsqlScratch->appendUChar(blr_version5); @@ -2929,9 +2915,8 @@ dsqlScratch->appendUChar(blr_begin); dsqlScratch->setPsql(true); + dsqlScratch->putLocalVariables(localDeclList, 0); - putLocalVariables(dsqlScratch, localDeclList, 0); - dsqlScratch->scopeLevel++; // dimitr: I see no reason to deny EXIT command in triggers, // hence I've added zero label at the beginning. @@ -2954,7 +2939,7 @@ // The statement type may have been set incorrectly when parsing // the trigger actions, so reset it to reflect the fact that this // is a data definition statement; also reset the ddl node. - statement->setType(DsqlCompiledStatement::TYPE_DDL); + dsqlScratch->getStatement()->setType(DsqlCompiledStatement::TYPE_DDL); } invalid = false; Modified: firebird/trunk/src/dsql/DdlNodes.h =================================================================== --- firebird/trunk/src/dsql/DdlNodes.h 2010-08-26 15:40:51 UTC (rev 51487) +++ firebird/trunk/src/dsql/DdlNodes.h 2010-08-27 02:18:00 UTC (rev 51488) @@ -229,12 +229,11 @@ }; -class CreateAlterFunctionNode : public DdlNode, public BlockNode +class CreateAlterFunctionNode : public DdlNode { public: CreateAlterFunctionNode(MemoryPool& pool, const Firebird::MetaName& aName) : DdlNode(pool), - BlockNode(pool, false), name(pool, aName), create(true), alter(false), @@ -334,12 +333,11 @@ RecreateFunctionNode; -class CreateAlterProcedureNode : public DdlNode, public BlockNode +class CreateAlterProcedureNode : public DdlNode { public: CreateAlterProcedureNode(MemoryPool& pool, const Firebird::MetaName& aName) : DdlNode(pool), - BlockNode(pool, true), name(pool, aName), create(true), alter(false), @@ -476,12 +474,11 @@ }; -class CreateAlterTriggerNode : public DdlNode, public BlockNode, public TriggerDefinition +class CreateAlterTriggerNode : public DdlNode, public TriggerDefinition { public: CreateAlterTriggerNode(MemoryPool& p, const Firebird::MetaName& aName) : DdlNode(p), - BlockNode(p, false), TriggerDefinition(p), create(true), alter(false), Added: firebird/trunk/src/dsql/DsqlCompilerScratch.cpp =================================================================== --- firebird/trunk/src/dsql/DsqlCompilerScratch.cpp (rev 0) +++ firebird/trunk/src/dsql/DsqlCompilerScratch.cpp 2010-08-27 02:18:00 UTC (rev 51488) @@ -0,0 +1,761 @@ +/* + * The contents of this file are subject to the Interbase Public + * License Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy + * of the License at http://www.Inprise.com/IPL.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 was created by Inprise Corporation + * and its predecessors. Portions created by Inprise Corporation are + * Copyright (C) Inprise Corporation. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + * Adriano dos Santos Fernandes + */ + +#include "firebird.h" +#include "../jrd/common.h" +#include "../dsql/DsqlCompilerScratch.h" +#include "../jrd/jrd.h" +#include "../jrd/blr.h" +#include "../dsql/node.h" +#include "../dsql/ddl_proto.h" +#include "../dsql/errd_proto.h" +#include "../dsql/gen_proto.h" +#include "../dsql/make_proto.h" +#include "../dsql/pass1_proto.h" + +using namespace Firebird; +using namespace Dsql; +using namespace Jrd; + + +// Write out field data type. +// Taking special care to declare international text. +void DsqlCompilerScratch::putDtype(const dsql_fld* field, bool useSubType) +{ +#ifdef DEV_BUILD + // Check if the field describes a known datatype + + if (field->fld_dtype > FB_NELEM(blr_dtypes) || !blr_dtypes[field->fld_dtype]) + { + SCHAR buffer[100]; + + sprintf(buffer, "Invalid dtype %d in BlockNode::putDtype", field->fld_dtype); + ERRD_bugcheck(buffer); + } +#endif + + if (field->fld_not_nullable) + appendUChar(blr_not_nullable); + + if (field->fld_type_of_name.hasData()) + { + if (field->fld_type_of_table) + { + if (field->fld_explicit_collation) + { + appendUChar(blr_column_name2); + appendUChar(field->fld_full_domain ? blr_domain_full : blr_domain_type_of); + appendMetaString(field->fld_type_of_table->str_data); + appendMetaString(field->fld_type_of_name.c_str()); + appendUShort(field->fld_ttype); + } + else + { + appendUChar(blr_column_name); + appendUChar(field->fld_full_domain ? blr_domain_full : blr_domain_type_of); + appendMetaString(field->fld_type_of_table->str_data); + appendMetaString(field->fld_type_of_name.c_str()); + } + } + else + { + if (field->fld_explicit_collation) + { + appendUChar(blr_domain_name2); + appendUChar(field->fld_full_domain ? blr_domain_full : blr_domain_type_of); + appendMetaString(field->fld_type_of_name.c_str()); + appendUShort(field->fld_ttype); + } + else + { + appendUChar(blr_domain_name); + appendUChar(field->fld_full_domain ? blr_domain_full : blr_domain_type_of); + appendMetaString(field->fld_type_of_name.c_str()); + } + } + + return; + } + + switch (field->fld_dtype) + { + case dtype_cstring: + case dtype_text: + case dtype_varying: + case dtype_blob: + if (!useSubType) + appendUChar(blr_dtypes[field->fld_dtype]); + else if (field->fld_dtype == dtype_varying) + { + appendUChar(blr_varying2); + appendUShort(field->fld_ttype); + } + else if (field->fld_dtype == dtype_cstring) + { + appendUChar(blr_cstring2); + appendUShort(field->fld_ttype); + } + else if (field->fld_dtype == dtype_blob) + { + appendUChar(blr_blob2); + appendUShort(field->fld_sub_type); + appendUShort(field->fld_ttype); + } + else + { + appendUChar(blr_text2); + appendUShort(field->fld_ttype); + } + + if (field->fld_dtype == dtype_varying) + appendUShort(field->fld_length - sizeof(USHORT)); + else if (field->fld_dtype != dtype_blob) + appendUShort(field->fld_length); + break; + + default: + appendUChar(blr_dtypes[field->fld_dtype]); + if (DTYPE_IS_EXACT(field->fld_dtype) || (dtype_quad == field->fld_dtype)) + appendUChar(field->fld_scale); + break; + } +} + +// Emit dyn for the local variables declared in a procedure or trigger. +void DsqlCompilerScratch::putLocalVariables(const dsql_nod* parameters, SSHORT locals) +{ + if (!parameters) + return; + + dsql_nod* const* ptr = parameters->nod_arg; + + for (const dsql_nod* const* const end = ptr + parameters->nod_count; ptr < end; ptr++) + { + dsql_nod* parameter = *ptr; + + putDebugSrcInfo(parameter->nod_line, parameter->nod_column); + + if (parameter->nod_type == Dsql::nod_def_field) + { + dsql_fld* field = (dsql_fld*) parameter->nod_arg[Dsql::e_dfl_field]; + const dsql_nod* const* rest = ptr; + + while (++rest != end) + { + if ((*rest)->nod_type == Dsql::nod_def_field) + { + const dsql_fld* rest_field = (dsql_fld*) (*rest)->nod_arg[Dsql::e_dfl_field]; + if (field->fld_name == rest_field->fld_name) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-637) << + Arg::Gds(isc_dsql_duplicate_spec) << Arg::Str(field->fld_name)); + } + } + } + + dsql_nod* varNode = MAKE_variable(field, field->fld_name.c_str(), VAR_local, 0, 0, locals); + variables.add(varNode); + + dsql_var* variable = (dsql_var*) varNode->nod_arg[Dsql::e_var_variable]; + putLocalVariable(variable, parameter, + reinterpret_cast<const dsql_str*>(parameter->nod_arg[Dsql::e_dfl_collate])); + + // Some field attributes are calculated inside + // putLocalVariable(), so we reinitialize the + // descriptor + MAKE_desc_from_field(&varNode->nod_desc, field); + + ++locals; + } + else if (parameter->nod_type == Dsql::nod_cursor) + { + PASS1_statement(this, parameter); + GEN_statement(this, parameter); + } + } +} + +// Write out local variable field data type. +void DsqlCompilerScratch::putLocalVariable(dsql_var* variable, dsql_nod* hostParam, + const dsql_str* collationName) +{ + dsql_fld* field = variable->var_field; + + appendUChar(blr_dcl_variable); + appendUShort(variable->var_variable_number); + DDL_resolve_intl_type(this, field, collationName); + + //const USHORT dtype = field->fld_dtype; + + putDtype(field, true); + //field->fld_dtype = dtype; + + // Check for a default value, borrowed from define_domain + dsql_nod* node = hostParam ? hostParam->nod_arg[Dsql::e_dfl_default] : NULL; + + if (node || (!field->fld_full_domain && !field->fld_not_nullable)) + { + appendUChar(blr_assignment); + + if (node) + { + fb_assert(node->nod_type == Dsql::nod_def_default); + PsqlChanger psqlChanger(this, false); + node = PASS1_node(this, node->nod_arg[Dsql::e_dft_default]); + GEN_expr(this, node); + } + else + appendUChar(blr_null); // Initialize variable to NULL + + appendUChar(blr_variable); + appendUShort(variable->var_variable_number); + } + else + { + appendUChar(blr_init_variable); + appendUShort(variable->var_variable_number); + } + + if (variable->var_name[0]) // Not a function return value + putDebugVariable(variable->var_variable_number, variable->var_name); + + ++hiddenVarsNumber; +} + +// Try to resolve variable name against parameters and local variables. +dsql_nod* DsqlCompilerScratch::resolveVariable(const dsql_str* varName) +{ + for (dsql_nod* const* i = variables.begin(); i != variables.end(); ++i) + { + dsql_nod* varNode = *i; + fb_assert(varNode->nod_type == Dsql::nod_variable); + + if (varNode->nod_type == Dsql::nod_variable) + { + const dsql_var* variable = (dsql_var*) varNode->nod_arg[Dsql::e_var_variable]; + DEV_BLKCHK(variable, dsql_type_var); + + if (!strcmp(varName->str_data, variable->var_name)) + return varNode; + } + } + + return NULL; +} + +// Generate BLR for a return. +void DsqlCompilerScratch::genReturn(bool eosFlag) +{ + const bool hasEos = !(flags & (FLAG_TRIGGER | FLAG_FUNCTION)); + + if (hasEos && !eosFlag) + appendUChar(blr_begin); + + appendUChar(blr_send); + appendUChar(1); + appendUChar(blr_begin); + + for (Array<dsql_nod*>::const_iterator i = outputVariables.begin(); i != outputVariables.end(); ++i) + { + const dsql_nod* parameter = *i; + const dsql_var* variable = (dsql_var*) parameter->nod_arg[Dsql::e_var_variable]; + appendUChar(blr_assignment); + appendUChar(blr_variable); + appendUShort(variable->var_variable_number); + appendUChar(blr_parameter2); + appendUChar(variable->var_msg_number); + appendUShort(variable->var_msg_item); + appendUShort(variable->var_msg_item + 1); + } + + if (hasEos) + { + appendUChar(blr_assignment); + appendUChar(blr_literal); + appendUChar(blr_short); + appendUChar(0); + appendUShort((eosFlag ? 0 : 1)); + appendUChar(blr_parameter); + appendUChar(1); + appendUShort(USHORT(2 * outputVariables.getCount())); + } + + appendUChar(blr_end); + + if (hasEos && !eosFlag) + { + appendUChar(blr_stall); + appendUChar(blr_end); + } +} + +void DsqlCompilerScratch::addCTEs(dsql_nod* with) +{ + DEV_BLKCHK(with, dsql_type_nod); + fb_assert(with->nod_type == Dsql::nod_with); + + if (ctes.getCount()) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + // WITH clause can't be nested + Arg::Gds(isc_dsql_cte_nested_with)); + } + + if (with->nod_flags & NOD_UNION_RECURSIVE) + flags |= DsqlCompilerScratch::FLAG_RECURSIVE_CTE; + + const dsql_nod* list = with->nod_arg[0]; + const dsql_nod* const* end = list->nod_arg + list->nod_count; + + for (dsql_nod* const* cte = list->nod_arg; cte < end; cte++) + { + fb_assert((*cte)->nod_type == Dsql::nod_derived_table); + + if (with->nod_flags & NOD_UNION_RECURSIVE) + { + currCtes.push(*cte); + PsqlChanger changer(this, false); + ctes.add(pass1RecursiveCte(*cte)); + currCtes.pop(); + + // Add CTE name into CTE aliases stack. It allows later to search for + // aliases of given CTE. + const dsql_str* cteName = (dsql_str*) (*cte)->nod_arg[Dsql::e_derived_table_alias]; + addCTEAlias(cteName); + } + else + ctes.add(*cte); + } +} + +dsql_nod* DsqlCompilerScratch::findCTE(const dsql_str* name) +{ + for (size_t i = 0; i < ctes.getCount(); ++i) + { + dsql_nod* cte = ctes[i]; + const dsql_str* cteName = (dsql_str*) cte->nod_arg[Dsql::e_derived_table_alias]; + + if (name->str_length == cteName->str_length && + strncmp(name->str_data, cteName->str_data, cteName->str_length) == 0) + { + return cte; + } + } + + return NULL; +} + +void DsqlCompilerScratch::clearCTEs() +{ + flags &= ~DsqlCompilerScratch::FLAG_RECURSIVE_CTE; + ctes.clear(); + cteAliases.clear(); +} + +void DsqlCompilerScratch::checkUnusedCTEs() const +{ + for (size_t i = 0; i < ctes.getCount(); ++i) + { + const dsql_nod* cte = ctes[i]; + + if (!(cte->nod_flags & NOD_DT_CTE_USED)) + { + const dsql_str* cteName = (dsql_str*) cte->nod_arg[Dsql::e_derived_table_alias]; + + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + Arg::Gds(isc_dsql_cte_not_used) << Arg::Str(cteName->str_data)); + } + } +} + +// Process derived table which can be recursive CTE. +// If it is non-recursive return input node unchanged. +// If it is recursive return new derived table which is an union of union of anchor (non-recursive) +// queries and union of recursive queries. Check recursive queries to satisfy various criterias. +// Note that our parser is right-to-left therefore nested list linked as first node in parent list +// and second node is always query spec. +// For example, if we have 4 CTE's where first two is non-recursive and last two is recursive: +// +// list union +// [0] [1] [0] [1] +// list cte3 ===> anchor recursive +// [0] [1] [0] [1] [0] [1] +// list cte3 cte1 cte2 cte3 cte4 +// [0] [1] +// cte1 cte2 +// +// Also, we should not change layout of original parse tree to allow it to be parsed again if +// needed. Therefore recursive part is built using newly allocated list nodes. +dsql_nod* DsqlCompilerScratch::pass1RecursiveCte(dsql_nod* input) +{ + dsql_str* const cte_alias = (dsql_str*) input->nod_arg[Dsql::e_derived_table_alias]; + dsql_nod* const select_expr = input->nod_arg[Dsql::e_derived_table_rse]; + dsql_nod* query = select_expr->nod_arg[Dsql::e_sel_query_spec]; + + if (query->nod_type != Dsql::nod_list && pass1RseIsRecursive(query)) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + // Recursive CTE (%s) must be an UNION + Arg::Gds(isc_dsql_cte_not_a_union) << Arg::Str(cte_alias->str_data)); + } + + // split queries list on two parts: anchor and recursive + dsql_nod* anchorRse = NULL, *recursiveRse = NULL; + dsql_nod* qry = query; + + dsql_nod* newQry = MAKE_node(Dsql::nod_list, 2); + newQry->nod_flags = query->nod_flags; + + while (true) + { + dsql_nod* rse = NULL; + + if (qry->nod_type == Dsql::nod_list) + rse = qry->nod_arg[1]; + else + rse = qry; + + dsql_nod* newRse = pass1RseIsRecursive(rse); + + if (newRse) // rse is recursive + { + if (anchorRse) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + // CTE '%s' defined non-recursive member after recursive + Arg::Gds(isc_dsql_cte_nonrecurs_after_recurs) << Arg::Str(cte_alias->str_data)); + } + + if (newRse->nod_arg[Dsql::e_qry_distinct]) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + // Recursive member of CTE '%s' has %s clause + Arg::Gds(isc_dsql_cte_wrong_clause) << Arg::Str(cte_alias->str_data) << + Arg::Str("DISTINCT")); + } + + if (newRse->nod_arg[Dsql::e_qry_group]) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + // Recursive member of CTE '%s' has %s clause + Arg::Gds(isc_dsql_cte_wrong_clause) << Arg::Str(cte_alias->str_data) << + Arg::Str("GROUP BY")); + } + + if (newRse->nod_arg[Dsql::e_qry_having]) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + // Recursive member of CTE '%s' has %s clause + Arg::Gds(isc_dsql_cte_wrong_clause) << Arg::Str(cte_alias->str_data) << + Arg::Str("HAVING")); + } + // hvlad: we need also forbid any aggregate function here + // but for now i have no idea how to do it simple + + if ((newQry->nod_type == Dsql::nod_list) && !(newQry->nod_flags & NOD_UNION_ALL)) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + // Recursive members of CTE (%s) must be linked with another members via UNION ALL + Arg::Gds(isc_dsql_cte_union_all) << Arg::Str(cte_alias->str_data)); + } + + if (!recursiveRse) + recursiveRse = newQry; + + newRse->nod_flags |= NOD_SELECT_EXPR_RECURSIVE; + + if (qry->nod_type == Dsql::nod_list) + newQry->nod_arg[1] = newRse; + else + newQry->nod_arg[0] = newRse; + } + else + { + if (qry->nod_type == Dsql::nod_list) + newQry->nod_arg[1] = rse; + else + newQry->nod_arg[0] = rse; + + if (!anchorRse) + { + if (qry->nod_type == Dsql::nod_list) + anchorRse = newQry; + else + anchorRse = rse; + } + } + + if (qry->nod_type != Dsql::nod_list) + break; + + qry = qry->nod_arg[0]; + + if (qry->nod_type == Dsql::nod_list) + { + newQry->nod_arg[0] = MAKE_node(Dsql::nod_list, 2); + newQry = newQry->nod_arg[0]; + newQry->nod_flags = qry->nod_flags; + } + } + + if (!recursiveRse) + return input; + + if (!anchorRse) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + // Non-recursive member is missing in CTE '%s' + Arg::Gds(isc_dsql_cte_miss_nonrecursive) << Arg::Str(cte_alias->str_data)); + } + + qry = recursiveRse; + dsql_nod* list = NULL; + + while (qry->nod_arg[0] != anchorRse) + { + list = qry; + qry = qry->nod_arg[0]; + } + + qry->nod_arg[0] = 0; + + if (list) + list->nod_arg[0] = qry->nod_arg[1]; + else + recursiveRse = qry->nod_arg[1]; + + dsql_nod* unionNode = MAKE_node(Dsql::nod_list, 2); + unionNode->nod_flags = NOD_UNION_ALL | NOD_UNION_RECURSIVE; + unionNode->nod_arg[0] = anchorRse; + unionNode->nod_arg[1] = recursiveRse; + + dsql_nod* select = MAKE_node(Dsql::nod_select_expr, Dsql::e_sel_count); + select->nod_arg[Dsql::e_sel_query_spec] = unionNode; + select->nod_arg[Dsql::e_sel_order] = select->nod_arg[Dsql::e_sel_rows] = + select->nod_arg[Dsql::e_sel_with_list] = NULL; + + dsql_nod* node = MAKE_node(Dsql::nod_derived_table, Dsql::e_derived_table_count); + dsql_str* alias = (dsql_str*) input->nod_arg[Dsql::e_derived_table_alias]; + node->nod_arg[Dsql::e_derived_table_alias] = (dsql_nod*) alias; + node->nod_arg[Dsql::e_derived_table_column_alias] = + input->nod_arg[Dsql::e_derived_table_column_alias]; + node->nod_arg[Dsql::e_derived_table_rse] = select; + node->nod_arg[Dsql::e_derived_table_context] = input->nod_arg[Dsql::e_derived_table_context]; + + return node; +} + +// Check if rse is recursive. If recursive reference is a table in the FROM list remove it. +// If recursive reference is a part of join add join boolean (returned by pass1JoinIsRecursive) +// to the WHERE clause. Punt if more than one recursive reference is found. +dsql_nod* DsqlCompilerScratch::pass1RseIsRecursive(dsql_nod* input) +{ + fb_assert(input->nod_type == Dsql::nod_query_spec); + + dsql_nod* result = MAKE_node(Dsql::nod_query_spec, Dsql::e_qry_count); + memcpy(result->nod_arg, input->nod_arg, Dsql::e_qry_count * sizeof(dsql_nod*)); + + dsql_nod* srcTables = input->nod_arg[Dsql::e_qry_from]; + dsql_nod* dstTables = MAKE_node(Dsql::nod_list, srcTables->nod_count); + result->nod_arg[Dsql::e_qry_from] = dstTables; + + dsql_nod** pDstTable = dstTables->nod_arg; + dsql_nod** pSrcTable = srcTables->nod_arg; + dsql_nod** end = srcTables->nod_arg + srcTables->nod_count; + bool found = false; + + for (dsql_nod** prev = pDstTable; pSrcTable < end; ++pSrcTable, ++pDstTable) + { + *prev++ = *pDstTable = *pSrcTable; + + switch ((*pDstTable)->nod_type) + { + case Dsql::nod_rel_proc_name: + case Dsql::nod_relation_name: + if (pass1RelProcIsRecursive(*pDstTable)) + { + if (found) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + // Recursive member of CTE can't reference itself more than once + Arg::Gds(isc_dsql_cte_mult_references)); + } + found = true; + + prev--; + dstTables->nod_count--; + } + break; + + case Dsql::nod_join: + { + *pDstTable = MAKE_node(Dsql::nod_join, Dsql::e_join_count); + memcpy((*pDstTable)->nod_arg, (*pSrcTable)->nod_arg, + Dsql::e_join_count * sizeof(dsql_nod*)); + + dsql_nod* joinBool = pass1JoinIsRecursive(*pDstTable); + if (joinBool) + { + if (found) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + // Recursive member of CTE can't reference itself more than once + Arg::Gds(isc_dsql_cte_mult_references)); + } + found = true; + + result->nod_arg[Dsql::e_qry_where] = + PASS1_compose(result->nod_arg[Dsql::e_qry_where], joinBool, Dsql::nod_and); + } + + break; + } + + case Dsql::nod_derived_table: + break; + + default: + fb_assert(false); + } + } + + return found ? result : NULL; +} + +// Check if table reference is recursive i.e. its name is equal to the name of current processing CTE. +bool DsqlCompilerScratch::pass1RelProcIsRecursive(dsql_nod* input) +{ + const dsql_str* relName = NULL; + const dsql_str* relAlias = NULL; + + switch (input->nod_type) + { + case Dsql::nod_rel_proc_name: + relName = (dsql_str*) input->nod_arg[Dsql::e_rpn_name]; + relAlias = (dsql_str*) input->nod_arg[Dsql::e_rpn_alias]; + break; + + case Dsql::nod_relation_name: + relName = (dsql_str*) input->nod_arg[Dsql::e_rln_name]; + relAlias = (dsql_str*) input->nod_arg[Dsql::e_rln_alias]; + break; + + default: + return false; + } + + fb_assert(currCtes.hasData()); + const dsql_nod* curr_cte = currCtes.object(); + const dsql_str* cte_name = (dsql_str*) curr_cte->nod_arg[Dsql::e_derived_table_alias]; + + const bool recursive = (cte_name->str_length == relName->str_length) && + (strncmp(relName->str_data, cte_name->str_data, cte_name->str_length) == 0); + + if (recursive) + addCTEAlias(relAlias ? relAlias : relName); + + return recursive; +} + +// Check if join have recursive members. If found remove this member from join and return its +// boolean (to be added into WHERE clause). +// We must remove member only if it is a table reference. Punt if recursive reference is found in +// outer join or more than one recursive reference is found +dsql_nod* DsqlCompilerScratch::pass1JoinIsRecursive(dsql_nod*& input) +{ + const NOD_TYPE join_type = input->nod_arg[Dsql::e_join_type]->nod_type; + bool remove = false; + + bool leftRecursive = false; + dsql_nod* leftBool = NULL; + dsql_nod** join_table = &input->nod_arg[Dsql::e_join_left_rel]; + + if ((*join_table)->nod_type == Dsql::nod_join) + { + leftBool = pass1JoinIsRecursive(*join_table); + leftRecursive = (leftBool != NULL); + } + else + { + leftBool = input->nod_arg[Dsql::e_join_boolean]; + leftRecursive = pass1RelProcIsRecursive(*join_table); + + if (leftRecursive) + remove = true; + } + + if (leftRecursive && join_type != Dsql::nod_join_inner) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + // Recursive member of CTE can't be member of an outer join + Arg::Gds(isc_dsql_cte_outer_join)); + } + + bool rightRecursive = false; + dsql_nod* rightBool = NULL; + + join_table = &input->nod_arg[Dsql::e_join_rght_rel]; + + if ((*join_table)->nod_type == Dsql::nod_join) + { + rightBool = pass1JoinIsRecursive(*join_table); + rightRecursive = (rightBool != NULL); + } + else + { + rightBool = input->nod_arg[Dsql::e_join_boolean]; + rightRecursive = pass1RelProcIsRecursive(*join_table); + + if (rightRecursive) + remove = true; + } + + if (rightRecursive && join_type != Dsql::nod_join_inner) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + // Recursive member of CTE can't be member of an outer join + Arg::Gds(isc_dsql_cte_outer_join)); + } + + if (leftRecursive && rightRecursive) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + // Recursive member of CTE can't reference itself more than once + Arg::Gds(isc_dsql_cte_mult_references)); + } + + if (leftRecursive) + { + if (remove) + input = input->nod_arg[Dsql::e_join_rght_rel]; + + return leftBool; + } + + if (rightRecursive) + { + if (remove) + input = input->nod_arg[Dsql::e_join_left_rel]; + + return rightBool; + } + + return NULL; +} Property changes on: firebird/trunk/src/dsql/DsqlCompilerScratch.cpp ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: firebird/trunk/src/dsql/DsqlCompilerScratch.h =================================================================== --- firebird/trunk/src/dsql/DsqlCompilerScratch.h (rev 0) +++ firebird/trunk/src/dsql/DsqlCompilerScratch.h 2010-08-27 02:18:00 UTC (rev 51488) @@ -0,0 +1,281 @@ +/* + * + * The contents of this file are subject to the Interbase Public + * License Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy + * of the License at http://www.Inprise.com/IPL.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 was created by Inprise Corporation + * and its predecessors. Portions created by Inprise Corporation are + * Copyright (C) Inprise Corporation. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + * Adriano dos Santos Fernandes + */ + +#ifndef DSQL_COMPILER_SCRATCH_H +#define DSQL_COMPILER_SCRATCH_H + +#include "../jrd/common.h" +#include "../dsql/dsql.h" +#include "../dsql/BlrWriter.h" +#include "../common/classes/array.h" +#include "../common/classes/MetaName.h" +#include "../common/classes/stack.h" +#include "../common/classes/alloc.h" + +namespace Jrd +{ + +// DSQL Compiler scratch block - may be discarded after compilation in the future. +class DsqlCompilerScratch : public BlrWriter +{ +public: + static const unsigned FLAG_IN_AUTO_TRANS_BLOCK = 0x001; + static const unsigned FLAG_RETURNING_INTO = 0x002; + static const unsigned FLAG_METADATA_SAVED = 0x004; + static const unsigned FLAG_PROCEDURE = 0x008; + static const unsigned FLAG_TRIGGER = 0x010; + static const unsigned FLAG_BLOCK = 0x020; + static const unsigned FLAG_RECURSIVE_CTE = 0x040; + static const unsigned FLAG_UPDATE_OR_INSERT = 0x080; + static const unsigned FLAG_MERGE = 0x100; + static const unsigned FLAG_FUNCTION = 0x200; + +public: + DsqlCompilerScratch(MemoryPool& p, dsql_dbb* aDbb, jrd_tra* aTransaction, + DsqlCompiledStatement* aStatement) + : BlrWriter(p), + dbb(aDbb), + transaction(aTransaction), + statement(aStatement), + flags(0), + ports(p), + relation(NULL), + procedure(NULL), + mainContext(p), + context(&mainContext), + unionContext(p), + derivedContext(p), + outerAggContext(NULL), + contextNumber(0), + derivedContextNumber(0), + scopeLevel(0), + loopLevel(0), + labels(p), + cursorNumber(0), + cursors(p), + inSelectList(0), + inWhereClause(0), + inGroupByClause(0), + inHavingClause(0), + inOrderByClause(0), + errorHandlers(0), + clientDialect(0), + inOuterJoin(0), + aliasRelationPrefix(NULL), + hiddenVars(p), + hiddenVarsNumber(0), + package(p), + currCtes(p), + recursiveCtx(0), + recursiveCtxId(0), + processingWindow(false), + checkConstraintTrigger(false), + variables(p), + outputVariables(p), + ctes(p), + cteAliases(p), + currCteAlias(NULL), + psql(false) + { + domainValue.clear(); + } + +protected: + // DsqlCompilerScratch should never be destroyed using delete. + // It dies together with it's pool in release_request(). + ~DsqlCompilerScratch() + { + } + + virtual bool isDdlDyn() + { + return (statement->getType() == DsqlCompiledStatement::TYPE_DDL || statement->getDdlNode()) && + !(flags & FLAG_BLOCK); + } + +public: + virtual bool isVersion4() + { + return statement->getFlags() & DsqlCompiledStatement::FLAG_BLR_VERSION4; + } + + MemoryPool& getPool() + { + return PermanentStorage::getPool(); + } + + dsql_dbb* getAttachment() + { + return dbb; + } + + jrd_tra* getTransaction() + { + return transaction; + } + + void setTransaction(jrd_tra* value) + { + transaction = value; + } + + DsqlCompiledStatement* getStatement() + { + return statement; + } + + DsqlCompiledStatement* getStatement() const + { + return statement; + } + + void putDtype(const dsql_fld* field, bool useSubType); + void putLocalVariables(const dsql_nod* parameters, SSHORT locals); + void putLocalVariable(dsql_var* variable, dsql_nod* hostParam, const dsql_str* collationName); + dsql_nod* resolveVariable(const dsql_str* varName); + void genReturn(bool eosFlag = false); + + void addCTEs(dsql_nod* list); + dsql_nod* findCTE(const dsql_str* name); + void clearCTEs(); + void checkUnusedCTEs() const; + + // hvlad: each member of recursive CTE can refer to CTE itself (only once) via + // CTE name or via alias. We need to substitute this aliases when processing CTE + // member to resolve field names. Therefore we store all aliases in order of + // occurrence and later use it in backward order (since our parser is right-to-left). + // Also we put CTE name after all such aliases to distinguish aliases for + // different CTE's. + // We also need to repeat this process if main select expression contains union with + // recursive CTE + void addCTEAlias(const dsql_str* alias) + { + cteAliases.add(alias); + } + + const dsql_str* getNextCTEAlias() + { + return *(--currCteAlias); + } + + void resetCTEAlias(const dsql_str* alias) + { + const dsql_str* const* begin = cteAliases.begin(); + + currCteAlias = cteAliases.end() - 1; + fb_assert(currCteAlias >= begin); + + const dsql_str* curr = *(currCteAlias); + while (strcmp(curr->str_data, alias->str_data)) + { + currCteAlias--; + fb_assert(currCteAlias >= begin); + + curr = *(currCteAlias); + } + } + + bool isPsql() const { return psql; } + void setPsql(bool value) { psql = value; } + +private: + dsql_nod* pass1RecursiveCte(dsql_nod* input); + dsql_nod* pass1RseIsRecursive(dsql_nod* input); + bool pass1RelProcIsRecursive(dsql_nod* input); + dsql_nod* pass1JoinIsRecursive(dsql_nod*& input); + +private: + dsql_dbb* dbb; // DSQL attachment + jrd_tra* transaction; // Transaction + DsqlCompiledStatement* statement; // Compiled statement + +public: + unsigned flags; // flags + Firebird::Array<dsql_msg*> ports; // Port messages + dsql_rel* relation; // relation created by this request (for DDL) + dsql_prc* procedure; // procedure created by this request (for DDL) + DsqlContextStack mainContext; + DsqlContextStack* context; + DsqlContextStack unionContext; // Save contexts for views of unions + DsqlContextStack derivedContext; // Save contexts for views of derived tables + dsql_ctx* outerAggContext; // agg context for outer ref + USHORT contextNumber; // Next available context number + USHORT derivedContextNumber; // Next available context number for derived tables + USHORT scopeLevel; // Scope level for parsing aliases in subqueries + USHORT loopLevel; // Loop level + DsqlStrStack labels; // Loop labels + USHORT cursorNumber; // Cursor number + DsqlNodStack cursors; // Cursors + USHORT inSelectList; // now processing "select list" + USHORT inWhereClause; // processing "where clause" + USHORT inGroupByClause; // processing "group by clause" + USHORT inHavingClause; // processing "having clause" + USHORT inOrderByClause; // processing "order by clause" + USHORT errorHandlers; // count of active error handlers + USHORT clientDialect; // dialect passed into the API call + USHORT inOuterJoin; // processing inside outer-join part + dsql_str* aliasRelationPrefix; // prefix for every relation-alias. + DsqlNodStack hiddenVars; // hidden variables + USHORT hiddenVarsNumber; // next hidden variable number + Firebird::MetaName package; // package being defined + DsqlNodStack currCtes; // current processing CTE's + class dsql_ctx* recursiveCtx; // context of recursive CTE + USHORT recursiveCtxId; // id of recursive union stream context + bool processingWindow; // processing window functions + bool checkConstraintTrigger; // compiling a check constraint trigger + dsc domainValue; // VALUE in the context of domain's check constraint + Firebird::Array<dsql_nod*> variables; + Firebird::Array<dsql_nod*> outputVariables; + +private: + Firebird::HalfStaticArray<dsql_nod*, 4> ctes; // common table expressions + Firebird::HalfStaticArray<const dsql_str*, 4> cteAliases; // CTE aliases in recursive members + const dsql_str* const* currCteAlias; + bool psql; +}; + +class PsqlChanger +{ +public: + PsqlChanger(DsqlCompilerScratch* aDsqlScratch, bool value) + : dsqlScratch(aDsqlScratch), + oldValue(dsqlScratch->isPsql()) + { + dsqlScratch->setPsql(value); + } + + ~PsqlChanger() + { + dsqlScratch->setPsql(oldValue); + } + +private: + // copying is prohibited + PsqlChanger(const PsqlChanger&); + PsqlChanger& operator =(const PsqlChanger&); + + DsqlCompilerScratch* dsqlScratch; + const bool oldValue; +}; + +} // namespace Jrd + +#endif // DSQL_COMPILER_SCRATCH_H Property changes on: firebird/trunk/src/dsql/DsqlCompilerScratch.h ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: firebird/trunk/src/dsql/Nodes.h =================================================================== --- firebird/trunk/src/dsql/Nodes.h 2010-08-26 15:40:51 UTC (rev 51487) +++ firebird/trunk/src/dsql/Nodes.h 2010-08-27 02:18:00 UTC (rev 51488) @@ -24,7 +24,7 @@ #define DSQL_NODES_H #include "../jrd/common.h" -#include "../dsql/dsql.h" +#include "../dsql/DsqlCompilerScratch.h" #include "../dsql/node.h" #include "../dsql/Visitors.h" #include "../common/classes/array.h" @@ -611,39 +611,6 @@ }; -// Common node for all "code blocks" (i.e.: procedures, triggers and execute block) -class BlockNode -{ -public: - explicit BlockNode(MemoryPool& pool, bool aHasEos) - : hasEos(aHasEos), - variables(pool), - outputVariables(pool) - { - } - - virtual ~BlockNode() - { - } - - static void putDtype(DsqlCompilerScratch* dsqlScratch, const dsql_fld* field, bool useSubType); - - void putLocalVariables(DsqlCompilerScratch* dsqlScratch, const dsql_nod* parameters, - SSHORT locals); - void putLocalVariable(DsqlCompilerScratch* dsqlScratch, dsql_var* variable, - dsql_nod* hostParam, const dsql_str* collationName); - dsql_nod* resolveVariable(const dsql_str* varName); - void genReturn(DsqlCompilerScratch* dsqlScratch, bool eosFlag = false); - -private: - bool hasEos; - -protected: - Firebird::Array<dsql_nod*> variables; - Firebird::Array<dsql_nod*> outputVariables; -}; - - } // namespace #endif // DSQL_NODES_H Modified: firebird/trunk/src/dsql/StmtNodes.cpp =================================================================== --- firebird/trunk/src/dsql/StmtNodes.cpp 2010-08-26 15:40:51 UTC (rev 51487) +++ firebird/trunk/src/dsql/StmtNodes.cpp 2010-08-27 02:18:00 UTC (rev 51488) @@ -52,278 +52,6 @@ namespace Jrd { -// Write out field data type. -// Taking special care to declare international text. -void BlockNode::putDtype(DsqlCompilerScratch* dsqlScratch, const dsql_fld* field, bool useSubType) -{ -#ifdef DEV_BUILD - // Check if the field describes a known datatype - - if (field->fld_dtype > FB_NELEM(blr_dtypes) || !blr_dtypes[field->fld_dtype]) - { - SCHAR buffer[100]; - - sprintf(buffer, "Invalid dtype %d in BlockNode::putDtype", field->fld_dtype); - ERRD_bugcheck(buffer); - } -#endif - - if (field->fld_not_nullable) - dsqlScratch->appendUChar(blr_not_nullable); - - if (field->fld_type_of_name.hasData()) - { - if (field->fld_type_of_table) - { - if (field->fld_explicit_collation) - { - dsqlScratch->appendUChar(blr_column_name2); - dsqlScratch->appendUChar(field->fld_full_domain ? blr_domain_full : blr_domain_type_of); - dsqlScratch->appendMetaString(field->fld_type_of_table->str_data); - dsqlScratch->appendMetaString(field->fld_type_of_name.c_str()); - dsqlScratch->appendUShort(field->fld_ttype); - } - else - { - dsqlScratch->appendUChar(blr_column_name); - dsqlScratch->appendUChar(field->fld_full_domain ? blr_domain_full : blr_domain_type_of); - dsqlScratch->appendMetaString(field->fld_type_of_table->str_data); - dsqlScratch->appendMetaString(field->fld_type_of_name.c_str()); - } - } - else - { - if (field->fld_explicit_collation) - { - dsqlScratch->appendUChar(blr_domain_name2); - dsqlScratch->appendUChar(field->fld_full_domain ? blr_domain_full : blr_domain_type_of); - dsqlScratch->appendMetaString(field->fld_type_of_name.c_str()); - dsqlScratch->appendUShort(field->fld_ttype); - } - else - { - dsqlScratch->appendUChar(blr_domain_name); - dsqlScratch->appendUChar(field->fld_full_domain ? blr_domain_full : blr_domain_type_of); - dsqlScratch->appendMetaString(field->fld_type_of_name.c_str()); - } - } - - return; - } - - switch (field->fld_dtype) - { - case dtype_cstring: - case dtype_text: - case dtype_varying: - case dtype_blob: - if (!useSubType) - dsqlScratch->appendUChar(blr_dtypes[field->fld_dtype]); - else if (field->fld_dtype == dtype_varying) - { - dsqlScratch->appendUChar(blr_varying2); - dsqlScratch->appendUShort(field->fld_ttype); - } - else if (field->fld_dtype == dtype_cstring) - { - dsqlScratch->appendUChar(blr_cstring2); - dsqlScratch->appendUShort(field->fld_ttype); - } - else if (field->fld_dtype == dtype_blob) - { - dsqlScratch->appendUChar(blr_blob2); - dsqlScratch->appendUShort(field->fld_sub_type); - dsqlScratch->appendUShort(field->fld_ttype); - } - else - { - dsqlScratch->appendUChar(blr_text2); - dsqlScratch->appendUShort(field->fld_ttype); - } - - if (field->fld_dtype == dtype_varying) - dsqlScratch->appendUShort(field->fld_length - sizeof(USHORT)); - else if (field->fld_dtype != dtype_blob) - dsqlScratch->appendUShort(field->fld_length); - break; - - default: - dsqlScratch->appendUChar(blr_dtypes[field->fld_dtype]); - if (DTYPE_IS_EXACT(field->fld_dtype) || (dtype_quad == field->fld_dtype)) - dsqlScratch->appendUChar(field->fld_scale); - break; - } -} - -// Emit dyn for the local variables declared in a procedure or trigger. -void BlockNode::putLocalVariables(DsqlCompilerScratch* dsqlScratch, const dsql_nod* parameters, - SSHORT locals) -{ - if (!parameters) - return; - - dsql_nod* const* ptr = parameters->nod_arg; - for (const dsql_nod* const* const end = ptr + parameters->nod_count; ptr < end; ptr++) - { - dsql_nod* parameter = *ptr; - - dsqlScratch->putDebugSrcInfo(parameter->nod_line, parameter->nod_column); - - if (parameter->nod_type == Dsql::nod_def_field) - { - dsql_fld* field = (dsql_fld*) parameter->nod_arg[Dsql::e_dfl_field]; - const dsql_nod* const* rest = ptr; - while (++rest != end) - { - if ((*rest)->nod_type == Dsql::nod_def_field) - { - const dsql_fld* rest_field = (dsql_fld*) (*rest)->nod_arg[Dsql::e_dfl_field]; - if (field->fld_name == rest_field->fld_name) - { - ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-637) << - Arg::Gds(isc_dsql_duplicate_spec) << Arg::Str(field->fld_name)); - } - } - } - - dsql_nod* var_node = MAKE_variable(field, field->fld_name.c_str(), VAR_local, 0, 0, locals); - variables.add(var_node); - - dsql_var* variable = (dsql_var*) var_node->nod_arg[Dsql::e_var_variable]; - putLocalVariable(dsqlScratch, variable, parameter, - reinterpret_cast<const dsql_str*>(parameter->nod_arg[Dsql::e_dfl_collate])); - - // Some field attributes are calculated inside - // putLocalVariable(), so we reinitialize the - // descriptor - MAKE_desc_from_field(&var_node->nod_desc, field); - - locals++; - } - else if (parameter->nod_type == Dsql::nod_cursor) - { - PASS1_statement(dsqlScratch, parameter); - GEN_statement(dsqlScratch, parameter); - } - } -} - -// Write out local variable field data type. -void BlockNode::putLocalVariable(DsqlCompilerScratch* dsqlScratch, dsql_var* variable, - dsql_nod* hostParam, const dsql_str* collationName) -{ - dsql_fld* field = variable->var_field; - - dsqlScratch->appendUChar(blr_dcl_variable); - dsqlScratch->appendUShort(variable->var_variable_number); - DDL_resolve_intl_type(dsqlScratch, field, collationName); - - //const USHORT dtype = field->fld_dtype; - - putDtype(dsqlScratch, field, true); - //field->fld_dtype = dtype; - - // Check for a default value, borrowed from define_domain - dsql_nod* node = hostParam ? hostParam->nod_arg[Dsql::e_dfl_default] : NULL; - - if (node || (!field->fld_full_domain && !field->fld_not_nullable)) - { - dsqlScratch->appendUChar(blr_assignment); - - if (node) - { - fb_assert(node->nod_type == Dsql::nod_def_default); - PsqlChanger psqlChanger(dsqlScratch, false); - node = PASS1_node(dsqlScratch, node->nod_arg[Dsql::e_dft_default]); - GEN_expr(dsqlScratch, node); - } - else - dsqlScratch->appendUChar(blr_null); // Initialize variable to NULL - - dsqlScratch->appendUChar(blr_variable); - dsqlScratch->appendUShort(variable->var_variable_number); - } - else - { - dsqlScratch->appendUChar(blr_init_variable); - dsqlScratch->appendUShort(variable->var_variable_number); - } - - if (variable->var_name[0]) // Not a function return value - dsqlScratch->putDebugVariable(variable->var_variable_number, variable->var_name); - - ++dsqlScratch->hiddenVarsNumber; -} - -// Try to resolve variable name against parameters and local variables. -dsql_nod* BlockNode::resolveVariable(const dsql_str* varName) -{ - for (dsql_nod* const* i = variables.begin(); i != variables.end(); ++i) - { - dsql_nod* var_node = *i; - fb_assert(var_node->nod_type == Dsql::nod_variable); - - if (var_node->nod_type == Dsql::nod_variable) - { - const dsql_var* variable = (dsql_var*) var_node->nod_arg[Dsql::e_var_variable]; - DEV_BLKCHK(variable, dsql_type_var); - - if (!strcmp(varName->str_data, variable->var_name)) - return var_node; - } - } - - return NULL; -} - -// Generate BLR for a return. -void BlockNode::genReturn(DsqlCompilerScratch* dsqlScratch, bool eosFlag) -{ - if (hasEos && !eosFlag) - dsqlScratch->appendUChar(blr_begin); - - dsqlScratch->appendUChar(blr_send); - dsqlScratch->appendUChar(1); - dsqlScratch->appendUChar(blr_begin); - - for (Array<dsql_nod*>::const_iterator i = outputVariables.begin(); i != outputVariables.end(); ++i) - { - const dsql_nod* parameter = *i; - const dsql_var* variable = (dsql_var*) parameter->nod_arg[Dsql::e_var_variable]; - dsqlScratch->appendUChar(blr_assignment); - dsqlScratch->appendUChar(blr_variable); - dsqlScratch->appendUShort(variable->var_variable_number); - dsqlScratch->appendUChar(blr_parameter2); - dsqlScratch->appendUChar(variable->var_msg_number); - dsqlScratch->appendUShort(variable->var_msg_item); - dsqlScratch->appendUShort(variable->var_msg_item + 1); - } - - if (hasEos) - { - dsqlScratch->appendUChar(blr_assignment); - dsqlScratch->appendUChar(blr_literal); - dsqlScratch->appendUChar(blr_short); - dsqlScratch->appendUChar(0); - dsqlScratch->appendUShort((eosFlag ? 0 : 1)); - dsqlScratch->appendUChar(blr_parameter); - dsqlScratch->appendUChar(1); - dsqlScratch->appendUShort(USHORT(2 * outputVariables.getCount())); - } - - dsqlScratch->appendUChar(blr_end); - - if (hasEos && !eosFlag) - { - dsqlScratch->appendUChar(blr_stall); - dsqlScratch->appendUChar(blr_end); - } -} - - -//-------------------- - - DmlNode* DmlNode::pass1(thread_db* tdbb, CompilerScratch* csb, jrd_nod* aNode) { node = aNode; @@ -678,8 +406,6 @@ { DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - statement->setBlockNode(this); - if (returns.hasData()) statement->setType(DsqlCompiledStatement::TYPE_SELECT_BLOCK); else @@ -793,11 +519,6 @@ void ExecBlockNode::genBlr() { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - - // Update blockNode, because we have a reference to the original unprocessed node. - statement->setBlockNode(this); - dsqlScratch->beginDebug(); // now do the input parameters @@ -808,10 +529,10 @@ dsql_nod* var = MAKE_variable(parameter.legacyField, parameter.name.c_str(), VAR_input, 0, (USHORT) (2 * i), 0); - variables.add(var); + dsqlScratch->variables.add(var); } - const unsigned returnsPos = variables.getCount(); + const unsigned returnsPos = dsqlScratch->variables.getCount(); // now do the output parameters for (size_t i = 0; i < returns.getCount(); ++i) @@ -821,10 +542,12 @@ dsql_nod* var = MAKE_variable(parameter.legacyField, parameter.name.c_str(), VAR_output, 1, (USHORT) (2 * i), i); - variables.add(var); - outputVariables.add(var); + dsqlScratch->variables.add(var); + dsqlScratch->outputVariables.add(var); } + DsqlCompiledStatement* statement = dsqlScratch->getStatement(); + dsqlScratch->appendUChar(blr_begin); if (parameters.hasData()) @@ -835,10 +558,12 @@ else statement->setSendMsg(NULL); - for (Array<dsql_nod*>::const_iterator i = outputVariables.begin(); i != outputVariables.end(); ++i) + for (Array<dsql_nod*>::const_iterator i = dsqlScratch->outputVariables.begin(); + i != dsqlScratch->outputVariables.end(); + ++i) { dsql_par* param = MAKE_parameter(statement->getReceiveMsg(), true, true, - (i - outputVariables.begin()) + 1, *i); + (i - dsqlScratch->outputVariables.begin()) + 1, *i); param->par_node = *i; MAKE_desc(dsqlScratch, ¶m->par_desc, *i, NULL); param->par_desc.dsc_flags |= DSC_nullable; @@ -864,7 +589,7 @@ for (unsigned i = 0; i < returnsPos; ++i) { - const dsql_nod* parameter = variables[i]; + const dsql_nod* parameter = dsqlScratch->variables[i]; const dsql_var* variable = (dsql_var*) parameter->nod_arg[Dsql::e_var_variable]; const dsql_fld* field = variable->var_field; @@ -875,7 +600,7 @@ // connection charset influence. So to validate, we cast them and assign to null. dsqlScratch->appendUChar(blr_assignment); dsqlScratch->appendUChar(blr_cast); - BlockNode::putDtype(dsqlScratch, field, true); + dsqlScratch->putDtype(field, true); dsqlScratch->appendUChar(blr_parameter2); dsqlScratch->appendUChar(0); dsqlScratch->appendUShort(variable->var_msg_item); @@ -884,16 +609,18 @@ } } - for (Array<dsql_nod*>::const_iterator i = outputVariables.begin(); i != outputVariables.end(); ++i) + for (Array<dsql_nod*>::const_iterator i = dsqlScratch->outputVariables.begin(); + i != dsqlScratch->outputVariables.end(); + ++i) { dsql_nod* parameter = *i; dsql_var* variable = (dsql_var*) parameter->nod_arg[Dsql::e_var_variable]; - putLocalVariable(dsqlScratch, variable, 0, NULL); + dsqlScratch->putLocalVariable(variable, 0, NULL); } dsqlScratch->setPsql(true); - putLocalVariables(dsqlScratch, localDeclList, USHORT(returns.getCount())); + dsqlScratch->putLocalVariables(localDeclList, USHORT(returns.getCount())); dsqlScratch->loopLevel = 0; @@ -912,7 +639,7 @@ statement->setType(DsqlCompiledStatement::TYPE_EXEC_BLOCK); dsqlScratch->appendUChar(blr_end); - genReturn(dsqlScratch, true); + dsqlScratch->genReturn(true); dsqlScratch->appendUChar(blr_end); dsqlScratch->endDebug(); @@ -1799,8 +1526,6 @@ statement->addFlags(DsqlCompiledStatement::FLAG_SELECTABLE); - blockNode = statement->getBlockNode(); - return this; } @@ -1813,8 +1538,7 @@ void SuspendNode::genBlr() { - if (blockNode) - blockNode->genReturn(dsqlScratch); + dsqlScratch->genReturn(); } @@ -1879,7 +1603,6 @@ ReturnNode* node = FB_NEW(getPool()) ReturnNode(getPool()); node->dsqlScratch = dsqlScratch; - node->blockNode = statement->getBlockNode(); node->value = PASS1_node(dsqlScratch, value); return node; @@ -1899,9 +1622,7 @@ GEN_expr(dsqlScratch, value); dsqlScratch->appendUChar(blr_variable); dsqlScratch->appendUShort(0); - - blockNode->genReturn(dsqlScratch); - + dsqlScratch->genReturn(); dsqlScratch->appendUChar(blr_leave); dsqlScratch->appendUChar(0); } Modified: firebird/trunk/src/dsql/StmtNodes.h =================================================================== --- firebird/trunk/src/dsql/StmtNodes.h 2010-08-26 15:40:51 UTC (rev 51487) +++ firebird/trunk/src/dsql/StmtNodes.h 2010-08-27 02:18:00 UTC (rev 51488) @@ -103,12 +103,11 @@ }; -class ExecBlockNode : public DsqlOnlyStmtNode, public BlockNode +class ExecBlockNode : public DsqlOnlyStmtNode { public: explicit ExecBlockNode(MemoryPool& pool) : DsqlOnlyStmtNode(pool), - BlockNode(pool, true), parameters(pool), returns(pool), localDeclList(NULL), @@ -319,7 +318,6 @@ public: explicit SuspendNode(MemoryPool& pool) : StmtNode(pool), - blockNode(NULL), message(NULL), statement(NULL) { @@ -339,7 +337,6 @@ virtual const jrd_nod* execute(thread_db* tdbb, jrd_req* request) const; public: - BlockNode* blockNode; NestConst<jrd_nod> message; NestConst<jrd_nod> statement; }; @@ -361,7 +358,6 @@ virtual void genBlr(); public: - BlockNode* blockNode; dsql_nod* value; }; Modified: firebird/trunk/src/dsql/dsql.h =================================================================== --- firebird/trunk/src/dsql/dsql.h 2010-08-26 15:40:51 UTC (rev 51487) +++ firebird/trunk/src/dsql/dsql.h 2010-08-27 02:18:00 UTC (rev 51488) @@ -66,14 +66,14 @@ namespace Jrd { - class Database; class Attachment; + class Database; + class DsqlCompilerScratch; class jrd_tra; class jrd_req; class blb; struct bid; - class BlockNode; class dsql_blb; class dsql_ctx; class dsql_msg; @@ -103,8 +103,6 @@ namespace Jrd { -class DsqlCompilerScratch; - //! generic data type used to store strings class dsql_str : public pool_alloc_rpt<char, dsql_type_str> { @@ -416,7 +414,6 @@ type(TYPE_SELECT), flags(0), ddlData(p), - blockNode(NULL), ddlNode(NULL), blob(NULL), sendMsg(NULL), @@ -448,10 +445,6 @@ const Firebird::HalfStaticArray<UCHAR, 1024>& getDdlData() const { return ddlData; } void setDdlData(Firebird::HalfStaticArray<UCHAR, 1024>& value) { ddlData = value; } - BlockNode* getBlockNode() { return blockNode; } - const BlockNode* getBlockNode() const { return blockNode; } - void setBlockNode(BlockNode* value) { blockNode = value; } - dsql_nod* getDdlNode() { return ddlNode; } const dsql_nod* getDdlNode() const { return ddlNode; } void setDdlNode(dsql_nod* value) { ddlNode = value; } @@ -496,7 +489,6 @@ ULONG flags; // generic flag Firebird::RefStrPtr sqlText; Firebird::HalfStaticA... [truncated message content] |
From: <fir...@us...> - 2010-08-27 03:15:17
|
Revision: 51491 http://firebird.svn.sourceforge.net/firebird/?rev=51491&view=rev Author: firebirds Date: 2010-08-27 03:15:10 +0000 (Fri, 27 Aug 2010) Log Message: ----------- nightly update Modified Paths: -------------- firebird/trunk/ChangeLog firebird/trunk/src/jrd/build_no.h firebird/trunk/src/misc/writeBuildNum.sh Modified: firebird/trunk/ChangeLog =================================================================== --- firebird/trunk/ChangeLog 2010-08-27 02:55:09 UTC (rev 51490) +++ firebird/trunk/ChangeLog 2010-08-27 03:15:10 UTC (rev 51491) @@ -1,3 +1,32 @@ + 2010-08-27 02:55 asfernandes + M src/jrd/dyn.epp +Fixed CORE-3109 - [Crash] isc_dql_exec_immed3_m for "create database ..." and NULL transaction + + 2010-08-27 02:18 asfernandes + M builds/posix/make.shared.variables + M src/dsql/DSqlDataTypeUtil.cpp + M src/dsql/DdlNodes.epp + M src/dsql/DdlNodes.h + A src/dsql/DsqlCompilerScratch.cpp + A src/dsql/DsqlCompilerScratch.h + M src/dsql/Nodes.h + M src/dsql/StmtNodes.cpp + M src/dsql/StmtNodes.h + M src/dsql/dsql.h + M src/dsql/gen.cpp + M src/dsql/misc_func.cpp + M src/dsql/pass1.cpp + M src/dsql/pass1_proto.h +1) Separate DsqlCompilerScratch in its own files. +2) Move BlockNode functionality to it. +3) Move some related CTE functions to it. + + 2010-08-26 15:40 asfernandes + M src/jrd/Function.epp + M src/jrd/Function.h + M src/jrd/fun.epp +Misc + 2010-08-25 15:52 asfernandes M src/jrd/RecordSourceNodes.cpp M src/jrd/RecordSourceNodes.h Modified: firebird/trunk/src/jrd/build_no.h =================================================================== --- firebird/trunk/src/jrd/build_no.h 2010-08-27 02:55:09 UTC (rev 51490) +++ firebird/trunk/src/jrd/build_no.h 2010-08-27 03:15:10 UTC (rev 51491) @@ -3,16 +3,16 @@ *** DO NOT EDIT *** TO CHANGE ANY INFORMATION IN HERE PLEASE EDIT src/misc/writeBuildNum.sh - FORMAL BUILD NUMBER:28697 + FORMAL BUILD NUMBER:28700 */ -#define PRODUCT_VER_STRING "3.0.0.28697" -#define FILE_VER_STRING "WI-T3.0.0.28697" -#define LICENSE_VER_STRING "WI-T3.0.0.28697" -#define FILE_VER_NUMBER 3, 0, 0, 28697 +#define PRODUCT_VER_STRING "3.0.0.28700" +#define FILE_VER_STRING "WI-T3.0.0.28700" +#define LICENSE_VER_STRING "WI-T3.0.0.28700" +#define FILE_VER_NUMBER 3, 0, 0, 28700 #define FB_MAJOR_VER "3" #define FB_MINOR_VER "0" #define FB_REV_NO "0" -#define FB_BUILD_NO "28697" +#define FB_BUILD_NO "28700" #define FB_BUILD_TYPE "T" #define FB_BUILD_SUFFIX "Firebird 3.0 Unstable" Modified: firebird/trunk/src/misc/writeBuildNum.sh =================================================================== --- firebird/trunk/src/misc/writeBuildNum.sh 2010-08-27 02:55:09 UTC (rev 51490) +++ firebird/trunk/src/misc/writeBuildNum.sh 2010-08-27 03:15:10 UTC (rev 51491) @@ -9,7 +9,7 @@ MajorVer=3 MinorVer=0 RevNo=0 -BuildNum=28697 +BuildNum=28700 if [ "$SPECIAL_BUILD_SUFFIX" = "" ]; then # Normal builds This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |