On Tue, Aug 3, 2010 at 10:06 AM, Oleg Broytman <phd@phd.pp.ru> wrote:
> On Mon, Aug 02, 2010 at 10:24:18PM -0700, Dominic LoBue wrote:
>> I am not quite sure what the problem is, but I have so far ruled out
>> both the database and my code.
>
>   I am not so sure...
>
>> When I use the same code on the same
>> database data in a mysql database, everything works fine.
>
>   It could be that the SQL syntax you use is valid in MySQL but invalid in
> SQLite.
>
>>  1/QueryR  :  SELECT FactionName, Description, solarSystemID,
>> corporationID, militiaCorporationID, raceIDs, sizeFactor,
>> stationCount, stationSystemCount, PRIMARY FROM chrFactions WHERE
>> ((chrFactions.factionID) = (500001))
>
>> sqlobject.dberrors.OperationalError: near "PRIMARY": syntax error
>
>   What does it mean - SELECT *** PRIMARY FROM? It seems you've got a
> column named PRIMARY...
>
> Oleg.
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://p.sf.net/sfu/dev2dev-palm
> _______________________________________________
> sqlobject-discuss mailing list
> sqlobject-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>

Oleg,

I'm not writing my own SQL queries. All I'm doing in my test is calling the get method, the query is automatically generated. Also, keep in mind I used the following keywords when I called connectionForURI(): debug=True, debugOutput=True

To answer your question, I do not know what it means or why it is trying to perform a select on 'PRIMARY'. There is no PRIMARY column, neither in my code nor in the database itself.

I just double checked to be sure, and I was right, there's no PRIMARY column. Here's a create statement to recreate the table:
CREATE TABLE "chrFactions" (
 "factionID" int(11) NOT NULL,
 "factionName" varchar(100) default NULL,
 "description" varchar(1000) default NULL,
 "raceIDs" int(11) default NULL,
 "solarSystemID" int(11) default NULL,
 "corporationID" int(11) default NULL,
 "sizeFactor" double default NULL,
 "stationCount" smallint(6) default NULL,
 "stationSystemCount" smallint(6) default NULL,
 "militiaCorporationID" int(11) default NULL,
 PRIMARY KEY  ("factionID")
)


And here's my definition:
class chrFactions(SQLObject):
   class sqlmeta:
       style = MixedCaseStyle(longID=True)
       idName = 'factionID'
       fromDatabase = True
   factionName = StringCol()
   description = StringCol()
   solarSystem = ForeignKey('mapSolarSystems', dbName='solarSystemID')
   corporation = ForeignKey('crpNPCCorporations', dbName='corporationID')
   militiaCorporation = ForeignKey('crpNPCCorporations',
                                   dbName='militiaCorporationID')
   corporations = MultipleJoin('crpNPCCorporations', joinColumn='factionID')
   solarSystems = MultipleJoin('mapSolarSystems', joinColumn='factionID')
   constellations = MultipleJoin('mapConstellations', joinColumn='factionID')
   regions = MultipleJoin('mapRegions', joinColumn='factionID')


However SQLObject clearly thinks there's a PRIMARY column for some reason:
>>> pprint(chrFactions.sqlmeta.columns)
{'corporationID': <SOForeignKey corporationID connected to crpNPCCorporations>,
 'description': <SOStringCol description>,
 'factionName': <SOStringCol factionName>,
 'militiaCorporationID': <SOForeignKey militiaCorporationID connected to crpNPCCorporations>,
 'pRIMARY': <SOCol pRIMARY default=None>,
 'raceIDs': <SOIntCol raceIDs default=None>,
 'sizeFactor': <SOCol sizeFactor default=None>,
 'solarSystemID': <SOForeignKey solarSystemID connected to mapSolarSystems>,
 'stationCount': <SOIntCol stationCount default=None>,
 'stationSystemCount': <SOIntCol stationSystemCount default=None>}


Now why would it think that?

--
Dominic LoBue