public void NonPoolingConnectionStringTest() { Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); string poolingConnStr = "Server=127.0.0.1;Port=23001;User Id=user;Password=password;Database=postgres;Pooling=false;CommandTimeout=1;Encoding=UNICODE;"; StorageLayer storageLayer = new StorageLayer(); Assert.IsTrue(!storageLayer.IsPooledConnectionString(poolingConnStr), "Connection string was not correctly recognised as non pooling."); }
public string DBExecuteScalar(string dbType, string dbConnStr, string query) { try { //if (!IsAppAuthorised(m_dialPlanContext.SIPDialPlan.AuthorisedApps, "dbexecutescalar")) //{ // Log("You are not authorised to use the DBExecuteScalar application, please contact [email protected]."); // return null; //} if (ServiceLevel == CustomerServiceLevels.Free) { Log("Your service level of " + ServiceLevel + " is not authorised to use the " + System.Reflection.MethodBase.GetCurrentMethod().Name + " method."); return null; } else { StorageTypes storageType = GetStorageType(dbType); if (storageType != StorageTypes.Unknown) { StorageLayer storageLayer = new StorageLayer(storageType, dbConnStr); string result = storageLayer.ExecuteScalar(storageType, dbConnStr, query) as string; Log("DBExecuteScalar successful result=" + result + "."); return result; } else { Log("Exception DBExecuteScalar did not recognise database type " + dbType + "."); return null; } } } catch (Exception excp) { Log("Exception DBExecuteScalar. " + excp.Message); return null; } }
public string DBExecuteScalar(string dbType, string dbConnStr, string query) { try { if (!IsAppAuthorised(m_dialPlanContext.SIPDialPlan.AuthorisedApps, "dbexecutescalar")) { Log("You are not authorised to use the DBExecuteScalar application, please contact [email protected]."); return null; } else { StorageTypes storageType = GetStorageType(dbType); if (storageType != StorageTypes.Unknown) { StorageLayer storageLayer = new StorageLayer(storageType, dbConnStr); string result = storageLayer.ExecuteScalar(storageType, dbConnStr, query) as string; Log("DBExecuteScalar successful result=" + result + "."); return result; } else { Log("Exception DBExecuteScalar did not recognise database type " + dbType + "."); return null; } } } catch (Exception excp) { Log("Exception DBExecuteScalar. " + excp.Message); return null; } }
public void DBExecuteNonQuery(string dbType, string dbConnStr, string query) { try { if (!IsAppAuthorised(m_dialPlanContext.SIPDialPlan.AuthorisedApps, "dbexecutenonquery")) { Log("You are not authorised to use the DBExecuteNonQuery application, please contact [email protected]."); } else { StorageTypes storageType = GetStorageType(dbType); if (storageType != StorageTypes.Unknown) { StorageLayer storageLayer = new StorageLayer(storageType, dbConnStr); storageLayer.ExecuteNonQuery(storageType, dbConnStr, query); Log("DBExecuteNonQuery successful for " + query + "."); } else { Log("Exception DBExecuteNonQuery did not recognise database type " + dbType + "."); } } } catch (Exception excp) { Log("Exception DBExecuteNonQuery. " + excp.Message); } }