!m_session.Open("host=localhost dbname=test user=test password=yourpassword")
I encountered this problem in PostgreSQL, but it likely is not limited to PG.
To reproduce the problem(you need a PostgreSQL server):
1. Open the SQL_PostgreSql example in the reference assembly. Modify the connection string to a valid one in Postgres.cpp
!m_session.Open("host=localhost dbname=test user=test password=yourpassword")
2. F5 to run the program.
3. Drop the test database (eg., in pgAdmin4) and recreate it either with the same name of change to a new name, eg, test1
4. modify the connection string like you did in step 1, with the name you changed to in step 3.
5. F5, the program will fail. As All_Tables(sch) now doesn't do anything as somehow it thinks all tables exsit.
SqlSchema sch(PGSQL); All_Tables(sch); if(sch.ScriptChanged(SqlSchema::UPGRADE)) SqlPerformScript(sch.Upgrade(), p); if(sch.ScriptChanged(SqlSchema::ATTRIBUTES)) { SqlPerformScript(sch.Attributes(), p); } if(sch.ScriptChanged(SqlSchema::CONFIG)) { SqlPerformScript(sch.ConfigDrop(), p); SqlPerformScript(sch.Config(), p); } sch.SaveNormal();
SqlSchema sch(PGSQL); All_Tables(sch); #ifndef flagNOSCHEMA SqlPerformScript(sch.Upgrade(), p); SqlPerformScript(sch.Attributes(), p); SqlPerformScript(sch.Config(), p); #endif