<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><DIV></DIV>
<DIV>'size' =&gt; 'big',<BR>&nbsp;</DIV>
<P><FONT face="bookman old style, new york, times, serif" color=#ff007f size=4><EM><STRONG>Nancy</STRONG></EM></FONT></P>
<P>&nbsp;</P>
<P><FONT face="arial, helvetica, sans-serif">Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.</FONT></P>
<DIV><BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: arial, helvetica, sans-serif"><BR>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: arial, helvetica, sans-serif"><FONT face=Tahoma size=2>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Andre Angelantoni &lt;aangel@mac.com&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> development@drupal.org<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Tue, December 28, 2010 2:28:32 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> [development] using db_insert with big ints<BR></FONT><BR>When I use db_insert in D7 (RC3), drupal_write_record (the engine behind db_insert) allows ints, serials, and floats for numbers.<BR><BR>If it sees int in the schema definition, it casts the number in PHP as an int before writing the record. Thus my facebook id of 100000412533411 becomes much much smaller. I have D6 code that I'm bringing to D7, btw.<BR><BR>In common.inc:<BR><BR>&nbsp; &nbsp; // Type cast to proper datatype, except when the value is NULL and the<BR>&nbsp; &nbsp; // column allows this.<BR>&nbsp; &nbsp; //<BR>&nbsp; &nbsp; // MySQL PDO silently casts e.g. FALSE and '' to 0
 when inserting the value<BR>&nbsp; &nbsp; // into an integer column, but PostgreSQL PDO does not. Also type cast NULL<BR>&nbsp; &nbsp; // when the column does not allow this.<BR>&nbsp; &nbsp; if (isset($object-&gt;$field) || !empty($info['not null'])) {<BR>&nbsp; &nbsp; &nbsp; if ($info['type'] == 'int' || $info['type'] == 'serial') {<BR>&nbsp; &nbsp; &nbsp; &nbsp; $fields[$field] = (int) $fields[$field];&nbsp; &nbsp; &nbsp; // ****HERE***<BR>&nbsp; &nbsp; &nbsp; }<BR>&nbsp; &nbsp; &nbsp; elseif ($info['type'] == 'float') {<BR>&nbsp; &nbsp; &nbsp; &nbsp; $fields[$field] = (float) $fields[$field];<BR>&nbsp; &nbsp; &nbsp; }<BR>&nbsp; &nbsp; &nbsp; else {<BR>&nbsp; &nbsp; &nbsp; &nbsp; $fields[$field] = (string) $fields[$field];<BR>&nbsp; &nbsp; &nbsp; }<BR>&nbsp; &nbsp; }<BR><BR>There doesn't appear to be a way to insert bigints using db_insert<BR><BR>...or am I completely missing something?<BR><BR>-Andre'<BR><BR></DIV></DIV></div></body></html>