bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

describeTableNames for GDL2


From: Markus Hitter
Subject: describeTableNames for GDL2
Date: Mon, 30 Dec 2002 17:32:14 +0100



Hi all,

the patch below plugs one of the missing functions in GDL2's PostgreSQL Adaptor. Works fine here with my almost virgin DB.


Have fun,
Markus


*** /tmp/pbcvsdiff.1732/1.3_Postgres95Channel.m 2002-12-30 17:23:43 +0100 --- /whereever/gdl2/EOAdaptors/Postgres95/Postgres95Channel.m 2002-12-30 17:23:24 +0100
***************
*** 1306,1315 ****

  - (NSArray *)describeTableNames
  {
!   // TODO
!   [self notImplemented: _cmd];
!   return nil;
  }

  - (NSArray *)describeStoredProcedureNames
--- 1300,1336 ----

  - (NSArray *)describeTableNames
  {
!     int i, count;
!     NSMutableArray *results = [NSMutableArray array];
!
!     NSAssert(_pgConn, @"Channel not opened");
!
!     _pgResult = PQexec(_pgConn,
! "SELECT tablename FROM pg_tables WHERE pg_tables.schemaname = 'public'");
!
! if (_pgResult == NULL || PQresultStatus(_pgResult) != PGRES_TUPLES_OK)
!       {
!         _pgResult = NULL;
!         [NSException raise: Postgres95Exception
! format: @"cannot read list of tables from database. "
!             @"bad response from server"];
!       }
!
!     [_oidToTypeName removeAllObjects];
!     count = PQntuples(_pgResult);
!
!     for (i = 0; i < count; i++)
!          {
!         char* oid = PQgetvalue(_pgResult, i, 0);
!
!         [results addObject: [NSString stringWithUTF8String: oid]];
!          }
!
!     PQclear(_pgResult);
!     _pgResult = NULL;
!
!     return [NSArray arrayWithArray:results];
  }

  - (NSArray *)describeStoredProcedureNames






- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]