ecpg code wont write to db

Поиск
Список
Период
Сортировка
От Andrew Jarcho
Тема ecpg code wont write to db
Дата
Msg-id 46299AC1.9080904@nyc.rr.com
обсуждение исходный текст
Ответы Re: ecpg code wont write to db
Список pgsql-novice
hi --
im using ecpg to issue commands to my postgresql db on my school's
Solaris system. The commands that read from the db seem to function
properly. Those that should write to the db run but have no effect. I
have no trouble writing to the db from php code.

a small multi-threaded server (written in C, using pthreads) accepts
calls on a stream internet socket. The server spawns a thread for each
incoming call. The code the thread executes calls a C wrapper for some
C++ code; the C++ code calls the C functions which were compiled from
the ecpg.  This architecture is due to the fact that the C++ code must
control the program as a whole.

i doubt that the multi-threading is the cause of the problem, as the
client (php) makes only a single call each time it is run.

a sample of the code follows. i'd very much appreciate any help anyone
can give me with this.

int do_login(const char *mstsLname, const char *mstsPasswd)
{
  EXEC SQL BEGIN DECLARE SECTION;
  const char *mstsLogname = mstsLname;
  const char *mstsPassword = mstsPasswd;
  int mstsLoginStatus = 0;
  EXEC SQL END DECLARE SECTION;
  EXEC SQL WHENEVER NOT FOUND GOTO notfound;

  connect_to_postgresql();

  EXEC SQL
    SELECT count(*) INTO :mstsLoginStatus
    FROM ms_account A
    WHERE A.logname = :mstsLogname AND
          A.password = :mstsPassword;

  if (mstsLoginStatus == 1) {
    EXEC SQL INSERT INTO ms_logInOut (logname, logDate, isIn)
      VALUES (:mstsLogname, SYSDATE, 'y');
    EXEC SQL COMMIT;
  }

  disconnect_from_postgresql();

  return mstsLoginStatus;  /* -1 for error; 0 if no such login; 1 if OK */

notfound:
  disconnect_from_postgresql_error();
  return -1;       /* return 'not found' */
}


В списке pgsql-novice по дате отправления:

Предыдущее
От: Gary Warner
Дата:
Сообщение: Visual C++ template?
Следующее
От: "Jasbinder Singh Bali"
Дата:
Сообщение: Re: ecpg code wont write to db