I am working with Drupal Commerce to create an e-Commerce store. However, I am having some trouble with my client's gateway of choice, First Data.   I have everything set up as directed (I believe) but when I try to submit an order the page times out and I am given this error message. (This happens if I am testing a transaction live, test authorized, or test denied)  PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away:   INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] =&gt; 0 [:db_insert_placeholder_1] =&gt; php [:db_insert_placeholder_2] =&gt; %type: !message in %function (line %line of %file). [:db_insert_placeholder_3] =&gt; a:6 {s:5:"%type";s:6:"Notice";s:8:"!message";s:27:"Undefined index: order_num";s:9:"%function";s:33:"firstdata_cc_submit_form_submit()";s:5:"%file";s 87:"/home/betads/public_html/sites/all/modules/commerce_firstdata/commerce_firstd ta.module";s:5:"%line";i:380;s:14:"severity_level";i:5;} [:db_insert_placeholder_4] =&gt; 5 [:db_insert_placeholder_5] =&gt; [:db_insert_placeholder_6] =&gt; https://beta.designsenseinc.net/checkout/7/review [:db_insert_placeholder_7] =&gt; https://beta.designsenseinc.net/checkout/7/review [:db_insert_placeholder_8] =&gt; 166.147.79.6 [:db_insert_placeholder_9] =&gt; 1330630525 ) in dblog_watchdog() (line 157 of /home/betads/public_html/modules/dblog/dblog.module).   Any idea what could be the issue? To test for yourself, you can visit  and add the product to cart.  Any help appreciated.
1833
Recently I started getting an error every time I try and add a content no matter what type.  This is the error that shows up in the browser:     Additional uncaught exception thrown while handling exception.        Original   PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT COUNT(cid) FROM {comment} WHERE status = :status; Array ( [:status] =&gt; 0 ) in comment_count_unpublished() (line 313 of /Applications/MAMP/htdocs/modules/comment/comment.module).        Additional      PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] =&gt; 1 [:db_insert_placeholder_1] =&gt; php [:db_insert_placeholder_2] =&gt; %type: !message in %function (line %line of %file). [:db_insert_placeholder_3] =&gt; a:6:{s:5:&quot;%type&quot;;s:12:&quot;PDOException&quot;;s:8:&quot;!message&quot;;s:154:&quot;SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT COUNT(cid) FROM {comment} WHERE status = :status; Array ( [:status] =&amp;gt; 0 ) &quot;;s:9:&quot;%function&quot;;s:27:&quot;comment_count_unpublished()&quot;;s:5:&quot;%file&quot;;s:56:&quot;/Applications/MAMP/htdocs/modules/comment/comment.module&quot;;s:5:&quot;%line&quot;;i:313;s:14:&quot;severity_level&quot;;i:3;} [:db_insert_placeholder_4] =&gt; 3 [:db_insert_placeholder_5] =&gt; [:db_insert_placeholder_6] =&gt; ; [:db_insert_placeholder_7] =&gt;  [:db_insert_placeholder_8] =&gt; 127.0.0.1 [:db_insert_placeholder_9] =&gt; 1338336955 ) in dblog_watchdog() (line 154 of /Applications/MAMP/htdocs/modules/dblog/dblog.module).   I also get the following error in my php error file:     PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in /Applications/MAMP/htdocs/includes/database/database.inc:2136        Stack trace:   0 /Applications/MAMP/htdocs/includes/database/database.inc(2136): PDOStatement->execute(Array)   1 /Applications/MAMP/htdocs/includes/database/database.inc(664): DatabaseStatementBase->execute(Array, Array)   2 /Applications/MAMP/htdocs/includes/database/database.inc(2315): DatabaseConnection->query('SELECT expire, ...', Array, Array)   3 /Applications/MAMP/htdocs/includes/lock.inc(167): db_query('SELECT expire, ...', Array)   4 /Applications/MAMP/htdocs/includes/lock.inc(146): lock_may_be_available('theme_registry:...')   5 /Applications/MAMP/htdocs/includes/theme.inc(447): lock_acquire('theme_registry:...')   6 /Applications/MAMP/htdocs/includes/bootstrap.inc(427): ThemeRegistry->set(Array)   7 [internal function]: DrupalCacheArray->__destruct()   8 {main}         thrown in /Applications/MAMP/htdocs/includes/database/database.inc on line 2136   I am having a little trouble deciphering these error messages. Could anyone help me understand what's going on here?
55040
We are in the process of implementing a new CMS (Drupal 6.x) that runs on MySQL. We have two data centers -- primary and secondary -- with known latency between them. We're unsure which version of MySQL we will run ... either Community or Enterprise, but that is a TBD. Looks like we will be running the InnoDB engine, OS is going to be RedHat EL 5.5 The primary servers are going to be active, while the secondary will be passive or hot stand-bys.   I would like to implement replication, high availability and automated failover in MySQL across the two data centers.   After a failover to the secondary servers, when we fail-back to the primary servers, we'd like to have data synched from the secondary DB to the primary DB quickly and completely so that we can continue to serve content from the primary servers.  I am interested in knowing what technologies/tools/best practices can be used to solve/address these issues. Also, any gotchas or ah-ha moments would be much appreciated as well. I've read up on MySQL replication, clustering, and at some 3rd party tools like Tungsten and Dolphinics, but I a unsure what the is best course of action.  Thank you for your time!  KM
103134
I have come to the conclusion that my PHP installation and my MySQL installation are not getting along; I’m working on making my first web page that uses MySQL for content, but after two days, man pages, online documentation, and dozens of tutorials, I just can’t get the PHP/MySQL part to work.  I have an established home web server (I am the only admin/user) that runs Apache and hosts my web pages.  I have MySQL installed, and was able to create and query a database through Terminal.  I have PHP installed, and can use echo to print text to the document.  When I work with MySQL however, everything changes…  I have a page that contains initialization stuff in .  contains a few paragraphs of hardcoded HTML and then PHP code to access MySQL.  When I first loaded the page, all that resulted was a blank page.  I commented out the PHP section and reloaded to confirm that the plain HTML still worked, which it did.  Therefore, some part of PHP was keeping any of the page from ever loading.    To begin troubleshooting my code, I left all of the PHP code commented except the following code for the server connection, which is adapted from several different tutorials:  &lt;? echo("&lt;p&gt;PHP is working&lt;/p&gt;");  $ses = mysql_connect("localhost","username","password"); if(!$ses){  echo("&lt;p&gt;Connection to content server failed.&lt;/p&gt;");  exit(); } echo("&lt;p&gt;Database Connected&lt;/p&gt;"); ?&gt;   When the page is loaded, the beginning HTML loads in addition to a paragraph reading “PHP is working” but neither the failure or success message appear.  I removed the If structure from the code - so that only two echos and the mysql_connect remained – and got the same result.    It seems that the mysql_connect feature is causing the server to stop loading the code when it is run, but I’m out of ideas for how to fix it.  For the record: I’ve modified the php.ini file to include the “connection = msql.so” line, and I’m using MySQL 5.5, Apache 2.2.22, PHP 5.3.10, Ubuntu 12.04.  Also, both my router and modem have been configured to forward port 3306 to the server – though I don’t see how that should be necessary – and my MySQL username and password have been triple checked and are identical to the ones that I use successfully in Terminal.  What am I missing?
27610
I'm receiving the following warnings when I use mysql_query() in my modules:  mysql_query(): A link to the server could not be established in ...... on line 6  If I use db_query() instead, it works fine.   The code is a simple SELECT query with no special characters or variables. The actual query is mysql_query("SELECT * FROM custom_nodify WHERE nid = 345");  I should mention that this happens with ANY mysql_query(), not just the one above.  Any suggestions as to why this doesn't work?
91873
We had several power outages and server rebooted couple times which seemed to cause issues with one of the databases.  We tried detaching at attaching database again but it looks like database is corrupted and we’re getting the  Msg 5172, Level 16, State 15, Line 1  Claiming that database header is invalid. Is there anything we can to do repair database or extract data from MDF file?  We do have a backup but it’s like 2 weeks old and doesn’t contain all data.
28662
I have managed to create a product type and import my product data, so I now have a list of products.  then i follow ryan szrama instruction   After that i get this error. EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 339 of C:\xampp\htdocs\drupal7\modules\entity\includes\entity.wrapper.inc).  what i should do??
38456
I created a block and put in some invalid PHP code resulted in entire site not accessible at all.   I'm fairly new to Drupal and I'm not a back-end programmer either. Much appreciated if you can provide a clear step-by-step guide on how to delete that particular block directly from the Database (PhpMyAdmin).
103855
I need to debug an issue and don't know how to start.  If I'm logged in the cart works just fine but, if I log out and put something in my cart I see the object in the cart widget but not my cart page.    And this is the markup in the page.    I need a hint to understand where to start searching the issue because the cart page permission and the view permission I think are fine because I see them, but the content is wrong..    If I go in admin/structure/views/view/commerce_cart_form/edit page and I insert the order ID, I can see the right cart displayed in the right way..   Where can I start to debug this?  Do you have a clue to where can the bug be?  I tried to put a couple of prints in the view header and the cart page remains blank. But why is the empty cart sentence not displayed if the order_id is empty? And why 2 different carts views in the same page act so differently?
30932
I installed Drush for the first time (so it may be a configuration error) and I'm trying to update to the latest core version of Drupal.  Drush is giving me this error - I'm on an OSX box.  dev5:clientnamedirectory my.name$ drush pm-update projects drupal-7.25 &lt;h1&gt;Additional uncaught exception thrown while handling exception.&lt;/h1&gt;  &lt;h2&gt;Original&lt;/h2&gt;&lt;p&gt;PDOException: SQLSTATE[HY000] [2002] No such file or directory in drupal_get_installed_schema_version() (line 155 of /Users/my.name/Sites/proface/includes/install.inc).&lt;/p&gt;  &lt;h2&gt;Additional&lt;/h2&gt;  &lt;p&gt;PDOException: SQLSTATE[HY000] [2002] No such file or directory in system_list() (line 165 of /Users/my.name/Sites/clientnamedirectory/includes/module.inc).&lt;/p&gt;&lt;hr /&gt;  Drush command terminated abnormally due to an unrecoverable error.
94051
I want to do something like this:    create table app_users (     app_user_id smallint(6) not null auto_increment primary key,     api_key     char(36) not null default uuid() );    However this results in a error, is there a way to call a function for a default value in mysql?  thanks.
8186
is there an alternative for mysql_insert_id() php function for PostgreSQL? Most of the frameworks are solving the problem partially by finding the current value of the sequence used in the ID. However, there are times that the primary key is not a serial column....
121895
I have a trigger and a class that seem to be causing an insert fail in Dataloader.  I am trying to insert 200 records to see if an error is generated before moving these to production. I'm just inserting the mandatory fields such as Name, Owner, Market, Customer_Success_Manager__c, and Business Unit.   Each time I get an error:     UpdateCSMTeam:execution of AfterInsertcaused by: System.DmlException:   Insert failed. First exception on row 0 with id01MJ0000009gXthMAE;   first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an   insert call: [Id]Class.UpdateCSM.updateTeamMem . I've listed the class   and trigger below.   APEX CLASS  public class UpdateCSM {             public static void updateTeamMember(List&lt;Account&gt; accounts) {                     List&lt;AccountShare&gt; ashareLIST = new List&lt;AccountShare&gt;();                     List&lt;AccountTeamMember&gt; ATM = new List&lt;AccountTeamMember&gt;();                    Set&lt;String&gt; rmMember = new Set&lt;String&gt;();                     Map&lt;ID, ID&gt; acctToBRepMap = new Map&lt;ID, ID&gt;();                      for(Account a:accounts){                              AccountShare caSharingRule = new AccountShare();                                caSharingRule.AccountId = a.Id;                                caSharingRule.OpportunityAccessLevel = 'Edit';                                caSharingRule.CaseAccessLevel = 'Edit';                                caSharingRule.AccountAccessLevel = 'Edit';                                caSharingRule.UserOrGroupId = a.Customer_Success_Manager__c;                                ashareLIST.add(caSharingRule);                                    if(a.Customer_Success_Manager__c!= null){                                   AccountTeamMember Teammemberad=new AccountTeamMember();                 Teammemberad.AccountId=a.id;                 Teammemberad.UserId=a.Customer_Success_Manager__c;                 Teammemberad.TeamMemberRole = 'Customer Success Manager';                                   ATM.add(Teammemberad);                             if(!ATM.isEmpty()){                                    insert ATM;                                              insert ashareLIST;                                                         if(a.Customer_Success_Manager__c==null){                                            list&lt;AccountTeamMember&gt; ratm = [SELECT UserId                                                                             FROM AccountTeamMember                                                                             WHERE (TeamMemberRole = 'Customer Success Manager')                                                          AND AccountId =:a.id];                                             if(ratm.size()&gt;0)                                                 delete ratm;                                        }                                    }                                 }                            }                         }                    } ...   APEX TRIGGER  trigger UpdateCSMTeam on Account (After update, After insert){         UpdateCSM.updateTeamMember(trigger.new); }
38883
I was following this tutorial:    So far, I installed mysql-server mysql-client libmysqlclient-dev, and I was suppose to tell MySQL to create its database directory structure where it will store its information using sudo mysql_install_db.  $ sudo mysql_install_db  [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize [ERROR]   The data directory needs to be specified.   I thought running mysqld --initialize would solve the issue:  $ mysqld --initialize   mysqld: Can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists) [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). [ERROR] Aborting   How do I tell MySQL to create its database directory structure where it will store its information?
110550
For a new project that I'm doing in PHP I've created an SQLMethods class to connect to the database and perform queries. Tonight was the first night that I actually got to test it (I wrote it a week or so ago and forgot about it) and an unexpected error occured: When it was calling my ExecuteQuery() function, it wouldn't use the database I selected in the constructor.  The constructor:      public function SQLMethods() {         $SQLConnection = mysql_connect($SQLDBAddress, $SQLUserName, $SQLPassword);          if (!$SQLConnection) {             die('Could not connect: ' . mysql_error());         }          mysql_select_db($SQLDB, $SQLConnection);     }   The function in question:      public function ExecuteQuery($Query) {         mysql_query($Query, $SQLConnection) or die('Could not perform query: ' . mysql_error());     }   Does anyone see what the issue might be? Does the connection close after the constructor completes?
20999
Table structure: CREATE TABLE dblog_query_strings (     id          bigserial,     query_string        text NOT NULL,     PRIMARY KEY     (id),     UNIQUE          (query_string) )  CREATE TABLE dblog_file_paths (     id          bigserial,     file_path       text NOT NULL,     PRIMARY KEY     (id),     UNIQUE          (file_path) )  CREATE TABLE db_log (     id          bigserial,     logged_at       timestamptz NOT NULL DEFAULT now(),     query_string_id     bigint NOT NULL,     file_path_id        bigint NOT NULL,     seconds         numeric,     PRIMARY KEY     (id),     FOREIGN KEY     (query_string_id) REFERENCES dblog_query_strings (id) ON UPDATE CASCADE ON DELETE CASCADE,     FOREIGN KEY     (file_path_id) REFERENCES dblog_file_paths (id) ON UPDATE CASCADE ON DELETE CASCADE )  The application code, which is indeed run at the same time by many different scripts: $query_string = 'test query string'; $file_path = 'test path'; $seconds = 0.00065708160400391; dbcall('INSERT INTO dblog_query_strings (query_string) VALUES ($1) ON CONFLICT DO NOTHING', $query_string); dbcall('INSERT INTO dblog_file_paths (file_path) VALUES ($1) ON CONFLICT DO NOTHING', $file_path); dbcall('INSERT INTO db_log (query_string_id, file_path_id, seconds) VALUES (     (SELECT id FROM dblog_query_strings WHERE query_string = $1),     (SELECT id FROM dblog_file_paths WHERE file_path = $2), $3)', [ $query_string, $file_path, $seconds ]);  The SOMETIMES logged error, for example right when I clear the database log: pg_query_params(): Query failed: ERROR:  null value in column &quot;query_string_id&quot; violates not-null constraint DETAIL:  Failing row contains (1, 2020-08-27 00:37:32.419107+02, null, null, 0.00065708160400391).  Analysis: The third INSERT sometimes gets nulls for its SELECTs, instead of the expected strings. This should be logically impossible, regardless of whether I run one script or 10,000 scripts in parallel, because even if the other scripts INSERT at the same time, and all but the first one fail, this is built into my mechanism, as you can see. The first two queries simply INSERT values if they don't exist. It thus doesn't matter how many concurrent scripts are being run. By the time the third and final INSERT is executed, the table is guaranteed to have those values in it. Yet this is clearly not always the case! But I don't see how that is possible. At this point, I'm 99% convinced that I've somehow hit a bug in PostgreSQL, but I'd much rather have this be a mistake/confusion by me. I don't see any way which in which the third INSERT can possibly ever get null values from those SELECTs, given that the queries before make sure that the values exist, prior to it being executed. They are not &quot;asynchronous&quot; but executed sequentially, one by one. I've tried it like this and as a single transaction. Nothing helps from the dreaded &quot;magical&quot; race conditions or whatever is really happening here. This is how I &quot;clear the log&quot;: dbcall('BEGIN'); dbcall('TRUNCATE TABLE db_log RESTART IDENTITY CASCADE'); dbcall('TRUNCATE TABLE dblog_query_strings RESTART IDENTITY CASCADE'); dbcall('TRUNCATE TABLE dblog_file_paths RESTART IDENTITY CASCADE'); dbcall('COMMIT');  While that transaction is being executed, tons of scripts are doing the INSERTs, but this doesn't matter since they will either see the old tables or completely empty ones... right? So how can I get errors still?
2806
My schema 'test' has 3 tables: 'user', 'post' and 'revision'.  CREATE TABLE IF NOT EXISTS `test`.`user` (   `iduser` INT UNSIGNED NOT NULL AUTO_INCREMENT,   `name` VARCHAR(45) NOT NULL,    PRIMARY KEY (`iduser`)) ENGINE = InnoDB;  CREATE TABLE IF NOT EXISTS `test`.`post` (   `idpost` INT UNSIGNED NOT NULL AUTO_INCREMENT,   `iduser` INT UNSIGNED NOT NULL,   `content` VARCHAR(4000) NOT NULL,   `revision_count` INT NOT NULL DEFAULT 0,    PRIMARY KEY (`idpost`),    INDEX `fk_post_user1_idx` (`iduser` ASC),    CONSTRAINT `fk_post_user1`      FOREIGN KEY (`iduser`)      REFERENCES `test`.`user` (`iduser`)      ON DELETE NO ACTION      ON UPDATE NO ACTION) ENGINE = InnoDB;  CREATE TABLE IF NOT EXISTS `test`.`revision` (   `idrevision` INT UNSIGNED NOT NULL,   `iduser` INT UNSIGNED NOT NULL,   `idpost` INT UNSIGNED NOT NULL,   `content` VARCHAR(4000) NOT NULL,    UNIQUE INDEX `index1` (`idpost` ASC, `idrevision` ASC),    PRIMARY KEY (`idrevision`, `iduser`),    INDEX `fk_revision_user1_idx` (`iduser` ASC),    CONSTRAINT `fk_revision_post`      FOREIGN KEY (`idpost`)      REFERENCES `test`.`post` (`idpost`)      ON DELETE NO ACTION      ON UPDATE NO ACTION,    CONSTRAINT `fk_revision_user1`      FOREIGN KEY (`iduser`)      REFERENCES `test`.`user` (`iduser`)      ON DELETE NO ACTION      ON UPDATE NO ACTION) ENGINE = InnoDB;   And there is the script creates data:  INSERT INTO `test`.`user` (`iduser`, `name`) VALUES (1, 'Ann'); INSERT INTO `test`.`user` (`iduser`, `name`) VALUES (2, 'Bob');  INSERT INTO `test`.`post` (`idpost`, `iduser`, `content`, `revision_count`) VALUES (1, 1, 'this is first post', 1);  INSERT INTO `test`.`revision` (`idrevision`, `iduser`, `idpost`, `content`) VALUES (1, 1, 1, 'this is old content of first post');   I create 2 sessions work concurrently. Session 1 works with query:  BEGIN; INSERT INTO revision (idrevision, idpost, iduser, content) VALUES     ((SELECT max_idrevision + 1      FROM (SELECT max(idrevision) AS max_idrevision           FROM revision WHERE idpost = 1) AS anon_1),     1, 2, 'abc xyz');   Now session 2 works:   BEGIN; UPDATE revision SET idrevision=3 WHERE idpost=1 AND iduser =1; -- will hang by lock  -- but with this update UPDATE revision SET content='nwe asdfs' WHERE idpost=1 AND iduser=1; -- not hang   I don't know what's lock mysql used with query insert in session 1? Is it row lock or table lock or anything else ? If it's row lock, why does second update query in session 2 not hang ?
43952
Which is the equivalent of mysql_data_seek using pdo objects? Can you give me an example?  Thanks!