summaryrefslogtreecommitdiff
path: root/offapi/com/sun/star/sdb/tools/XConnectionTools.idl
blob: 7a7f1d6ea3c0df3ba8128d871a60c2bf24d9e3a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#ifndef __com_sun_star_sdb_tools_XConnectionTools_idl__
#define __com_sun_star_sdb_tools_XConnectionTools_idl__

#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/sdbc/SQLException.idl>

module com {  module sun {  module star {
    module container {
        interface XNameAccess;
    };
    module lang {
        interface XComponent;
    };
};};};
module com {  module sun {  module star {  module sdb {
    interface XSingleSelectQueryComposer;
    module tools {

interface XTableName;
interface XObjectNames;
interface XDataSourceMetaData;

/** encapsulates various useful functionality around a
    com::sun::star::sdb::Connection

    <p>Most of the functionality provided here is meaningful only relative to
    a given database connection. For instance, for quoting table names, you need
    the meta data instance of the connection. Thus, the entry point for obtaining
    a XConnectionTools instance is the
    com::sun::star::sdb::Connection service.</p>

    <p>Note that nearly all functionality provided by this interface is also
    available by other means, it's only provided here for convenience purposes.</p>

    @since OOo 2.0.4
*/
interface XConnectionTools
{
    /** creates an instance supporting the XTableName interface,
        which can be used to manipulate table names for various purposes.

        <p>The returned object is guaranteed to not be `NULL`.</p>
    */
    XTableName      createTableName();

    /** returns an instance supporting the XObjectNames interface,
        which provides access to functionality around table and query names.

        <p>The returned object is guaranteed to not be `NULL`.</p>
    */
    XObjectNames    getObjectNames();

    /** provides access to the application-level data source meta data
    */
    XDataSourceMetaData
                    getDataSourceMetaData();

    /** get fields for a result set given by a "command descriptor"

        <p>A command descriptor here means:
        <ul><li>a SDB-level connection (com.sun.star.sdb::Connection</li>
            <li>a string specifying the name of an object relative to the connection</li>
            <li>a com.sun.star.sdb::CommandType value specifying the type
                of the object</li>
        </ul>
        </p>

        @param commandType
            the type of the object

        @param command
            the object. This may be a table name, a query name, or an SQL statement, depending on the value
            of _nCommandType

        @param keepFieldsAlive
            If (and only if) CommandType is CommandType.COMMAND, the fields collection which is returned
            by this function here is a temporary object. It is kept alive by another object, which is to be
            created temporarily, too. To ensure that the fields you get are valid as long as you need them,
            the owner which controls their life time is transfered to this parameter upon return.<br/>

            Your fields live as long as this component lives.<br/>

            Additionally, you are encouraged to dispose this component as soon as you don't need the fields anymore.
            It depends on the connection's implementation if this is necessary, but the is no guarantee, so to
            be on the safe side with respect to resource leaks, you should dispose the component.

        @return
            the container of the columns (aka fields) of the object
    */
    ::com::sun::star::container::XNameAccess getFieldsByCommandDescriptor(  [in] long commandType,
                                                                            [in] string command,
                                                                            [out] ::com::sun::star::lang::XComponent  keepFieldsAlive
                                                                            ) raises( com::sun::star::sdbc::SQLException );

    /** get the composer initialized with a command and command type.
        @param commandType
            the type of the object

        @param command
            the object. This may be a table name, a query name, or an SQL statement, depending on the value
            of _nCommandType
        @return
            the composer filled with command and command type.
    */
    ::com::sun::star::sdb::XSingleSelectQueryComposer getComposer([in] long commandType,[in] string command);
};

}; }; }; }; };

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */