Class DBModifs
global helper functions for DBModifiers
Inheritance
Namespace: DBaddin
Assembly: DBaddin.dll
Syntax
public class DBModifs
Fields
| Improve this Doc View SourceDBModifDefColl
DBModif definition collections of DBmodif types (key of top level dictionary) with values being collections of DBModifierNames (key of contained dictionaries) and DBModifiers (value of contained dictionaries))
Declaration
public static Dictionary<string, Dictionary<string, DBModif>> DBModifDefColl
Field Value
Description |
---|
hadError
indicates an error in execution of DBModifiers, used for commit/rollback and for non-interactive message return
Declaration
public static bool hadError
Field Value
Description |
---|
idbcnn
main db connection for DB modifiers
Declaration
public static IDbConnection idbcnn
Field Value
Description |
---|
listSepLocal
used to work around the fact that when started by Application.Run, Formulas are sometimes returned as local
Declaration
public static string listSepLocal
Field Value
Description |
---|
preventChangeWhileFetching
avoid entering Application.SheetChange Event handler during listfetch/setquery
Declaration
public static bool preventChangeWhileFetching
Field Value
Description |
---|
trans
common transaction, needed for DBSequence and all other DB Modifiers
Declaration
public static DbTransaction trans
Field Value
Description |
---|
Methods
| Improve this Doc View SourcecreateDBModif(String, String)
creates a DBModif at the current active cell or edits an existing one defined in targetDefName (after being called in defined range or from ribbon + Ctrl + Shift)
Declaration
public static void createDBModif(string createdDBModifType, string targetDefName = "")
Parameters
Name | Description |
---|---|
createdDBModifType | |
targetDefName |
CVErrText(Int32)
to convert the error number to text
Declaration
public static string CVErrText(int whichError)
Parameters
Name | Description |
---|---|
whichError | integer error number |
Returns
Description |
---|
text of error |
deleteRow()
marks a row in a DBMapper for deletion, used as a ExcelCommand to have a keyboard shortcut
Declaration
[ExcelCommand(Name = "deleteRow", ShortCut = "^D")]
public static void deleteRow()
executeDBModif(String, Boolean)
execute given DBModifier, used for VBA call by Application.Run
Declaration
[ExcelCommand(Name = "executeDBModif")]
public static string executeDBModif(string DBModifName, bool headLess = false)
Parameters
Name | Description |
---|---|
DBModifName | Full name of DB Modifier, including type at beginning |
headLess | if set to true, DBAddin will avoid to issue messages and return messages in exceptions which are returned (headless) |
Returns
Description |
---|
empty string on success, error message otherwise |
getDBModifDefinitions(Boolean)
gets defined names for DBModifier (DBMapper/DBAction/DBSeqnce) invocation in the current workbook and updates Ribbon with it
Declaration
public static void getDBModifDefinitions(bool onlyCheck = false)
Parameters
Name | Description |
---|---|
onlyCheck |
getDBModifNameFromRange(Range)
gets DB Modification Name (DBMapper or DBAction) from theRange
Declaration
public static string getDBModifNameFromRange(Range theRange)
Parameters
Name | Description |
---|---|
theRange |
Returns
Description |
---|
the retrieved name as a string (not name object !) |
insertRow()
inserts a row in a DBMapper, used as a ExcelCommand to have a keyboard shortcut
Declaration
[ExcelCommand(Name = "insertRow", ShortCut = "^I")]
public static void insertRow()
IsXLCVErr(Object)
To check for errors in passed range obj, makes use of the fact that Range.Value never passes Integer Values back except for Errors
Declaration
public static bool IsXLCVErr(object rangeval)
Parameters
Name | Description |
---|---|
rangeval | Range.Value to be checked for errors |
Returns
Description |
---|
true if error |
openIdbConnection(Int32, String)
opens a database connection
Declaration
public static bool openIdbConnection(int env, string database)
Parameters
Name | Description |
---|---|
env | number of the environment as given in the settings |
database | database to replace database selection parameter in connection string of environment |
Returns
Description |
---|
True on success |
resizeDBMapperRange(Range, Range)
in case there is a defined DBMapper underlying the DBListFetch/DBSetQuery target area then change the extent of it (oldRange) to the new area given in theRange
Declaration
public static void resizeDBMapperRange(Range theRange, Range oldRange)
Parameters
Name | Description |
---|---|
theRange | new extent after refresh of DBListFetch/DBSetQuery function |
oldRange | extent before refresh of DBListFetch/DBSetQuery function |
TypeToDbType(Type, String, Collection)
cast .NET data type to ADO.NET DbType
Declaration
public static DbType TypeToDbType(Type t, string columnName, Collection schemaDataTypeCollection)
Parameters
Name | Description |
---|---|
t | given .NET data type |
columnName | |
schemaDataTypeCollection |
Returns
Description |
---|
ADO.NET DbType |