Subversion Repository Public Repository

ConnectionOdbcSdk

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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
´╗┐using System;
using System.Collections.Generic;
using System.Data;

namespace Cisco.UnityConnection.OdbcSdk
{
    /// <summary>
    /// Used for generic translation purposes - ODBC, vs ADO.NET vs. different provider's DB drivers use different
    /// type designations but they all boil down to this set of options.
    /// </summary>
    public enum DbParamType
    {
        Int,
        Bool,
        VarChar,
        LVarChar,
        NVarChar,
        Long,
        Char,
        Short,
        DateTime
    }

    /// <summary>
    /// all the database object types that can have a DTMFAccessID (extension) associated with them. 
    /// </summary>
    public enum ObjectsTypesWithExtensions
    {
        User,
        Handler,
        PublicDistributionList,
        Contact,
        Location,
    }

    /// <summary>
    /// 
    /// </summary>
    public interface IConnectionDatabaseFunctions
    {

        #region Fields and Properties

        /// <summary>
        /// The greeting administrator role - do a lazy fetch for this if it's searched against.
        /// </summary>
        string GreetingsAdministratorRoleObjectId { get; }

        string PrimaryLocationObjectId { get; }

        bool DebugMode { get; set; }

        ConnectionState DatabaseConnectionStatus { get; }

        #endregion

        event UnityConnectionDatabaseFunctionsInformixAdoNet.LoggingEventHandler ErrorEvents;
        event UnityConnectionDatabaseFunctionsInformixAdoNet.LoggingEventHandler DebugEvents;

        #region Open and Close Database Methods

        /// <summary>
        /// Initial connection to database on remote server.  
        /// </summary>
        DbFetchResult AttachToDatabase(string pServerName, string pLoginName, string pPassword,string pDatabaseName = "UnityDirDb");


        /// <summary>
        /// For attaching to different databases on the remote server - defaults to UnityDirDb but can be switched "on the fly" to 
        /// the report db, dyn db or one of the mailbox dbs as needed.
        /// </summary>
        DbFetchResult UpdateDatabaseName(string pDatabaseName);

        /// <summary>
        /// Disconnect from the database
        /// </summary>
        void Disconnect();

        #endregion


        #region Helper Methods

        /// <summary>
        /// When we create users in a database we need to force it to reindex (update statistics) or message imports into that mailstore
        /// will grind to a halt.  This is technically true only if the mailstore is completely empty and then you add a bunch of users and then
        /// a bunch of messages - but to be safe we force a reindex after adding users to any mailstore here - it's pretty quick and does no harm at
        /// any rate.
        /// </summary>
        /// <param name="pDatabaseName">
        /// The mailstore name to update - most systems have only one mailstore but it's possible there are up to 5.
        /// </param>
        /// <param name="pServerName"></param>
        /// <param name="pLoginName"></param>
        /// <param name="pPassword"></param>
        DbFetchResult UpdateStatisticsForDatabase(string pDatabaseName, string pServerName, string pLoginName,string pPassword);

        /// <summary>
        /// General routine to pull a configuration data item out of the vw_Configuration view.
        /// An error is logged only if more than one match is found to a full name (which should never happen) - no error
        /// is logged if no match is found as this may be fine.
        /// </summary>
        /// <param name="pFullConfigurationItemName" type="string">
        /// The full name of the configuration data item to return.  This is usually in the format 'System.Conversations.Notification.AllowDeviceCancel'
        /// </param>
        /// <returns>
        /// An empty string is returned if no match is found, the string value otherwise.
        /// </returns>
        string GetConfigurationString(string pFullConfigurationItemName);

        /// <summary>
        /// Generates a new remote file name which reserves a slot for uploading a new greeting or voice name to the Connection server.  This file name 
        /// (which is just a GUID) will hang around for a few hours and then be deleted if it's not used by then.  You must get this reserved before you 
        /// can upload any WAV file to the server via HTTP.
        /// </summary>
        /// <returns>
        /// A GUID representing the new file name slot you can use will be returned.  If an empty string is returned there was an error which is logged. 
        /// There's really not a lot of reasons this can fail, however.
        /// </returns>
        string GetRemoteFileName();

        /// <summary>
        /// Used to check if a voice name or greeting file is marked for deletion - in versions of Conneciton after 8.6 this is not strictly
        /// necessary but prior to that voice names show up in views after they're deleted but before the background task removes them from
        /// the system which can cause problems.  This returns TRUE if the file has marked for deleltion, FALSE if it's not.
        /// </summary>
        /// <param name="pStreamFileName" type="string">
        /// The full stream file name (i.e. from vw_Subscriber's "VoiceName" column for instance).
        /// </param>
        /// <returns>
        /// TRUE is returned if the file is marked for deleltion, FALSE if it is not.
        /// </returns>
        bool IsStreamFileMarkedDeleted(string pStreamFileName);

        /// <summary>
        /// Function to put a string together that describes the action of a one key link, after message,  
        /// user exit link, after greeting link etc...  This string is used for display, reporting or 
        /// logging purposes as a quick human-readable description.
        /// </summary>
        /// <param name="pConversationName" type="string">
        /// The conversation name associated with the action.  Can be blank for actions such as "1" for 
        /// hangup or "4" for take message.
        /// </param>
        /// <param name="pAction" type="int">
        /// Action ID assocated with link.  Always required, even for a one key set to ignore (action=0).
        /// </param>
        /// <param name="pDestinationObjectId" type="string">
        /// The destination objectID if the action is set to "2" for goto.  Can be blank for other actions.
        /// </param>
        /// <param name="pMenuEntryObjectId" type="string">
        /// If the action is for a manu entry link this should be provided - required if the key is linked to
        /// an alternate contact number.  Can be blank for after greeting or other actions that are not 
        /// menu entries.
        /// </param>
        /// <returns>
        /// A human readable description of the action.
        /// </returns>
        string GetActionDescription(string pConversationName, int pAction, string pDestinationObjectId,string pMenuEntryObjectId);


        /// <summary>
        /// Returns true if the conversation name passed in is found in Connection's conversation table - false if not.  Used when 
        /// restoring from Unity since a few conversations (hotel, CVM for instance) are not supported in Connection.
        /// </summary>
        /// <param name="pConversationName">
        /// Conversation name to check for.
        /// </param>
        /// <returns>
        /// True if the conversation name exists, false if it does not.
        /// </returns>
        bool ConnectionConversationNameExists(string pConversationName);

        /// <summary>
        /// Returns TRUE if there is a conflict with an extension in the partiton provided, false if there is no.  If there is a 
        /// conflict a description of the conflicting object type is returned in the pMatchDescription string.
        /// </summary>
        /// <param name="pDtmfAccessId">
        /// The extension to search for
        /// </param>
        /// <param name="pPartitionObjectId">
        /// The partition to search in
        /// </param>
        /// <param name="pMatchDescription">
        /// If there's a conflict the description of the conflicting object is returned here, otherwise this is empty.
        /// </param>
        /// <returns>
        /// TRUE is returned if there is a matching extension, FALSE if there is not.
        /// </returns>
        bool ExtensionExists(string pDtmfAccessId, string pPartitionObjectId, out string pMatchDescription);

        /// <summary>
        /// Pulls a description of a Connection object that has an extension from the database - helper function for displaying information 
        /// about conflicting extensions so the admin can know WHAT object it's conflicting with and not just that there's a conflict.
        /// </summary>
        /// <param name="pObjectId">
        /// Object's unique id
        /// </param>
        /// <param name="pObjectType">
        /// Type of object to search for.
        /// </param>
        /// <returns>
        /// Description of the object and it's type or an error string if there's a problem finding it.
        /// </returns>
        string GetObjectDescription(string pObjectId, ObjectsTypesWithExtensions pObjectType);

        #endregion


        #region Stored Procedure Methods

        /// <summary>
        /// Starts a new command for the instance of the DBFunctions class - only a single command can be started, edited and then run per instance so by 
        /// calling this routine any existing command for this instance will be wiped out and a new command structure will be started for the stored procedure
        /// name passed in.
        /// </summary>
        /// <param name="pProcedureName" type="string">
        /// The name of the stored procedure - usually starts with 'csp_'
        /// </param>
        /// <param name="pIncludeAuditInfo" type="bool">
        /// Optional variable, defaults to TRUE.  TRUE means the currently logged in user and applicaiton name will be added to the stored proc
        /// parameters automatically for audit logging purposes.  FALSE prevents this.  FALSE should only be used for the handful of stored 
        /// procedures that do not accept the audit component and alias parameters, in all other cases this should always be included.
        /// </param>
        bool StartNewCommand(string pProcedureName, bool pIncludeAuditInfo = true);

        /// <summary>
        /// Simple routine for helping to construct command strings for running stored procs in Informix.  Each instance of the DBFunctions class will have a single
        /// Command string structure that is edited by the AddCommandParam and used when the ExecuteProc function is called.  
        /// This is the default entry point for all param adding - all types can be passed as a string (this is how they come out of data tables and the data reader
        /// objects).  Overloads are provided for passing native types instead which improve efficiency somewhat.
        /// </summary>
        /// <param name="pParamName" type="string">
        /// The name of the parameter, usually starts with a 'p'
        /// </param>
        /// <param name="pType" type="System.Data.Odbc.IfxType">
        /// The IfxType - an auto complete list will be provided.
        /// </param>
        /// <param name="pValue" type="string">
        /// The value to be passed to the stored proc.  All values are passed as strings, including numbers and dates.
        /// </param>
        /// <param name="pAddOnlyIfNonZero">
        /// For numeric valus (int, shortint,long...) this will prevent the value from being added to the list of params if it's zero.  Several parameters
        /// in Connection stored procs do not want to be zero...
        ///  </param>
        bool AddCommandParam(string pParamName, DbParamType pType, string pValue, bool pAddOnlyIfNonZero = false);


        /// <summary>
        /// simple overload to allow an integer to be passed to the add command param - will allow assigning values if the type passed in is 
        /// an integer, bigInt, smallInt or boolean.  Boolean will evaluate to true for any value no equal to 0.  Other types will throw an 
        /// error.
        /// </summary>
        /// <param name="pParamName"></param>
        /// <param name="pIfxType"></param>
        /// <param name="pValue"></param>
        /// <param name="pAddOnlyIfNonZero"></param>
        bool AddCommandParam(string pParamName, DbParamType pIfxType, int pValue, bool pAddOnlyIfNonZero = false);

        /// <summary>
        /// Alternative version of AddCommandParam for integer that only adds the command to the building command call if the value passed in 
        /// is greater than or equal to a specified value that defaults to 0.  Many backup DB params can be -1 for "ignore" which use this 
        /// capability for easy code flow.
        /// </summary>
        /// <param name="pParamName"></param>
        /// <param name="pIfxType"></param>
        /// <param name="pValue"></param>
        /// <param name="pAddOnlyIfGreaterThanOrEqualTo">
        /// Minimum value to allow - if the value is less than this the item is not added to the command call.
        /// </param>
        bool AddCommandParam(string pParamName, DbParamType pIfxType, long pValue, int pAddOnlyIfGreaterThanOrEqualTo);

        /// <summary>
        /// simple overload to allow an integer to be passed to the add command param - will allow assigning values if the type passed in is 
        /// an integer, bigInt, smallInt or boolean.  True translates to 1, false translates to 0.
        /// </summary>
        /// <param name="pParamName"></param>
        /// <param name="pIfxType"></param>
        /// <param name="pValue"></param>
        bool AddCommandParam(string pParamName, DbParamType pIfxType, bool pValue);

        /// <summary>
        /// simple overload to allow an long to be passed to the add command param - will allow assigning values if the type passed in is 
        /// an integer, bigInt, smallInt or boolean.  Boolean will evaluate to true for any value no equal to 0.  Other types will throw an 
        /// error.
        /// </summary>
        /// <param name="pParamName"></param>
        /// <param name="pIfxType"></param>
        /// <param name="pValue"></param>
        /// <param name="pAddOnlyIfNonZero"> </param>
        bool AddCommandParam(string pParamName, DbParamType pIfxType, long pValue, bool pAddOnlyIfNonZero = false);

        /// <summary>
        /// simple overload to allow a DateTime to be passed to the add command param - will allow assigning values if the type passed in is 
        /// a Date.  
        /// </summary>
        /// <param name="pParamName"></param>
        /// <param name="pIfxType"></param>
        /// <param name="pValue"></param>
        bool AddCommandParam(string pParamName, DbParamType pIfxType, DateTime pValue);

        /// <summary>
        /// simple function to call built up stored proc - this version returns no value (and expects none from the stored proc which can be 
        /// important as some procs fail if you run them expecting a return value or vice versa).
        /// </summary>
        /// <returns>
        /// True is returned if the stored proc executes, False if an error is thrown.
        /// </returns>
        DbFetchResult ExecuteProc();

        /// <summary>
        /// Overload the execut proc function for calling parties that wish to get details back - some procs require you accept a return value
        /// from them to execute cleanly (i.e. most create procs that return an ObjectID for instance).        
        /// </summary>
        /// <param name="pObjectIdReturn" type="string">
        ///  strObjectIDReturn is an out argument that is used to pass back an ObjectID value (assuming one is generated).
        /// </param>
        /// <param name="pObjectIdColumnName" type="string">
        /// strObjectIDColumnName is an optional parameter that you can use to specify which column name in the return set holds the ObjectID.  If 
        /// this is not passed in then the first column found is returned which is usually the only one returned anyway.
        /// Some stored procedures will return multiple columns in the return recordset, however, so passing in the explicit columnd name is necessary.
        /// </param>
        /// <param name="pIgnoreReturnValue">
        /// Some stored procs are poorly designed and require a return value and do not provide a way to suppress FK errors (i.e. such as creating 
        /// a private list member - no way to ignore the error thrown if that member already exists).  One way to deal with this is to call the 
        /// proc with a return value but ignore it - supressing any errors that result from one not being returned.
        ///  </param>
        /// <returns>
        /// A Cisco.Unity.Connection.DBFetchResult - this contains the success boolean flag and a ErrorDetails string for display/logging purposes
        /// if something fails.
        /// </returns>
        DbFetchResult ExecuteProc(out string pObjectIdReturn, string pObjectIdColumnName = "",bool pIgnoreReturnValue = false);


        /// <summary>
        /// If a client has started a stored proc and has to abort before completing it then they need to clear
        /// the monitor lock by calling this method
        /// </summary>
        void ClearProcMonitor();

        /// <summary>
        /// If the user is just constructing the stored procedure string for reference (i.e. learning) reasons, finish off the 
        /// stored proc construciton format, return the string and release the monitor lock for adding params.
        /// </summary>
        /// <returns>
        /// Full string showing execution of stored proc with parameters
        /// </returns>
        string GetProcString();



        #endregion


        #region Data Fetch Methods

        /// <summary>
        /// Allows you to fetch a single value from a table or view.  All values are returned as strings
        /// so it's up to the calling routing to cast it if necessary.
        /// NOTE - the query should return a single value (column) - the first item is always returned regardless.
        /// If you pass TRUE for supress error, no error is logged, just an empty string is returned - this is for 
        /// cases where the calling client wants to just check for the existence of a value without raising an error.
        /// Use the parameterized query format whenever possible!
        /// </summary>
        /// <param name="pQueryString" type="string">
        /// The full SQL query against the UnityDirDB database (talbe or view).  It should return a single value.
        /// </param>
        /// <param name="pSuppressErrorOnNoData" type="bool">
        /// If TRUE no error is raised if the query returns no value.  FALSE will cause those conditions to log
        /// an error.
        /// </param>
        /// <param name="pNoDataReturnString" type="string">
        /// If no data is returned this string value is resturned from the function.  By default this is an empty string 
        /// but you can use "(error)" or "[no data]" or the like depending on the needs.  Saves having to check for empty
        /// string by the client to populate output appropriately for instance.
        /// </param>
        /// <param name="pParams">
        /// list of items to be added as parameters when using a parameterized query.  With ODBC the parameters are not named but 
        /// just ordered so a query that looks like "Select Alias FORM vw_User WHERE IsTemplate=? and ObjectId=?" would take a 0 or 1 
        /// followed by an object ID string as parameters in that order so they get filled in properly.
        /// </param>
        /// <returns>
        /// A string value from the database or the pNoDataReturnString value if no data is returned.
        /// </returns>
        string GetSingleValueFromQuery(string pQueryString, bool pSuppressErrorOnNoData = false,
                                              string pNoDataReturnString = "", params object[] pParams);



        /// <summary>
        /// Returns a list of mailstore names that are active on the target connection server.
        /// Returns and empty list if there's an error, returns a list of strings that are the mailstore DB names
        /// otherwise.  There should always be at least one.
        /// </summary>
        /// <returns>
        /// A System.Collections.Generic.List of strings containing all the mailstore names active on the current Connection server.  
        /// By default this is only 1 item but systems support up to 6 currently, more probably to come.
        /// </returns>
        List<string> GetMailstoresList();

        /// <summary>
        /// returns the primary DTMFAccessID (extenson) for any objectId you pass in if any - blank is returned if no extension is found.
        /// search for contacts, users, call handlers, interview handlers, name lookup handlers or distribution lsits.
        /// </summary>
        /// <param name="pParentObjectId" type="string">
        /// The objectId of the user, handler, contact or public distribution list that you're searching against.
        /// </param>
        /// <returns>
        /// The DTMFAccessID (extension) listed as primary (only users can have alternate extensions) for the ObjectID passed in.  
        /// If no extension is found a blank string is returned.
        /// </returns>
        string GetPrimaryDtmfAccessId(string pParentObjectId);

        /// <summary>
        /// Returns the alias of a user or contact - this is useful for getting human readable
        /// identifier information for private list membership data among other things
        /// </summary>
        /// <param name="pObjectId" type="string">
        /// The ObjectID of the user or contact that you're searching against.
        /// </param>
        /// <returns>
        /// The alias string of the user or contact is returned if found.  An empty string is returned otherwise.
        /// </returns>
        string GetAliasOfObject(string pObjectId);

        /// <summary>
        /// Pass in a count query (i.e. "SELECT COUNT(*) FROM vw_user WHERE...") and this routine will return that number as an integer.  
        /// Use the parameterized query format whenever possible!
        /// </summary>
        /// <param name="pCountQueryString" type="string">
        /// Count SQL query string in the form "SELECT COUNT(*) FROM vw_user WHERE..."
        /// </param>
        /// <param name="pParams">
        /// list of items to be added as parameters when using a parameterized query.  With ODBC the parameters are not named but just ordered so a 
        /// query that looks like "Select Alias FORM vw_User WHERE IsTemplate=? and ObjectId=?" would take a 0 or 1 followed by an object ID string 
        /// as parameters in that order so they get filled in properly.
        /// </param>
        /// <returns>
        /// 0 is returned if there is an error or no data is found.  The number generated by the count query is returned otherwise.
        /// </returns>
        int GetCount(string pCountQueryString, params object[] pParams);


        /// <summary>
        /// Executes a non query (such as a count call) 
        /// </summary>
        /// <param name="pQueryString">
        /// query to execute
        /// </param>
        /// <param name="pParams">
        /// list of items to be added as parameters when using a parameterized query.  With ODBC the parameters are not named but just ordered so a 
        /// query that looks like "Select Alias FORM vw_User WHERE IsTemplate=? and ObjectId=?" would take a 0 or 1 followed by an object ID string 
        /// as parameters in that order so they get filled in properly.
        /// </param>
        /// <returns>
        ///  number of records affected is returned.
        /// </returns>
        int ExecuteNonQuery(string pQueryString, params object[] pParams);

