mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
tabs!
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4792 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
da38309eac
commit
d9f4dd283e
@ -1404,9 +1404,9 @@ pgend_session_begin (GNCBook *sess, const char * sessionid,
|
|||||||
PQfinish (be->connection);
|
PQfinish (be->connection);
|
||||||
|
|
||||||
/* The connection may have failed either because the
|
/* The connection may have failed either because the
|
||||||
* database doesn't exist, or because there was a
|
* database doesn't exist, or because there was a
|
||||||
* network problem, or because the user supplied a
|
* network problem, or because the user supplied a
|
||||||
* bad password or username. Try to tell these apart.
|
* bad password or username. Try to tell these apart.
|
||||||
*/
|
*/
|
||||||
be->connection = PQsetdbLogin (be->hostname,
|
be->connection = PQsetdbLogin (be->hostname,
|
||||||
be->portno,
|
be->portno,
|
||||||
@ -1433,26 +1433,26 @@ pgend_session_begin (GNCBook *sess, const char * sessionid,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we are here, then we've successfully connected to the
|
/* If we are here, then we've successfully connected to the
|
||||||
* server. Now, check to see if database exists */
|
* server. Now, check to see if database exists */
|
||||||
p = be->buff; *p = 0;
|
p = be->buff; *p = 0;
|
||||||
p = stpcpy (p, "SELECT datname FROM pg_database "
|
p = stpcpy (p, "SELECT datname FROM pg_database "
|
||||||
" WHERE datname='");
|
" WHERE datname='");
|
||||||
p = stpcpy (p, be->dbName);
|
p = stpcpy (p, be->dbName);
|
||||||
p = stpcpy (p, "';");
|
p = stpcpy (p, "';");
|
||||||
|
|
||||||
SEND_QUERY (be,be->buff, );
|
SEND_QUERY (be,be->buff, );
|
||||||
db_exists = (gboolean) pgendGetResults (be, db_exists_cb, FALSE);
|
db_exists = (gboolean) pgendGetResults (be, db_exists_cb, FALSE);
|
||||||
|
|
||||||
PQfinish (be->connection);
|
PQfinish (be->connection);
|
||||||
be->connection = NULL;
|
be->connection = NULL;
|
||||||
|
|
||||||
if (db_exists)
|
if (db_exists)
|
||||||
{
|
{
|
||||||
/* Weird. We couldn't connect to the database, but it
|
/* Weird. We couldn't connect to the database, but it
|
||||||
* does seem to exist. I presume that this is some
|
* does seem to exist. I presume that this is some
|
||||||
* sort of access control problem. */
|
* sort of access control problem. */
|
||||||
xaccBackendSetError (&be->be, ERR_BACKEND_PERM);
|
xaccBackendSetError (&be->be, ERR_BACKEND_PERM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1497,7 +1497,7 @@ pgend_session_begin (GNCBook *sess, const char * sessionid,
|
|||||||
* server. Now, check to see if database exists */
|
* server. Now, check to see if database exists */
|
||||||
p = be->buff; *p = 0;
|
p = be->buff; *p = 0;
|
||||||
p = stpcpy (p, "SELECT datname FROM pg_database "
|
p = stpcpy (p, "SELECT datname FROM pg_database "
|
||||||
" WHERE datname='");
|
" WHERE datname='");
|
||||||
p = stpcpy (p, be->dbName);
|
p = stpcpy (p, be->dbName);
|
||||||
p = stpcpy (p, "';");
|
p = stpcpy (p, "';");
|
||||||
|
|
||||||
@ -1534,12 +1534,12 @@ pgend_session_begin (GNCBook *sess, const char * sessionid,
|
|||||||
PQerrorMessage(be->connection));
|
PQerrorMessage(be->connection));
|
||||||
PQfinish (be->connection);
|
PQfinish (be->connection);
|
||||||
be->connection = NULL;
|
be->connection = NULL;
|
||||||
/* We just created the database! If we can't connect now,
|
/* We just created the database! If we can't connect now,
|
||||||
* the server is insane! */
|
* the server is insane! */
|
||||||
xaccBackendSetError (&be->be, ERR_BACKEND_SERVER_ERR);
|
xaccBackendSetError (&be->be, ERR_BACKEND_SERVER_ERR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finally, create all the tables and indexes.
|
/* Finally, create all the tables and indexes.
|
||||||
* We do this in pieces, so as not to exceed the max length
|
* We do this in pieces, so as not to exceed the max length
|
||||||
* for postgres queries (which is 8192).
|
* for postgres queries (which is 8192).
|
||||||
@ -1555,15 +1555,15 @@ pgend_session_begin (GNCBook *sess, const char * sessionid,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Wierd. We were asked to create something that exists.
|
/* Wierd. We were asked to create something that exists.
|
||||||
* This shouldn't really happen ... */
|
* This shouldn't really happen ... */
|
||||||
PWARN ("Asked to create the database %s,\n"
|
PWARN ("Asked to create the database %s,\n"
|
||||||
"\tbut it already exists!\n"
|
"\tbut it already exists!\n"
|
||||||
"\tThis shouldn't really happen.",
|
"\tThis shouldn't really happen.",
|
||||||
be->dbName);
|
be->dbName);
|
||||||
|
|
||||||
PQfinish (be->connection);
|
PQfinish (be->connection);
|
||||||
|
|
||||||
/* Connect to the database */
|
/* Connect to the database */
|
||||||
be->connection = PQsetdbLogin (be->hostname,
|
be->connection = PQsetdbLogin (be->hostname,
|
||||||
be->portno,
|
be->portno,
|
||||||
@ -1572,7 +1572,7 @@ pgend_session_begin (GNCBook *sess, const char * sessionid,
|
|||||||
be->dbName,
|
be->dbName,
|
||||||
be->username, /* login */
|
be->username, /* login */
|
||||||
password); /* pwd */
|
password); /* pwd */
|
||||||
|
|
||||||
/* check the connection status */
|
/* check the connection status */
|
||||||
if (CONNECTION_BAD == PQstatus(be->connection))
|
if (CONNECTION_BAD == PQstatus(be->connection))
|
||||||
{
|
{
|
||||||
@ -1583,10 +1583,10 @@ pgend_session_begin (GNCBook *sess, const char * sessionid,
|
|||||||
PQfinish (be->connection);
|
PQfinish (be->connection);
|
||||||
be->connection = NULL;
|
be->connection = NULL;
|
||||||
|
|
||||||
/* Well, if we are here, we were connecting just fine,
|
/* Well, if we are here, we were connecting just fine,
|
||||||
* just not to this database. Therefore, it must be a
|
* just not to this database. Therefore, it must be a
|
||||||
* permission problem.
|
* permission problem.
|
||||||
*/
|
*/
|
||||||
xaccBackendSetError (&be->be, ERR_BACKEND_PERM);
|
xaccBackendSetError (&be->be, ERR_BACKEND_PERM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user