[ccan] Accpeting code module

Stewart Smith stewart at flamingspork.com
Thu May 29 10:04:25 EST 2008


On Thu, 2008-05-29 at 07:43 +1000, Adam Kennedy wrote:
> Stewart Smith wrote:
> > On Tue, 2008-05-27 at 19:28 +0530, dinesh g wrote:
> >   
> >> I will look in to SQLite for using for our DB.
> >>     
> >
> > Just also be aware that SQLite can be a lot more 'forgiving' of bad data
> > in than MySQL... so testing on both is worthwhile.
> >   
> Of course, please don't read that to mean that MySQL is NOT forgiving of 
> bad data, since it also likes to do crazy and unreliable things.

/me puts on my "works as developer at MySQL/Sun" hat and says "yeah!
although nobody seems to be aware of strict mode in 5.0 and above"

if you set sql_mode to strict, then MySQL behaves much like some would
expect it to, is not default to not break old apps.

of course, to make it fun - sqlite and mysql are forgiving in much
different ways. e.g.

sqlite> create table t1 (a varchar(10));
sqlite> insert into t1 values ('asntohuntoahuntoahuteoahutahunteoah');
sqlite> select * from t1;
asntohuntoahuntoahuteoahutahunteoah
sqlite> 

mysql> create table t1 (a varchar(10));
Query OK, 0 rows affected (0.02 sec)

mysql> insert into t1 values ('ateohuahutoaehutaheoutoaehthut');
Query OK, 1 row affected, 1 warning (0.02 sec)

mysql> show warnings;
+---------+------+----------------------------------------+
| Level   | Code | Message                                |
+---------+------+----------------------------------------+
| Warning | 1265 | Data truncated for column 'a' at row 1 | 
+---------+------+----------------------------------------+
1 row in set (0.00 sec)

mysql> select * from t1;
+------------+
| a          |
+------------+
| ateohuahut | 
+------------+
1 row in set (0.00 sec)

Now, with added strict mode:

mysql> set sql_mode=STRICT_ALL_TABLES;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into t1 values ('ateohuahutoaehutaheoutoaehthut');
ERROR 1406 (22001): Data too long for column 'a' at row 1
mysql> 


hope this helps/clarifies,
stewart
-- 
Stewart Smith (stewart at flamingspork.com)
http://www.flamingspork.com/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/ccan/attachments/20080529/00e14077/attachment.pgp>


More information about the ccan mailing list