        /// <summary>
        /// Function that provides a way to look for conflicts for alias and/or extension for users.  This is handy for providing human readable error 
        /// messages when creating new users and there is a conflict with another user.
        /// </summary>
        /// <param name="pAlias" type="string">
        /// The Alias to search against.  If a blank is passed then just the extension is used.  If non blank is passed then an alias match is required.
        /// </param>
        /// <param name="pExtension" type="string">
        /// The Extension (DTMFAccessID) to search against.  Only the primary extension is searched for in this case, not alternates.  If this is passed 
        /// in as blank then the alias is the only item searched on.  If it's non blank a match for primary extension is required.
        /// </param>
        /// <param name="pRestrictSearchToLocalOnly" type="bool">
        /// TRUE means restrict searches to users homed on the current Conneciton server, FALSE means check the global (networked) user tables.
        /// </param>
        /// <param name="pMatchCountReturn" type="int">
        /// Returns 0 if no match found, 1 if a single match found and 2 if 2 or more matches are found.
        /// </param>
        /// <param name="pObjectIdReturn" type="string">
        /// The ObjectID of the first user found if one or more matches are found, blank string returned if no match is found.
        /// </param>
        /// <param name="pMatchDescriptionReturn" type="string">
        /// Returns "No match found" if no match and "Multiple users match alias and extension" if 2 or more matches are found.  
        /// Blank is returned for a single match.
        /// </param>
        /// <returns>
        /// TRUE is returned if a match is found for either alias or extension.  FALSE otherwise.  If a single match is found the ObjectID of the 
        /// matching user is passed via the strObjectID ref string.  If multiple matches are found this information is indicated in the 
        /// strMatchDescription ref variable.
        /// </returns>
        bool FindUserByAliasOrExtension(string pAlias, string pExtension, bool pRestrictSearchToLocalOnly,out int pMatchCountReturn,
                                        out string pObjectIdReturn, out string pMatchDescriptionReturn);



        /// <summary>
        /// Function that provides a way to look for conflicts for name and/or extension for handlers.  This is handy for providing human readable 
        /// error messages when creating new handlers and there is a conflict with another handler.
        /// </summary>
        /// <param name="pDisplayName" type="string">
        /// The display name to search against.  If a blank is passed then just the extension is used.  If non blank is passed then a name match is 
        /// required.
        /// </param>
        /// <param name="pExtension" type="string">
        /// The Extension (DTMFAccessID) to search against.  If this is passed in as blank then the name is the only item searched on.  If it's non 
        /// blank a match for primary extension is required.
        /// </param>
        /// <param name="pMatchCountReturn" type="int">
        /// Returns 0 if no match found, 1 if a single match found and 2 if 2 or more matches are found.
        /// </param>
        /// <param name="pObjectIdReturn" type="string">
        ///  The ObjectID of the first handler found if one or more matches are found, blank string returned if no match is found.
        /// </param>
        /// <param name="pMatchDescriptionReturn" type="string">
        ///  Returns "No match found" if no match and "Multiple handlers match name and extension" if 2 or more matches are found.  
        ///  Blank is returned for a single match.
        /// </param>
        /// <returns>
        /// TRUE is returned if a match is found for either name or extension.  FALSE otherwise.  If a single match is found the ObjectID of the 
        /// matching handler is passed via the strObjectID out string.  If multiple matches are found this information is indicated in the 
        /// strMatchDescription out variable.
        /// </returns>
        bool FindHandlerByNameOrExtension(string pDisplayName, string pExtension, out int pMatchCountReturn,
                                          out string pObjectIdReturn, out string pMatchDescriptionReturn);



