Files
libreoffice/connectivity/source/parse/sqliterator.cxx
Thorsten Behrens e65c0fe553 Merge commit 'ooo/DEV300_m101' into integration/dev300_m101
Conflicts:
	avmedia/inc/avmedia/mediaitem.hxx
	avmedia/prj/build.lst
	avmedia/source/framework/mediaitem.cxx
	avmedia/source/gstreamer/gstcommon.hxx
	avmedia/source/gstreamer/gstframegrabber.cxx
	avmedia/source/gstreamer/gstframegrabber.hxx
	avmedia/source/gstreamer/gstmanager.cxx
	avmedia/source/gstreamer/gstmanager.hxx
	avmedia/source/gstreamer/gstplayer.cxx
	avmedia/source/gstreamer/gstplayer.hxx
	avmedia/source/gstreamer/gstuno.cxx
	avmedia/source/gstreamer/gstwindow.cxx
	avmedia/source/gstreamer/gstwindow.hxx
	avmedia/source/gstreamer/makefile.mk
	avmedia/source/quicktime/quicktimeuno.cxx
	avmedia/source/viewer/mediawindow.cxx
	avmedia/source/viewer/mediawindow_impl.cxx
	avmedia/source/viewer/mediawindow_impl.hxx
	avmedia/source/viewer/mediawindowbase_impl.cxx
	avmedia/source/win/winuno.cxx
	basic/inc/basic/basmgr.hxx
	basic/inc/basic/mybasic.hxx
	basic/inc/basic/process.hxx
	basic/inc/basic/sbmeth.hxx
	basic/inc/basic/sbmod.hxx
	basic/inc/basic/sbxdef.hxx
	basic/inc/basic/sbxvar.hxx
	basic/source/app/app.cxx
	basic/source/app/app.hxx
	basic/source/app/appbased.cxx
	basic/source/app/appedit.cxx
	basic/source/app/appwin.cxx
	basic/source/app/appwin.hxx
	basic/source/app/brkpnts.cxx
	basic/source/app/brkpnts.hxx
	basic/source/app/dialogs.cxx
	basic/source/app/dialogs.hxx
	basic/source/app/msgedit.cxx
	basic/source/app/mybasic.cxx
	basic/source/app/process.cxx
	basic/source/app/processw.hxx
	basic/source/app/textedit.cxx
	basic/source/basmgr/basicmanagerrepository.cxx
	basic/source/basmgr/basmgr.cxx
	basic/source/classes/disas.cxx
	basic/source/classes/eventatt.cxx
	basic/source/classes/image.cxx
	basic/source/classes/sb.cxx
	basic/source/classes/sbunoobj.cxx
	basic/source/classes/sbxmod.cxx
	basic/source/comp/codegen.cxx
	basic/source/comp/dim.cxx
	basic/source/comp/exprgen.cxx
	basic/source/comp/exprnode.cxx
	basic/source/comp/exprtree.cxx
	basic/source/comp/sbcomp.cxx
	basic/source/inc/expr.hxx
	basic/source/inc/object.hxx
	basic/source/inc/sbunoobj.hxx
	basic/source/runtime/dllmgr-x86.cxx
	basic/source/runtime/iosys.cxx
	basic/source/runtime/makefile.mk
	basic/source/runtime/methods.cxx
	basic/source/runtime/methods1.cxx
	basic/source/runtime/runtime.cxx
	basic/source/runtime/stdobj.cxx
	basic/source/runtime/step0.cxx
	basic/source/runtime/step1.cxx
	basic/source/runtime/step2.cxx
	basic/source/sbx/sbxarray.cxx
	basic/source/sbx/sbxbase.cxx
	basic/source/sbx/sbxbool.cxx
	basic/source/sbx/sbxbyte.cxx
	basic/source/sbx/sbxcoll.cxx
	basic/source/sbx/sbxconv.hxx
	basic/source/sbx/sbxcurr.cxx
	basic/source/sbx/sbxexec.cxx
	basic/source/sbx/sbxint.cxx
	basic/source/sbx/sbxobj.cxx
	basic/source/sbx/sbxscan.cxx
	basic/source/sbx/sbxstr.cxx
	basic/source/sbx/sbxvals.cxx
	basic/source/sbx/sbxvalue.cxx
	basic/source/sbx/sbxvar.cxx
	basic/workben/mgrtest.cxx
	configmgr/prj/build.lst
	configmgr/source/access.cxx
	configmgr/source/configurationprovider.cxx
	configmgr/source/defaultprovider.cxx
	configmgr/source/pad.cxx
	configmgr/source/services.cxx
	configmgr/source/update.cxx
	configmgr/source/xmlreader.cxx
	configmgr/source/xmlreader.hxx
	connectivity/prj/build.lst
	connectivity/qa/complex/connectivity/TestCase.java
	connectivity/source/cpool/Zregistration.cxx
	connectivity/source/drivers/adabas/Bservices.cxx
	connectivity/source/drivers/ado/Aservices.cxx
	connectivity/source/drivers/calc/Cservices.cxx
	connectivity/source/drivers/calc/makefile.mk
	connectivity/source/drivers/dbase/DIndex.cxx
	connectivity/source/drivers/dbase/DIndexIter.cxx
	connectivity/source/drivers/dbase/DNoException.cxx
	connectivity/source/drivers/dbase/DTable.cxx
	connectivity/source/drivers/dbase/Dservices.cxx
	connectivity/source/drivers/dbase/dindexnode.cxx
	connectivity/source/drivers/evoab/LNoException.cxx
	connectivity/source/drivers/evoab/LServices.cxx
	connectivity/source/drivers/evoab2/NServices.cxx
	connectivity/source/drivers/file/FNoException.cxx
	connectivity/source/drivers/file/FPreparedStatement.cxx
	connectivity/source/drivers/file/FResultSet.cxx
	connectivity/source/drivers/file/FStatement.cxx
	connectivity/source/drivers/file/quotedstring.cxx
	connectivity/source/drivers/flat/ETable.cxx
	connectivity/source/drivers/flat/Eservices.cxx
	connectivity/source/drivers/hsqldb/Hservices.cxx
	connectivity/source/drivers/jdbc/jservices.cxx
	connectivity/source/drivers/kab/KServices.cxx
	connectivity/source/drivers/macab/MacabServices.cxx
	connectivity/source/drivers/mozab/MResultSet.cxx
	connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx
	connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
	connectivity/source/drivers/mysql/Yservices.cxx
	connectivity/source/drivers/odbc/OFunctions.cxx
	connectivity/source/drivers/odbc/oservices.cxx
	connectivity/source/inc/dbase/DIndexPage.hxx
	connectivity/source/inc/file/FTable.hxx
	connectivity/source/manager/mregistration.cxx
	connectivity/source/parse/PColumn.cxx
	desktop/prj/build.lst
	desktop/qa/deployment_misc/test_dp_version.cxx
	desktop/source/app/app.cxx
	desktop/source/app/appfirststart.cxx
	desktop/source/app/cmdlineargs.cxx
	desktop/source/app/cmdlineargs.hxx
	desktop/source/app/sofficemain.cxx
	desktop/source/deployment/gui/dp_gui.hrc
	desktop/source/deployment/gui/dp_gui_dialog2.cxx
	desktop/source/deployment/gui/dp_gui_dialog2.hxx
	desktop/source/deployment/gui/dp_gui_updatedialog.cxx
	desktop/source/deployment/gui/dp_gui_updatedialog.hxx
	desktop/source/deployment/manager/dp_extensionmanager.cxx
	desktop/source/deployment/manager/dp_extensionmanager.hxx
	desktop/source/deployment/misc/dp_misc.src
	desktop/source/deployment/registry/component/dp_component.cxx
	desktop/source/deployment/registry/configuration/dp_configuration.cxx
	desktop/source/deployment/registry/dp_backend.cxx
	desktop/source/deployment/registry/help/dp_help.cxx
	desktop/source/deployment/registry/script/dp_script.cxx
	desktop/source/migration/pages.cxx
	desktop/source/migration/pages.hxx
	desktop/source/migration/wizard.cxx
	desktop/source/migration/wizard.hrc
	desktop/source/migration/wizard.hxx
	desktop/source/migration/wizard.src
	desktop/source/pkgchk/unopkg/unopkg_shared.h
	desktop/source/so_comp/services.cxx
	desktop/source/splash/makefile.mk
	desktop/source/splash/services_spl.cxx
	desktop/source/splash/splash.cxx
	drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
	editeng/inc/editeng/adjitem.hxx
	editeng/inc/editeng/bolnitem.hxx
	editeng/inc/editeng/borderline.hxx
	editeng/inc/editeng/boxitem.hxx
	editeng/inc/editeng/brkitem.hxx
	editeng/inc/editeng/brshitem.hxx
	editeng/inc/editeng/bulitem.hxx
	editeng/inc/editeng/charreliefitem.hxx
	editeng/inc/editeng/charrotateitem.hxx
	editeng/inc/editeng/charscaleitem.hxx
	editeng/inc/editeng/cmapitem.hxx
	editeng/inc/editeng/colritem.hxx
	editeng/inc/editeng/crsditem.hxx
	editeng/inc/editeng/editdata.hxx
	editeng/inc/editeng/editeng.hxx
	editeng/inc/editeng/editobj.hxx
	editeng/inc/editeng/editstat.hxx
	editeng/inc/editeng/editview.hxx
	editeng/inc/editeng/emphitem.hxx
	editeng/inc/editeng/escpitem.hxx
	editeng/inc/editeng/fhgtitem.hxx
	editeng/inc/editeng/flstitem.hxx
	editeng/inc/editeng/fontitem.hxx
	editeng/inc/editeng/frmdiritem.hxx
	editeng/inc/editeng/fwdtitem.hxx
	editeng/inc/editeng/hyznitem.hxx
	editeng/inc/editeng/kernitem.hxx
	editeng/inc/editeng/langitem.hxx
	editeng/inc/editeng/lrspitem.hxx
	editeng/inc/editeng/lspcitem.hxx
	editeng/inc/editeng/numitem.hxx
	editeng/inc/editeng/outliner.hxx
	editeng/inc/editeng/paravertalignitem.hxx
	editeng/inc/editeng/pmdlitem.hxx
	editeng/inc/editeng/postitem.hxx
	editeng/inc/editeng/protitem.hxx
	editeng/inc/editeng/shaditem.hxx
	editeng/inc/editeng/sizeitem.hxx
	editeng/inc/editeng/svxacorr.hxx
	editeng/inc/editeng/svxfont.hxx
	editeng/inc/editeng/svxrtf.hxx
	editeng/inc/editeng/swafopt.hxx
	editeng/inc/editeng/tstpitem.hxx
	editeng/inc/editeng/twolinesitem.hxx
	editeng/inc/editeng/txtrange.hxx
	editeng/inc/editeng/udlnitem.hxx
	editeng/inc/editeng/ulspitem.hxx
	editeng/inc/editeng/wghtitem.hxx
	editeng/inc/editeng/writingmodeitem.hxx
	editeng/inc/editeng/xmlcnitm.hxx
	editeng/inc/helpid.hrc
	editeng/inc/pch/precompiled_editeng.hxx
	editeng/source/editeng/editdbg.cxx
	editeng/source/editeng/editdoc.cxx
	editeng/source/editeng/editdoc.hxx
	editeng/source/editeng/editdoc2.cxx
	editeng/source/editeng/editeng.cxx
	editeng/source/editeng/editobj.cxx
	editeng/source/editeng/editobj2.hxx
	editeng/source/editeng/editsel.cxx
	editeng/source/editeng/editundo.cxx
	editeng/source/editeng/editundo.hxx
	editeng/source/editeng/editview.cxx
	editeng/source/editeng/edtspell.hxx
	editeng/source/editeng/eehtml.cxx
	editeng/source/editeng/eehtml.hxx
	editeng/source/editeng/eeobj.cxx
	editeng/source/editeng/eerdll.cxx
	editeng/source/editeng/eertfpar.cxx
	editeng/source/editeng/impedit.cxx
	editeng/source/editeng/impedit.hxx
	editeng/source/editeng/impedit2.cxx
	editeng/source/editeng/impedit3.cxx
	editeng/source/editeng/impedit4.cxx
	editeng/source/editeng/impedit5.cxx
	editeng/source/editeng/makefile.mk
	editeng/source/items/bulitem.cxx
	editeng/source/items/charhiddenitem.cxx
	editeng/source/items/flditem.cxx
	editeng/source/items/frmitems.cxx
	editeng/source/items/makefile.mk
	editeng/source/items/numitem.cxx
	editeng/source/items/paraitem.cxx
	editeng/source/items/svxfont.cxx
	editeng/source/items/textitem.cxx
	editeng/source/items/writingmodeitem.cxx
	editeng/source/items/xmlcnitm.cxx
	editeng/source/misc/SvXMLAutoCorrectImport.cxx
	editeng/source/misc/svxacorr.cxx
	editeng/source/misc/txtrange.cxx
	editeng/source/misc/unolingu.cxx
	editeng/source/outliner/outleeng.cxx
	editeng/source/outliner/outliner.cxx
	editeng/source/outliner/outlundo.hxx
	editeng/source/outliner/outlvw.cxx
	editeng/source/outliner/paralist.cxx
	editeng/source/outliner/paralist.hxx
	editeng/source/rtf/rtfgrf.cxx
	editeng/source/rtf/rtfitem.cxx
	editeng/source/rtf/svxrtf.cxx
	editeng/source/uno/unoipset.cxx
	editeng/util/makefile.mk
	embeddedobj/prj/build.lst
	embeddedobj/source/commonembedding/miscobj.cxx
	eventattacher/prj/build.lst
	fileaccess/source/FileAccess.cxx
	formula/inc/formula/FormulaCompiler.hxx
	formula/inc/formula/token.hxx
	formula/inc/formula/tokenarray.hxx
	formula/source/core/api/FormulaCompiler.cxx
	formula/source/core/api/token.cxx
	formula/source/ui/dlg/FormulaHelper.cxx
	formula/source/ui/dlg/formula.cxx
	formula/source/ui/dlg/parawin.cxx
	formula/source/ui/dlg/structpg.cxx
	fpicker/prj/d.lst
	fpicker/source/aqua/FPentry.cxx
	fpicker/source/office/OfficeControlAccess.cxx
	fpicker/source/office/iodlg.cxx
	fpicker/source/office/iodlg.hxx
	fpicker/source/office/iodlg.src
	fpicker/source/office/iodlgimp.cxx
	fpicker/source/unx/gnome/FPentry.cxx
	fpicker/source/unx/gnome/SalGtkFilePicker.cxx
	fpicker/source/unx/gnome/SalGtkPicker.cxx
	fpicker/source/unx/kde4/KDE4FPEntry.cxx
	fpicker/source/win32/filepicker/FPentry.cxx
	framework/AllLangResTarget_fwe.mk
	framework/inc/dispatch/interaction.hxx
	framework/inc/framework/addonmenu.hxx
	framework/inc/framework/addonsoptions.hxx
	framework/inc/framework/bmkmenu.hxx
	framework/inc/framework/imageproducer.hxx
	framework/inc/framework/sfxhelperfunctions.hxx
	framework/inc/framework/statusbarconfiguration.hxx
	framework/inc/framework/titlehelper.hxx
	framework/inc/framework/toolboxconfiguration.hxx
	framework/inc/threadhelp/lockhelper.hxx
	framework/inc/xml/eventsdocumenthandler.hxx
	framework/inc/xml/statusbardocumenthandler.hxx
	framework/inc/xml/toolboxconfiguration.hxx
	framework/inc/xml/toolboxconfigurationdefines.hxx
	framework/inc/xml/toolboxdocumenthandler.hxx
	framework/prj/build.lst
	framework/qa/complex/ModuleManager/makefile.mk
	framework/qa/complex/accelerators/makefile.mk
	framework/qa/complex/framework/recovery/makefile.mk
	framework/qa/complex/imageManager/_XInitialization.java
	framework/source/classes/menumanager.cxx
	framework/source/dispatch/interaction.cxx
	framework/source/fwe/classes/bmkmenu.cxx
	framework/source/fwe/helper/actiontriggerhelper.cxx
	framework/source/fwe/helper/imageproducer.cxx
	framework/source/fwe/xml/menuconfiguration.cxx
	framework/source/fwe/xml/toolboxdocumenthandler.cxx
	framework/source/helper/uiconfigelementwrapperbase.cxx
	framework/source/helper/uielementwrapperbase.cxx
	framework/source/inc/pattern/window.hxx
	framework/source/jobs/jobdata.cxx
	framework/source/layoutmanager/layoutmanager.cxx
	framework/source/layoutmanager/panel.hxx
	framework/source/loadenv/loadenv.cxx
	framework/source/register/registerservices.cxx
	framework/source/services/menudocumenthandler.cxx
	framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
	framework/source/uiconfiguration/uiconfigurationmanager.cxx
	framework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx
	framework/source/uielement/addonstoolbarmanager.cxx
	framework/source/uielement/controlmenucontroller.cxx
	framework/source/uielement/fontsizemenucontroller.cxx
	framework/source/uielement/imagebuttontoolbarcontroller.cxx
	framework/source/uielement/macrosmenucontroller.cxx
	framework/source/uielement/menubarmanager.cxx
	framework/source/uielement/newmenucontroller.cxx
	framework/source/uielement/togglebuttontoolbarcontroller.cxx
	framework/source/uielement/toolbarmanager.cxx
	framework/source/uielement/toolbarsmenucontroller.cxx
	framework/test/makefile.mk
	framework/test/threadtest/makefile.mk
	framework/test/typecfg/makefile.mk
	framework/util/guiapps/makefile.mk
	framework/util/makefile.mk
	idl/inc/bastype.hxx
	idl/inc/hash.hxx
	idl/inc/lex.hxx
	idl/inc/module.hxx
	idl/inc/object.hxx
	idl/inc/slot.hxx
	idl/inc/types.hxx
	idl/source/cmptools/hash.cxx
	idl/source/cmptools/lex.cxx
	idl/source/objects/basobj.cxx
	idl/source/objects/bastype.cxx
	idl/source/objects/module.cxx
	idl/source/objects/object.cxx
	idl/source/objects/slot.cxx
	idl/source/objects/types.cxx
	idl/source/prj/command.cxx
	idl/source/prj/database.cxx
	idl/source/prj/globals.cxx
	idl/source/prj/svidl.cxx
	linguistic/inc/linguistic/misc.hxx
	linguistic/prj/build.lst
	linguistic/source/convdic.cxx
	linguistic/source/convdiclist.cxx
	linguistic/source/dicimp.cxx
	linguistic/source/dlistimp.cxx
	linguistic/source/gciterator.cxx
	linguistic/source/iprcache.cxx
	linguistic/source/lngopt.cxx
	linguistic/source/lngprophelp.cxx
	linguistic/source/lngsvcmgr.cxx
	linguistic/source/lngsvcmgr.hxx
	linguistic/source/misc2.cxx
	linguistic/workben/sprophelp.cxx
	officecfg/registry/data/org/openoffice/VCL.xcu
	officecfg/util/makefile.mk
	oovbaapi/ooo/vba/XApplicationBase.idl
	oovbaapi/ooo/vba/XVBAAppService.idl
	oovbaapi/ooo/vba/XVBADocService.idl
	oovbaapi/ooo/vba/excel/XApplication.idl
	oovbaapi/ooo/vba/excel/XRange.idl
	oovbaapi/ooo/vba/excel/XWorkbook.idl
	oovbaapi/ooo/vba/excel/XWorksheet.idl
	oovbaapi/ooo/vba/word/XApplication.idl
	oovbaapi/ooo/vba/word/XGlobals.idl
	oovbaapi/ooo/vba/word/XTableOfContents.idl
	readlicense_oo/prj/build.lst
	scripting/prj/build.lst
	scripting/prj/d.lst
	scripting/source/basprov/basprov.cxx
	scripting/source/basprov/basscript.cxx
	scripting/source/basprov/basscript.hxx
	scripting/source/dlgprov/dlgprov.cxx
	scripting/source/inc/util/util.hxx
	scripting/source/protocolhandler/scripthandler.cxx
	scripting/source/provider/ProviderCache.cxx
	scripting/source/pyprov/makefile.mk
	scripting/source/runtimemgr/ScriptNameResolverImpl.cxx
	scripting/source/runtimemgr/ScriptRuntimeManager.cxx
	scripting/source/runtimemgr/StorageBridge.cxx
	scripting/source/storage/ScriptMetadataImporter.cxx
	scripting/source/storage/ScriptSecurityManager.cxx
	scripting/source/storage/ScriptStorage.cxx
	scripting/source/storage/ScriptStorageManager.cxx
	sfx2/inc/about.hxx
	sfx2/inc/brokenpackageint.hxx
	sfx2/inc/docvor.hxx
	sfx2/inc/pch/precompiled_sfx2.hxx
	sfx2/inc/sfx2/app.hxx
	sfx2/inc/sfx2/basmgr.hxx
	sfx2/inc/sfx2/bindings.hxx
	sfx2/inc/sfx2/childwin.hxx
	sfx2/inc/sfx2/ctrlitem.hxx
	sfx2/inc/sfx2/dinfdlg.hxx
	sfx2/inc/sfx2/dispatch.hxx
	sfx2/inc/sfx2/docfilt.hxx
	sfx2/inc/sfx2/evntconf.hxx
	sfx2/inc/sfx2/fcontnr.hxx
	sfx2/inc/sfx2/frame.hxx
	sfx2/inc/sfx2/imagemgr.hxx
	sfx2/inc/sfx2/imgmgr.hxx
	sfx2/inc/sfx2/linksrc.hxx
	sfx2/inc/sfx2/macrconf.hxx
	sfx2/inc/sfx2/macropg.hxx
	sfx2/inc/sfx2/mnuitem.hxx
	sfx2/inc/sfx2/mnumgr.hxx
	sfx2/inc/sfx2/module.hxx
	sfx2/inc/sfx2/msg.hxx
	sfx2/inc/sfx2/objsh.hxx
	sfx2/inc/sfx2/passwd.hxx
	sfx2/inc/sfx2/prnmon.hxx
	sfx2/inc/sfx2/request.hxx
	sfx2/inc/sfx2/sfx.hrc
	sfx2/inc/sfx2/sfxbasemodel.hxx
	sfx2/inc/sfx2/sfxhtml.hxx
	sfx2/inc/sfx2/sfxresid.hxx
	sfx2/inc/sfx2/sfxsids.hrc
	sfx2/inc/sfx2/sfxuno.hxx
	sfx2/inc/sfx2/shell.hxx
	sfx2/inc/sfx2/stbitem.hxx
	sfx2/inc/sfx2/styfitem.hxx
	sfx2/inc/sfx2/tabdlg.hxx
	sfx2/inc/sfx2/tbxctrl.hxx
	sfx2/inc/sfx2/tplpitem.hxx
	sfx2/inc/sfx2/viewfrm.hxx
	sfx2/inc/sfx2/viewsh.hxx
	sfx2/inc/sfxbasic.hxx
	sfx2/inc/sorgitm.hxx
	sfx2/prj/build.lst
	sfx2/qa/complex/docinfo/makefile.mk
	sfx2/qa/cppunit/makefile.mk
	sfx2/sdi/makefile.mk
	sfx2/source/appl/app.cxx
	sfx2/source/appl/app.hrc
	sfx2/source/appl/app.src
	sfx2/source/appl/appbas.cxx
	sfx2/source/appl/appcfg.cxx
	sfx2/source/appl/appchild.cxx
	sfx2/source/appl/appmain.cxx
	sfx2/source/appl/appmisc.cxx
	sfx2/source/appl/appopen.cxx
	sfx2/source/appl/appquit.cxx
	sfx2/source/appl/appserv.cxx
	sfx2/source/appl/appuno.cxx
	sfx2/source/appl/childwin.cxx
	sfx2/source/appl/fileobj.cxx
	sfx2/source/appl/helpinterceptor.cxx
	sfx2/source/appl/imagemgr.cxx
	sfx2/source/appl/impldde.cxx
	sfx2/source/appl/impldde.hxx
	sfx2/source/appl/linkmgr2.cxx
	sfx2/source/appl/lnkbase2.cxx
	sfx2/source/appl/makefile.mk
	sfx2/source/appl/module.cxx
	sfx2/source/appl/newhelp.cxx
	sfx2/source/appl/opengrf.cxx
	sfx2/source/appl/sfxdll.cxx
	sfx2/source/appl/sfxhelp.cxx
	sfx2/source/appl/shutdownicon.cxx
	sfx2/source/appl/shutdowniconunx.cxx
	sfx2/source/appl/workwin.cxx
	sfx2/source/bastyp/fltfnc.cxx
	sfx2/source/bastyp/frmhtml.cxx
	sfx2/source/bastyp/frmhtmlw.cxx
	sfx2/source/bastyp/helper.cxx
	sfx2/source/bastyp/minarray.cxx
	sfx2/source/bastyp/progress.cxx
	sfx2/source/bastyp/sfxhtml.cxx
	sfx2/source/config/evntconf.cxx
	sfx2/source/control/bindings.cxx
	sfx2/source/control/ctrlitem.cxx
	sfx2/source/control/dispatch.cxx
	sfx2/source/control/macrconf.cxx
	sfx2/source/control/macro.cxx
	sfx2/source/control/makefile.mk
	sfx2/source/control/minfitem.cxx
	sfx2/source/control/msg.cxx
	sfx2/source/control/msgpool.cxx
	sfx2/source/control/objface.cxx
	sfx2/source/control/request.cxx
	sfx2/source/control/shell.cxx
	sfx2/source/control/sorgitm.cxx
	sfx2/source/dialog/about.cxx
	sfx2/source/dialog/basedlgs.cxx
	sfx2/source/dialog/dinfdlg.cxx
	sfx2/source/dialog/dinfedt.cxx
	sfx2/source/dialog/dockwin.cxx
	sfx2/source/dialog/filedlghelper.cxx
	sfx2/source/dialog/mailmodel.cxx
	sfx2/source/dialog/mailmodelapi.cxx
	sfx2/source/dialog/makefile.mk
	sfx2/source/dialog/mgetempl.cxx
	sfx2/source/dialog/passwd.cxx
	sfx2/source/dialog/passwd.hrc
	sfx2/source/dialog/printopt.cxx
	sfx2/source/dialog/securitypage.cxx
	sfx2/source/dialog/splitwin.cxx
	sfx2/source/dialog/styfitem.cxx
	sfx2/source/dialog/tabdlg.cxx
	sfx2/source/dialog/taskpane.cxx
	sfx2/source/dialog/templdlg.cxx
	sfx2/source/dialog/tplpitem.cxx
	sfx2/source/dialog/versdlg.cxx
	sfx2/source/doc/QuerySaveDocument.cxx
	sfx2/source/doc/SfxDocumentMetaData.cxx
	sfx2/source/doc/applet.cxx
	sfx2/source/doc/doc.hrc
	sfx2/source/doc/doc.src
	sfx2/source/doc/docfile.cxx
	sfx2/source/doc/docinf.cxx
	sfx2/source/doc/doctempl.cxx
	sfx2/source/doc/doctemplates.cxx
	sfx2/source/doc/docvor.cxx
	sfx2/source/doc/guisaveas.cxx
	sfx2/source/doc/makefile.mk
	sfx2/source/doc/objcont.cxx
	sfx2/source/doc/objitem.cxx
	sfx2/source/doc/objmisc.cxx
	sfx2/source/doc/objserv.cxx
	sfx2/source/doc/printhelper.cxx
	sfx2/source/doc/sfxacldetect.cxx
	sfx2/source/doc/sfxbasemodel.cxx
	sfx2/source/inc/applet.hxx
	sfx2/source/inc/fltoptint.hxx
	sfx2/source/inc/sfxlocal.hrc
	sfx2/source/inc/virtmenu.hxx
	sfx2/source/inc/workwin.hxx
	sfx2/source/menu/mnuitem.cxx
	sfx2/source/menu/objmnctl.cxx
	sfx2/source/menu/virtmenu.cxx
	sfx2/source/notify/eventsupplier.cxx
	sfx2/source/notify/makefile.mk
	sfx2/source/toolbox/imgmgr.cxx
	sfx2/source/toolbox/tbxitem.cxx
	sfx2/source/view/frame.cxx
	sfx2/source/view/orgmgr.cxx
	sfx2/source/view/printer.cxx
	sfx2/source/view/prnmon.cxx
	sfx2/source/view/viewfrm.cxx
	sfx2/source/view/viewprn.cxx
	sfx2/source/view/viewsh.cxx
	sfx2/util/makefile.mk
	sfx2/workben/custompanel/makefile.mk
	shell/source/backends/desktopbe/desktopbackend.cxx
	shell/source/backends/gconfbe/gconfbackend.cxx
	shell/source/backends/kde4be/kde4backend.cxx
	shell/source/backends/kdebe/kdebackend.cxx
	shell/source/win32/SysShentry.cxx
	shell/source/win32/shlxthandler/propsheets/propsheets.cxx
	shell/source/win32/simplemail/smplmailentry.cxx
	svx/inc/float3d.hrc
	svx/inc/fmhelp.hrc
	svx/inc/globlmn_tmpl.hrc
	svx/inc/helpid.hrc
	svx/inc/pch/precompiled_svx.hxx
	svx/inc/sjctrl.hxx
	svx/inc/srchitem.hxx
	svx/inc/svdibrow.hxx
	svx/inc/svx/SmartTagItem.hxx
	svx/inc/svx/algitem.hxx
	svx/inc/svx/camera3d.hxx
	svx/inc/svx/chrtitem.hxx
	svx/inc/svx/clipfmtitem.hxx
	svx/inc/svx/ctredlin.hxx
	svx/inc/svx/dbtoolsclient.hxx
	svx/inc/svx/deflt3d.hxx
	svx/inc/svx/dialogs.hrc
	svx/inc/svx/drawitem.hxx
	svx/inc/svx/e3ditem.hxx
	svx/inc/svx/extrud3d.hxx
	svx/inc/svx/flagsdef.hxx
	svx/inc/svx/float3d.hxx
	svx/inc/svx/frmsel.hxx
	svx/inc/svx/gallery.hxx
	svx/inc/svx/gallery1.hxx
	svx/inc/svx/galtheme.hxx
	svx/inc/svx/grfcrop.hxx
	svx/inc/svx/hdft.hxx
	svx/inc/svx/hlnkitem.hxx
	svx/inc/svx/hyprlink.hxx
	svx/inc/svx/itemwin.hxx
	svx/inc/svx/lathe3d.hxx
	svx/inc/svx/linkwarn.hxx
	svx/inc/svx/modctrl.hxx
	svx/inc/svx/msdffdef.hxx
	svx/inc/svx/obj3d.hxx
	svx/inc/svx/optgenrl.hxx
	svx/inc/svx/optgrid.hxx
	svx/inc/svx/pageitem.hxx
	svx/inc/svx/paraprev.hxx
	svx/inc/svx/postattr.hxx
	svx/inc/svx/rotmodit.hxx
	svx/inc/svx/ruler.hxx
	svx/inc/svx/rulritem.hxx
	svx/inc/svx/scene3d.hxx
	svx/inc/svx/sdasaitm.hxx
	svx/inc/svx/sdasitm.hxx
	svx/inc/svx/sdggaitm.hxx
	svx/inc/svx/sdmetitm.hxx
	svx/inc/svx/sdtaaitm.hxx
	svx/inc/svx/sdtaditm.hxx
	svx/inc/svx/sdtaitm.hxx
	svx/inc/svx/sdtakitm.hxx
	svx/inc/svx/sdtfchim.hxx
	svx/inc/svx/sdtfsitm.hxx
	svx/inc/svx/srchdlg.hxx
	svx/inc/svx/svddrag.hxx
	svx/inc/svx/svdetc.hxx
	svx/inc/svx/svdglue.hxx
	svx/inc/svx/svdhlpln.hxx
	svx/inc/svx/svdlayer.hxx
	svx/inc/svx/svdmark.hxx
	svx/inc/svx/svdmodel.hxx
	svx/inc/svx/svdoashp.hxx
	svx/inc/svx/svdobj.hxx
	svx/inc/svx/svdocirc.hxx
	svx/inc/svx/svdoedge.hxx
	svx/inc/svx/svdogrp.hxx
	svx/inc/svx/svdomeas.hxx
	svx/inc/svx/svdoole2.hxx
	svx/inc/svx/svdorect.hxx
	svx/inc/svx/svdotable.hxx
	svx/inc/svx/svdotext.hxx
	svx/inc/svx/svdovirt.hxx
	svx/inc/svx/svdpage.hxx
	svx/inc/svx/svdsnpv.hxx
	svx/inc/svx/svdtrans.hxx
	svx/inc/svx/svdundo.hxx
	svx/inc/svx/svimbase.hxx
	svx/inc/svx/svx3ditems.hxx
	svx/inc/svx/svxdlg.hxx
	svx/inc/svx/sxcikitm.hxx
	svx/inc/svx/sxekitm.hxx
	svx/inc/svx/sxelditm.hxx
	svx/inc/svx/sxenditm.hxx
	svx/inc/svx/sxmkitm.hxx
	svx/inc/svx/sxmtpitm.hxx
	svx/inc/svx/sxmuitm.hxx
	svx/inc/svx/tabarea.hxx
	svx/inc/svx/tabline.hxx
	svx/inc/svx/unoprov.hxx
	svx/inc/svx/viewlayoutitem.hxx
	svx/inc/svx/xbitmap.hxx
	svx/inc/svx/xbtmpit.hxx
	svx/inc/svx/xcolit.hxx
	svx/inc/svx/xfillit0.hxx
	svx/inc/svx/xflclit.hxx
	svx/inc/svx/xflftrit.hxx
	svx/inc/svx/xflgrit.hxx
	svx/inc/svx/xflhtit.hxx
	svx/inc/svx/xftadit.hxx
	svx/inc/svx/xftsfit.hxx
	svx/inc/svx/xftshit.hxx
	svx/inc/svx/xlineit0.hxx
	svx/inc/svx/xlinjoit.hxx
	svx/inc/svx/xlnclit.hxx
	svx/inc/svx/xlndsit.hxx
	svx/inc/svx/xlnedcit.hxx
	svx/inc/svx/xlnedit.hxx
	svx/inc/svx/xlnedwit.hxx
	svx/inc/svx/xlnstcit.hxx
	svx/inc/svx/xlnstit.hxx
	svx/inc/svx/xlnstwit.hxx
	svx/inc/svx/xlnwtit.hxx
	svx/inc/svx/xtextit0.hxx
	svx/inc/svx/zoomitem.hxx
	svx/inc/svx/zoomslideritem.hxx
	svx/inc/xpolyimp.hxx
	svx/inc/zoom_def.hxx
	svx/prj/d.lst
	svx/source/accessibility/AccessibleShape.cxx
	svx/source/accessibility/DescriptionGenerator.cxx
	svx/source/customshapes/EnhancedCustomShapeEngine.cxx
	svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
	svx/source/dialog/_bmpmask.cxx
	svx/source/dialog/_contdlg.cxx
	svx/source/dialog/connctrl.cxx
	svx/source/dialog/contwnd.cxx
	svx/source/dialog/ctredlin.cxx
	svx/source/dialog/ctredlin.hrc
	svx/source/dialog/ctredlin.src
	svx/source/dialog/dialcontrol.cxx
	svx/source/dialog/dlgctrl.cxx
	svx/source/dialog/docrecovery.cxx
	svx/source/dialog/fntctrl.cxx
	svx/source/dialog/fontwork.cxx
	svx/source/dialog/frmsel.cxx
	svx/source/dialog/graphctl.cxx
	svx/source/dialog/grfflt.cxx
	svx/source/dialog/hdft.cxx
	svx/source/dialog/hyperdlg.cxx
	svx/source/dialog/hyprdlg.hxx
	svx/source/dialog/hyprlink.cxx
	svx/source/dialog/hyprlink.hxx
	svx/source/dialog/hyprlink.src
	svx/source/dialog/imapdlg.cxx
	svx/source/dialog/imapwnd.cxx
	svx/source/dialog/linkwarn.hrc
	svx/source/dialog/makefile.mk
	svx/source/dialog/optgrid.cxx
	svx/source/dialog/orienthelper.cxx
	svx/source/dialog/pagectrl.cxx
	svx/source/dialog/prtqry.cxx
	svx/source/dialog/rlrcitem.cxx
	svx/source/dialog/rubydialog.cxx
	svx/source/dialog/rulritem.cxx
	svx/source/dialog/simptabl.cxx
	svx/source/dialog/srchdlg.cxx
	svx/source/dialog/svxbmpnumvalueset.cxx
	svx/source/dialog/svxruler.cxx
	svx/source/dialog/swframeexample.cxx
	svx/source/engine3d/float3d.cxx
	svx/source/engine3d/float3d.src
	svx/source/engine3d/svx3ditems.cxx
	svx/source/fmcomp/gridctrl.cxx
	svx/source/fmcomp/trace.cxx
	svx/source/form/ParseContext.cxx
	svx/source/form/datanavi.cxx
	svx/source/form/filtnav.cxx
	svx/source/form/fmexch.cxx
	svx/source/form/fmexpl.cxx
	svx/source/form/fmobjfac.cxx
	svx/source/form/fmpage.cxx
	svx/source/form/fmshell.cxx
	svx/source/form/fmshimp.cxx
	svx/source/form/fmsrcimp.cxx
	svx/source/form/fmvwimp.cxx
	svx/source/form/makefile.mk
	svx/source/form/tabwin.cxx
	svx/source/form/tbxform.cxx
	svx/source/form/typemap.cxx
	svx/source/gallery2/galbrws1.cxx
	svx/source/gallery2/galbrws2.cxx
	svx/source/gallery2/galexpl.cxx
	svx/source/gallery2/gallery1.cxx
	svx/source/gallery2/galtheme.cxx
	svx/source/gallery2/makefile.mk
	svx/source/gengal/gengal.cxx
	svx/source/gengal/makefile.mk
	svx/source/inc/fmgroup.hxx
	svx/source/intro/about_ooo.hrc
	svx/source/intro/iso.src
	svx/source/intro/ooo.src
	svx/source/items/SmartTagItem.cxx
	svx/source/items/algitem.cxx
	svx/source/items/chrtitem.cxx
	svx/source/items/clipfmtitem.cxx
	svx/source/items/customshapeitem.cxx
	svx/source/items/drawitem.cxx
	svx/source/items/e3ditem.cxx
	svx/source/items/grfitem.cxx
	svx/source/items/hlnkitem.cxx
	svx/source/items/makefile.mk
	svx/source/items/pageitem.cxx
	svx/source/items/rotmodit.cxx
	svx/source/items/viewlayoutitem.cxx
	svx/source/items/zoomitem.cxx
	svx/source/items/zoomslideritem.cxx
	svx/source/src/app.hrc
	svx/source/stbctrls/makefile.mk
	svx/source/stbctrls/modctrl.cxx
	svx/source/stbctrls/xmlsecctrl.cxx
	svx/source/stbctrls/zoomctrl.cxx
	svx/source/svdraw/clonelist.cxx
	svx/source/svdraw/svdattr.cxx
	svx/source/svdraw/svdcrtv.cxx
	svx/source/svdraw/svdedtv1.cxx
	svx/source/svdraw/svdedtv2.cxx
	svx/source/svdraw/svdedxv.cxx
	svx/source/svdraw/svdetc.cxx
	svx/source/svdraw/svdfmtf.cxx
	svx/source/svdraw/svdfmtf.hxx
	svx/source/svdraw/svdglue.cxx
	svx/source/svdraw/svdhdl.cxx
	svx/source/svdraw/svdhlpln.cxx
	svx/source/svdraw/svdibrow.cxx
	svx/source/svdraw/svdlayer.cxx
	svx/source/svdraw/svdmodel.cxx
	svx/source/svdraw/svdoashp.cxx
	svx/source/svdraw/svdobj.cxx
	svx/source/svdraw/svdocapt.cxx
	svx/source/svdraw/svdocirc.cxx
	svx/source/svdraw/svdoedge.cxx
	svx/source/svdraw/svdograf.cxx
	svx/source/svdraw/svdogrp.cxx
	svx/source/svdraw/svdomeas.cxx
	svx/source/svdraw/svdomedia.cxx
	svx/source/svdraw/svdopath.cxx
	svx/source/svdraw/svdotext.cxx
	svx/source/svdraw/svdotxdr.cxx
	svx/source/svdraw/svdotxed.cxx
	svx/source/svdraw/svdotxfl.cxx
	svx/source/svdraw/svdotxln.cxx
	svx/source/svdraw/svdotxtr.cxx
	svx/source/svdraw/svdoutl.cxx
	svx/source/svdraw/svdpage.cxx
	svx/source/svdraw/svdpagv.cxx
	svx/source/svdraw/svdpntv.cxx
	svx/source/svdraw/svdpoev.cxx
	svx/source/svdraw/svdsnpv.cxx
	svx/source/svdraw/svdstr.src
	svx/source/svdraw/svdtrans.cxx
	svx/source/svdraw/svdundo.cxx
	svx/source/svdraw/svdview.cxx
	svx/source/svdraw/svdxcgv.cxx
	svx/source/table/svdotable.cxx
	svx/source/tbxctrls/colorwindow.hxx
	svx/source/tbxctrls/extrusioncontrols.cxx
	svx/source/tbxctrls/fillctrl.cxx
	svx/source/tbxctrls/grafctrl.cxx
	svx/source/tbxctrls/itemwin.cxx
	svx/source/tbxctrls/layctrl.cxx
	svx/source/tbxctrls/lboxctrl.cxx
	svx/source/tbxctrls/linectrl.cxx
	svx/source/tbxctrls/tbcontrl.cxx
	svx/source/tbxctrls/verttexttbxctrl.cxx
	svx/source/unodraw/unomod.cxx
	svx/source/unodraw/unopage.cxx
	svx/source/unodraw/unoprov.cxx
	svx/source/unodraw/unoshape.cxx
	svx/source/unodraw/unoshtxt.cxx
	svx/source/xml/xmlxtexp.cxx
	svx/source/xoutdev/_xpoly.cxx
	svx/source/xoutdev/xattr.cxx
	svx/source/xoutdev/xattr2.cxx
	svx/source/xoutdev/xattrbmp.cxx
	svx/source/xoutdev/xtabcolr.cxx
	svx/util/makefile.mk
	svx/workben/edittest.cxx
	sysui/desktop/productversion.mk
	ucb/prj/build.lst
	ucb/source/cacher/cacheserv.cxx
	ucb/source/core/ucb1.component
	ucb/source/core/ucbserv.cxx
	ucb/source/core/ucbstore.cxx
	ucb/source/core/ucbstore.hxx
	ucb/source/sorter/sortmain.cxx
	ucb/source/ucp/file/prov.cxx
	ucb/source/ucp/file/shell.cxx
	ucb/source/ucp/ftp/ftpservices.cxx
	ucb/source/ucp/gio/gio_provider.cxx
	ucb/source/ucp/gvfs/gvfs_provider.cxx
	ucb/source/ucp/hierarchy/hierarchyservices.cxx
	ucb/source/ucp/odma/odma_lib.cxx
	ucb/source/ucp/odma/odma_services.cxx
	ucb/source/ucp/package/pkgservices.cxx
	ucb/source/ucp/tdoc/tdoc_services.cxx
	ucb/source/ucp/webdav/ContentProperties.cxx
	ucb/source/ucp/webdav/NeonHeadRequest.cxx
	ucb/source/ucp/webdav/webdavcontent.cxx
	ucb/source/ucp/webdav/webdavservices.cxx
	uui/source/iahndl.cxx
	uui/source/iahndl.hxx
	uui/source/loginerr.hxx
	uui/source/nameclashdlg.hxx
	uui/source/passcrtdlg.cxx
	uui/source/passworddlg.cxx
	uui/source/passworddlg.hxx
	uui/source/services.cxx
	vbahelper/inc/vbahelper/vbahelper.hxx
	vbahelper/prj/build.lst
	vbahelper/prj/d.lst
	vbahelper/source/msforms/makefile.mk
	vbahelper/source/msforms/vbauserform.cxx
	vbahelper/source/vbahelper/makefile.mk
	vbahelper/source/vbahelper/vbaapplicationbase.cxx
	vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
	vbahelper/source/vbahelper/vbadocumentbase.cxx
	vbahelper/source/vbahelper/vbadocumentsbase.cxx
	vbahelper/source/vbahelper/vbahelper.cxx
	vbahelper/util/makefile.mk
	xmlhelp/source/cxxhelp/provider/databases.cxx
	xmlhelp/source/cxxhelp/provider/services.cxx
	xmlhelp/source/treeview/tvfactory.cxx
	xmloff/JunitTest_xmloff_unoapi.mk
	xmloff/inc/functional.hxx
	xmloff/inc/xmloff/formlayerexport.hxx
	xmloff/inc/xmloff/formlayerimport.hxx
	xmloff/inc/xmloff/functional.hxx
	xmloff/inc/xmloff/shapeimport.hxx
	xmloff/inc/xmloff/xmlcnitm.hxx
	xmloff/inc/xmloff/xmlnumfi.hxx
	xmloff/prj/build.lst
	xmloff/source/chart/SchXMLChartContext.cxx
	xmloff/source/chart/SchXMLExport.cxx
	xmloff/source/chart/SchXMLImport.cxx
	xmloff/source/chart/SchXMLLegendContext.hxx
	xmloff/source/chart/SchXMLPlotAreaContext.cxx
	xmloff/source/core/xmluconv.cxx
	xmloff/source/draw/sdxmlexp.cxx
	xmloff/source/draw/shapeexport4.cxx
	xmloff/source/draw/ximp3dobject.cxx
	xmloff/source/draw/ximp3dscene.cxx
	xmloff/source/forms/formlayerexport.cxx
	xmloff/source/forms/formlayerimport.cxx
	xmloff/source/forms/handler/vcl_time_handler.hxx
	xmloff/source/forms/layerimport.cxx
	xmloff/source/forms/layerimport.hxx
	xmloff/source/forms/property_meta_data.hxx
	xmloff/source/style/PageHeaderFooterContext.cxx
	xmloff/source/style/PageMasterStyleMap.cxx
	xmloff/source/style/prstylei.cxx
	xmloff/source/style/xmlimppr.cxx
	xmloff/source/style/xmlnumfi.cxx
	xmloff/source/style/xmlstyle.cxx
	xmloff/source/table/tabledesignsimporter.cxx
	xmloff/source/text/XMLTextNumRuleInfo.cxx
	xmloff/source/text/XMLTextShapeStyleContext.cxx
	xmloff/source/text/txtstyle.cxx
	xmloff/source/transform/ChartOOoTContext.cxx
	xmloff/source/transform/EventOOoTContext.cxx
	xmloff/source/transform/TransformerBase.cxx
	xmloff/util/makefile.mk
	xmlscript/util/xcr.component
