DrupalBin
Submit Code
About
Recent Posts
TwitterFeed for D4D review
text
rewrite
Module to overrule the save settings of the "new node" form
Code
apidoc
Empty DateTime Object
Fix for listcars_manufacturer.module
listcars_manufacturer.info
listcars_manufacturer.module
more
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Log in using OpenID
Cancel OpenID login
Create new account
Request new password
Tags
CCK
drupal
fapi
jquery
menu
module
php
simpletest
test
theme
user
views
more tags
Home
›
Fix for schema api 'char' datatype not working ..
Fix for Fix for schema api 'char' datatype not working ..
View
Fix
Fixes are not saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Show summary in full view
<?php # vim: set filetype=php expandtab tabstop=2 shiftwidth=2 autoindent smartindent: function balance_install() { drupal_install_schema('balance'); } // user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT NULL, `amount` FLOAT DEFAULT NULL, `lid` FLOAT DEFAULT NULL, `status`' at line 3 query: CREATE TABLE web_balance ( `bid` INT unsigned NOT NULL auto_increment, `module` DEFAULT NULL, `amount` FLOAT DEFAULT NULL, `lid` FLOAT DEFAULT NULL, `status` TINYINT unsigned NOT NULL DEFAULT 0, PRIMARY KEY (bid) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /c/projects/click_to_call/trunk/control_interface/includes/database.inc on line 509. // user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT NULL, `started` DATETIME NOT NULL, `cancelled` DATETIME NOT NULL, `co' at line 7 query: CREATE TABLE web_balance_log ( `lid` INT unsigned NOT NULL auto_increment, `bid` INT unsigned NOT NULL, `type` TINYINT unsigned DEFAULT NULL, `amount` FLOAT DEFAULT NULL, `cid` INT unsigned DEFAULT NULL, `module` DEFAULT NULL, `started` DATETIME NOT NULL, `cancelled` DATETIME NOT NULL, `completed` DATETIME NOT NULL, `status` TINYINT DEFAULT NULL, PRIMARY KEY (bid, id) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /c/projects/click_to_call/trunk/control_interface/includes/database.inc on line 509. function balance_schema() { $schema['balance'] = array ( 'fields' => array ( 'bid' => array ( 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE ), 'module' => array ( 'type' => 'char', 'size' => 25 ), /* The module which created this balance entry .. */ 'amount' => array ( 'type' => 'float' ), /* The amount is kept under default currency */ 'lid' => array ( 'type' => 'float' ), /* Last billing log that is responsible for balance change .. */ 'status' => array ( 'type' => 'int', 'unsigned' => TRUE, 'size' => 'tiny', 'not null' => TRUE, 'default' => 0 ) /* 1-enabled, 0-disabled */ ), 'primary key' => array ( 'bid' ), ); $schema["balance_log"] = array ( 'fields' => array ( 'lid' => array ( 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE ), 'bid' => array ( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE ), 'type' => array ( 'type' => 'int', 'unsigned' => TRUE, 'size' => 'tiny' ), /* if we are doing debit or credit .. */ 'amount' => array ( 'type' => 'float' ), /* The amount of money has been transferred */ 'cid' => array ( 'type' => 'int', 'unsigned' => TRUE ), 'module' => array ( 'type' => 'char', 'size' => 25 ), /* The module responsible for the billing log .. */ 'started' => array ( 'type' => 'datetime', 'not null' => TRUE ), /* time when the transaction started .. */ 'cancelled' => array ( 'type' => 'datetime', 'not null' => TRUE ), /* time when the transaction cancelled .. */ 'completed' => array ( 'type' => 'datetime', 'not null' => TRUE ), /* time when the transaction completed .. */ 'status' => array ( 'type' => 'int', 'size' => 'tiny' ), /* 1-completed, 2-cancelled, 3-locked etc .. */ ), 'primary key' => array ( 'bid', 'id' ), ); $schema["currency"] = array ( 'fields' => array ( 'vid' => array ( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 ), 'nid' => array ( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 ), 'conversion_rate' => array ( 'type' => 'float', 'default' => 1 ) /* conversion rate to the default currency */ ), 'primary key' => array ( 'nid', 'vid' ) ); return $schema; } function balance_uninstall() { drupal_uninstall_schema('balance'); }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal 5
Drupal 6
HTML
INI
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.
See Also:
Order
Title:
URL:
-1
0
1
Title:
URL:
-1
0
1
Any links you'd like to have associated with the post (Drupal.org issue, Wikipedia article, etc).
File attachments
Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.
Attach new file:
The maximum upload size is
1 MB
. Only files with the following extensions may be uploaded:
jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp
.