Home » Community » Newbie corner » sqlarray and sqlite (Trying to use sqlite example but...)
Re: sqlarray and sqlite [message #54827 is a reply to message #54819] |
Sat, 19 September 2020 08:04 |
jimlef
Messages: 90 Registered: September 2020 Location: US
|
Member |
|
|
Last post of the evening, I promise
I now have my table populated with values, not sure if this is the best way (I'm a newb at this after all) but here's the working code:
#include "Invoices.h"
#include "customers.h"
#define SCHEMADIALECT <plugin/sqlite3/Sqlite3Schema.h>
#include "Sql/sch_source.h"
CustomersWindow::CustomersWindow() {
String DBFile;
String configfile = ConfigFile();
CtrlLayout(*this, "Customers");
if(FileExists(configfile))
{
VectorMap<String, String> cfg = LoadIniFile(configfile);
DBFile = cfg.Get("DBFile", Null);
}
else
{
Exclamation("Can't find DB");
}
SQL;
Sqlite3Session sqlite3;
if(!sqlite3.Open(DBFile)) {
Exclamation("Can't create or open database file\n");
return;
}
SQL = sqlite3;
SqlId tbl_customers("tbl_customers"), id("id"), name("name"), email("email"), contact("contact"), address("address"), city("city"), state("state"), zip("zip"), taxable("taxable");
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("40 40 20 50 20 15 10 5");
CustArray.SetOrderBy(id);
Sql sql(sqlite3);
sql.Execute("select * from tbl_customers");
while(sql.Fetch())
CustArray.Add(sql);
// CustArray.WhenBar = THISBACK(BorrowMenu);
// CustArray.WhenLeftDouble = THISBACK(EditBorrow);
CustArray.GoEndPostQuery();
}
Good night all ...
|
|
|
|
|
sqlarray and sqlite
By: jimlef on Fri, 18 September 2020 22:49
|
|
|
Re: sqlarray and sqlite
By: jimlef on Sat, 19 September 2020 05:50
|
|
|
Re: sqlarray and sqlite
By: jimlef on Sat, 19 September 2020 06:57
|
|
|
Re: sqlarray and sqlite
By: jimlef on Sat, 19 September 2020 08:04
|
|
|
Re: sqlarray and sqlite
By: mirek on Mon, 21 September 2020 08:19
|
|
|
Re: sqlarray and sqlite
By: jimlef on Mon, 21 September 2020 22:54
|
|
|
Re: sqlarray and sqlite
By: jimlef on Tue, 22 September 2020 03:05
|
|
|
Re: sqlarray and sqlite
By: mirek on Tue, 22 September 2020 09:08
|
|
|
Re: sqlarray and sqlite
By: jimlef on Tue, 22 September 2020 17:43
|
|
|
Re: sqlarray and sqlite
By: mirek on Tue, 22 September 2020 17:54
|
|
|
Re: sqlarray and sqlite
By: jimlef on Tue, 22 September 2020 18:07
|
|
|
Re: sqlarray and sqlite
By: mirek on Tue, 22 September 2020 18:47
|
|
|
Re: sqlarray and sqlite
By: jimlef on Tue, 22 September 2020 20:41
|
|
|
Re: sqlarray and sqlite
By: mirek on Wed, 23 September 2020 16:32
|
|
|
Re: sqlarray and sqlite
By: jimlef on Wed, 23 September 2020 17:14
|
|
|
Re: sqlarray and sqlite
By: jimlef on Wed, 23 September 2020 19:57
|
|
|
Re: sqlarray and sqlite
By: jimlef on Thu, 24 September 2020 06:08
|
|
|
Re: sqlarray and sqlite
By: mirek on Thu, 24 September 2020 13:46
|
|
|
Re: sqlarray and sqlite
By: jimlef on Thu, 24 September 2020 16:40
|
|
|
Re: sqlarray and sqlite
By: jimlef on Thu, 24 September 2020 19:28
|
|
|
Re: sqlarray and sqlite
By: mirek on Fri, 02 October 2020 11:40
|
|
|
Re: sqlarray and sqlite
By: jimlef on Fri, 02 October 2020 15:13
|
|
|
Re: sqlarray and sqlite
By: jimlef on Sat, 03 October 2020 00:17
|
|
|
Re: sqlarray and sqlite
By: mirek on Sun, 04 October 2020 10:05
|
|
|
Re: sqlarray and sqlite
By: jimlef on Sun, 04 October 2020 17:27
|
|
|
Re: sqlarray and sqlite
By: mirek on Sun, 04 October 2020 19:56
|
|
|
Re: sqlarray and sqlite
By: jimlef on Sun, 04 October 2020 20:37
|
Goto Forum:
Current Time: Mon May 20 12:33:49 CEST 2024
Total time taken to generate the page: 0.00488 seconds
|