2011-03-12 02:42:58 +01:00

2250 lines
97 KiB
C++
Executable File
Raw Blame History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org 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 License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_connectivity.hxx"
#include "connectivity/sqliterator.hxx"
#include "connectivity/sdbcx/VTable.hxx"
#include <connectivity/sqlparse.hxx>
#include <connectivity/dbtools.hxx>
#include <connectivity/sqlerror.hxx>
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdb/XQueriesSupplier.hpp>
#include <com/sun/star/sdb/ErrorCondition.hpp>
#ifdef SQL_TEST_PARSETREEITERATOR
#include <iostream>
#endif
#include "connectivity/PColumn.hxx"
#include "connectivity/dbtools.hxx"
#include <tools/diagnose_ex.h>
#include "TConnection.hxx"
#include <comphelper/types.hxx>
#include <connectivity/dbmetadata.hxx>
#include <com/sun/star/sdb/SQLFilterOperator.hpp>
#include "diagnose_ex.h"
#include <rtl/logfile.hxx>
#define SQL_ISRULEOR2(pParseNode, e1,e2) ((pParseNode)->isRule() && (\
(pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e1) || \
(pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e2)))
using namespace ::comphelper;
using namespace ::connectivity;
using namespace ::connectivity::sdbcx;
using namespace ::dbtools;
using namespace ::connectivity::parse;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
namespace connectivity
{
struct OSQLParseTreeIteratorImpl
{
::std::vector< TNodePair > m_aJoinConditions;
Reference< XConnection > m_xConnection;
Reference< XDatabaseMetaData > m_xDatabaseMetaData;
Reference< XNameAccess > m_xTableContainer;
Reference< XNameAccess > m_xQueryContainer;
::boost::shared_ptr< OSQLTables > m_pTables; /// all tables which participate in the SQL statement
::boost::shared_ptr< OSQLTables > m_pSubTables; /// all tables from sub queries not the tables from the select tables
::boost::shared_ptr< QueryNameSet > m_pForbiddenQueryNames;
sal_uInt32 m_nIncludeMask;
bool m_bIsCaseSensitive;
OSQLParseTreeIteratorImpl( const Reference< XConnection >& _rxConnection, const Reference< XNameAccess >& _rxTables )
:m_xConnection( _rxConnection )
,m_nIncludeMask( OSQLParseTreeIterator::All )
,m_bIsCaseSensitive( true )
{
OSL_PRECOND( m_xConnection.is(), "OSQLParseTreeIteratorImpl::OSQLParseTreeIteratorImpl: invalid connection!" );
m_xDatabaseMetaData = m_xConnection->getMetaData();
m_bIsCaseSensitive = m_xDatabaseMetaData.is() && m_xDatabaseMetaData->supportsMixedCaseQuotedIdentifiers();
m_pTables.reset( new OSQLTables( m_bIsCaseSensitive ) );
m_pSubTables.reset( new OSQLTables( m_bIsCaseSensitive ) );
m_xTableContainer = _rxTables;
DatabaseMetaData aMetaData( m_xConnection );
if ( aMetaData.supportsSubqueriesInFrom() )
{
// connections might support the XQueriesSupplier interface, if they implement the css.sdb.Connection
// service
Reference< XQueriesSupplier > xSuppQueries( m_xConnection, UNO_QUERY );
if ( xSuppQueries.is() )
m_xQueryContainer = xSuppQueries->getQueries();
}
}
public:
inline bool isQueryAllowed( const ::rtl::OUString& _rQueryName )
{
if ( !m_pForbiddenQueryNames.get() )
return true;
if ( m_pForbiddenQueryNames->find( _rQueryName ) == m_pForbiddenQueryNames->end() )
return true;
return false;
}
};
//-------------------------------------------------------------------------
/** helper class for temporarily adding a query name to a list of forbidden query names
*/
class ForbidQueryName
{
::boost::shared_ptr< QueryNameSet >& m_rpAllForbiddenNames;
::rtl::OUString m_sForbiddenQueryName;
public:
ForbidQueryName( OSQLParseTreeIteratorImpl& _rIteratorImpl, const ::rtl::OUString _rForbiddenQueryName )
:m_rpAllForbiddenNames( _rIteratorImpl.m_pForbiddenQueryNames )
,m_sForbiddenQueryName( _rForbiddenQueryName )
{
if ( !m_rpAllForbiddenNames.get() )
m_rpAllForbiddenNames.reset( new QueryNameSet );
m_rpAllForbiddenNames->insert( m_sForbiddenQueryName );
}
~ForbidQueryName()
{
m_rpAllForbiddenNames->erase( m_sForbiddenQueryName );
}
};
}
//-----------------------------------------------------------------------------
OSQLParseTreeIterator::OSQLParseTreeIterator(const Reference< XConnection >& _rxConnection,
const Reference< XNameAccess >& _rxTables,
const OSQLParser& _rParser,
const OSQLParseNode* pRoot )
:m_rParser( _rParser )
,m_pImpl( new OSQLParseTreeIteratorImpl( _rxConnection, _rxTables ) )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::OSQLParseTreeIterator" );
setParseTree(pRoot);
}
//-----------------------------------------------------------------------------
OSQLParseTreeIterator::OSQLParseTreeIterator( const OSQLParseTreeIterator& _rParentIterator, const OSQLParser& _rParser, const OSQLParseNode* pRoot )
:m_rParser( _rParser )
,m_pImpl( new OSQLParseTreeIteratorImpl( _rParentIterator.m_pImpl->m_xConnection, _rParentIterator.m_pImpl->m_xTableContainer ) )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::OSQLParseTreeIterator" );
m_pImpl->m_pForbiddenQueryNames = _rParentIterator.m_pImpl->m_pForbiddenQueryNames;
setParseTree( pRoot );
}
//-----------------------------------------------------------------------------
OSQLParseTreeIterator::~OSQLParseTreeIterator()
{
dispose();
}
// -----------------------------------------------------------------------------
const OSQLTables& OSQLParseTreeIterator::getTables() const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getTables" );
return *m_pImpl->m_pTables;
}
// -----------------------------------------------------------------------------
bool OSQLParseTreeIterator::isCaseSensitive() const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::isCaseSensitive" );
return m_pImpl->m_bIsCaseSensitive;
}
// -----------------------------------------------------------------------------
void OSQLParseTreeIterator::dispose()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::dispose" );
m_aSelectColumns = NULL;
m_aGroupColumns = NULL;
m_aOrderColumns = NULL;
m_aParameters = NULL;
m_pImpl->m_xTableContainer = NULL;
m_pImpl->m_xDatabaseMetaData = NULL;
m_aCreateColumns = NULL;
m_pImpl->m_pTables->clear();
m_pImpl->m_pSubTables->clear();
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::setParseTree(const OSQLParseNode * pNewParseTree)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::setParseTree" );
m_pImpl->m_pTables->clear();
m_pImpl->m_pSubTables->clear();
m_aSelectColumns = new OSQLColumns();
m_aGroupColumns = new OSQLColumns();
m_aOrderColumns = new OSQLColumns();
m_aParameters = new OSQLColumns();
m_aCreateColumns = new OSQLColumns();
m_pParseTree = pNewParseTree;
if (!m_pParseTree)
{
m_eStatementType = SQL_STATEMENT_UNKNOWN;
return;
}
// falls m_pParseTree aber keine Connection, dann Fehler
if ( !m_pImpl->m_xTableContainer.is() )
return;
m_aErrors = SQLException();
// Statement-Typ ermitteln ...
if (SQL_ISRULE(m_pParseTree,select_statement) || SQL_ISRULE(m_pParseTree,union_statement) )
{
m_eStatementType = SQL_STATEMENT_SELECT;
}
else if (SQL_ISRULE(m_pParseTree,insert_statement))
{
m_eStatementType = SQL_STATEMENT_INSERT;
}
else if (SQL_ISRULE(m_pParseTree,update_statement_searched))
{
m_eStatementType = SQL_STATEMENT_UPDATE;
}
else if (SQL_ISRULE(m_pParseTree,delete_statement_searched))
{
m_eStatementType = SQL_STATEMENT_DELETE;
}
else if (m_pParseTree->count() == 3 && SQL_ISRULE(m_pParseTree->getChild(1),odbc_call_spec))
{
m_eStatementType = SQL_STATEMENT_ODBC_CALL;
}
else if (SQL_ISRULE(m_pParseTree->getChild(0),base_table_def))
{
m_eStatementType = SQL_STATEMENT_CREATE_TABLE;
m_pParseTree = m_pParseTree->getChild(0);
}
else
{
m_eStatementType = SQL_STATEMENT_UNKNOWN;
//aIteratorStatus.setInvalidStatement();
return;
}
}
//-----------------------------------------------------------------------------
namespace
{
//.........................................................................
static void impl_getRowString( const Reference< XRow >& _rxRow, const sal_Int32 _nColumnIndex, ::rtl::OUString& _out_rString )
{
_out_rString = _rxRow->getString( _nColumnIndex );
if ( _rxRow->wasNull() )
_out_rString= ::rtl::OUString();
}
//.........................................................................
static ::rtl::OUString lcl_findTableInMetaData(
const Reference< XDatabaseMetaData >& _rxDBMeta, const ::rtl::OUString& _rCatalog,
const ::rtl::OUString& _rSchema, const ::rtl::OUString& _rTableName )
{
::rtl::OUString sComposedName;
static const ::rtl::OUString s_sTableTypeView(RTL_CONSTASCII_USTRINGPARAM("VIEW"));
static const ::rtl::OUString s_sTableTypeTable(RTL_CONSTASCII_USTRINGPARAM("TABLE"));
static const ::rtl::OUString s_sWildcard( RTL_CONSTASCII_USTRINGPARAM( "%" ));
// we want all catalogues, all schemas, all tables
Sequence< ::rtl::OUString > sTableTypes(3);
sTableTypes[0] = s_sTableTypeView;
sTableTypes[1] = s_sTableTypeTable;
sTableTypes[2] = s_sWildcard; // just to be sure to include anything else ....
if ( _rxDBMeta.is() )
{
sComposedName = ::rtl::OUString();
Reference< XResultSet> xRes = _rxDBMeta->getTables(
_rCatalog.getLength() ? makeAny( _rCatalog ) : Any(), _rSchema.getLength() ? _rSchema : s_sWildcard, _rTableName, sTableTypes );
Reference< XRow > xCurrentRow( xRes, UNO_QUERY );
if ( xCurrentRow.is() && xRes->next() )
{
::rtl::OUString sCatalog, sSchema, sName;
impl_getRowString( xCurrentRow, 1, sCatalog );
impl_getRowString( xCurrentRow, 2, sSchema );
impl_getRowString( xCurrentRow, 3, sName );
sComposedName = ::dbtools::composeTableName(
_rxDBMeta,
sCatalog,
sSchema,
sName,
sal_False,
::dbtools::eInDataManipulation
);
}
}
return sComposedName;
}
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::impl_getQueryParameterColumns( const OSQLTable& _rQuery )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::impl_getQueryParameterColumns" );
if ( ( m_pImpl->m_nIncludeMask & Parameters ) != Parameters )
// parameters not to be included in the traversal
return;
::rtl::Reference< OSQLColumns > pSubQueryParameterColumns( new OSQLColumns() );
// get the command and the EscapeProcessing properties from the sub query
::rtl::OUString sSubQueryCommand;
sal_Bool bEscapeProcessing = sal_False;
try
{
Reference< XPropertySet > xQueryProperties( _rQuery, UNO_QUERY_THROW );
OSL_VERIFY( xQueryProperties->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_COMMAND ) ) >>= sSubQueryCommand );
OSL_VERIFY( xQueryProperties->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_ESCAPEPROCESSING ) ) >>= bEscapeProcessing );
}
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
// parse the sub query
do {
if ( !bEscapeProcessing || ( sSubQueryCommand.getLength() == 0 ) )
break;
::rtl::OUString sError;
::std::auto_ptr< OSQLParseNode > pSubQueryNode( const_cast< OSQLParser& >( m_rParser ).parseTree( sError, sSubQueryCommand, sal_False ) );
if ( !pSubQueryNode.get() )
break;
OSQLParseTreeIterator aSubQueryIterator( *this, m_rParser, pSubQueryNode.get() );
aSubQueryIterator.traverseSome( Parameters | SelectColumns );
// SelectColumns might also contain parameters
// #i77635# - 2007-07-23 / frank.schoenheit@sun.com
pSubQueryParameterColumns = aSubQueryIterator.getParameters();
aSubQueryIterator.dispose();
} while ( false );
// copy the parameters of the sub query to our own parameter array
::std::copy( pSubQueryParameterColumns->get().begin(), pSubQueryParameterColumns->get().end(),
::std::insert_iterator< OSQLColumns::Vector >( m_aParameters->get(), m_aParameters->get().end() ) );
}
//-----------------------------------------------------------------------------
OSQLTable OSQLParseTreeIterator::impl_locateRecordSource( const ::rtl::OUString& _rComposedName )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::impl_locateRecordSource" );
if ( !_rComposedName.getLength() )
{
OSL_ENSURE( false, "OSQLParseTreeIterator::impl_locateRecordSource: no object name at all?" );
return OSQLTable();
}
OSQLTable aReturn;
::rtl::OUString sComposedName( _rComposedName );
try
{
::rtl::OUString sCatalog, sSchema, sName;
qualifiedNameComponents( m_pImpl->m_xDatabaseMetaData, sComposedName, sCatalog, sSchema, sName, ::dbtools::eInDataManipulation );
// check whether there is a query with the given name
bool bQueryDoesExist = m_pImpl->m_xQueryContainer.is() && m_pImpl->m_xQueryContainer->hasByName( sComposedName );
// check whether the table container contains an object with the given name
if ( !bQueryDoesExist && !m_pImpl->m_xTableContainer->hasByName( sComposedName ) )
sComposedName = lcl_findTableInMetaData( m_pImpl->m_xDatabaseMetaData, sCatalog, sSchema, sName );
bool bTableDoesExist = m_pImpl->m_xTableContainer->hasByName( sComposedName );
// now obtain the object
// if we're creating a table, and there already is a table or query with the same name,
// this is worth an error
if ( SQL_STATEMENT_CREATE_TABLE == m_eStatementType )
{
if ( bQueryDoesExist )
impl_appendError( IParseContext::ERROR_INVALID_QUERY_EXIST, &sName );
else if ( bTableDoesExist )
impl_appendError( IParseContext::ERROR_INVALID_TABLE_EXIST, &sName );
else
aReturn = impl_createTableObject( sName, sCatalog, sSchema );
}
else
{
// queries win over tables, so if there's a query with this name, take this, no matter if
// there's a table, too
if ( bQueryDoesExist )
{
if ( !m_pImpl->isQueryAllowed( sComposedName ) )
{
impl_appendError( m_rParser.getErrorHelper().getSQLException( sdb::ErrorCondition::PARSER_CYCLIC_SUB_QUERIES, NULL ) );
return NULL;
}
m_pImpl->m_xQueryContainer->getByName( sComposedName ) >>= aReturn;
// collect the parameters from the sub query
ForbidQueryName aForbidName( *m_pImpl, sComposedName );
impl_getQueryParameterColumns( aReturn );
}
else if ( bTableDoesExist )
m_pImpl->m_xTableContainer->getByName( sComposedName ) >>= aReturn;
else
{
if ( m_pImpl->m_xQueryContainer.is() )
// the connection on which we're working supports sub queries in from (else
// m_xQueryContainer would not have been set), so emit a better error message
impl_appendError( IParseContext::ERROR_INVALID_TABLE_OR_QUERY, &sName );
else
impl_appendError( IParseContext::ERROR_INVALID_TABLE, &sName );
}
}
}
catch(Exception&)
{
impl_appendError( IParseContext::ERROR_INVALID_TABLE, &sComposedName );
}
return aReturn;
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseOneTableName( OSQLTables& _rTables,const OSQLParseNode * pTableName, const ::rtl::OUString & rTableRange )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseOneTableName" );
if ( ( m_pImpl->m_nIncludeMask & TableNames ) != TableNames )
// tables should not be included in the traversal
return;
OSL_ENSURE(pTableName != NULL,"OSQLParseTreeIterator::traverseOneTableName: pTableName == NULL");
Any aCatalog;
::rtl::OUString aSchema,aTableName,aComposedName;
::rtl::OUString aTableRange(rTableRange);
// Tabellenname abholen
OSQLParseNode::getTableComponents(pTableName,aCatalog,aSchema,aTableName,m_pImpl->m_xDatabaseMetaData);
// create the composed name like DOMAIN.USER.TABLE1
aComposedName = ::dbtools::composeTableName(m_pImpl->m_xDatabaseMetaData,
aCatalog.hasValue() ? ::comphelper::getString(aCatalog) : ::rtl::OUString(),
aSchema,
aTableName,
sal_False,
::dbtools::eInDataManipulation);
// if there is no alias for the table name assign the orignal name to it
if ( !aTableRange.getLength() )
aTableRange = aComposedName;
// get the object representing this table/query
OSQLTable aTable = impl_locateRecordSource( aComposedName );
if ( aTable.is() )
_rTables[ aTableRange ] = aTable;
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::impl_fillJoinConditions(const OSQLParseNode* i_pJoinCondition)
{
if (i_pJoinCondition->count() == 3 && // Ausdruck is geklammert
SQL_ISPUNCTUATION(i_pJoinCondition->getChild(0),"(") &&
SQL_ISPUNCTUATION(i_pJoinCondition->getChild(2),")"))
{
impl_fillJoinConditions(i_pJoinCondition->getChild(1));
}
else if (SQL_ISRULEOR2(i_pJoinCondition,search_condition,boolean_term) && // AND/OR-Verknuepfung:
i_pJoinCondition->count() == 3)
{
// nur AND Verkn<6B>pfung zulassen
if ( SQL_ISTOKEN(i_pJoinCondition->getChild(1),AND) )
{
impl_fillJoinConditions(i_pJoinCondition->getChild(0));
impl_fillJoinConditions(i_pJoinCondition->getChild(1));
}
}
else if (SQL_ISRULE(i_pJoinCondition,comparison_predicate))
{
// only the comparison of columns is allowed
OSL_ENSURE(i_pJoinCondition->count() == 3,"OQueryDesignView::InsertJoinConnection: Fehler im Parse Tree");
if (SQL_ISRULE(i_pJoinCondition->getChild(0),column_ref) &&
SQL_ISRULE(i_pJoinCondition->getChild(2),column_ref) &&
i_pJoinCondition->getChild(1)->getNodeType() == SQL_NODE_EQUAL)
{
m_pImpl->m_aJoinConditions.push_back( TNodePair(i_pJoinCondition->getChild(0),i_pJoinCondition->getChild(2)) );
}
}
}
//-----------------------------------------------------------------------------
::std::vector< TNodePair >& OSQLParseTreeIterator::getJoinConditions() const
{
return m_pImpl->m_aJoinConditions;
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::getQualified_join( OSQLTables& _rTables, const OSQLParseNode *pTableRef, ::rtl::OUString& aTableRange )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getQualified_join" );
OSL_PRECOND( SQL_ISRULE( pTableRef, cross_union ) || SQL_ISRULE( pTableRef, qualified_join ) ,
"OSQLParseTreeIterator::getQualified_join: illegal node!" );
aTableRange = ::rtl::OUString();
const OSQLParseNode* pNode = getTableNode(_rTables,pTableRef->getChild(0),aTableRange);
if ( isTableNode( pNode ) )
traverseOneTableName( _rTables, pNode, aTableRange );
sal_uInt32 nPos = 4;
if( SQL_ISRULE(pTableRef,cross_union) || pTableRef->getChild(1)->getTokenID() != SQL_TOKEN_NATURAL)
{
nPos = 3;
// join_condition,named_columns_join
if ( SQL_ISRULE( pTableRef, qualified_join ) )
{
const OSQLParseNode* pJoin_spec = pTableRef->getChild(4);
if ( SQL_ISRULE( pJoin_spec, join_condition ) )
{
impl_fillJoinConditions(pJoin_spec->getChild(1));
}
else
{
const OSQLParseNode* pColumnCommalist = pJoin_spec->getChild(2);
// Alle Columns in der column_commalist ...
for (sal_uInt32 i = 0; i < pColumnCommalist->count(); i++)
{
const OSQLParseNode * pCol = pColumnCommalist->getChild(i);
// add twice because the column must exists in both tables
m_pImpl->m_aJoinConditions.push_back( TNodePair(pCol,pCol) );
}
}
}
}
pNode = getTableNode(_rTables,pTableRef->getChild(nPos),aTableRange);
if ( isTableNode( pNode ) )
traverseOneTableName( _rTables, pNode, aTableRange );
}
//-----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getTableNode( OSQLTables& _rTables, const OSQLParseNode *pTableRef,::rtl::OUString& rTableRange )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getTableNode" );
OSL_PRECOND( SQL_ISRULE( pTableRef, table_ref ) || SQL_ISRULE( pTableRef, joined_table )
|| SQL_ISRULE( pTableRef, qualified_join ) || SQL_ISRULE( pTableRef, cross_union ),
"OSQLParseTreeIterator::getTableNode: only to be called for table_ref nodes!" );
const OSQLParseNode* pTableNameNode = NULL;
if ( SQL_ISRULE( pTableRef, joined_table ) )
{
getQualified_join( _rTables, pTableRef->getChild(1), rTableRange );
}
if ( SQL_ISRULE( pTableRef, qualified_join ) || SQL_ISRULE( pTableRef, cross_union ) )
{
getQualified_join( _rTables, pTableRef, rTableRange );
}
else
{
rTableRange = OSQLParseNode::getTableRange(pTableRef);
if ( ( pTableRef->count() == 4 ) // '{' SQL_TOKEN_OJ joined_table '}'
|| ( pTableRef->count() == 5 ) // '(' joined_table ')' range_variable op_column_commalist
)
{
getQualified_join( _rTables, pTableRef->getChild(6 - pTableRef->count()), rTableRange );
}
else if ( pTableRef->count() == 3 ) // subquery range_variable op_column_commalist || '(' joined_table ')'
{
const OSQLParseNode* pSubQuery = pTableRef->getChild(0);
if ( pSubQuery->isToken() )
{
getQualified_join( _rTables, pTableRef->getChild(1), rTableRange );
}
else
{
OSL_ENSURE( pSubQuery->count() == 3, "sub queries should have 3 children!" );
const OSQLParseNode* pQueryExpression = pSubQuery->getChild(1);
if ( SQL_ISRULE( pQueryExpression, select_statement ) )
{
getSelect_statement( *m_pImpl->m_pSubTables, pQueryExpression );
}
else
{
OSL_ENSURE( false, "OSQLParseTreeIterator::getTableNode: subquery which is no select_statement: not yet implemented!" );
}
}
}
else if ( pTableRef->count() == 2 ) // table_node table_primary_as_range_column
{
pTableNameNode = pTableRef->getChild(0);
}
else
OSL_ENSURE( false, "OSQLParseTreeIterator::getTableNode: unhandled case!" );
}
return pTableNameNode;
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::getSelect_statement(OSQLTables& _rTables,const OSQLParseNode* pSelect)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getSelect_statement" );
if(SQL_ISRULE(pSelect,union_statement))
{
getSelect_statement(_rTables,pSelect->getChild(0));
//getSelect_statement(pSelect->getChild(3));
return;
}
OSQLParseNode * pTableRefCommalist = pSelect->getChild(3)->getChild(0)->getChild(1);
OSL_ENSURE(pTableRefCommalist != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableRefCommalist,table_ref_commalist),"OSQLParseTreeIterator: error in parse tree!");
const OSQLParseNode* pTableName = NULL;
::rtl::OUString aTableRange;
for (sal_uInt32 i = 0; i < pTableRefCommalist->count(); i++)
{ // from clause durchlaufen
aTableRange = ::rtl::OUString();
const OSQLParseNode* pTableListElement = pTableRefCommalist->getChild(i);
if ( isTableNode( pTableListElement ) )
{
traverseOneTableName( _rTables, pTableListElement, aTableRange );
}
else if ( SQL_ISRULE( pTableListElement, table_ref ) )
{
// Tabellenreferenz kann aus Tabellennamen, Tabellennamen (+),'('joined_table')'(+) bestehen
pTableName = pTableListElement->getChild(0);
if( isTableNode( pTableName ) )
{ // Tabellennamen gefunden
aTableRange = OSQLParseNode::getTableRange(pTableListElement);
traverseOneTableName( _rTables, pTableName, aTableRange );
}
else if(SQL_ISPUNCTUATION(pTableName,"{"))
{ // '{' SQL_TOKEN_OJ joined_table '}'
getQualified_join( _rTables, pTableListElement->getChild(2), aTableRange );
}
else
{ // '(' joined_table ')' range_variable op_column_commalist
getTableNode( _rTables, pTableListElement, aTableRange );
}
}
else if (SQL_ISRULE( pTableListElement, qualified_join ) || SQL_ISRULE( pTableListElement, cross_union ) )
{
getQualified_join( _rTables, pTableListElement, aTableRange );
}
else if ( SQL_ISRULE( pTableListElement, joined_table ) )
{
getQualified_join( _rTables, pTableListElement->getChild(1), aTableRange );
}
// if (! aIteratorStatus.IsSuccessful()) break;
}
}
//-----------------------------------------------------------------------------
bool OSQLParseTreeIterator::traverseTableNames(OSQLTables& _rTables)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseTableNames" );
if ( m_pParseTree == NULL )
return false;
OSQLParseNode* pTableName = NULL;
switch ( m_eStatementType )
{
case SQL_STATEMENT_SELECT:
getSelect_statement( _rTables, m_pParseTree );
break;
case SQL_STATEMENT_CREATE_TABLE:
case SQL_STATEMENT_INSERT:
case SQL_STATEMENT_DELETE:
pTableName = m_pParseTree->getChild(2);
break;
case SQL_STATEMENT_UPDATE:
pTableName = m_pParseTree->getChild(1);
break;
default:
break;
}
if ( pTableName )
{
::rtl::OUString sTableRange;
traverseOneTableName( _rTables, pTableName, sTableRange );
}
return !hasErrors();
}
//-----------------------------------------------------------------------------
::rtl::OUString OSQLParseTreeIterator::getColumnAlias(const OSQLParseNode* _pDerivedColumn)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getColumnAlias" );
OSL_ENSURE(SQL_ISRULE(_pDerivedColumn,derived_column),"No derived column!");
::rtl::OUString sColumnAlias;
if(_pDerivedColumn->getChild(1)->count() == 2)
sColumnAlias = _pDerivedColumn->getChild(1)->getChild(1)->getTokenValue();
else if(!_pDerivedColumn->getChild(1)->isRule())
sColumnAlias = _pDerivedColumn->getChild(1)->getTokenValue();
return sColumnAlias;
}
// -----------------------------------------------------------------------------
namespace
{
void lcl_getColumnRange( const OSQLParseNode* _pColumnRef, const Reference< XConnection >& _rxConnection,
::rtl::OUString& _out_rColumnName, ::rtl::OUString& _out_rTableRange,
const OSQLColumns* _pSelectColumns, ::rtl::OUString& _out_rColumnAliasIfPresent )
{
_out_rColumnName = _out_rTableRange = _out_rColumnAliasIfPresent = ::rtl::OUString();
if ( SQL_ISRULE( _pColumnRef, column_ref ) )
{
if( _pColumnRef->count() > 1 )
{
for ( sal_Int32 i=0; i<((sal_Int32)_pColumnRef->count())-2; ++i )
_pColumnRef->getChild(i)->parseNodeToStr( _out_rTableRange, _rxConnection, NULL, sal_False, sal_False );
_out_rColumnName = _pColumnRef->getChild( _pColumnRef->count()-1 )->getChild(0)->getTokenValue();
}
else
_out_rColumnName = _pColumnRef->getChild(0)->getTokenValue();
// look up the column in the select column, to find an possible alias
if ( _pSelectColumns )
{
for ( OSQLColumns::Vector::const_iterator lookupColumn = _pSelectColumns->get().begin();
lookupColumn != _pSelectColumns->get().end();
++lookupColumn
)
{
Reference< XPropertySet > xColumn( *lookupColumn );
try
{
::rtl::OUString sName, sTableName;
xColumn->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_REALNAME ) ) >>= sName;
xColumn->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_TABLENAME ) ) >>= sTableName;
if ( sName == _out_rColumnName && sTableName == _out_rTableRange )
xColumn->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_NAME ) ) >>= _out_rColumnAliasIfPresent;
}
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
}
}
}
else if(SQL_ISRULE(_pColumnRef,general_set_fct) || SQL_ISRULE(_pColumnRef,set_fct_spec))
{ // Funktion
_pColumnRef->parseNodeToStr( _out_rColumnName, _rxConnection );
}
else if(_pColumnRef->getNodeType() == SQL_NODE_NAME)
_out_rColumnName = _pColumnRef->getTokenValue();
}
}
// -----------------------------------------------------------------------------
void OSQLParseTreeIterator::getColumnRange( const OSQLParseNode* _pColumnRef,
::rtl::OUString& _rColumnName,
::rtl::OUString& _rTableRange) const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getColumnRange" );
::rtl::OUString sDummy;
lcl_getColumnRange( _pColumnRef, m_pImpl->m_xConnection, _rColumnName, _rTableRange, NULL, sDummy );
}
// -----------------------------------------------------------------------------
void OSQLParseTreeIterator::getColumnRange( const OSQLParseNode* _pColumnRef,
::rtl::OUString& _rColumnName,
::rtl::OUString& _rTableRange,
::rtl::OUString& _out_rColumnAliasIfPresent ) const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getColumnRange" );
lcl_getColumnRange( _pColumnRef, m_pImpl->m_xConnection, _rColumnName, _rTableRange, &*m_aSelectColumns, _out_rColumnAliasIfPresent );
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::getColumnRange( const OSQLParseNode* _pColumnRef,
const Reference< XConnection >& _rxConnection, ::rtl::OUString& _out_rColumnName, ::rtl::OUString& _out_rTableRange )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getColumnRange" );
::rtl::OUString sDummy;
lcl_getColumnRange( _pColumnRef, _rxConnection, _out_rColumnName, _out_rTableRange, NULL, sDummy );
}
//-----------------------------------------------------------------------------
sal_Bool OSQLParseTreeIterator::getColumnTableRange(const OSQLParseNode* pNode, ::rtl::OUString &rTableRange) const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getColumnTableRange" );
// Ermitteln ob alle Spalten zu einer Tabelle gehoeren
if (SQL_ISRULE(pNode,column_ref))
{
::rtl::OUString aColName, aTableRange;
getColumnRange(pNode, aColName, aTableRange);
if (!aTableRange.getLength()) // keinen gefunden
{
// dann die Spalte in den Tabellen suchen
for (ConstOSQLTablesIterator aIter = m_pImpl->m_pTables->begin(); aIter != m_pImpl->m_pTables->end(); ++aIter)
{
if (aIter->second.is())
{
try
{
Reference< XNameAccess > xColumns = aIter->second->getColumns();
if(xColumns->hasByName(aColName))
{
Reference< XPropertySet > xColumn;
if (xColumns->getByName(aColName) >>= xColumn)
{
OSL_ENSURE(xColumn.is(),"Column isn't a propertyset!");
aTableRange = aIter->first;
break;
}
}
}
catch(Exception&)
{
}
}
}
if (!aTableRange.getLength())
return sal_False;
}
if (!rTableRange.getLength())
rTableRange = aTableRange;
else if (rTableRange != aTableRange)
return sal_False;
}
else
{
for (sal_uInt32 i = 0, ncount = pNode->count(); i < ncount; i++)
{
if (!getColumnTableRange(pNode->getChild(i), rTableRange))
return sal_False;
}
}
return sal_True;
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseCreateColumns(const OSQLParseNode* pSelectNode)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseCreateColumns" );
// aIteratorStatus.Clear();
if (!pSelectNode || m_eStatementType != SQL_STATEMENT_CREATE_TABLE || m_pImpl->m_pTables->empty())
{
impl_appendError( IParseContext::ERROR_GENERAL );
return;
}
if (!SQL_ISRULE(pSelectNode,base_table_element_commalist))
return ;
for (sal_uInt32 i = 0; i < pSelectNode->count(); i++)
{
OSQLParseNode *pColumnRef = pSelectNode->getChild(i);
if (SQL_ISRULE(pColumnRef,column_def))
{
::rtl::OUString aColumnName;
::rtl::OUString aTypeName;
::rtl::OUString aTableRange;
sal_Int32 nType = DataType::VARCHAR;
aColumnName = pColumnRef->getChild(0)->getTokenValue();
OSQLParseNode *pDatatype = pColumnRef->getChild(1);
if (pDatatype && SQL_ISRULE(pDatatype,character_string_type))
{
const OSQLParseNode *pType = pDatatype->getChild(0);
aTypeName = pType->getTokenValue();
if (pDatatype->count() == 2 && (pType->getTokenID() == SQL_TOKEN_CHAR || pType->getTokenID() == SQL_TOKEN_CHARACTER ))
nType = DataType::CHAR;
const OSQLParseNode *pParams = pDatatype->getChild(pDatatype->count()-1);
if ( pParams->count() )
{
sal_Int32 nLen = pParams->getChild(1)->getTokenValue().toInt32();
(void)nLen;
}
}
else if(pDatatype && pDatatype->getNodeType() == SQL_NODE_KEYWORD)
{
aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR"));
}
if (aTypeName.getLength())
{
//TODO:Create a new class for create statement to handle field length
OParseColumn* pColumn = new OParseColumn(aColumnName,aTypeName,::rtl::OUString(),::rtl::OUString(),
ColumnValue::NULLABLE_UNKNOWN,0,0,nType,sal_False,sal_False,isCaseSensitive());
pColumn->setFunction(sal_False);
pColumn->setRealName(aColumnName);
Reference< XPropertySet> xCol = pColumn;
m_aCreateColumns->get().push_back(xCol);
}
}
}
}
//-----------------------------------------------------------------------------
bool OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSelectNode)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseSelectColumnNames" );
if ( ( m_pImpl->m_nIncludeMask & SelectColumns ) != SelectColumns )
return true;
if (!pSelectNode || m_eStatementType != SQL_STATEMENT_SELECT || m_pImpl->m_pTables->empty())
{
impl_appendError( IParseContext::ERROR_GENERAL );
return false;
}
if(SQL_ISRULE(pSelectNode,union_statement))
{
return traverseSelectColumnNames( pSelectNode->getChild( 0 ) )
/*&& traverseSelectColumnNames( pSelectNode->getChild( 3 ) )*/;
}
static ::rtl::OUString aEmptyString;
// nyi: mehr Pruefung auf korrekte Struktur!
if (pSelectNode->getChild(2)->isRule() && SQL_ISPUNCTUATION(pSelectNode->getChild(2)->getChild(0),"*"))
{
// SELECT * ...
setSelectColumnName(m_aSelectColumns,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("*")), aEmptyString,aEmptyString);
}
else if (SQL_ISRULE(pSelectNode->getChild(2),scalar_exp_commalist))
{
// SELECT column[,column] oder SELECT COUNT(*) ...
OSQLParseNode * pSelection = pSelectNode->getChild(2);
for (sal_uInt32 i = 0; i < pSelection->count(); i++)
{
OSQLParseNode *pColumnRef = pSelection->getChild(i);
//if (SQL_ISRULE(pColumnRef,select_sublist))
if (SQL_ISRULE(pColumnRef,derived_column) &&
SQL_ISRULE(pColumnRef->getChild(0),column_ref) &&
pColumnRef->getChild(0)->count() == 3 &&
SQL_ISPUNCTUATION(pColumnRef->getChild(0)->getChild(2),"*"))
{
// alle Spalten der Tabelle
::rtl::OUString aTableRange;
pColumnRef->getChild(0)->parseNodeToStr( aTableRange, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
setSelectColumnName(m_aSelectColumns,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("*")), aEmptyString,aTableRange);
continue;
}
else if (SQL_ISRULE(pColumnRef,derived_column))
{
::rtl::OUString aColumnAlias(getColumnAlias(pColumnRef)); // kann leer sein
::rtl::OUString sColumnName;
::rtl::OUString aTableRange;
sal_Int32 nType = DataType::VARCHAR;
sal_Bool bFkt(sal_False);
pColumnRef = pColumnRef->getChild(0);
if (
pColumnRef->count() == 3 &&
SQL_ISPUNCTUATION(pColumnRef->getChild(0),"(") &&
SQL_ISPUNCTUATION(pColumnRef->getChild(2),")")
)
pColumnRef = pColumnRef->getChild(1);
if (SQL_ISRULE(pColumnRef,column_ref))
{
getColumnRange(pColumnRef,sColumnName,aTableRange);
OSL_ENSURE(sColumnName.getLength(),"Columnname darf nicht leer sein");
}
else /*if (SQL_ISRULE(pColumnRef,general_set_fct) || SQL_ISRULE(pColumnRef,set_fct_spec) ||
SQL_ISRULE(pColumnRef,position_exp) || SQL_ISRULE(pColumnRef,extract_exp) ||
SQL_ISRULE(pColumnRef,length_exp) || SQL_ISRULE(pColumnRef,char_value_fct)||
SQL_ISRULE(pColumnRef,num_value_exp) || SQL_ISRULE(pColumnRef,term))*/
{
/* Funktionsaufruf vorhanden */
pColumnRef->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_True );
::rtl::OUString sTableRange;
// check if the column is also a parameter
traverseORCriteria(pColumnRef); // num_value_exp
// gehoeren alle beteiligten Spalten der Funktion zu einer Tabelle
if (m_pImpl->m_pTables->size() == 1)
{
aTableRange = m_pImpl->m_pTables->begin()->first;
}
else
{
getColumnTableRange(pColumnRef,aTableRange);
}
if ( pColumnRef->isRule() )
{
bFkt = sal_True;
nType = getFunctionReturnType(pColumnRef);
}
}
/*
else
{
aIteratorStatus.setStatementTooComplex();
return;
}
*/
if(!aColumnAlias.getLength())
aColumnAlias = sColumnName;
setSelectColumnName(m_aSelectColumns,sColumnName,aColumnAlias,aTableRange,bFkt,nType,SQL_ISRULE(pColumnRef,general_set_fct) || SQL_ISRULE(pColumnRef,set_fct_spec));
}
}
}
return !hasErrors();
}
//-----------------------------------------------------------------------------
bool OSQLParseTreeIterator::traverseOrderByColumnNames(const OSQLParseNode* pSelectNode)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseOrderByColumnNames" );
traverseByColumnNames( pSelectNode, sal_True );
return !hasErrors();
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseByColumnNames(const OSQLParseNode* pSelectNode,sal_Bool _bOrder)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseByColumnNames" );
// aIteratorStatus.Clear();
if (pSelectNode == NULL)
{
//aIteratorStatus.setInvalidStatement();
return;
}
if (m_eStatementType != SQL_STATEMENT_SELECT)
{
//aIteratorStatus.setInvalidStatement();
return;
}
if(SQL_ISRULE(pSelectNode,union_statement))
{
traverseByColumnNames(pSelectNode->getChild(0),_bOrder);
return;
}
OSL_ENSURE(pSelectNode->count() >= 4,"OSQLParseTreeIterator: error in parse tree!");
OSQLParseNode * pTableExp = pSelectNode->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator:table_exp error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
sal_uInt32 nPos = ( _bOrder ? 4 : 2 );
OSQLParseNode * pOptByClause = pTableExp->getChild(nPos);
OSL_ENSURE(pOptByClause != NULL,"OSQLParseTreeIterator: error in parse tree!");
if ( pOptByClause->count() == 0 )
return;
OSL_ENSURE(pOptByClause->count() == 3,"OSQLParseTreeIterator: error in parse tree!");
OSQLParseNode * pOrderingSpecCommalist = pOptByClause->getChild(2);
OSL_ENSURE(pOrderingSpecCommalist != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(!_bOrder || SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OSQLParseTreeIterator:ordering_spec_commalist error in parse tree!");
OSL_ENSURE(pOrderingSpecCommalist->count() > 0,"OSQLParseTreeIterator: error in parse tree!");
::rtl::OUString sColumnName,aColumnAlias;
::rtl::OUString aTableRange;
sal_uInt32 nCount = pOrderingSpecCommalist->count();
for (sal_uInt32 i = 0; i < nCount; ++i)
{
OSQLParseNode* pColumnRef = pOrderingSpecCommalist->getChild(i);
OSL_ENSURE(pColumnRef != NULL,"OSQLParseTreeIterator: error in parse tree!");
if ( _bOrder )
{
OSL_ENSURE(SQL_ISRULE(pColumnRef,ordering_spec),"OSQLParseTreeIterator:ordering_spec error in parse tree!");
OSL_ENSURE(pColumnRef->count() == 2,"OSQLParseTreeIterator: error in parse tree!");
pColumnRef = pColumnRef->getChild(0);
}
aTableRange = ::rtl::OUString();
sColumnName = ::rtl::OUString();
if ( SQL_ISRULE(pColumnRef,column_ref) )
{
// Column-Name (und TableRange):
if(SQL_ISRULE(pColumnRef,column_ref))
getColumnRange(pColumnRef,sColumnName,aTableRange);
else // eine Expression
pColumnRef->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
OSL_ENSURE(sColumnName.getLength(),"sColumnName darf nicht leer sein");
}
else
{ // here I found a predicate
pColumnRef->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
}
OSL_ENSURE(pColumnRef != NULL,"OSQLParseTreeIterator: error in parse tree!");
if ( _bOrder )
{
// Ascending/Descending
OSQLParseNode * pOptAscDesc = pColumnRef->getParent()->getChild(1);
OSL_ENSURE(pOptAscDesc != NULL,"OSQLParseTreeIterator: error in parse tree!");
sal_Bool bAscending = pOptAscDesc && SQL_ISTOKEN(pOptAscDesc,ASC);
setOrderByColumnName(sColumnName, aTableRange,bAscending);
}
else
setGroupByColumnName(sColumnName, aTableRange);
}
}
//-----------------------------------------------------------------------------
bool OSQLParseTreeIterator::traverseGroupByColumnNames(const OSQLParseNode* pSelectNode)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseGroupByColumnNames" );
traverseByColumnNames( pSelectNode, sal_False );
return !hasErrors();
}
// -----------------------------------------------------------------------------
namespace
{
::rtl::OUString lcl_generateParameterName( const OSQLParseNode& _rParentNode, const OSQLParseNode& _rParamNode )
{
::rtl::OUString sColumnName( RTL_CONSTASCII_USTRINGPARAM( "param" ) );
const sal_Int32 nCount = (sal_Int32)_rParentNode.count();
for ( sal_Int32 i = 0; i < nCount; ++i )
{
if ( _rParentNode.getChild(i) == &_rParamNode )
{
sColumnName += ::rtl::OUString::valueOf( i+1 );
break;
}
}
return sColumnName;
}
}
// -----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseParameters(const OSQLParseNode* _pNode)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseParameters" );
if ( _pNode == NULL )
return;
::rtl::OUString sColumnName, sTableRange, aColumnAlias;
const OSQLParseNode* pParent = _pNode->getParent();
if ( pParent != NULL )
{
if ( SQL_ISRULE(pParent,comparison_predicate) ) // x = X
{
sal_uInt32 nPos = 0;
if ( pParent->getChild(nPos) == _pNode )
nPos = 2;
const OSQLParseNode* pOther = pParent->getChild(nPos);
if ( SQL_ISRULE( pOther, column_ref ) )
getColumnRange( pOther, sColumnName, sTableRange, aColumnAlias);
else
pOther->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
} // if ( SQL_ISRULE(pParent,comparison_predicate) ) // x = X
else if ( SQL_ISRULE(pParent,other_like_predicate_part_2) )
{
const OSQLParseNode* pOther = pParent->getParent()->getChild(0);
if ( SQL_ISRULE( pOther, column_ref ) )
getColumnRange( pOther, sColumnName, sTableRange, aColumnAlias);
else
pOther->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
}
else if ( SQL_ISRULE(pParent,between_predicate_part_2) )
{
const OSQLParseNode* pOther = pParent->getParent()->getChild(0);
if ( SQL_ISRULE( pOther, column_ref ) )
getColumnRange( pOther, sColumnName, sTableRange, aColumnAlias);
else
{
pOther->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
lcl_generateParameterName( *pParent, *_pNode );
}
}
else if ( pParent->getNodeType() == SQL_NODE_COMMALISTRULE )
{
lcl_generateParameterName( *pParent, *_pNode );
}
}
traverseParameter( _pNode, pParent, sColumnName, sTableRange, aColumnAlias );
const sal_uInt32 nCount = _pNode->count();
for (sal_uInt32 i = 0; i < nCount; ++i)
{
const OSQLParseNode* pChild = _pNode->getChild(i);
traverseParameters( pChild );
}
}
//-----------------------------------------------------------------------------
bool OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSelectNode)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseSelectionCriteria" );
if ( pSelectNode == NULL )
return false;
// Parse Tree analysieren (je nach Statement-Typ)
// und Zeiger auf WHERE-Klausel setzen:
OSQLParseNode * pWhereClause = NULL;
if (m_eStatementType == SQL_STATEMENT_SELECT)
{
if(SQL_ISRULE(pSelectNode,union_statement))
{
return traverseSelectionCriteria( pSelectNode->getChild( 0 ) )
&& traverseSelectionCriteria( pSelectNode->getChild( 3 ) );
}
OSL_ENSURE(pSelectNode->count() >= 4,"OSQLParseTreeIterator: error in parse tree!");
OSQLParseNode * pTableExp = pSelectNode->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
pWhereClause = pTableExp->getChild(1);
} else if (SQL_ISRULE(pSelectNode,update_statement_searched)) {
OSL_ENSURE(pSelectNode->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
pWhereClause = pSelectNode->getChild(4);
} else if (SQL_ISRULE(pSelectNode,delete_statement_searched)) {
OSL_ENSURE(pSelectNode->count() == 4,"OSQLParseTreeIterator: error in parse tree!");
pWhereClause = pSelectNode->getChild(3);
} else if (SQL_ISRULE(pSelectNode,delete_statement_positioned)) {
// nyi
OSL_FAIL("OSQLParseTreeIterator::getSelectionCriteria: positioned nyi");
} else {
// Anderes Statement. Keine Selektionskriterien.
return false;
}
if (! SQL_ISRULE(pWhereClause,where_clause)) {
// Die Where Clause ist meistens optional, d. h. es koennte sich auch
// um "optional_where_clause" handeln.
OSL_ENSURE(SQL_ISRULE(pWhereClause,opt_where_clause),"OSQLParseTreeIterator: error in parse tree!");
return false;
}
// Wenn es aber eine where_clause ist, dann darf sie nicht leer sein:
OSL_ENSURE(pWhereClause->count() == 2,"OSQLParseTreeIterator: error in parse tree!");
OSQLParseNode * pComparisonPredicate = pWhereClause->getChild(1);
OSL_ENSURE(pComparisonPredicate != NULL,"OSQLParseTreeIterator: error in parse tree!");
//
// Und nun die Vergleichskriterien abarbeiten (rekursiv, alles ist erstmal ein OR-Kriterium):
//
traverseORCriteria(pComparisonPredicate);
return !hasErrors();
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseORCriteria(OSQLParseNode * pSearchCondition)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseORCriteria" );
if (
pSearchCondition->count() == 3 &&
SQL_ISPUNCTUATION(pSearchCondition->getChild(0),"(") &&
SQL_ISPUNCTUATION(pSearchCondition->getChild(2),")")
)
{
// Runde Klammern um den Ausdruck
traverseORCriteria(pSearchCondition->getChild(1));
} else if (SQL_ISRULE(pSearchCondition,search_condition) &&
pSearchCondition->count() == 3 &&
SQL_ISTOKEN(pSearchCondition->getChild(1),OR))
{
// OR-Verknuepfung:
for (int i = 0; i < 3; i++) {
if (i == 1) continue; // Schluesselwort OR ueberspringen
// Ist das erste Element wieder eine OR-Verknuepfung?
if (i == 0 &&
SQL_ISRULE(pSearchCondition->getChild(0),search_condition) &&
pSearchCondition->getChild(0)->count() == 3 &&
SQL_ISTOKEN(pSearchCondition->getChild(0)->getChild(1),OR))
{
// Dann rekursiv absteigen ...
traverseORCriteria(pSearchCondition->getChild(0));
} else {
// AND-Kriterien ...
traverseANDCriteria(pSearchCondition->getChild(i));
// if (! aIteratorStatus.IsSuccessful()) break;
}
// if (! aIteratorStatus.IsSuccessful()) break;
}
} else {
// Nur *ein* Kriterium oder eine AND-Verknuepfung von Kriterien.
// Direkt die AND-Kriterien behandeln.
traverseANDCriteria(pSearchCondition);
// if (! aIteratorStatus.IsSuccessful()) return;
}
// Fehler einfach weiterreichen.
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseANDCriteria" );
if (
SQL_ISRULE(pSearchCondition,boolean_primary) &&
pSearchCondition->count() == 3 &&
SQL_ISPUNCTUATION(pSearchCondition->getChild(0),"(") &&
SQL_ISPUNCTUATION(pSearchCondition->getChild(2),")")
)
{
// Runde Klammern
traverseANDCriteria(pSearchCondition->getChild(1));
}
// Das erste Element ist eine OR-Verknuepfung
else if ( SQL_ISRULE(pSearchCondition,search_condition) && pSearchCondition->count() == 3 )
{
// Dann rekursiv absteigen (dieselbe Row benutzen) ...
traverseORCriteria(pSearchCondition->getChild(0));
// if (! aIteratorStatus.IsSuccessful())
// return;
// Und mit dem rechten Child weitermachen:
traverseANDCriteria(pSearchCondition->getChild(2));
}
// Das erste Element ist (wieder) eine AND-Verknuepfung
else if ( SQL_ISRULE(pSearchCondition,boolean_term) && pSearchCondition->count() == 3 )
{
// Dann rekursiv absteigen (dieselbe Row benutzen) ...
traverseANDCriteria(pSearchCondition->getChild(0));
// if (! aIteratorStatus.IsSuccessful())
// return;
// Und mit dem rechten Child weitermachen:
traverseANDCriteria(pSearchCondition->getChild(2));
}
// Sonst einzelne Suchkriterien wie =, !=, ..., LIKE, IS NULL usw. behandeln:
else if (SQL_ISRULE(pSearchCondition,comparison_predicate) )
{
::rtl::OUString aValue;
pSearchCondition->getChild(2)->parseNodeToStr( aValue, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
traverseOnePredicate(pSearchCondition->getChild(0),aValue,pSearchCondition->getChild(2));
impl_fillJoinConditions(pSearchCondition);
// if (! aIteratorStatus.IsSuccessful())
// return;
}
else if (SQL_ISRULE(pSearchCondition,like_predicate) /*&& SQL_ISRULE(pSearchCondition->getChild(0),column_ref)*/)
{
OSL_ENSURE(pSearchCondition->count() == 2,"OSQLParseTreeIterator: error in parse tree!");
const OSQLParseNode* pPart2 = pSearchCondition->getChild(1);
sal_Int32 nCurentPos = pPart2->count()-2;
OSQLParseNode * pNum_value_exp = pPart2->getChild(nCurentPos);
OSQLParseNode * pOptEscape = pPart2->getChild(nCurentPos+1);
OSL_ENSURE(pNum_value_exp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pOptEscape != NULL,"OSQLParseTreeIterator: error in parse tree!");
if (pOptEscape->count() != 0)
{
// aIteratorStatus.setStatementTooComplex();
return;
}
::rtl::OUString aValue;
OSQLParseNode * pParam = NULL;
if (SQL_ISRULE(pNum_value_exp,parameter))
pParam = pNum_value_exp;
else if(pNum_value_exp->isToken())
// Normaler Wert
aValue = pNum_value_exp->getTokenValue();
else
{
pNum_value_exp->parseNodeToStr( aValue, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
pParam = pNum_value_exp;
}
traverseOnePredicate(pSearchCondition->getChild(0),aValue,pParam);
// if (! aIteratorStatus.IsSuccessful())
// return;
}
else if (SQL_ISRULE(pSearchCondition,in_predicate))
{
OSL_ENSURE(pSearchCondition->count() == 2,"OSQLParseTreeIterator: error in parse tree!");
const OSQLParseNode* pPart2 = pSearchCondition->getChild(1);
traverseORCriteria(pSearchCondition->getChild(0));
// if (! aIteratorStatus.IsSuccessful()) return;
OSQLParseNode* pChild = pPart2->getChild(2);
if ( SQL_ISRULE(pChild->getChild(0),subquery) )
{
traverseTableNames( *m_pImpl->m_pSubTables );
traverseSelectionCriteria(pChild->getChild(0)->getChild(1));
}
else
{ // '(' value_exp_commalist ')'
pChild = pChild->getChild(1);
sal_Int32 nCount = pChild->count();
for (sal_Int32 i=0; i < nCount; ++i)
{
traverseANDCriteria(pChild->getChild(i));
}
}
}
else if (SQL_ISRULE(pSearchCondition,test_for_null) /*&& SQL_ISRULE(pSearchCondition->getChild(0),column_ref)*/)
{
OSL_ENSURE(pSearchCondition->count() == 2,"OSQLParseTreeIterator: error in parse tree!");
const OSQLParseNode* pPart2 = pSearchCondition->getChild(1);
(void)pPart2;
OSL_ENSURE(SQL_ISTOKEN(pPart2->getChild(0),IS),"OSQLParseTreeIterator: error in parse tree!");
::rtl::OUString aString;
traverseOnePredicate(pSearchCondition->getChild(0),aString,NULL);
// if (! aIteratorStatus.IsSuccessful()) return;
}
else if (SQL_ISRULE(pSearchCondition,num_value_exp) || SQL_ISRULE(pSearchCondition,term))
{
::rtl::OUString aString;
traverseOnePredicate(pSearchCondition->getChild(0),aString,pSearchCondition->getChild(0));
traverseOnePredicate(pSearchCondition->getChild(2),aString,pSearchCondition->getChild(2));
}
// Fehler einfach weiterreichen.
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
,const OSQLParseNode* _pColumnRef
,const ::rtl::OUString& _aColumnName
,const ::rtl::OUString& _aTableRange
,const ::rtl::OUString& _rColumnAlias)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseParameter" );
if ( !SQL_ISRULE( _pParseNode, parameter ) )
return;
if ( ( m_pImpl->m_nIncludeMask & Parameters ) != Parameters )
// parameters not to be included in the traversal
return;
OSL_ENSURE(_pParseNode->count() > 0,"OSQLParseTreeIterator: error in parse tree!");
OSQLParseNode * pMark = _pParseNode->getChild(0);
::rtl::OUString sParameterName;
if (SQL_ISPUNCTUATION(pMark,"?"))
{
sParameterName = _rColumnAlias.getLength()
? _rColumnAlias
: _aColumnName.getLength()
? _aColumnName
: ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("?"));
}
else if (SQL_ISPUNCTUATION(pMark,":"))
{
sParameterName = _pParseNode->getChild(1)->getTokenValue();
}
else if (SQL_ISPUNCTUATION(pMark,"["))
{
sParameterName = _pParseNode->getChild(1)->getTokenValue();
}
else
{
OSL_FAIL("OSQLParseTreeIterator: error in parse tree!");
}
// found a parameter
if ( _pColumnRef && (SQL_ISRULE(_pColumnRef,general_set_fct) || SQL_ISRULE(_pColumnRef,set_fct_spec)) )
{// found a function as column_ref
::rtl::OUString sFunctionName;
_pColumnRef->getChild(0)->parseNodeToStr( sFunctionName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
const sal_uInt32 nCount = _pColumnRef->count();
sal_uInt32 i = 0;
for(; i < nCount;++i)
{
if ( _pColumnRef->getChild(i) == _pParseNode )
break;
}
sal_Int32 nType = ::connectivity::OSQLParser::getFunctionParameterType( _pColumnRef->getParent()->getChild(0)->getTokenID(), i+1);
OParseColumn* pColumn = new OParseColumn( sParameterName,
::rtl::OUString(),
::rtl::OUString(),
::rtl::OUString(),
ColumnValue::NULLABLE_UNKNOWN,
0,
0,
nType,
sal_False,
sal_False,
isCaseSensitive());
pColumn->setFunction(sal_True);
pColumn->setAggregateFunction(sal_True);
pColumn->setRealName(sFunctionName);
m_aParameters->get().push_back(pColumn);
}
else
{
sal_Bool bNotFound = sal_True;
OSQLColumns::Vector::const_iterator aIter = ::connectivity::find(
m_aSelectColumns->get().begin(),
m_aSelectColumns->get().end(),
_aColumnName,::comphelper::UStringMixEqual( isCaseSensitive() )
);
if(aIter != m_aSelectColumns->get().end())
{
OParseColumn* pNewColumn = new OParseColumn(*aIter,isCaseSensitive());
pNewColumn->setName(sParameterName);
pNewColumn->setRealName(_aColumnName);
m_aParameters->get().push_back(pNewColumn);
bNotFound = sal_False;
}
else if(_aColumnName.getLength())// search in the tables for the right one
{
Reference<XPropertySet> xColumn = findColumn( _aColumnName, _aTableRange, true );
if ( xColumn.is() )
{
OParseColumn* pNewColumn = new OParseColumn(xColumn,isCaseSensitive());
pNewColumn->setName(sParameterName);
pNewColumn->setRealName(_aColumnName);
m_aParameters->get().push_back(pNewColumn);
bNotFound = sal_False;
}
}
if ( bNotFound )
{
sal_Int32 nType = DataType::VARCHAR;
OSQLParseNode* pParent = _pColumnRef ? _pColumnRef->getParent() : NULL;
if ( pParent && (SQL_ISRULE(pParent,general_set_fct) || SQL_ISRULE(pParent,set_fct_spec)) )
{
const sal_uInt32 nCount = _pColumnRef->count();
sal_uInt32 i = 0;
for(; i < nCount;++i)
{
if ( _pColumnRef->getChild(i) == _pParseNode )
break;
}
nType = ::connectivity::OSQLParser::getFunctionParameterType( pParent->getChild(0)->getTokenID(), i+1);
}
::rtl::OUString aNewColName( getUniqueColumnName( sParameterName ) );
OParseColumn* pColumn = new OParseColumn(aNewColName,
::rtl::OUString(),
::rtl::OUString(),
::rtl::OUString(),
ColumnValue::NULLABLE_UNKNOWN,
0,
0,
nType,
sal_False,
sal_False,
isCaseSensitive() );
pColumn->setName(aNewColName);
pColumn->setRealName(sParameterName);
m_aParameters->get().push_back(pColumn);
}
}
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseOnePredicate(
OSQLParseNode * pColumnRef,
::rtl::OUString& rValue,
OSQLParseNode * pParseNode)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseOnePredicate" );
if ( !pParseNode )
return;
// Column-Name (und TableRange):
::rtl::OUString aColumnName, aTableRange, sColumnAlias;
getColumnRange( pColumnRef, aColumnName, aTableRange, sColumnAlias);
::rtl::OUString aName;
/*if (SQL_ISRULE(pParseNode,parameter))
traverseParameter( pParseNode, pColumnRef, aColumnName, aTableRange, sColumnAlias );
else */if (SQL_ISRULE(pParseNode,column_ref))// Column-Name (und TableRange):
getColumnRange(pParseNode,aName,rValue);
else
{
traverseORCriteria(pParseNode);
// if (! aIteratorStatus.IsSuccessful()) return;
}
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseSome( sal_uInt32 _nIncludeMask )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseSome" );
impl_traverse( _nIncludeMask );
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseAll()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::traverseAll" );
impl_traverse( All );
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::impl_traverse( sal_uInt32 _nIncludeMask )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::impl_traverse" );
impl_resetErrors();
m_pImpl->m_nIncludeMask = _nIncludeMask;
if ( !traverseTableNames( *m_pImpl->m_pTables ) )
return;
switch ( m_eStatementType )
{
case SQL_STATEMENT_SELECT:
{
const OSQLParseNode* pSelectNode = m_pParseTree;
traverseParameters( pSelectNode );
if ( !traverseSelectColumnNames( pSelectNode )
|| !traverseOrderByColumnNames( pSelectNode )
|| !traverseGroupByColumnNames( pSelectNode )
|| !traverseSelectionCriteria( pSelectNode )
)
return;
}
break;
case SQL_STATEMENT_CREATE_TABLE:
{
//0 | 1 | 2 |3| 4 |5
//create table sc.foo ( a char(20), b char )
const OSQLParseNode* pCreateNode = m_pParseTree->getChild(4);
traverseCreateColumns(pCreateNode);
}
break;
case SQL_STATEMENT_INSERT:
break;
default:
break;
}
}
// Dummy-Implementationen:
//-----------------------------------------------------------------------------
OSQLTable OSQLParseTreeIterator::impl_createTableObject( const ::rtl::OUString& rTableName,
const ::rtl::OUString& rCatalogName, const ::rtl::OUString& rSchemaName )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::impl_createTableObject" );
OSL_PRECOND( m_eStatementType == SQL_STATEMENT_CREATE_TABLE,
"OSQLParseTreeIterator::impl_createTableObject: only to be called for CREATE TABLE statements!" );
// (in all other cases, m_pTables is to contain the table objects as obtained from the tables
// container of the connection (m_xTablesContainer)
OSQLTable aReturnTable = new OTable(
NULL,
sal_False,
rTableName,
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Table")),
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("New Created Table")),
rSchemaName,
rCatalogName
);
return aReturnTable;
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::appendColumns(::rtl::Reference<OSQLColumns>& _rColumns,const ::rtl::OUString& _rTableAlias,const OSQLTable& _rTable)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::appendColumns" );
if (!_rTable.is())
return;
Reference<XNameAccess> xColumns = _rTable->getColumns();
if ( !xColumns.is() )
return;
Sequence< ::rtl::OUString > aColNames = xColumns->getElementNames();
const ::rtl::OUString* pBegin = aColNames.getConstArray();
const ::rtl::OUString* pEnd = pBegin + aColNames.getLength();
for(;pBegin != pEnd;++pBegin)
{
::rtl::OUString aName(getUniqueColumnName(*pBegin));
Reference< XPropertySet > xColumn;
if(xColumns->hasByName(*pBegin) && (xColumns->getByName(*pBegin) >>= xColumn) && xColumn.is())
{
OParseColumn* pColumn = new OParseColumn(aName
, getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))
, getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)))
, getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION)))
, getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)))
, getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))
, getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))
, getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))
, getBOOL(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)))
, getBOOL(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))
, isCaseSensitive() );
pColumn->setTableName(_rTableAlias);
pColumn->setRealName(*pBegin);
Reference< XPropertySet> xCol = pColumn;
_rColumns->get().push_back(xCol);
}
else
impl_appendError( IParseContext::ERROR_INVALID_COLUMN, pBegin, &_rTableAlias );
}
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns>& _rColumns,const ::rtl::OUString & rColumnName,const ::rtl::OUString & rColumnAlias, const ::rtl::OUString & rTableRange,sal_Bool bFkt,sal_Int32 _nType,sal_Bool bAggFkt)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::setSelectColumnName" );
if(rColumnName.toChar() == '*' && !rTableRange.getLength())
{ // SELECT * ...
OSL_ENSURE(_rColumns == m_aSelectColumns,"Invalid columns used here!");
for(ConstOSQLTablesIterator aIter = m_pImpl->m_pTables->begin(); aIter != m_pImpl->m_pTables->end();++aIter)
appendColumns(_rColumns,aIter->first,aIter->second);
}
else if( rColumnName.toChar() == '*' && rTableRange.getLength() )
{ // SELECT <table>.*
OSL_ENSURE(_rColumns == m_aSelectColumns,"Invalid columns used here!");
ConstOSQLTablesIterator aFind = m_pImpl->m_pTables->find(rTableRange);
if(aFind != m_pImpl->m_pTables->end())
appendColumns(_rColumns,rTableRange,aFind->second);
}
else if ( !rTableRange.getLength() )
{ // SELECT <something> ...
// without table specified
if ( !bFkt )
{
Reference< XPropertySet> xNewColumn;
for ( OSQLTablesIterator aIter = m_pImpl->m_pTables->begin(); aIter != m_pImpl->m_pTables->end(); ++aIter )
{
if ( !aIter->second.is() )
continue;
Reference<XNameAccess> xColumns = aIter->second->getColumns();
Reference< XPropertySet > xColumn;
if ( !xColumns->hasByName( rColumnName )
|| !( xColumns->getByName( rColumnName ) >>= xColumn )
)
continue;
::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias));
OParseColumn* pColumn = new OParseColumn(xColumn,isCaseSensitive());
xNewColumn = pColumn;
pColumn->setTableName(aIter->first);
pColumn->setName(aNewColName);
pColumn->setRealName(rColumnName);
break;
}
if ( !xNewColumn.is() )
{
// no function (due to the above !bFkt), no existing column
// => assume an expression
::rtl::OUString aNewColName( getUniqueColumnName( rColumnAlias ) );
// did not find a column with this name in any of the tables
OParseColumn* pColumn = new OParseColumn(
aNewColName,
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR")),
// TODO: does this match with _nType?
// Or should be fill this from the getTypeInfo of the connection?
::rtl::OUString(),
::rtl::OUString(),
ColumnValue::NULLABLE_UNKNOWN,
0,
0,
_nType,
sal_False,
sal_False,
isCaseSensitive()
);
xNewColumn = pColumn;
pColumn->setRealName( rColumnName );
}
_rColumns->get().push_back( xNewColumn );
}
else
{
::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias));
OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(),::rtl::OUString(),
ColumnValue::NULLABLE_UNKNOWN,0,0,_nType,sal_False,sal_False,isCaseSensitive());
pColumn->setFunction(sal_True);
pColumn->setAggregateFunction(bAggFkt);
pColumn->setRealName(rColumnName);
Reference< XPropertySet> xCol = pColumn;
_rColumns->get().push_back(xCol);
}
}
else // ColumnName und Tablename vorhanden
{
ConstOSQLTablesIterator aFind = m_pImpl->m_pTables->find(rTableRange);
sal_Bool bError = sal_False;
if (aFind != m_pImpl->m_pTables->end() && aFind->second.is())
{
if (bFkt)
{
::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias));
OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(),::rtl::OUString(),
ColumnValue::NULLABLE_UNKNOWN,0,0,_nType,sal_False,sal_False,isCaseSensitive());
pColumn->setFunction(sal_True);
pColumn->setAggregateFunction(bAggFkt);
pColumn->setRealName(rColumnName);
pColumn->setTableName(aFind->first);
Reference< XPropertySet> xCol = pColumn;
_rColumns->get().push_back(xCol);
}
else
{
Reference< XPropertySet > xColumn;
if (aFind->second->getColumns()->hasByName(rColumnName) && (aFind->second->getColumns()->getByName(rColumnName) >>= xColumn))
{
::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias));
OParseColumn* pColumn = new OParseColumn(xColumn,isCaseSensitive());
pColumn->setName(aNewColName);
pColumn->setRealName(rColumnName);
pColumn->setTableName(aFind->first);
Reference< XPropertySet> xCol = pColumn;
_rColumns->get().push_back(xCol);
}
else
bError = sal_True;
}
}
else
bError = sal_True;
// Tabelle existiert nicht oder Feld nicht vorhanden
if (bError)
{
::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias));
OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(),::rtl::OUString(),
ColumnValue::NULLABLE_UNKNOWN,0,0,DataType::VARCHAR,sal_False,sal_False,isCaseSensitive());
pColumn->setFunction(sal_True);
pColumn->setAggregateFunction(bAggFkt);
Reference< XPropertySet> xCol = pColumn;
_rColumns->get().push_back(xCol);
}
}
}
//-----------------------------------------------------------------------------
::rtl::OUString OSQLParseTreeIterator::getUniqueColumnName(const ::rtl::OUString & rColumnName) const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getUniqueColumnName" );
::rtl::OUString aAlias(rColumnName);
OSQLColumns::Vector::const_iterator aIter = find(
m_aSelectColumns->get().begin(),
m_aSelectColumns->get().end(),
aAlias,
::comphelper::UStringMixEqual( isCaseSensitive() )
);
sal_Int32 i=1;
while(aIter != m_aSelectColumns->get().end())
{
(aAlias = rColumnName) += ::rtl::OUString::valueOf(i++);
aIter = find(
m_aSelectColumns->get().begin(),
m_aSelectColumns->get().end(),
aAlias,
::comphelper::UStringMixEqual( isCaseSensitive() )
);
}
return aAlias;
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::setOrderByColumnName(const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange,sal_Bool bAscending)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::setOrderByColumnName" );
Reference<XPropertySet> xColumn = findColumn( rColumnName, rTableRange, false );
if ( xColumn.is() )
m_aOrderColumns->get().push_back(new OOrderColumn( xColumn, rTableRange, isCaseSensitive(), bAscending ) );
else
{
sal_Int32 nId = rColumnName.toInt32();
if ( nId > 0 && nId < static_cast<sal_Int32>(m_aSelectColumns->get().size()) )
m_aOrderColumns->get().push_back( new OOrderColumn( ( m_aSelectColumns->get() )[nId-1], isCaseSensitive(), bAscending ) );
}
#ifdef SQL_TEST_PARSETREEITERATOR
cout << "OSQLParseTreeIterator::setOrderByColumnName: "
<< (const char *) rColumnName << ", "
<< (const char *) rTableRange << ", "
<< (bAscending ? "sal_True" : "sal_False")
<< "\n";
#endif
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::setGroupByColumnName(const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::setGroupByColumnName" );
Reference<XPropertySet> xColumn = findColumn( rColumnName, rTableRange, false );
if ( xColumn.is() )
m_aGroupColumns->get().push_back(new OParseColumn(xColumn,isCaseSensitive()));
else
{
sal_Int32 nId = rColumnName.toInt32();
if ( nId > 0 && nId < static_cast<sal_Int32>(m_aSelectColumns->get().size()) )
m_aGroupColumns->get().push_back(new OParseColumn((m_aSelectColumns->get())[nId-1],isCaseSensitive()));
}
#ifdef SQL_TEST_PARSETREEITERATOR
cout << "OSQLParseTreeIterator::setOrderByColumnName: "
<< (const char *) rColumnName << ", "
<< (const char *) rTableRange << ", "
<< (bAscending ? "sal_True" : "sal_False")
<< "\n";
#endif
}
//-----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getWhereTree() const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getWhereTree" );
if (!m_pParseTree)
return NULL;
// Parse Tree analysieren (je nach Statement-Typ)
// und Zeiger auf WHERE-Klausel setzen:
OSQLParseNode * pWhereClause = NULL;
if(getStatementType() == SQL_STATEMENT_SELECT)
{
OSL_ENSURE(m_pParseTree->count() >= 4,"ParseTreeIterator: error in parse tree!");
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
pWhereClause = pTableExp->getChild(1);
}
else if (SQL_ISRULE(m_pParseTree,update_statement_searched) ||
SQL_ISRULE(m_pParseTree,delete_statement_searched))
{
pWhereClause = m_pParseTree->getChild(m_pParseTree->count()-1);
}
if(pWhereClause->count() != 2)
pWhereClause = NULL;
return pWhereClause;
}
//-----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getOrderTree() const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getOrderTree" );
if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT)
return NULL;
// Parse Tree analysieren (je nach Statement-Typ)
// und Zeiger auf ORDER-Klausel setzen:
OSQLParseNode * pOrderClause = NULL;
OSL_ENSURE(m_pParseTree->count() >= 4,"ParseTreeIterator: error in parse tree!");
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
pOrderClause = pTableExp->getChild(4);
// Wenn es aber eine order_by ist, dann darf sie nicht leer sein:
if(pOrderClause->count() != 3)
pOrderClause = NULL;
return pOrderClause;
}
//-----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getGroupByTree() const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getGroupByTree" );
if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT)
return NULL;
// Parse Tree analysieren (je nach Statement-Typ)
// und Zeiger auf ORDER-Klausel setzen:
OSQLParseNode * pGroupClause = NULL;
OSL_ENSURE(m_pParseTree->count() >= 4,"ParseTreeIterator: error in parse tree!");
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
pGroupClause = pTableExp->getChild(2);
// Wenn es aber eine order_by ist, dann darf sie nicht leer sein:
if(pGroupClause->count() != 3)
pGroupClause = NULL;
return pGroupClause;
}
//-----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getHavingTree() const
{
if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT)
return NULL;
// Parse Tree analysieren (je nach Statement-Typ)
// und Zeiger auf ORDER-Klausel setzen:
OSQLParseNode * pHavingClause = NULL;
OSL_ENSURE(m_pParseTree->count() >= 4,"ParseTreeIterator: error in parse tree!");
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
pHavingClause = pTableExp->getChild(3);
// Wenn es aber eine order_by ist, dann darf sie nicht leer sein:
if(pHavingClause->count() < 1)
pHavingClause = NULL;
return pHavingClause;
}
// -----------------------------------------------------------------------------
sal_Bool OSQLParseTreeIterator::isTableNode(const OSQLParseNode* _pTableNode) const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::isTableNode" );
return _pTableNode && (SQL_ISRULE(_pTableNode,catalog_name) ||
SQL_ISRULE(_pTableNode,schema_name) ||
SQL_ISRULE(_pTableNode,table_name));
}
// -----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getSimpleWhereTree() const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getSimpleWhereTree" );
const OSQLParseNode* pNode = getWhereTree();
return pNode ? pNode->getChild(1) : NULL;
}
// -----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getSimpleOrderTree() const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getSimpleOrderTree" );
const OSQLParseNode* pNode = getOrderTree();
return pNode ? pNode->getChild(2) : NULL;
}
// -----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getSimpleGroupByTree() const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getSimpleGroupByTree" );
const OSQLParseNode* pNode = getGroupByTree();
return pNode ? pNode->getChild(2) : NULL;
}
// -----------------------------------------------------------------------------
const OSQLParseNode* OSQLParseTreeIterator::getSimpleHavingTree() const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getSimpleHavingTree" );
const OSQLParseNode* pNode = getHavingTree();
return pNode ? pNode->getChild(1) : NULL;
}
// -----------------------------------------------------------------------------
Reference< XPropertySet > OSQLParseTreeIterator::findColumn( const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange, bool _bLookInSubTables )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::findColumn" );
Reference< XPropertySet > xColumn = findColumn( *m_pImpl->m_pTables, rColumnName, rTableRange );
if ( !xColumn.is() && _bLookInSubTables )
xColumn = findColumn( *m_pImpl->m_pSubTables, rColumnName, rTableRange );
return xColumn;
}
// -----------------------------------------------------------------------------
Reference< XPropertySet > OSQLParseTreeIterator::findColumn(const OSQLTables& _rTables,const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::findColumn" );
Reference< XPropertySet > xColumn;
if ( rTableRange.getLength() )
{
ConstOSQLTablesIterator aFind = _rTables.find(rTableRange);
if ( aFind != _rTables.end()
&& aFind->second.is()
&& aFind->second->getColumns().is()
&& aFind->second->getColumns()->hasByName(rColumnName) )
aFind->second->getColumns()->getByName(rColumnName) >>= xColumn;
}
if ( !xColumn.is() )
{
OSQLTables::const_iterator aEnd = _rTables.end();
for(OSQLTables::const_iterator aIter = _rTables.begin(); aIter != aEnd; ++aIter)
{
if ( aIter->second.is() )
{
Reference<XNameAccess> xColumns = aIter->second->getColumns();
if( xColumns.is() && xColumns->hasByName(rColumnName) && (xColumns->getByName(rColumnName) >>= xColumn) )
{
OSL_ENSURE(xColumn.is(),"Column isn't a propertyset!");
break; // diese Column darf nur einmal vorkommen
}
}
}
}
return xColumn;
}
// -----------------------------------------------------------------------------
void OSQLParseTreeIterator::impl_appendError( IParseContext::ErrorCode _eError, const ::rtl::OUString* _pReplaceToken1, const ::rtl::OUString* _pReplaceToken2 )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::impl_appendError" );
::rtl::OUString sErrorMessage = m_rParser.getContext().getErrorMessage( _eError );
if ( _pReplaceToken1 )
{
bool bTwoTokens = ( _pReplaceToken2 != NULL );
const sal_Char* pPlaceHolder1 = bTwoTokens ? "#1" : "#";
const ::rtl::OUString sPlaceHolder1 = ::rtl::OUString::createFromAscii( pPlaceHolder1 );
sErrorMessage = sErrorMessage.replaceAt( sErrorMessage.indexOf( sPlaceHolder1 ), sPlaceHolder1.getLength(), *_pReplaceToken1 );
if ( _pReplaceToken2 )
sErrorMessage = sErrorMessage.replaceAt( sErrorMessage.indexOf( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#2")) ), 2, *_pReplaceToken2 );
}
impl_appendError( SQLException(
sErrorMessage, NULL, getStandardSQLState( SQL_GENERAL_ERROR ), 1000, Any() ) );
}
// -----------------------------------------------------------------------------
void OSQLParseTreeIterator::impl_appendError( const SQLException& _rError )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::impl_appendError" );
if ( m_aErrors.Message.getLength() )
{
SQLException* pErrorChain = &m_aErrors;
while ( pErrorChain->NextException.hasValue() )
pErrorChain = static_cast< SQLException* >( pErrorChain->NextException.pData );
pErrorChain->NextException <<= _rError;
}
else
m_aErrors = _rError;
}
// -----------------------------------------------------------------------------
sal_Int32 OSQLParseTreeIterator::getFunctionReturnType(const OSQLParseNode* _pNode )
{
sal_Int32 nType = DataType::OTHER;
::rtl::OUString sFunctionName;
if ( SQL_ISRULE(_pNode,length_exp) )
{
_pNode->getChild(0)->getChild(0)->parseNodeToStr(sFunctionName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
nType = ::connectivity::OSQLParser::getFunctionReturnType( sFunctionName, &m_rParser.getContext() );
}
else if ( SQL_ISRULE(_pNode,num_value_exp) || SQL_ISRULE(_pNode,term) || SQL_ISRULE(_pNode,factor) )
{
nType = DataType::DOUBLE;
}
else
{
_pNode->getChild(0)->parseNodeToStr(sFunctionName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
// MIN and MAX have another return type, we have to check the expression itself.
// @see http://qa.openoffice.org/issues/show_bug.cgi?id=99566
if ( SQL_ISRULE(_pNode,general_set_fct) && (SQL_ISTOKEN(_pNode->getChild(0),MIN) || SQL_ISTOKEN(_pNode->getChild(0),MAX) ))
{
const OSQLParseNode* pValueExp = _pNode->getChild(3);
if (SQL_ISRULE(pValueExp,column_ref))
{
::rtl::OUString sColumnName;
::rtl::OUString aTableRange;
getColumnRange(pValueExp,sColumnName,aTableRange);
OSL_ENSURE(sColumnName.getLength(),"Columnname darf nicht leer sein");
Reference<XPropertySet> xColumn = findColumn( sColumnName, aTableRange, true );
if ( xColumn.is() )
{
xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_TYPE)) >>= nType;
}
}
else
{
if ( SQL_ISRULE(pValueExp,num_value_exp) || SQL_ISRULE(pValueExp,term) || SQL_ISRULE(pValueExp,factor) )
{
nType = DataType::DOUBLE;
}
else if ( SQL_ISRULE(pValueExp,datetime_primary) )
{
switch(pValueExp->getChild(0)->getTokenID() )
{
case SQL_TOKEN_CURRENT_DATE:
nType = DataType::DATE;
break;
case SQL_TOKEN_CURRENT_TIME:
nType = DataType::TIME;
break;
case SQL_TOKEN_CURRENT_TIMESTAMP:
nType = DataType::TIMESTAMP;
break;
}
}
else if ( SQL_ISRULE(pValueExp,value_exp_primary) )
{
nType = getFunctionReturnType(pValueExp->getChild(1));
}
else if ( SQL_ISRULE(pValueExp,concatenation)
|| SQL_ISRULE(pValueExp,char_factor)
|| SQL_ISRULE(pValueExp,bit_value_fct)
|| SQL_ISRULE(pValueExp,char_value_fct)
|| SQL_ISRULE(pValueExp,char_substring_fct)
|| SQL_ISRULE(pValueExp,fold)
|| SQL_ISTOKEN(pValueExp,STRING) )
{
nType = DataType::VARCHAR;
}
}
if ( nType == DataType::OTHER )
nType = DataType::DOUBLE;
}
else
nType = ::connectivity::OSQLParser::getFunctionReturnType( sFunctionName, &m_rParser.getContext() );
}
return nType;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */