bool SqLiteStore::SetAverage(time_t time,unsigned int value)
{
    std::stringstream ss;
    ss<<"INSERT INTO AVERAGE_TIMELOG (value,time) VALUES(";
    ss<<value<<","<<time<<");";
    
    return ExecQuery(ss.str());
}
bool SqLiteStore::InitTables()
{
    const char *sql1 = "CREATE TABLE IF NOT EXISTS TIMELOG("  \
    "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," \
    "value INTEGET," \
    "time TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL" \
    ");";
    
    bool ret= ExecQuery(sql1);
    
    const char *sql2 = "CREATE TABLE IF NOT EXISTS AVERAGE_TIMELOG("  \
    "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," \
    "value INTEGET," \
    "time TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL" \
    ");";
    
    return ExecQuery(sql2) && ret;//create even if other returned false
}
/*---------------------------------------------------------------------------*/
void wxSQLBook::OnExplainClick(wxCommandEvent& event)
{
    wxString SQL = GetCurrentSQLStatement();
    if (!SQL.IsEmpty())
    {
        SQL = ("EXPLAIN ") + SQL;
        ExecQuery(SQL, true);
    }
}
Exemple #4
0
SQLCursorPtr CODBCSource::ExecQuery(const tchar* pszQuery)
{
	ASSERT(IsOpen() == true);

	// Allocate a cursor for the result set.
	ODBCCursorPtr cursor(new CODBCCursor(*this));

	// Execute it.
	ExecQuery(pszQuery, cursor.getRef());

	return cursor;
}
/*---------------------------------------------------------------------------*/
void wxSQLBook::ExecScript(const wxArrayString& arrayString)
{
    for (size_t i = 0; i < arrayString.Count(); i++)
        if (!arrayString.Item(i).IsEmpty())
            ExecQuery(arrayString.Item(i));
}
/*---------------------------------------------------------------------------*/
void wxSQLBook::OnExecSQLClick(wxCommandEvent& event)
{
    wxString SQL = GetCurrentSQLStatement();
    if (!SQL.IsEmpty())
        ExecQuery(SQL);
}
Exemple #7
0
inline SQLCursorPtr CSQLSource::ExecQuery(const tstring& query)
{
	return ExecQuery(query.c_str());
}