mysql docs
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
Sessions
|
||||||
|
|
||||||
|
make_session_id
|
||||||
|
session_destroy
|
||||||
|
session_start
|
||||||
@@ -8,4 +8,4 @@ return value : a new session ID
|
|||||||
Creates a session ID
|
Creates a session ID
|
||||||
|
|
||||||
:see
|
:see
|
||||||
>uri
|
>session
|
||||||
|
|||||||
@@ -1 +1,14 @@
|
|||||||
(not documented yet)
|
:sig
|
||||||
|
MySQL* mysql_connect(String host = "localhost", String username = "root", String password = "")
|
||||||
|
|
||||||
|
:params
|
||||||
|
host : host name of the MySQL server
|
||||||
|
username : user name
|
||||||
|
password : password
|
||||||
|
return value : pointer to the MySQL connection struct
|
||||||
|
|
||||||
|
:desc
|
||||||
|
Establishes a connection to a MySQL server.
|
||||||
|
|
||||||
|
:see
|
||||||
|
>mysql
|
||||||
|
|||||||
@@ -1 +1,11 @@
|
|||||||
(not documented yet)
|
:sig
|
||||||
|
void mysql_disconnect(MySQL* m)
|
||||||
|
|
||||||
|
:params
|
||||||
|
m : pointer to an existing MySQL connection struct
|
||||||
|
|
||||||
|
:desc
|
||||||
|
Closes a connection to a MySQL server.
|
||||||
|
|
||||||
|
:see
|
||||||
|
>mysql
|
||||||
|
|||||||
@@ -1 +1,12 @@
|
|||||||
(not documented yet)
|
:sig
|
||||||
|
String mysql_error(MySQL* m)
|
||||||
|
|
||||||
|
:params
|
||||||
|
m : pointer to a MySQL connection struct
|
||||||
|
return value : MySQL error message (if present, otherwise empty string)
|
||||||
|
|
||||||
|
:desc
|
||||||
|
Returns the last error message from a connection to a MySQL server.
|
||||||
|
|
||||||
|
:see
|
||||||
|
>mysql
|
||||||
|
|||||||
@@ -1 +1,13 @@
|
|||||||
(not documented yet)
|
:sig
|
||||||
|
String mysql_escape(String raw, char quote_char)
|
||||||
|
|
||||||
|
:params
|
||||||
|
raw : the string to be escaped
|
||||||
|
quote_char : the character that should be used to wrap the string (pass NULL for no wrapping)
|
||||||
|
return value : the safe version of the 'raw' string
|
||||||
|
|
||||||
|
:desc
|
||||||
|
Escapes a string such that it can be passed as a safe value into an SQL expression.
|
||||||
|
|
||||||
|
:see
|
||||||
|
>mysql
|
||||||
|
|||||||
@@ -1 +1,12 @@
|
|||||||
(not documented yet)
|
:sig
|
||||||
|
u64 mysql_insert_id(MySQL* m)
|
||||||
|
|
||||||
|
:params
|
||||||
|
m : pointer to an active MySQL connection
|
||||||
|
return value : the last used automatic row ID
|
||||||
|
|
||||||
|
:desc
|
||||||
|
This retrieves the last row ID that was used for a column with an AUTO_INCREMENT row key.
|
||||||
|
|
||||||
|
:see
|
||||||
|
>mysql
|
||||||
|
|||||||
@@ -1 +1,17 @@
|
|||||||
(not documented yet)
|
:sig
|
||||||
|
DTree mysql_query(MySQL* m, String q, StringMap params)
|
||||||
|
|
||||||
|
:params
|
||||||
|
m : pointer to an active MySQL connection struct
|
||||||
|
q : a string containing a MySQL query
|
||||||
|
params : optional, a list of query parameter keys and values
|
||||||
|
return value : a list of rows returned from executing the query
|
||||||
|
|
||||||
|
:desc
|
||||||
|
Executes a MySQL query and returns the resulting data (if any).
|
||||||
|
|
||||||
|
:Examples
|
||||||
|
(tbd)
|
||||||
|
|
||||||
|
:see
|
||||||
|
>mysql
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
:sig
|
||||||
|
void session_destroy(String session_name)
|
||||||
|
|
||||||
|
:params
|
||||||
|
session_name : the name of the session
|
||||||
|
|
||||||
|
:desc
|
||||||
|
Deletes the cookie specified by 'session_name' and clears the data stored under the session ID. This empties the 'context->session_id' and 'context->session' variables.
|
||||||
|
|
||||||
|
:see
|
||||||
|
>session
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
:sig
|
||||||
|
String session_start(String session_name)
|
||||||
|
|
||||||
|
:params
|
||||||
|
return value : the session ID, defaults to "uce-session"
|
||||||
|
|
||||||
|
:desc
|
||||||
|
Starts session or connects to existing session. This function sets a cookie with the name contained in 'session_name' if it does not exist and fills that cookie with a new unique session ID. It then loads the session data for that session ID. Afterwards, the following fields are populated in the 'context' variable:
|
||||||
|
|
||||||
|
context->session_id : the current session ID
|
||||||
|
|
||||||
|
context->session_name : the current session cookie name
|
||||||
|
|
||||||
|
context->session : the current session data. The session data is automatically saved after a request completes.
|
||||||
|
|
||||||
|
:see
|
||||||
|
>session
|
||||||
@@ -49,7 +49,8 @@ String MySQL::escape(String raw, char quote_char)
|
|||||||
String mysql_escape(String raw, char quote_char)
|
String mysql_escape(String raw, char quote_char)
|
||||||
{
|
{
|
||||||
String result;
|
String result;
|
||||||
result.append(1, quote_char);
|
if(quote_char > 0)
|
||||||
|
result.append(1, quote_char);
|
||||||
|
|
||||||
for(u32 i = 0; i < raw.length(); i++)
|
for(u32 i = 0; i < raw.length(); i++)
|
||||||
{
|
{
|
||||||
@@ -77,7 +78,8 @@ String mysql_escape(String raw, char quote_char)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result.append(1, quote_char);
|
if(quote_char > 0)
|
||||||
|
result.append(1, quote_char);
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -315,6 +315,7 @@ void session_destroy(String session_name)
|
|||||||
{
|
{
|
||||||
set_cookie(session_name, "", time() - context->server->config.SESSION_TIME);
|
set_cookie(session_name, "", time() - context->server->config.SESSION_TIME);
|
||||||
context->session.clear();
|
context->session.clear();
|
||||||
|
save_session_data(context->session_id, context->session);
|
||||||
context->session_id = "";
|
context->session_id = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
Library
|
Library
|
||||||
=================================
|
=================================
|
||||||
- sha1 / md5 / meow
|
- md5 / meow
|
||||||
- fold StringList into DTree _OR_ make better StringList
|
- fold StringList into DTree _OR_ make better StringList
|
||||||
|
- make session data use DTree instead of StringList
|
||||||
|
|
||||||
Bugs
|
Bugs
|
||||||
=================================
|
=================================
|
||||||
|
|||||||
Reference in New Issue
Block a user