My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef __mysql_h__
#define __mysql_h__

#ifndef flagNOMYSQL

#include <Sql/Sql.h>

#ifdef PLATFORM_WIN32
#ifndef IPPROTO_IP
#include <winsock2.h>
#endif
#include <MySql.h>
#endif

#ifdef PLATFORM_POSIX
#include <mysql/mysql.h>
#endif

NAMESPACE_UPP

const char *MySqlReadString(const char *s, String& stmt);

bool MySqlPerformScript(const String& text, StatementExecutor& se, Gate2<int, int> progress_canceled = false);
#ifdef NOAPPSQL
bool MySqlUpdateSchema(const SqlSchema& sch, int i, StatementExecutor& se);
#else
bool MySqlUpdateSchema(const SqlSchema& sch, int i, StatementExecutor& se = SQLStatementExecutor());
#endif

String MySqlTextType(int n);

class MySqlSession : public SqlSession {
public:
virtual bool IsOpen() const;
virtual RunScript GetRunScript() const { return &MySqlPerformScript; }
virtual Vector<String> EnumUsers();
virtual Vector<String> EnumDatabases();
virtual Vector<String> EnumTables(String database);

protected:
virtual SqlConnection *CreateConnection();

private:
MYSQL *mysql;
String username;
double lastid;
int level;

public:
bool Connect(const char *user = NULL, const char *password = NULL, const char *database = NULL,
const char *host = NULL, int port = MYSQL_PORT, const char *socket = NULL);
bool Open(const char *connect);
void Close();

String GetUser() { return username; }

operator MYSQL *() { return mysql; }

virtual void Begin();
virtual void Commit();
virtual void Rollback();
virtual int GetTransactionLevel() const;

MySqlSession() { mysql = NULL; Dialect(MY_SQL); }
~MySqlSession() { Close(); }
};

END_UPP_NAMESPACE

#endif

#endif

Change log

r4290 by cxl on Dec 10, 2011   Diff
Sql: Refactored SQL 'default app cursor',
added per-thread SQL option, added
secondary SQLR 'default app cursor'
Go to: 
Project members, sign in to write a code review

Older revisions

r3357 by cxl on Apr 18, 2011   Diff
MySql: GetTransactionLevel
r281 by mdelfede on Jun 7, 2008   Diff
changed svn layout
r49 by unodgs on Jan 17, 2007   Diff
[No log message]
All revisions of this file

File info

Size: 1676 bytes, 72 lines

File properties

svn:eol-style
native
Powered by Google Project Hosting