[PEAK] bulletins example OF DOOM, revisited

Stephen Waterbury golux at comcast.net
Wed Apr 14 20:41:08 EDT 2004


Phillip J. Eby wrote:
> At 06:08 PM 4/14/04 -0400, Stephen C. Waterbury wrote:

>>      def _save(self, ob):
>> -        self.db("""INSERT OR REPLACE INTO users
>> -                (loginId, fullName, password) VALUES (%s, %s, %s)""",
>> +        self.db("""INSERT INTO users
>> +                (loginid, fullname, password) VALUES (%s, %s, %s)""",
>>              (ob.loginId, ob.fullName, ob.password)
>>          )
> 
> 
> Note that this isn't a correct translation.  Under SQLite, INSERT OR 
> REPLACE will update the table if an item with the same primary key 
> already exists.  I think there may be a Postgres incantation you can use 
> to do the same thing, but I'm not sure.

Might be -- I confess to not spending too much time looking,
but I knew PostgreSQL didn't do 'REPLACE' (although it *is*
part of SQL).  I've never tried to implement that particular
semantic at the db API level, although it's pretty easy at the
logical API level.  As long as a database gives me ACID,
scalability, and acceptable performance, I don't ask for too
much more.  ;)

>>      syntax = naming.URL.Sequence(
>> -        ('//',), (user, (':', passwd), '@'), server, ('/', db)
>> +        ('//',), (user, (':', passwd), '@'), (server, '/'), db,
>>      )
> 
> I'm can't use this part, though.  For example, it's wrong for Sybase, 
> which *must* have a server.  I'll have to look at creating a separate 
> PostgresURL type.  I guess it's end times for GenericSQL_URL.

What does Sybase do about domain socket connections -- use
localhost or ""?  (Probably not localhost since that would mean
127.0.0.1, with possibility of a port as well).  It must have
*some* way to do domain sockets ... Sybase *originated* on unix,
IIRC!  Do you have to give it the domain socket *name* or
something?  Sheesh, that would be yucky.

- Steve



More information about the PEAK mailing list