        /// <summary>
        /// Function that provides a way to look for conflicts for name and/or extension for interview handlers.  This is handy for providing human 
        /// readable error messages when creating new handlers and there is a conflict with another handler.
        /// </summary>
        /// <param name="pDisplayName" type="string">
        /// The display name to search against.  If a blank is passed then just the extension is used.  If non blank is passed then a name match is
        /// required.
        /// </param>
        /// <param name="pExtension" type="string">
        /// The Extension (DTMFAccessID) to search against.  If this is passed in as blank then the name is the only item searched on.  If it's non 
        /// blank a match for primary extension is required.
        /// </param>
        /// <param name="pMatchCountReturn" type="int">
        /// Returns 0 if no match found, 1 if a single match found and 2 if 2 or more matches are found.
        /// </param>
        /// <param name="pObjectIdReturn" type="string">
        ///  The ObjectID of the first handler found if one or more matches are found, blank string returned if no match is found.
        /// </param>
        /// <param name="pMatchDescriptionReturn" type="string">
        ///  Returns "No match found" if no match and "Multiple handlers match name and extension" if 2 or more matches are found.  
        ///  Blank is returned for a single match.
        /// </param>
        /// <returns>
        /// TRUE is returned if a match is found for either name or extension.  FALSE otherwise.  If a single match is found the ObjectID of the 
        /// matching handler is passed via the strObjectID out string.  If multiple matches are found this information is indicated in the 
        /// strMatchDescription out variable.
        /// </returns>
        bool FindInterviewHandlerByNameOrExtension(string pDisplayName, string pExtension, out int pMatchCountReturn,
                                                   out string pObjectIdReturn, out string pMatchDescriptionReturn);

        /// <summary>
        /// Function that provides a way to look for conflicts for name and/or extension for name lookup handlers.  This is handy for providing human 
        /// readable error messages when creating new handlers and there is a conflict with another handler.
        /// </summary>
        /// <param name="pDisplayName" type="string">
        /// The display name to search against.  If a blank is passed then just the extension is used.  If non blank is passed then a name match is 
        /// required.
        /// </param>
        /// <param name="pExtension" type="string">
        /// The Extension (DTMFAccessID) to search against.  If this is passed in as blank then the name is the only item searched on.  If it's non 
        /// blank a match for primary extension is required.
        /// </param>
        /// <param name="pMatchCountReturn" type="int">
        /// Returns 0 if no match found, 1 if a single match found and 2 if 2 or more matches are found.
        /// </param>
        /// <param name="pObjectIdReturn" type="string">
        ///  The ObjectID of the first handler found if one or more matches are found, blank string returned if no match is found.
        /// </param>
        /// <param name="pMatchDescriptionReturn" type="string">
        ///  Returns "No match found" if no match and "Multiple handlers match name and extension" if 2 or more matches are found.  
        ///  Blank is returned for a single match.
        /// </param>
        /// <returns>
        /// TRUE is returned if a match is found for either name or extension.  FALSE otherwise.  If a single match is found the ObjectID of the 
        /// matching handler is passed via the strObjectID out string.  If multiple matches are found this information is indicated in the 
        /// strMatchDescription out variable.
        /// </returns>
        bool FindNameLookupHandlerByNameOrExtension(string pDisplayName, string pExtension, out int pMatchCountReturn,
                                                    out string pObjectIdReturn, out string pMatchDescriptionReturn);

        /// <summary>
        /// Function that provides a way to look for conflicts for name and/or extension for name distribution lists.  This is handy for providing human 
        /// readable error messages when creating new lists and there is a conflict with another list.
        /// </summary>
        /// <param name="pAlias" type="string">
        /// The alias to search against.  If a blank is passed then just the extension is used.  If non blank is passed then an alias match is required.
        /// </param>
        /// <param name="pName">
        /// Display name
        ///  </param>
        /// <param name="pExtension" type="string">
        /// The Extension (DTMFAccessID) to search against.  If this is passed in as blank then the name is the only item searched on.  If it's non 
        /// blank a match for extension is required.
        /// </param>
        /// <param name="pMatchCountReturn" type="int">
        /// Returns 0 if no match found, 1 if a single match found and 2 if 2 or more matches are found.
        /// </param>
        /// <param name="pObjectIdReturn" type="string">
        ///  The ObjectID of the first list found if one or more matches are found, blank string returned if no match is found.
        /// </param>
        /// <param name="pMatchDescriptionReturn" type="string">
        ///  Returns "No match found" if no match and "Multiple lists match name and extension" if 2 or more matches are found.  
        ///  Blank is returned for a single match.
        /// </param>
        /// <param name="pSearchLocalPartitionOnly"></param>
        /// <returns>
        /// TRUE is returned if a match is found for either name or extension.  FALSE otherwise.  If a single match is found the ObjectID of the 
        /// matching list is passed via the strObjectID out string.  If multiple matches are found this information is indicated in the 
        /// strMatchDescription out variable.
        /// </returns>
        bool FindDistributionListByAliasNameOrExtension(string pAlias, string pName, string pExtension,out int pMatchCountReturn,
                                                        out string pObjectIdReturn, out string pMatchDescriptionReturn,
                                                        bool pSearchLocalPartitionOnly = false);


