Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » At Wits End/SQLite3
At Wits End/SQLite3 [message #8529] Thu, 15 March 2007 20:05 Go to next message
MikeyV is currently offline  MikeyV
Messages: 20
Registered: February 2007
Promising Member
Hello,

I'm so frustrated with trying to make this app that I could scream.

I've looked at the reference for SQLite, but it's a console app.

I've looked at the example Homebudget, but it's needlessly complicated for an example.

Both of these apps build a sqlite db, but I have an existing one, so I don't need my app to build it. Neither example is clear on what headers need to be included to just interface with the db.

I made a test app to see if I could populate a dropdown with data from my db, but I can't get it to compile. Here are the errors I get:
Sats.cpp
In file included from D:/Development/upp/uppsrc/Sql/sch_schema.h:24,
                 from D:\Development\MyUppApps\Sats\/Sats.h:13,
                 from D:\Development\MyUppApps\Sats\Sats.cpp:1:
D:/Development/upp/uppsrc/plugin/sqlite3/Sqlite3Schema.h:6:1: warning: "INT64" redefined
In file included from D:/Development/upp/uppsrc/Core/Core.h:329,
                 from D:/Development/upp/uppsrc/Draw/Draw.h:4,
                 from D:/Development/upp/uppsrc/CtrlCore/CtrlCore.h:4,
                 from D:/Development/upp/uppsrc/CtrlLib/CtrlLib.h:4,
                 from D:\Development\MyUppApps\Sats\/Sats.h:4,
                 from D:\Development\MyUppApps\Sats\Sats.cpp:1:
D:/Development/upp/uppsrc/Core/Defs.h:194:1: warning: this is the location of the previous definition
In file included from D:/Development/upp/uppsrc/Sql/sch_model.h:149,
                 from D:/Development/upp/uppsrc/plugin/sqlite3/Sqlite3Schema.h:82,
                 from D:/Development/upp/uppsrc/Sql/sch_source.h:5,
                 from D:\Development\MyUppApps\Sats\/Sats.h:15,
                 from D:\Development\MyUppApps\Sats\Sats.cpp:1:
D:/Development/MyUppApps/Sats/Sats.sch:7: error: redefinition of `Upp::SqlId ID'
D:/Development/MyUppApps/Sats/Sats.sch:2: error: `Upp::SqlId ID' previously declared here
D:/Development/MyUppApps/Sats/Sats.sch:35: error: redefinition of `Upp::SqlId ID'
D:/Development/MyUppApps/Sats/Sats.sch:2: error: `Upp::SqlId ID' previously declared here
D:/Development/MyUppApps/Sats/Sats.sch:36: error: redefinition of `Upp::SqlId Code'
D:/Development/MyUppApps/Sats/Sats.sch:31: error: `Upp::SqlId Code' previously declared here
D:/Development/MyUppApps/Sats/Sats.sch:40: error: redefinition of `Upp::SqlId ID'
D:/Development/MyUppApps/Sats/Sats.sch:2: error: `Upp::SqlId ID' previously declared here
D:/Development/MyUppApps/Sats/Sats.sch:41: error: redefinition of `Upp::SqlId Code'
D:/Development/MyUppApps/Sats/Sats.sch:31: error: `Upp::SqlId Code' previously declared here
D:/Development/MyUppApps/Sats/Sats.sch:45: error: redefinition of `Upp::SqlId ID'
D:/Development/MyUppApps/Sats/Sats.sch:2: error: `Upp::SqlId ID' previously declared here
D:/Development/MyUppApps/Sats/Sats.sch:46: error: redefinition of `Upp::SqlId Code'
D:/Development/MyUppApps/Sats/Sats.sch:31: error: `Upp::SqlId Code' previously declared here
D:/Development/MyUppApps/Sats/Sats.sch:50: error: redefinition of `Upp::SqlId ID'
D:/Development/MyUppApps/Sats/Sats.sch:2: error: `Upp::SqlId ID' previously declared here
D:/Development/MyUppApps/Sats/Sats.sch:51: error: redefinition of `Upp::SqlId Code'
D:/Development/MyUppApps/Sats/Sats.sch:31: error: `Upp::SqlId Code' previously declared here
D:/Development/MyUppApps/Sats/Sats.sch:57: error: redefinition of `Upp::SqlId FName'
D:/Development/MyUppApps/Sats/Sats.sch:8: error: `Upp::SqlId FName' previously declared here
D:/Development/MyUppApps/Sats/Sats.sch:58: error: redefinition of `Upp::SqlId LName'
D:/Development/MyUppApps/Sats/Sats.sch:9: error: `Upp::SqlId LName' previously declared here
D:/Development/MyUppApps/Sats/Sats.sch:63: error: redefinition of `Upp::SqlId ID'
D:/Development/MyUppApps/Sats/Sats.sch:2: error: `Upp::SqlId ID' previously declared here
D:/Development/MyUppApps/Sats/Sats.sch:71: error: redefinition of `Upp::SqlId ID'
D:/Development/MyUppApps/Sats/Sats.sch:2: error: `Upp::SqlId ID' previously declared here
D:/Development/MyUppApps/Sats/Sats.sch:72: error: redefinition of `Upp::SqlId Code'
D:/Development/MyUppApps/Sats/Sats.sch:31: error: `Upp::SqlId Code' previously declared here
D:/Development/MyUppApps/Sats/Sats.sch:76: error: redefinition of `Upp::SqlId ID'
D:/Development/MyUppApps/Sats/Sats.sch:2: error: `Upp::SqlId ID' previously declared here
D:/Development/MyUppApps/Sats/Sats.sch:82: error: redefinition of `Upp::SqlId Remarks'
D:/Development/MyUppApps/Sats/Sats.sch:26: error: `Upp::SqlId Remarks' previously declared here
Sats: 1 file(s) built in (0:04.65), 4656 msecs / file, duration = 4656 msecs

There were errors. (1:54.48)


The redefinition errors make no sense to me what so ever. Is it saying that I can't use the same name for a field in different tables? Why would that be the case?

Please show me where I'm going wrong.

Thanks in advance,
Mike
  • Attachment: Sats.zip
    (Size: 1.61KB, Downloaded 329 times)
Re: At Wits End/SQLite3 [message #8530 is a reply to message #8529] Thu, 15 March 2007 20:27 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
MikeyV wrote on Thu, 15 March 2007 15:05

Hello,

I'm so frustrated with trying to make this app that I could scream.

I've looked at the reference for SQLite, but it's a console app.

I've looked at the example Homebudget, but it's needlessly complicated for an example.



There is another one: examples/SQLApp

Mirek
Re: At Wits End/SQLite3 [message #8531 is a reply to message #8530] Thu, 15 March 2007 20:34 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
The difference between

INT_	(ID)


and

INT	(ID)


is that former also defines SqlId ID("ID"). Of course, if you use '_' twice for ID, you have got two definitions of the same symbol, no-no in C++.

So the moral of the story - always use '_' only once per identifier.

Note: This is not somethin I am particulary happy about, but there is no better choice in C++. It is still less hassle than define SQL ids separately.

Mirek
Re: At Wits End/SQLite3 [message #8532 is a reply to message #8531] Thu, 15 March 2007 20:47 Go to previous message
MikeyV is currently offline  MikeyV
Messages: 20
Registered: February 2007
Promising Member
Wow, it works!

Thanks Mirek!

I was getting undefined's yesterday, so after thinking about it, I decided that the app didn't understand my field names without a schema of some sort. I guess that did the trick.

So the moral is:

1. Define a schema.
2. Only use (INT_ STRING_) for the first field declaration. After that, use the one without the underscore.

Thanks again. Until next roadblock that is Razz

EDIT: You know, the schema for Homebudget is set up correctly, I just wasn't seeing INT_ (ID) and INT (ID)

I guess I went blind to the underscore...

[Updated on: Thu, 15 March 2007 20:58]

Report message to a moderator

Previous Topic: MS SQL Server connection possible?
Next Topic: Next SQLite3 Issue
Goto Forum:
  


Current Time: Mon Apr 29 08:36:46 CEST 2024

Total time taken to generate the page: 0.02872 seconds