[svn:parrot] r41274 - trunk/examples/nci

NotFound at svn.parrot.org NotFound at svn.parrot.org
Tue Sep 15 15:42:48 UTC 2009


Author: NotFound
Date: Tue Sep 15 15:42:44 2009
New Revision: 41274
URL: https://trac.parrot.org/parrot/changeset/41274

Log:
[examples] MySql: add 'elements' vtable overrides to result objects and quote vtable override names

Modified:
   trunk/examples/nci/Mysql.pir
   trunk/examples/nci/mysqltest.p6

Modified: trunk/examples/nci/Mysql.pir
==============================================================================
--- trunk/examples/nci/Mysql.pir	Tue Sep 15 15:08:00 2009	(r41273)
+++ trunk/examples/nci/Mysql.pir	Tue Sep 15 15:42:44 2009	(r41274)
@@ -127,7 +127,7 @@
 .end
 
 #-----------------------------------------------------------------------
-.sub init :vtable
+.sub 'init' :vtable
     .local pmc mysql_init
     mysql_init = get_mysql_function('mysql_init', 'pp')
 
@@ -405,7 +405,7 @@
 .namespace ['Mysql';'Result']
 
 #-----------------------------------------------------------------------
-.sub init_pmc :vtable
+.sub 'init_pmc' :vtable
     .param pmc mysql :named
     .param pmc r :named
 
@@ -438,7 +438,7 @@
 .end
 
 #-----------------------------------------------------------------------
-.sub destroy :vtable
+.sub 'destroy' :vtable
     self.'free'()
 .end
 
@@ -457,7 +457,7 @@
 .end
 
 #-----------------------------------------------------------------------
-.sub field_count :method
+.sub 'elements' :vtable
     .local pmc field_count
     field_count = get_mysql_function('mysql_field_count', 'ip')
     .local pmc mysql
@@ -468,6 +468,13 @@
 .end
 
 #-----------------------------------------------------------------------
+.sub field_count :method
+    .local int fields
+    fields = elements self
+    .return(fields)
+.end
+
+#-----------------------------------------------------------------------
 .sub fetch_row :method
 
     .local pmc rowres
@@ -519,14 +526,21 @@
 .namespace ['Mysql';'Row']
 
 #-----------------------------------------------------------------------
-.sub get_integer :vtable
+.sub 'get_integer' :vtable
+    .local pmc data
+    data = getattribute self, 'data'
+    $I0 = data
+    .return($I0)
+.end
+
+.sub 'elements' :vtable
     .local pmc data
     data = getattribute self, 'data'
     $I0 = data
     .return($I0)
 .end
 
-.sub get_number :vtable
+.sub 'get_number' :vtable
     .local pmc data
     data = getattribute self, 'data'
     $I0 = data
@@ -534,7 +548,7 @@
     .return($N0)
 .end
 
-.sub get_string_keyed :vtable
+.sub 'get_string_keyed' :vtable
     .param int n
 
     .local pmc data
@@ -543,7 +557,7 @@
     .return($S0)
 .end
 
-.sub get_pmc_keyed :vtable
+.sub 'get_pmc_keyed' :vtable
     .param int n
 
     .local pmc data

Modified: trunk/examples/nci/mysqltest.p6
==============================================================================
--- trunk/examples/nci/mysqltest.p6	Tue Sep 15 15:08:00 2009	(r41273)
+++ trunk/examples/nci/mysqltest.p6	Tue Sep 15 15:42:44 2009	(r41274)
@@ -43,6 +43,7 @@
     my @row_copy;
     my $i = 0;
     while ($i < $elems) {
+        print $i, ': ';
         print "'", $row[$i], "'";
 	@row_copy.push($row[$i]);
         ++$i;


More information about the parrot-commits mailing list