        /// <summary>
        /// Function to fill a data table passed back via out param with data from a query against the Connection server passed in.   
        /// This routine runs on the main thread and is blocking.
        /// A data table can only pass back information in a single table, it cannot handle multiple selects creating multiple tables. If you
        /// need that kind of additional functionality use the FillDataSet routines instead.
        /// Use the parameterized query formate whenever possible!
        /// </summary>
        /// <param name="pQueryString" type="string">
        /// Full SQL Query to execute on the Connection server's database
        /// </param>
        /// <param name="pDataTable" type="System.Data.DataTable">
        /// dataTable object pasted back as an out param
        /// </param>
        /// <param name="pFailIfNoData" type="bool">
        /// optional flag that causes the routing to reuturn FALSE if the resulting data reader has no rows.  By default this is FALSE meaning 
        /// that so long as the query executes without errors TRUE is returned even if no data was retrieved.                
        /// </param>
        /// <param name="pParams">
        /// list of items to be added as parameters when using a parameterized query.  With ODBC the parameters are not named but just ordered 
        /// so a query that looks like "Select Alias FORM vw_User WHERE IsTemplate=? and ObjectId=?" would take a 0 or 1 followed by an object 
        /// ID string as parameters in that order so they get filled in properly.
        /// </param>
        /// <returns>
        /// A Cisco.Unity.Connection.DBFetchResult - this contains the success boolean flag and a ErrorDetails string for display/logging purposes
        /// if something fails.
        /// </returns>
        DbFetchResult FillDataTableBlocking(string pQueryString, out DataTable pDataTable, bool pFailIfNoData = false,params object[] pParams);

        #endregion

    }
}

Commits for ConnectionOdbcSdk/trunk/ConnectionServer/IConnectionDatabaseFunctions.cs

Diff revisions: vs.
Revision Author Commited Message
19 Diff Diff jlindborg picture jlindborg Mon 06 Jan, 2014 22:26:38 +0000

renaming and reorganizing unit tests a bit.

14 Diff Diff jlindborg picture jlindborg Fri 06 Sep, 2013 22:40:34 +0000

Most of the integration tests complete – more unit tests needed at some point.

13 Diff Diff jlindborg picture jlindborg Fri 06 Sep, 2013 02:57:55 +0000

More unit test work and related bug fixing.

10 Diff Diff jlindborg picture jlindborg Mon 02 Sep, 2013 18:54:54 +0000

More unit and integration test work

8 Diff Diff jlindborg picture jlindborg Fri 30 Aug, 2013 00:27:58 +0000

adding some unit/integration tests into the project, doing a little cleanup.

6 Diff Diff jlindborg picture jlindborg Wed 10 Jul, 2013 20:55:47 +0000

cleaning up some code, adding comments and working on naming conventions a bit.

5 Diff Diff jlindborg picture jlindborg Sat 01 Jun, 2013 03:10:24 +0000

adding stubs for PostgreSql functions (dreaming big)
Putting working copy of older style ODBC functions class in

3 jlindborg picture jlindborg Sat 01 Jun, 2013 02:42:57 +0000

Starting basic ODBC SDK project