Click here to Skip to main content
12,622,032 members (36,131 online)
Click here to Skip to main content

Tagged as

Stats

13.6K views
2.6K downloads
8 bookmarked
Posted

Backup/Restore PostgreSQL databases

, 5 Mar 2013 CPOL
Allow your applications the ability to backup and restore your PostgreSQL databases.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace pgstore
{
    /// <summary>
    /// This class is used to indicate parameters used to launch pg_dump aund pg_restore commnds
    /// the parameters are initialized with the most common parameters
    /// its could be changed if necessary to do a specific tasks
    /// </summary>
    public class StoreParameters
    {
        public StoreParameters()
        {
            DataOnly = false;
            Blobs = true;
            Clean = false;      
            Oids = false;
            NoOwner = false;
            SchemaOnly = false;
            NoPrivileges = false;
    
        }
        public bool DataOnly { get; set; }
        public bool Blobs { get; set; }
        public bool Clean { get; set; }    
        public bool Oids { get; set; }
        public bool NoOwner { get; set; }
        public bool SchemaOnly { get; set; }
        public bool NoPrivileges { get; set; }
 

        public string DataOnlyCode { get { if (DataOnly)  return " -a"; return ""; } }
        public string BlobsCode { get { if (Blobs) return " -b"; return ""; } }
        public string CleanCode { get { if (Clean && !DataOnly)   return " -c"; return ""; } } 
        public string OidsCode { get { if (Oids) return " -o"; return ""; } }
        public string NoOwnerCode { get { if (NoOwner) return " -O"; return ""; } }
        public string SchemaOnlyCode { get { if (SchemaOnly) return " -s"; return ""; } }
        public string NoPrivilegesCode { get { if (NoPrivileges) return " -x"; return ""; } }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Saddoud Anis
Software Developer (Senior) B&B
Tunisia Tunisia
Microsoft DOTNET developer
VOIP Technologies
ERP Petales

http://www.declaration.tn/

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161128.1 | Last Updated 5 Mar 2013
Article Copyright 2013 by Saddoud Anis
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid