]> git.saurik.com Git - apple/security.git/blob - OSX/include/security_cdsa_plugin/DbContext.h
Security-57336.1.9.tar.gz
[apple/security.git] / OSX / include / security_cdsa_plugin / DbContext.h
1 /*
2 * Copyright (c) 2000-2001,2011,2014 Apple Inc. All Rights Reserved.
3 *
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
8 * using this file.
9 *
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
16 */
17
18
19 #ifndef _DBCONTEXT_H_
20 #define _DBCONTEXT_H_ 1
21
22 #include <security_cdsa_plugin/Database.h>
23 #include <security_cdsa_utilities/handleobject.h>
24
25 #ifdef _CPP_DBCONTEXT
26 # pragma export on
27 #endif
28
29 namespace Security
30 {
31
32 class DatabaseSession;
33
34 class DbContext : public HandleObject
35 {
36 NOCOPY(DbContext)
37 public:
38 Database &mDatabase;
39 DatabaseSession &mDatabaseSession;
40
41 DbContext(Database &inDatabase,
42 DatabaseSession &inDatabaseSession,
43 CSSM_DB_ACCESS_TYPE inAccessRequest,
44 const CSSM_ACCESS_CREDENTIALS *inAccessCred);
45
46 virtual ~DbContext();
47
48 CSSM_HANDLE
49 dataGetFirst(const CssmQuery *inQuery,
50 CSSM_DB_RECORD_ATTRIBUTE_DATA_PTR inoutAttributes,
51 CssmData *inoutData,
52 CSSM_DB_UNIQUE_RECORD_PTR &outUniqueRecord);
53
54 void
55 dataGetNext(CSSM_HANDLE inResultsHandle,
56 CSSM_DB_RECORD_ATTRIBUTE_DATA_PTR inoutAttributes,
57 CssmData *inoutData,
58 CSSM_DB_UNIQUE_RECORD_PTR &outUniqueRecord);
59
60 void
61 dataAbortQuery(CSSM_HANDLE inResultsHandle);
62 private:
63 CSSM_DB_ACCESS_TYPE mAccessRequest;
64 CSSM_ACCESS_CREDENTIALS *mAccessCred;
65 //typedef set<DbQuery *> DbQuerySet;
66 //DbQuerySet mDbQuerySet;
67 //Mutex mDbQuerySetLock;
68 };
69
70 } // end namespace Security
71
72 #ifdef _CPP_DBCONTEXT
73 # pragma export off
74 #endif
75
76 #endif //_DBCONTEXT_H_