|
From: <cre...@us...> - 2007-07-11 03:21:49
|
Revision: 1715
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1715&view=rev
Author: creecode
Date: 2007-07-10 20:21:48 -0700 (Tue, 10 Jul 2007)
Log Message:
-----------
\p isn't going to fly on Windows for Pascal strings, back to the \x notation
Modified Paths:
--------------
Frontier/trunk/Common/source/langmysql.c
Modified: Frontier/trunk/Common/source/langmysql.c
===================================================================
--- Frontier/trunk/Common/source/langmysql.c 2007-07-11 02:08:31 UTC (rev 1714)
+++ Frontier/trunk/Common/source/langmysql.c 2007-07-11 03:21:48 UTC (rev 1715)
@@ -351,7 +351,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pMySQL could not allocate a connection object." );
+ langerrormessage ( "\x2D" "MySQL could not allocate a connection object." );
return ( false );
@@ -361,7 +361,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pCould not connect to MySQL server." );
+ langerrormessage ( "\x22" "Could not connect to MySQL server." );
return ( false );
@@ -401,7 +401,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
@@ -455,7 +455,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
@@ -485,7 +485,7 @@
queryid = mysql_store_result(dbid);
if(mysql_errno(dbid) != 0) {
- langerrormessage ("\x21""Could initialize MySQL query.");
+ langerrormessage ("\x21""Could not initialize MySQL query.");
return (false);
}
@@ -529,6 +529,9 @@
boolean mysqlgetrowverb (hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
//
+ // 2007-07-10 creedon: convert some numeric MYSQL_TYPE to numbers, see
+ // "Formats supported and returned as number"
+ //
// 2007-06-04 gewirtz: fix for returning TEXT type variant of BLOB
//
// 2007-05-31 creedon, asseily: fix for crash when column_text is NULL, return nil
@@ -578,18 +581,21 @@
MYSQL_TYPE_DECIMAL
MYSQL_TYPE_DOUBLE
MYSQL_TYPE_FLOAT
- MYSQL_TYPE_INT24
- MYSQL_TYPE_LONG
- MYSQL_TYPE_LONGLONG
MYSQL_TYPE_NEWDECIMAL
- MYSQL_TYPE_SHORT
MYSQL_TYPE_STRING
MYSQL_TYPE_TIME
MYSQL_TYPE_TIMESTAMP
- MYSQL_TYPE_TINY
MYSQL_TYPE_VAR_STRING
MYSQL_TYPE_YEAR
+ Formats supported and returned as number:
+
+ MYSQL_TYPE_INT24
+ MYSQL_TYPE_LONG
+ MYSQL_TYPE_LONGLONG
+ MYSQL_TYPE_SHORT
+ MYSQL_TYPE_TINY
+
More info: http://dev.mysql.com/doc/refman/5.1/en/c-api-datatypes.html
*/
@@ -684,6 +690,44 @@
if ( ! setheapvalue ( h, stringvaluetype, &val ) ) // convert handle to value
goto error;
+ bundle { // coerce certain numeric MYSQL_TYPE_ to kernel number types
+
+ tyvaluetype type;
+
+ switch ( field -> type ) {
+
+ case MYSQL_TYPE_LONG:
+ case MYSQL_TYPE_LONGLONG:
+
+ type = doublevaluetype;
+
+ break;
+
+ case MYSQL_TYPE_INT24:
+ case MYSQL_TYPE_SHORT:
+
+ type = longvaluetype;
+
+ break;
+
+ case MYSQL_TYPE_TINY:
+
+ type = intvaluetype;
+
+ break;
+
+ default:
+
+ type = NULL;
+
+ } // switch
+
+ if ( type != NULL )
+ if ( ! coercevalue ( &val, type ) )
+ goto error;
+
+ } // bundle
+
} // if
if (!langpushlistval (hlist, NULL, &val))
@@ -743,7 +787,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
@@ -795,7 +839,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
@@ -803,7 +847,7 @@
if ( mysql_ping ( dbid ) != 0 ) { // Check that server's still alive
- langerrormessage ( "\pLost connection to MySQL server." );
+ langerrormessage ( "\x20" "Lost connection to MySQL server." );
return ( false );
@@ -907,7 +951,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
@@ -970,7 +1014,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
@@ -1027,7 +1071,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
@@ -1079,7 +1123,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
@@ -1146,7 +1190,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
@@ -1210,7 +1254,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
@@ -1286,7 +1330,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
@@ -1340,7 +1384,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
@@ -1401,7 +1445,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
@@ -1453,7 +1497,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
@@ -1544,7 +1588,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
@@ -1611,7 +1655,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
@@ -1668,7 +1712,7 @@
if ( dbid == NULL ) {
- langerrormessage ( "\pInvalid MySQL database connection ID." );
+ langerrormessage ( "\x25" "Invalid MySQL database connection ID." );
return ( false );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|