I have just started looking at the PgSqlDump class to use for backup.
My first attempt works. whey hey!!!
On one of my db's I have around 300 tables. I am looking to backup the data of all except one.
My thought was, rather than looping around all the table names and adding them to the Tables collection of the object I would initiate the object and remove the one table name.
The hover over help for the collection says that it "Gets and Sets" the tables.
Is there a way to tell it to "Get" all the tables prior to calling the Backup method?
If not should I lookup another Devart class to help me?
Kerry
Initiating the pgsqlDump table list prior to backup
-
- Posts: 52
- Joined: Tue 05 Jan 2010 12:26
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
-
- Posts: 52
- Joined: Tue 05 Jan 2010 12:26
Thank you for your reply.
I was looking to see if there was a method to auto populate the Tables collection.
I see from the sample code the ability to read in the Tables in the db which I can manipulate.
I also saw from the documentation pgSqlDumpObjects but cannot find in the documentation a way to use it.
Perhaps I can add the request as a wishlist item?
I was looking to see if there was a method to auto populate the Tables collection.
I see from the sample code the ability to read in the Tables in the db which I can manipulate.
I also saw from the documentation pgSqlDumpObjects but cannot find in the documentation a way to use it.
Perhaps I can add the request as a wishlist item?
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
As I can understand, you wish to retrieve names of all tables available in the database, and construct the Tables property from them. Am I correct? For this purpose, the PgSqlConnection.GetSchema method can be used like in the following sample:
For details on retrieving metadata, please see the corresponding topic of our documentation:
http://www.devart.com/dotconnect/postgr ... aData.html
As for the PgSqlDumpObjects enumeration, it should be used as the value for the PgSqlDump.ObjectTypes property. It can be assigned as usual enumeration:
Feel free to contact us if something is unclear.
Code: Select all
StringBuilder sb = new StringBuilder();
DataTable dt = connection.GetSchema(PgSqlMetaDataCollectionNames.Tables);
foreach (DataRow dr in dt.Rows)
sb.Append(dr["Name"]).Append(";");
PgSqlDump dump = new PgSqlDump(connection);
dump.Tables = sb.ToString();
dump.Backup(...);
http://www.devart.com/dotconnect/postgr ... aData.html
As for the PgSqlDumpObjects enumeration, it should be used as the value for the PgSqlDump.ObjectTypes property. It can be assigned as usual enumeration:
Code: Select all
pgSqlDump.ObjectTypes = PgSqlDumpObjects.Schemas | PgSqlDumpObjects.Users;
-
- Posts: 52
- Joined: Tue 05 Jan 2010 12:26