|
From: <dav...@us...> - 2007-04-11 04:22:15
|
Revision: 1654
http://svn.sourceforge.net/frontierkernel/?rev=1654&view=rev
Author: davidgewirtz
Date: 2007-04-10 21:22:15 -0700 (Tue, 10 Apr 2007)
Log Message:
-----------
More functions written.
Modified Paths:
--------------
Frontier/branches/mysql/Common/headers/langmysql.h
Frontier/branches/mysql/Common/resources/Mac/kernelverbs.r
Frontier/branches/mysql/Common/resources/Win32/kernelverbs.rc
Frontier/branches/mysql/Common/source/langmysql.c
Modified: Frontier/branches/mysql/Common/headers/langmysql.h
===================================================================
--- Frontier/branches/mysql/Common/headers/langmysql.h 2007-04-10 21:25:09 UTC (rev 1653)
+++ Frontier/branches/mysql/Common/headers/langmysql.h 2007-04-11 04:22:15 UTC (rev 1654)
@@ -41,6 +41,20 @@
extern boolean mysqlgeterrormessageverb (hdltreenode, tyvaluerecord *, bigstring); /* 2007-04-10 gewirtz */
+extern boolean mysqlgetclientinfoverb (hdltreenode, tyvaluerecord *, bigstring); /* 2007-04-10 gewirtz */
+
+extern boolean mysqlgetclientversionverb (hdltreenode, tyvaluerecord *, bigstring); /* 2007-04-10 gewirtz */
+
+extern boolean mysqlgethostinfoverb (hdltreenode, tyvaluerecord *, bigstring); /* 2007-04-10 gewirtz */
+
+extern boolean mysqlgetserverversionverb (hdltreenode, tyvaluerecord *, bigstring); /* 2007-04-10 gewirtz */
+
+extern boolean mysqlgetprotocolinfoverb (hdltreenode, tyvaluerecord *, bigstring); /* 2007-04-10 gewirtz */
+
+extern boolean mysqlgetserverinfoverb (hdltreenode, tyvaluerecord *, bigstring); /* 2007-04-10 gewirtz */
+
+extern boolean mysqlgetqueryinfoverb (hdltreenode, tyvaluerecord *, bigstring); /* 2007-04-10 gewirtz */
+
extern boolean mysqlcloseverb (hdltreenode, tyvaluerecord *, bigstring); /* 2007-04-08 gewirtz */
Modified: Frontier/branches/mysql/Common/resources/Mac/kernelverbs.r
===================================================================
--- Frontier/branches/mysql/Common/resources/Mac/kernelverbs.r 2007-04-10 21:25:09 UTC (rev 1653)
+++ Frontier/branches/mysql/Common/resources/Mac/kernelverbs.r 2007-04-11 04:22:15 UTC (rev 1654)
@@ -1169,15 +1169,21 @@
resource 'EFP#' (idmysqlverbs, "mysql") { /* 2007-04-09 gewirtz mysql verbs */
{
"mysql", false, {
-
- "init",
- "connect",
- "compileQuery",
- "clearQuery",
- "getRow",
- "getErrorNumber",
- "getErrorMessage",
- "close"
+ "init",
+ "connect",
+ "compileQuery",
+ "clearQuery",
+ "getRow",
+ "getErrorNumber",
+ "getErrorMessage",
+ "getClientInfo",
+ "getClientVersion",
+ "getHostInfo",
+ "getServerVersion",
+ "getProtocolInfo",
+ "getServerInfo",
+ "getQueryInfo",
+ "close"
}
}
};
Modified: Frontier/branches/mysql/Common/resources/Win32/kernelverbs.rc
===================================================================
--- Frontier/branches/mysql/Common/resources/Win32/kernelverbs.rc 2007-04-10 21:25:09 UTC (rev 1653)
+++ Frontier/branches/mysql/Common/resources/Win32/kernelverbs.rc 2007-04-11 04:22:15 UTC (rev 1654)
@@ -1106,13 +1106,20 @@
1, // Number of "blocks" in this resource
"mysql\0", // Function Processor name
false, // Window required
- 8, // Count of verbs
- "init\0",
- "connect\0",
- "compileQuery\0",
- "clearQuery\0",
- "getRow\0",
- "getErrorNumber\0",
- "getErrorMessage\0",
- "close\0"
+ 15, // Count of verbs
+ "init\0",
+ "connect\0",
+ "compileQuery\0",
+ "clearQuery\0",
+ "getRow\0",
+ "getErrorNumber\0",
+ "getErrorMessage\0",
+ "getClientInfo\0",
+ "getClientVersion\0",
+ "getHostInfo\0",
+ "getServerVersion\0",
+ "getProtocolInfo\0",
+ "getServerInfo\0",
+ "getQueryInfo\0",
+ "close\0"
END
Modified: Frontier/branches/mysql/Common/source/langmysql.c
===================================================================
--- Frontier/branches/mysql/Common/source/langmysql.c 2007-04-10 21:25:09 UTC (rev 1653)
+++ Frontier/branches/mysql/Common/source/langmysql.c 2007-04-11 04:22:15 UTC (rev 1654)
@@ -80,6 +80,13 @@
getrowfunc,
geterrornumberfunc,
geterrormessagefunc,
+ getclientinfofunc,
+ getclientversionfunc,
+ gethostinfofunc,
+ getserverversionfunc,
+ getprotocolinfofunc,
+ getserverinfofunc,
+ getqueryinfofunc,
closefunc,
ctmysqlverbs
} tymysqlverbtoken;
@@ -94,49 +101,53 @@
switch (token) {
- case initfunc: { /* 2007-04-08 gewirtz: initialize MySQL */
-
+ case initfunc: { /* 2007-04-08 gewirtz: initialize MySQL */
return (mysqlinitverb (hp1, v, bserror));
} /* initfunc */
-
- case connectfunc: { /* 2007-04-08 gewirtz: initialize MySQL */
-
+ case connectfunc: { /* 2007-04-08 gewirtz: initialize MySQL */
return (mysqlconnectverb (hp1, v, bserror));
} /* connectfunc */
-
- case compilequeryfunc: { /* 2007-04-09 gewirtz: prepare a MySQL query */
-
+ case compilequeryfunc: { /* 2007-04-09 gewirtz: prepare a MySQL query */
return (mysqlcompilequeryverb (hp1, v, bserror));
} /* compilequeryfunc */
-
- case clearqueryfunc: { /* 2007-04-09 gewirtz: clear a MySQL query from memory */
-
+ case clearqueryfunc: { /* 2007-04-09 gewirtz: clear a MySQL query from memory */
return (mysqlclearqueryverb (hp1, v, bserror));
} /* clearqueryfunc */
-
- case getrowfunc: { /* 2007-04-09 gewirtz: get a full row from a query */
-
+ case getrowfunc: { /* 2007-04-09 gewirtz: get a full row from a query */
return (mysqlgetrowverb (hp1, v, bserror));
} /* getrowfunc */
-
- case geterrornumberfunc: { /* 2007-04-09 gewirtz: get the error number from the most recent call */
-
+ case geterrornumberfunc: { /* 2007-04-10 gewirtz: get the error number from the most recent call */
return (mysqlgeterrornumberverb (hp1, v, bserror));
} /* geterrornumberfunc */
-
- case geterrormessagefunc: { /* 2007-04-09 gewirtz: get the error message from the most recent call */
-
+ case geterrormessagefunc: { /* 2007-04-10 gewirtz: get the error message from the most recent call */
return (mysqlgeterrormessageverb (hp1, v, bserror));
} /* geterrormessagefunc */
-
- case closefunc: { /* 2007-04-08 gewirtz: close a MySQL db */
-
+ case getclientinfofunc: { /* 2007-04-10 gewirtz: get the MySQL client info */
+ return (mysqlgetclientinfoverb (hp1, v, bserror));
+ } /* getclientinfofunc */
+ case getclientversionfunc: { /* 2007-04-10 gewirtz: get the MySQL client version */
+ return (mysqlgetclientversionverb (hp1, v, bserror));
+ } /* getclientversionfunc */
+ case gethostinfofunc: { /* 2007-04-10 gewirtz: get the MySQL host info */
+ return (mysqlgethostinfoverb (hp1, v, bserror));
+ } /* gethostinfofunc */
+ case getserverversionfunc: { /* 2007-04-10 gewirtz: get the MySQL server version */
+ return (mysqlgetserverversionverb (hp1, v, bserror));
+ } /* getserverversionfunc */
+ case getprotocolinfofunc: { /* 2007-04-10 gewirtz: get the MySQL protocol info */
+ return (mysqlgetprotocolinfoverb (hp1, v, bserror));
+ } /* getprotocolinfofunc */
+ case getserverinfofunc: { /* 2007-04-10 gewirtz: get the MySQL server info */
+ return (mysqlgetserverinfoverb (hp1, v, bserror));
+ } /* getserverinfofunc */
+ case getqueryinfofunc: { /* 2007-04-10 gewirtz: get the results messages from the last query */
+ return (mysqlgetqueryinfoverb (hp1, v, bserror));
+ } /* getqueryinfofunc */
+ case closefunc: { /* 2007-04-08 gewirtz: close a MySQL db */
return (mysqlcloseverb (hp1, v, bserror));
} /* closefunc */
-
default:
getstringlist (langerrorlist, unimplementedverberror, bserror);
-
return (false);
} /* switch */
} /* mysqlfunctionvalue */
@@ -148,7 +159,6 @@
} /* mysqlinitverbs */
boolean mysqlinitverb ( hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror ) {
-
MYSQL *dbid; // the MySQL object handle
//
@@ -267,6 +277,7 @@
MYSQL *dbid; // the MySQL object handle
MYSQL_RES *queryid; // the returned MySQL query id
int returnCode; // return code from MySQL query
+ const char *mysqlMsg; // pointer to the message DEBUG
/*
sqlite.compileQuery(dbid, query)
@@ -301,15 +312,20 @@
return (false);
}
+ mysqlMsg = mysql_info(dbid); // DEBUG
+
queryid = mysql_store_result(dbid);
if(mysql_errno(dbid) != 0) {
langerrormessage ("\x21""Could initialize MySQL query.");
return (false);
}
- return (setlongvalue ((long) queryid, vreturned)); /* return the db address to the scripter */
+ mysqlMsg = mysql_info(dbid); // DEBUG
-
+ if (mysql_field_count(dbid) == 0)
+ return (setlongvalue ((long) 0, vreturned)); /* return 0 to the scripter */
+ else
+ return (setlongvalue ((long) queryid, vreturned)); /* return the db address to the scripter */
} /* mysqlcompilequeryverb */
boolean mysqlclearqueryverb (hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
@@ -529,4 +545,211 @@
return (setheapvalue (returnH, stringvaluetype, vreturned));
-} /* mysqlgeterrormessageverb */
\ No newline at end of file
+} /* mysqlgeterrormessageverb */
+
+boolean mysqlgetclientinfoverb (hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
+ const char *mysqlMsg; // pointer to the message
+ Handle returnH = nil; // The handle being returned back to Frontier
+
+ /*
+ Frontier verb: sqlite.getErrorMessage(dbfile)
+
+ Returns the error message for the most recent SQLite API call.
+ Takes a database ID.
+ Returns a string containing the error message.
+ NOTE: do not pass the opened database ID across threads.
+
+ SQLite docs: http://www.sqlite.org/capi3ref.html#sqlite3_errmsg.
+ */
+
+ /* Process the SQLite sequence */
+ mysqlMsg = mysql_get_client_info();
+
+ /* Exit the verb, converting errMsg back to Frontier handle */
+ if(!newfilledhandle ((ptrvoid) mysqlMsg, strlen (mysqlMsg), &returnH))
+ return false; /* Allocation failed */
+
+ return (setheapvalue (returnH, stringvaluetype, vreturned));
+
+} /* mysqlgetclientinfoverb */
+
+boolean mysqlgetclientversionverb (hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
+ unsigned long returnCode; // The number being returned back to Frontier
+
+ /*
+ Frontier verb: sqlite.getErrorMessage(dbfile)
+
+ Returns the error message for the most recent SQLite API call.
+ Takes a database ID.
+ Returns a string containing the error message.
+ NOTE: do not pass the opened database ID across threads.
+
+ SQLite docs: http://www.sqlite.org/capi3ref.html#sqlite3_errmsg.
+ */
+
+ /* Process the MySQL call */
+ returnCode = mysql_get_client_version();
+
+ return (setlongvalue ((long) returnCode, vreturned));
+
+} /* mysqlgetclientversionverb */
+
+boolean mysqlgethostinfoverb (hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
+ MYSQL *dbid; // the MySQL object handle
+ const char *mysqlMsg; // pointer to the message
+ Handle returnH = nil; // The handle being returned back to Frontier
+
+ /*
+ Frontier verb: sqlite.getErrorMessage(dbfile)
+
+ Returns the error message for the most recent SQLite API call.
+ Takes a database ID.
+ Returns a string containing the error message.
+ NOTE: do not pass the opened database ID across threads.
+
+ SQLite docs: http://www.sqlite.org/capi3ref.html#sqlite3_errmsg.
+ */
+
+ flnextparamislast = true; /* makes sure Frontier throws an error if more than one param is passed */
+
+ if (!getlongvalue (hparam1, 1, (long *) &dbid)) /* Get the long value, which becomes the db pointer */
+ return (false);
+
+ /* Process the SQLite sequence */
+ mysqlMsg = mysql_get_host_info(dbid);
+
+ /* Exit the verb, converting errMsg back to Frontier handle */
+ if(!newfilledhandle ((ptrvoid) mysqlMsg, strlen (mysqlMsg), &returnH))
+ return false; /* Allocation failed */
+
+ return (setheapvalue (returnH, stringvaluetype, vreturned));
+
+} /* mysqlgethostinfoverb */
+
+boolean mysqlgetserverversionverb (hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
+ MYSQL *dbid; // the MySQL object handle
+ unsigned long returnCode; // the return code
+ Handle returnH = nil; // The handle being returned back to Frontier
+
+ /*
+ Frontier verb: sqlite.getErrorMessage(dbfile)
+
+ Returns the error message for the most recent SQLite API call.
+ Takes a database ID.
+ Returns a string containing the error message.
+ NOTE: do not pass the opened database ID across threads.
+
+ SQLite docs: http://www.sqlite.org/capi3ref.html#sqlite3_errmsg.
+ */
+
+ flnextparamislast = true; /* makes sure Frontier throws an error if more than one param is passed */
+
+ if (!getlongvalue (hparam1, 1, (long *) &dbid)) /* Get the long value, which becomes the db pointer */
+ return (false);
+
+ /* Process the SQLite sequence */
+ returnCode = mysql_get_server_version(dbid);
+
+ /* Exit the verb, converting errMsg back to Frontier handle */
+ return (setlongvalue ((long) returnCode, vreturned));
+
+} /* mysqlgetserverversionverb */
+
+boolean mysqlgetprotocolinfoverb (hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
+ MYSQL *dbid; // the MySQL object handle
+ unsigned int returnCode; // the return code
+ Handle returnH = nil; // The handle being returned back to Frontier
+
+ /*
+ Frontier verb: sqlite.getErrorMessage(dbfile)
+
+ Returns the error message for the most recent SQLite API call.
+ Takes a database ID.
+ Returns a string containing the error message.
+ NOTE: do not pass the opened database ID across threads.
+
+ SQLite docs: http://www.sqlite.org/capi3ref.html#sqlite3_errmsg.
+ */
+
+ flnextparamislast = true; /* makes sure Frontier throws an error if more than one param is passed */
+
+ if (!getlongvalue (hparam1, 1, (long *) &dbid)) /* Get the long value, which becomes the db pointer */
+ return (false);
+
+ /* Process the SQLite sequence */
+ returnCode = mysql_get_proto_info(dbid);
+
+ /* Exit the verb, converting errMsg back to Frontier handle */
+ return (setlongvalue ((long) returnCode, vreturned));
+
+} /* mysqlgetprotocolinfoverb */
+
+boolean mysqlgetserverinfoverb (hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
+ MYSQL *dbid; // the MySQL object handle
+ const char *mysqlMsg; // pointer to the message
+ Handle returnH = nil; // The handle being returned back to Frontier
+
+ /*
+ Frontier verb: sqlite.getErrorMessage(dbfile)
+
+ Returns the error message for the most recent SQLite API call.
+ Takes a database ID.
+ Returns a string containing the error message.
+ NOTE: do not pass the opened database ID across threads.
+
+ SQLite docs: http://www.sqlite.org/capi3ref.html#sqlite3_errmsg.
+ */
+
+ flnextparamislast = true; /* makes sure Frontier throws an error if more than one param is passed */
+
+ if (!getlongvalue (hparam1, 1, (long *) &dbid)) /* Get the long value, which becomes the db pointer */
+ return (false);
+
+ /* Process the SQLite sequence */
+ mysqlMsg = mysql_get_server_info(dbid);
+
+ /* Exit the verb, converting errMsg back to Frontier handle */
+ if(!newfilledhandle ((ptrvoid) mysqlMsg, strlen (mysqlMsg), &returnH))
+ return false; /* Allocation failed */
+
+ return (setheapvalue (returnH, stringvaluetype, vreturned));
+
+} /* mysqlgetserverinfoverb */
+
+boolean mysqlgetqueryinfoverb (hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
+ MYSQL *dbid; // the MySQL object handle
+ const char *mysqlMsg; // pointer to the message
+ Handle returnH = nil; // The handle being returned back to Frontier
+
+ /*
+ Frontier verb: sqlite.getErrorMessage(dbfile)
+
+ Returns the error message for the most recent SQLite API call.
+ Takes a database ID.
+ Returns a string containing the error message.
+ NOTE: do not pass the opened database ID across threads.
+
+ SQLite docs: http://www.sqlite.org/capi3ref.html#sqlite3_errmsg.
+ */
+
+ flnextparamislast = true; /* makes sure Frontier throws an error if more than one param is passed */
+
+ if (!getlongvalue (hparam1, 1, (long *) &dbid)) /* Get the long value, which becomes the db pointer */
+ return (false);
+
+ /* Process the SQLite sequence */
+ mysqlMsg = mysql_info(dbid);
+
+ if (mysqlMsg == NULL) {
+ /* Exit the verb, converting errMsg back to Frontier handle */
+ if(!newfilledhandle ((ptrvoid) "", 0, &returnH))
+ return false; /* Allocation failed */
+ } else {
+ /* Exit the verb, converting errMsg back to Frontier handle */
+ if(!newfilledhandle ((ptrvoid) mysqlMsg, strlen (mysqlMsg), &returnH))
+ return false; /* Allocation failed */
+ }
+
+ return (setheapvalue (returnH, stringvaluetype, vreturned));
+
+} /* mysqlgetqueryinfoverb */
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|