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 » Community » Newbie corner » sqlarray and sqlite (Trying to use sqlite example but...)
sqlarray and sqlite [message #54819] Fri, 18 September 2020 22:49 Go to previous message
jimlef is currently offline  jimlef
Messages: 90
Registered: September 2020
Location: US
Member
Hi everyone,

I've been looking over the example for sqlite and these forums, and basically I want to bind my table to the array... When I try to code this, I get "not defined" errors, and I am not seeing where in the example these things were defined other than the schema. I'm lost as to where to move forward here, before adding query functions etc.

My schema:
TABLE (tbl_customers)
	INT	(id) NOT_NULL PRIMARY_KEY AUTO_INCREMENT
	STRING (name, 150) NOT_NULL
	STRING (email, 150)
	STRING (contact, 150)
	STRING (address, 150)
	STRING (city, 50)
	STRING (state, 20)
	STRING (zip, 10)
	INT (taxable) NOT_NULL
END_TABLE



My include file:
sqlinclude.h:
#ifndef _Invoices_sqlinclude_h_
#define _Invoices_sqlinclude_h_
#include <SqlCtrl/SqlCtrl.h>
#include <plugin/sqlite3/Sqlite3.h>

#define SCHEMADIALECT <plugin/sqlite3/Sqlite3Schema.h>
#define MODEL "Invoices/Tables/Invoices.sch"
#include <Sql/sch_header.h>

#endif

customers.h:
#ifndef _Invoices_customers_h_
#define _Invoices_customers_h_
#include "Invoices/sqlinclude.h"
struct CustomersWindow : WithCustomersWindowLayout<TopWindow> {
public:
	CustomersWindow();
	void Paint(Draw& w) {
        w.DrawRect(GetSize(), Color(204, 255, 255)); // <= enter your background color here
     }
};
	

#endif


In my layout I have ITEM(SqlArray, CustArray, LeftPosZ(436, 656).TopPosZ(28, 420))

And my cpp code:
#include "Invoices.h"
#include "customers.h"

CustomersWindow::CustomersWindow() {
	CtrlLayout(*this, "Customers");
	
	CustArray.SetTable(tbl_customers);
	
	CustArray.AddKey(id);
	// CustArray.Join(BOOK_ID, book); // joins id from other db to this id
	CustArray.AddColumn(name, "Name"); // .SetConvert(DateIntConvert());
	CustArray.AddColumn(email, "Email"); // .SetConvert(DateIntConvert());
	CustArray.AddColumn(contact, "Phone");
	CustArray.AddColumn(address, "Address");
	CustArray.AddColumn(city, "City");
	CustArray.AddColumn(state, "State");
	CustArray.AddColumn(zip, "Zip");
	CustArray.AddColumn(taxable, "Taxable?");
	CustArray.ColumnWidths("50 50 20 50 20 15 10 2");
	CustArray.SetOrderBy(id);
	// CustArray.WhenBar = THISBACK(BorrowMenu);
	// CustArray.WhenLeftDouble = THISBACK(EditBorrow);
	CustArray.GoEndPostQuery();
}


None of the ids from the schema are recognized, so I have to declare the table another way?
Thank you all for the guidance...

Jim
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Friends? Cousins? Half-siblings?
Next Topic: how to make an editfield accept only number or date? have any examples in the documentation?
Goto Forum:
  


Current Time: Thu May 09 19:26:56 CEST 2024

Total time taken to generate the page: 0.01877 seconds