campo-sirio/ba/ba8201.h

72 lines
1.5 KiB
C
Raw Normal View History

#ifndef __SQLITE_H
#define __SQLITE_H
#ifndef __SHEET_H
#include <sheet.h>
#endif
///////////////////////////////////////////////////////////
// TSQL_query
///////////////////////////////////////////////////////////
struct TSQL_column_info : public TObject
{
TString _name;
int _width;
bool _numeric;
};
enum TQueryExportFormat { fmt_unknown, fmt_html, fmt_txt, fmt_slk, fmt_campo };
class TSQL_query : public TObject
{
TString _sql;
TRecnotype _firstrow, _pagesize, _items;
TArray _column;
TArray _page;
protected:
void reset();
bool save_as_html(const TFilename& path);
bool save_as_silk(const TFilename& path);
bool save_as_text(const TFilename& path);
bool save_as_campo(const TFilename& path);
public:
void set(const char* sql);
virtual int on_get_items(int argc, char** values, char** columns);
TRecnotype items() const;
const TString_array* row(TRecnotype n);
unsigned int columns() const;
const TSQL_column_info& column_info(unsigned int c) const;
const TToken_string& sheet_head() const; // Used by TQuery_sheet
bool save_as(const char* filename, TQueryExportFormat = fmt_unknown);
TSQL_query(const char* sql);
virtual ~TSQL_query() { }
};
///////////////////////////////////////////////////////////
// TQuery_sheet
///////////////////////////////////////////////////////////
class TQuery_sheet : public TSheet
{
TSQL_query& _query;
protected:
virtual void get_row(long r, TToken_string& row);
virtual long get_items() const;
public:
TQuery_sheet(TSQL_query& sql);
};
#endif