--Fba/0zbH8Xs+Fj9o
Content-Type: multipart/mixed; boundary="wac7ysb48OaltWcw"
Content-Disposition: inline
--wac7ysb48OaltWcw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Thu, Feb 02, 2006 at 04:14:18AM -0700, Warren Young wrote:
Quote:
Can you please split this up into three separate patches? When you have=
=20
three separate things going on in a single patch, it is hard to evaluate=
=20
it. If I did accept it as-is, it would also make the svn change history=
=20
more convoluted. |
Ok, I understand. Here are the three patches, expected to be applied in
this order:
- custom01.patch makes custom.pl work in strict+warning mode.
- custom12.patch empties $set after each pass, preventing unnecessary
code from being generated.
- custom23.patch makes custom.pl generate sql_cmp() functions for long
fields.
On a related topic, I noticed that (as mentioned in my previous post)
there was no way to use nullable fields in SSQLS structures, so I am
preparing a patch that lets one use the Null<> template in there. It
surprises me, however, that, first, this feature is lacking, and next,
that it only returns a few matches in the list's archives. Did I miss
something obvious?
Best regards,
-Waba.
--wac7ysb48OaltWcw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="custom01.patch"
Content-Transfer-Encoding: quoted-printable
This patch makes custom.pl work in strict+warning mode.
--- custom0.pl 2006-02-02 13:14:22.000000000 +0100
+++ custom1.pl 2006-02-02 13:15:21.000000000 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
=20
################################################## ######################
# custom.pl - Generates custom.h and custom-macros.h, as these files
@@ -38,6 +38,8 @@
=20
# No user-serviceable parts below.
=20
+use strict;
+
open (OUT0, ">custom.h");
open (OUT, ">custom-macros.h");
=20
@@ -65,9 +67,9 @@
}
---
=20
-@types =3D ("char", "unsigned char", "tiny_int", "int", "unsigned int",
+my @types =3D ("char", "unsigned char", "tiny_int", "int", "unsigned int",
"short int", "unsigned short int");
-foreach $type (@types) {
+foreach my $type (@types) {
print OUT0 << "---";
=20
inline int sql_cmp($type a,$type b) {
@@ -77,7 +79,7 @@
}
=20
@types =3D ("double", "float");
-foreach $type (@types) {
+foreach my $type (@types) {
print OUT0 << "---";
=20
inline int sql_cmp($type a,$type b) {
@@ -89,7 +91,7 @@
}=09
=20
@types =3D ("longlong", "ulonglong");
-foreach $type (@types) {
+foreach my $type (@types) {
print OUT0 << "---";
=20
inline int sql_cmp($type a,$type b) {
@@ -140,7 +142,9 @@
{return sql_compare_##NAME<mysqlpp::sql_dummy>(*this,other );}
---
=20
-foreach $j (1..$max_data_members) {
+my ($parm0, $parm1);
+
+foreach my $j (1..$max_data_members) {
$parm0 .=3D "T$j, C$j";
$parm0 .=3D ", " unless $j =3D=3D $max_data_members;
$parm1 .=3D "C$j";
@@ -166,11 +170,13 @@
// ---------------------------------------------------
---
=20
-foreach $i (1..$max_data_members) {
+
+foreach my $i (1..$max_data_members) {
+ my ($compr, $define, $compp, $set, $parm2);
$compr =3D ""; $parm2 =3D ""; $define =3D "";
$compr =3D " int cmp; \\\n" unless $i =3D=3D 1;
$compp =3D "";
- foreach $j (1..$i) {
+ foreach my $j (1..$i) {
$compr .=3D " if (cmp =3D mysqlpp::sql_cmp(x.C$j , y.C$j )) retur=
n cmp; \\\n"
unless $j =
=3D=3D $i;
$compr .=3D " return mysqlpp::sql_cmp(x.C$j , y.C$j );" if $j =
=3D=3D $i;
@@ -228,20 +234,20 @@
---
=20
=20
-foreach $i (1..$max_data_members) {
- $parm_complete =3D "";=20
- $parm_order =3D ""; $parm_order2c =3D "";
- $parm_simple =3D ""; $parm_simple2c =3D "";
- $parm_simple_b =3D ""; $parm_simple2c_b =3D "";
- $parm_names =3D ""; $parm_names2c =3D "";
- $defs =3D ""; $popul =3D ""; $parmc =3D ""; $parmC =3D "";
- $value_list =3D ""; $field_list =3D ""; $equal_list =3D "";
- $value_list_cus =3D ""; $cus_field_list =3D ""; $cus_equal_list =3D "";
- $create_bool =3D ""; $create_list =3D "";
- $cusparms1 =3D ""; $cusparms2 =3D ""; $cusparmsv =3D ""; =20
- $cusparms11 =3D ""; $cusparms22 =3D "";
- $names =3D "";$enums =3D "";
- foreach $j (1 .. $i) {
+foreach my $i (1..$max_data_members) {
+ my $parm_complete =3D "";=20
+ my $parm_order =3D ""; my $parm_order2c =3D "";
+ my $parm_simple =3D ""; my $parm_simple2c =3D "";
+ my $parm_simple_b =3D ""; my $parm_simple2c_b =3D "";
+ my $parm_names =3D ""; my $parm_names2c =3D "";
+ my $defs =3D ""; my $popul =3D ""; my $parmc =3D ""; my $parmC =3D "";
+ my $value_list =3D ""; my $field_list =3D ""; my $equal_list =3D "";
+ my $value_list_cus =3D ""; my $cus_field_list =3D ""; my $cus_equal_li=
st =3D "";
+ my $create_bool =3D ""; my $create_list =3D "";
+ my $cusparms1 =3D ""; my $cusparms2 =3D ""; my $cusparmsv =3D ""; =
=20
+ my $cusparms11 =3D ""; my $cusparms22 =3D "";
+ my $names =3D "";my $enums =3D "";
+ foreach my $j (1 .. $i) {
$parm_complete .=3D "T$j, I$j, N$j, O$j";
$parm_complete .=3D ", " unless $j =3D=3D $i;
$parm_order .=3D "T$j, I$j, O$j";
@@ -315,7 +321,7 @@
$parmc .=3D "I$j";
$parmc .=3D ", " unless $j =3D=3D $max_data_members;
}
- foreach $j ($i+1 .. $max_data_members) {
+ foreach my $j ($i+1 .. $max_data_members) {
$parmC .=3D "0, 0";
$parmC .=3D ", " unless $j =3D=3D $max_data_members;
$parmc .=3D "0";
@@ -327,7 +333,7 @@
// Begin Create $i
// ---------------------------------------------------
---
- $out =3D <<"---";
+ my $out =3D <<"---";
#define sql_create_basic_c_order_$i(NAME, CMP, CONTR, $parm_order)
=20
struct NAME;=20
@@ -878,7 +884,7 @@
=20
=20
sub prepare {
- local $_ =3D @_[0];
+ local $_ =3D $_[0];
s/\n+$//;
s/\n[\n ]*\n/\n/g;=20
s/\n+/\\\n/g;
--wac7ysb48OaltWcw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="custom12.patch"
Content-Transfer-Encoding: quoted-printable
This patch empties $set after each pass, preventing unnecessary code from=
=20
being generated.
--- custom1.pl 2006-02-02 13:15:21.000000000 +0100
+++ custom2.pl 2006-02-02 13:15:54.000000000 +0100
@@ -176,6 +176,7 @@
$compr =3D ""; $parm2 =3D ""; $define =3D "";
$compr =3D " int cmp; \\\n" unless $i =3D=3D 1;
$compp =3D "";
+ $set =3D "";
foreach my $j (1..$i) {
$compr .=3D " if (cmp =3D mysqlpp::sql_cmp(x.C$j , y.C$j )) retur=
n cmp; \\\n"
unless $j =
=3D=3D $i;
--wac7ysb48OaltWcw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="custom23.patch"
Content-Transfer-Encoding: quoted-printable
This patch makes custom.pl generate sql_cmp() functions for long fields.
--- custom2.pl 2006-02-02 13:15:54.000000000 +0100
+++ custom3.pl 2006-02-02 13:16:13.000000000 +0100
@@ -68,7 +68,7 @@
---
=20
my @types =3D ("char", "unsigned char", "tiny_int", "int", "unsigned int",
- "short int", "unsigned short int");
+ "short int", "unsigned short int", "unsigned long", "long");
foreach my $type (@types) {
print OUT0 << "---";
=20
--wac7ysb48OaltWcw--
--Fba/0zbH8Xs+Fj9o
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
iD8DBQFD4f+9UQHbkgA+2bIRAlWkAJ9MkThgTjVTtP6W2n/VQQIlO9U/JACdElJU
LHiJn3l9twmymlnGPqRMb6A=
=+p4U
-----END PGP SIGNATURE-----
--Fba/0zbH8Xs+Fj9o--