Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17119/src/backends/monet5
Modified Files:
Tag: SQL_2-18
sql.mx
Log Message:
fix concurrency problem (related to temp tables)
Index: sql.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql.mx,v
retrieving revision 1.228
retrieving revision 1.228.2.1
diff -u -d -r1.228 -r1.228.2.1
--- sql.mx 28 May 2007 08:18:17 -0000 1.228
+++ sql.mx 30 Jun 2007 13:21:21 -0000 1.228.2.1
@@ -687,13 +687,10 @@
sql5_export str @[EMAIL PROTECTED]( @1 *res, @2 *v, int *d2, int *s2 );
@h
@:numcastup_export(sht,sht)@
-@:numcastup_export(sht,oid)@
@:numcastup_export(int,sht)@
@:numcastup_export(int,int)@
-@:numcastup_export(int,oid)@
@:numcastup_export(lng,sht)@
@:numcastup_export(lng,int)@
-@:numcastup_export(lng,oid)@
@:numcastup_export(lng,lng)@
@= fnumcastdown_export
@:simpledowncast_export(@1,@2)@
@@ -1692,9 +1689,9 @@
SQL-99 are shown below. At some point they also should be
moved to module code base.
@= round
-str @1_dec_round_wrap( @1 *res, @1 *v, @1 *r )
+str
[EMAIL PROTECTED]( @1 *res, @1 *v, @1 *r )
{
-/* dec_round(dec d, 100) = (d + 100/2)/100 */
@1 val = *v;
@1 add = *r;
@@ -1712,7 +1709,9 @@
*res = val;
return NULL;
}
-str @1_round_wrap( @1 *res, @1 *v, int *d, int *s, sht *r )
+
+str
[EMAIL PROTECTED]( @1 *res, @1 *v, int *d, int *s, sht *r )
{
/* shortcut nil */
if (*v == @1_nil) {
@@ -1737,12 +1736,15 @@
return MAL_SUCCEED;
}
-str @1_dbl_dec_round_wrap( @1 *res, @1 *v, dbl *r )
+str
[EMAIL PROTECTED]( @1 *res, @1 *v, dbl *r )
{
@1 add = *r; /* lossy conversion */
return @1_dec_round_wrap(res,v, &add);
}
-str @1_int_dec_round_wrap( @1 *res, @1 *v, int *r )
+
+str
[EMAIL PROTECTED]( @1 *res, @1 *v, int *r )
{
@1 add = *r; /* lossy conversion */
return @1_dec_round_wrap(res,v, &add);
@@ -1753,7 +1755,7 @@
{
char *s = strip_extra_zeros(*val);
char *dot = strchr(s, '.');
- int digits = strlen(s) - 1;
+ int digits = _strlen(s) - 1;
int scale = digits - (dot-s);
lng value = 0;
@@ -1789,6 +1791,7 @@
*res = (@1) value;
return MAL_SUCCEED;
}
+
str
[EMAIL PROTECTED]( @1 *res, str *v, int *len )
{
@@ -1796,13 +1799,13 @@
return [EMAIL PROTECTED]( res, v, len, &zero );
}
@c
-
@:round(sht)@
@:round(int)@
@:round(lng)@
@= fround
-str @[EMAIL PROTECTED]( @1 *res, @1 *v, @2 *r )
+str
[EMAIL PROTECTED]@2_dec_round_wrap( @1 *res, @1 *v, @2 *r )
{
@1 val = *v;
@@ -1843,6 +1846,7 @@
GDKfree(p);
return MAL_SUCCEED;
}
+
str
[EMAIL PROTECTED]( str *res, @1 *val )
{
@@ -1899,7 +1903,7 @@
sz = convert2str(m, eclass, d, s, has_tz, p, tpe, &r, len);
} else {
str v = *(str*)p;
- sz = strlen(v);
+ sz = _strlen(v);
if (len == 0 || sz <= len)
r = GDKstrdup(v);
}
@@ -1918,7 +1922,8 @@
}
@= simpleupcast
-str @[EMAIL PROTECTED]( @1 *res, @2 *v )
+str
[EMAIL PROTECTED]@1( @1 *res, @2 *v )
{
/* shortcut nil */
if (*v == @2_nil) {
@@ -1961,8 +1966,7 @@
str @[EMAIL PROTECTED]( @1 *res, int *s1, @2 *v )
{
int scale = *s1;
- lng vdummy= *v;
- @1 r, h = (vdummy <0)?-5:5;
+ @1 r, h = (*v<0)?-5:5;
/* shortcut nil */
if (*v == @2_nil) {
@@ -1974,18 +1978,18 @@
always fit */
r = (@1)*v;
if (scale)
- r = (r+h)/scales[scale];
+ r = (@1) ((r + h) / scales[scale]);
*res = r;
return(MAL_SUCCEED);
}
-str @[EMAIL PROTECTED]( @1 *res, int *S1, @2 *v, int *d2, int *S2 )
+str
[EMAIL PROTECTED]@1( @1 *res, int *S1, @2 *v, int *d2, int *S2 )
{
int p = *d2, inlen = 1;
@2 cpyval = *v;
int s1 = *S1, s2 = *S2;
- lng vdummy= *v;
- @1 r, h = ( vdummy<0)?-5:5;
+ @1 r, h = (*v<0)?-5:5;
/* shortcut nil */
if (*v == @2_nil) {
@@ -2008,14 +2012,15 @@
always fit */
r = (@1)*v;
if (s2 > s1)
- r *= scales[s2-s1];
+ r *= (@1) scales[s2 - s1];
else if (s2 != s1)
- r = (r+h)/scales[s1-s2];
+ r = (@1) ((r + h) / scales[s1 - s2]);
*res = r;
return(MAL_SUCCEED);
}
-str @[EMAIL PROTECTED]( @1 *res, @2 *v, int *d2, int *s2 )
+str
[EMAIL PROTECTED]@1( @1 *res, @2 *v, int *d2, int *s2 )
{
int zero = 0;
return @[EMAIL PROTECTED]( res, &zero, v, d2, s2 );
@@ -2023,13 +2028,10 @@
@c
@:numcastup(sht,sht)@
-@:numcastup(sht,oid)@
@:numcastup(int,sht)@
@:numcastup(int,int)@
-@:numcastup(int,oid)@
@:numcastup(lng,sht)@
@:numcastup(lng,int)@
-@:numcastup(lng,oid)@
@:numcastup(lng,lng)@
@= fnumcastdown
@@ -2038,7 +2040,8 @@
/* when casting a floating point to an decimal we like to preserve the
* precision. This means we first scale the float before converting.
*/
-str @[EMAIL PROTECTED]( @1 *res, @2 *v, int *d2, int *s2 )
+str
[EMAIL PROTECTED]@1( @1 *res, @2 *v, int *d2, int *s2 )
{
int p = *d2, inlen = 1, scale = *s2;
@2 r;
@@ -2052,10 +2055,10 @@
/* since the @1 type is bigger than or equal to the @2 type, it will
always fit */
- r = (@1)*v;
+ r = (@2) *v;
if (scale)
r *= scales[scale];
- cpyval = r;
+ cpyval = (lng) r;
/* count the number of digits in the input */
while (cpyval /= 10)
@@ -2065,7 +2068,7 @@
throw(SQL, "convert",
"too many digits (%d > %d)", inlen, p);
}
- *res = r;
+ *res = (@1) r;
return MAL_SUCCEED;
}
@c
@@ -2079,7 +2082,8 @@
@= fnumcastup
@:simpleupcast(@1,@2)@
-str @[EMAIL PROTECTED]( @1 *res, int *s1, @2 *v )
+str
[EMAIL PROTECTED]@1( @1 *res, int *s1, @2 *v )
{
int scale = *s1;
@1 r;
@@ -2099,7 +2103,8 @@
return MAL_SUCCEED;
}
-str @[EMAIL PROTECTED]( @1 *res, int *S1, @2 *v, int *d2, int *S2 )
+str
[EMAIL PROTECTED]@1( @1 *res, int *S1, @2 *v, int *d2, int *S2 )
{
int p = *d2, inlen = 1;
@2 cpyval = *v;
@@ -2133,7 +2138,8 @@
return MAL_SUCCEED;
}
-str @[EMAIL PROTECTED]( @1 *res, @2 *v, int *d2, int *s2 )
+str
[EMAIL PROTECTED]@1( @1 *res, @2 *v, int *d2, int *s2 )
{
int zero = 0;
return @[EMAIL PROTECTED]( res, &zero, v, d2, s2 );
@@ -2150,7 +2156,8 @@
@= numcastdown
@:simpledowncast(@1,@2)@
-str @[EMAIL PROTECTED]( @1 *res, int *s1, @2 *v )
+str
[EMAIL PROTECTED]@1( @1 *res, int *s1, @2 *v )
{
int scale = *s1;
lng val = *v, h = (val<0)?-5:5;
@@ -2173,7 +2180,8 @@
}
}
-str @[EMAIL PROTECTED]( @1 *res, int *S1, @2 *v, int *d2, int *S2 )
+str
[EMAIL PROTECTED]@1( @1 *res, int *S1, @2 *v, int *d2, int *S2 )
{
int p = *d2, inlen = 1;
lng val = *v, cpyval = val, h = (val<0)?-5:5;
@@ -2210,7 +2218,8 @@
}
}
-str @[EMAIL PROTECTED]( @1 *res, @2 *v, int *d2, int *s2 )
+str
[EMAIL PROTECTED]@1( @1 *res, @2 *v, int *d2, int *s2 )
{
int zero = 0;
return @[EMAIL PROTECTED]( res, &zero, v, d2, s2 );
@@ -2221,7 +2230,8 @@
@:numcastdown(int,lng)@
str
-month_interval_str( int *ret, str *s, int *ek, int *sk ){
+month_interval_str( int *ret, str *s, int *ek, int *sk )
+{
lng res;
if (interval_from_str( *s, *sk, *ek, &res ) < 0)
@@ -2232,7 +2242,8 @@
}
str
-second_interval_str( lng *res, str *s, int *ek, int *sk ){
+second_interval_str( lng *res, str *s, int *ek, int *sk )
+{
if (interval_from_str( *s, *sk, *ek, res ) < 0)
throw(SQL, "calc.second_interval",
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins