pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feedHow to convert this mysql syntax
4+ messages / 4 participants
[nested] [flat]
* How to convert this mysql syntax
@ 2005-02-04 12:49 vincent.richomme@ratp.fr
0 siblings, 1 reply; 4+ messages in thread
From: vincent.richomme@ratp.fr @ 2005-02-04 12:49 UTC (permalink / raw)
To: pgsql-odbc
I thought that SQL was nomalized but when I tried this wmysql code
With PostGreSQL it doesn't work.
//Select database
m_pDb.Execute( "USE dbBornes;" );
// Create table
csSql.Format( "CREATE TABLE %s(", m_DbTable );
csSql += _T( "UserID INTEGER NOT NULL AUTO_INCREMENT," );
csSql += _T( "Time DATETIME NOT NULL," );
csSql += _T( "NumSerie INTEGER NOT NULL," );
csTmp.Format( "%s VARCHAR(64),", im->first );
csSql += _T( "PRIMARY KEY(UserID))" );
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: How to convert this mysql syntax
@ 2005-02-04 14:40 markw@mohawksoft.com
parent: vincent.richomme@ratp.fr
0 siblings, 1 reply; 4+ messages in thread
From: markw@mohawksoft.com @ 2005-02-04 14:40 UTC (permalink / raw)
To: vincent.richomme@ratp.fr; +Cc: pgsql-odbc
> I thought that SQL was nomalized but when I tried this wmysql code
SQL is mostly normalized, but every database seems to bring in its own
incompatibilities.
>
> With PostGreSQL it doesn't work.
It is probably a MySQL extension.
>
>
>
>
>
> //Select database
>
>
>
> m_pDb.Execute( "USE dbBornes;" );
Try:
m_pDb.Execute( "connect dbBornes;" );
>
>
>
> // Create table
>
> csSql.Format( "CREATE TABLE %s(", m_DbTable );
>
> csSql += _T( "UserID INTEGER NOT NULL AUTO_INCREMENT," );
>
> csSql += _T( "Time DATETIME NOT NULL," );
>
> csSql += _T( "NumSerie INTEGER NOT NULL," );
>
> csTmp.Format( "%s VARCHAR(64),", im->first );
>
> csSql += _T( "PRIMARY KEY(UserID))" );
>
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: How to convert this mysql syntax
@ 2005-02-04 14:49 Jeff Eckermann <jeff_eckermann@yahoo.com>
parent: markw@mohawksoft.com
0 siblings, 0 replies; 4+ messages in thread
From: Jeff Eckermann @ 2005-02-04 14:49 UTC (permalink / raw)
To: vincent.richomme@ratp.fr; +Cc: pgsql-odbc
--- markw@mohawksoft.com wrote:
> > I thought that SQL was nomalized but when I tried
> this wmysql code
>
> SQL is mostly normalized, but every database seems
> to bring in its own
> incompatibilities.
> >
> > With PostGreSQL it doesn't work.
>
> It is probably a MySQL extension.
>
> >
> >
> >
> >
> >
> > //Select database
> >
> >
> >
> > m_pDb.Execute( "USE dbBornes;" );
>
> Try:
> m_pDb.Execute( "connect dbBornes;" );
>
> >
> >
> >
> > // Create table
> >
> > csSql.Format( "CREATE TABLE %s(", m_DbTable );
> >
> > csSql += _T( "UserID INTEGER NOT NULL
> > AUTO_INCREMENT," );
csSql += _T( "UserID SERIAL NOT NULL," );
> >
> > csSql += _T( "Time DATETIME NOT NULL," );
csSql += _T( "Time TIMESTAMP NOT NULL," );
> >
> > csSql += _T( "NumSerie INTEGER NOT NULL," );
> >
> > csTmp.Format( "%s VARCHAR(64),", im->first );
> >
> > csSql += _T( "PRIMARY KEY(UserID))" );
http://www.postgresql.org/docs/8.0/interactive/datatype.html
> >
> >
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the
> unregister command
> (send "unregister YourEmailAddressHere" to
> majordomo@postgresql.org)
>
__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: How to convert this mysql syntax
@ 2005-02-04 18:33 Merlin Moncure <merlin.moncure@rcsonline.com>
0 siblings, 0 replies; 4+ messages in thread
From: Merlin Moncure @ 2005-02-04 18:33 UTC (permalink / raw)
To: Jeff Eckermann <jeff_eckermann@yahoo.com>; +Cc: pgsql-odbc
> > > csSql += _T( "UserID INTEGER NOT NULL
> > > AUTO_INCREMENT," );
>
> csSql += _T( "UserID SERIAL NOT NULL," );
>
or,
csSql += _T( "UserID SERIAL PRIMARY KEY," );
Primary keys get the not null automatically. Serial, by the way, is
just shorthand for defaulting the primary key to a value pulled from a
sequence. It as a non standard extension just like AUTO_INCREMENT is,
but it is a *much* better abstraction of an incrementing key.
Merlin
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2005-02-04 18:33 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-02-04 12:49 How to convert this mysql syntax vincent.richomme@ratp.fr
2005-02-04 14:40 ` markw@mohawksoft.com
2005-02-04 14:49 ` Jeff Eckermann <jeff_eckermann@yahoo.com>
2005-02-04 18:33 Re: How to convert this mysql syntax Merlin Moncure <merlin.moncure@rcsonline.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox