I'm trying to find a solution of this issue for hours but with no success so far. After I tried to update few modules to newest version in my Drupal 7 site earlier, I got an error on update.php page saying that there's some PDO failure.
Does anyone know what's causing this and how to solve it?
PDOException: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.: SELECT name, schema_version FROM {system} WHERE type = :type; Array ( [:type] => module ) in drupal_get_installed_schema_version() (line 155 of /var/www/vhosts/xxxxxxx/httpdocs/includes/install.inc).
Line 155 of install.inc is the SELECT call:
if (!$versions) {
$versions = array();
$result = db_query("SELECT name, schema_version FROM {system} WHERE type = :type", array(':type' => 'module'));
foreach ($result as $row) {
$versions[$row->name] = $row->schema_version;
}
}
Thanks for help, any clue is appreciated.
Not sure what is causing it but it might be worth to login to mysql and run flush tables; That should clear anything that is hanging.
Related
I have what people say "it works on my computer" issue.
On my Trait, I have the following code:
use App\Models\Lessons;
...
$lessons = Lessons::find($lesson);
But when I fire this up in production, it gives error message Base table or view not found: 1146 Table db.Lessons doesn't exist (SQL: select * from LessonswhereLessons.id = 5 limit 1) ....
I check my model and I can find protected $table = 'Lessons';. (This was the #1 SO answer given based on the related question)
I also checked the DB and I can see the lessons table.
BTW, this works in local.
I have tried deleting the DB, and rerunning artisan/seeder/etc (This a new install so no problem dropping) but still getting the same issue. Any opinions are highly appreciated.
I am hitting DB2 database using grovvy scripts in SOAPUI, the below code was working fine for me for sometime.
However suddenly its not working and I am stuck and unable to find a solution
The query:SELECT Column_ID FROM Table_Name where Column_TIMESTAMP > '2016-10-26 05:37:22'
Below is the code
def sqlQueryPopID = "SELECT Column_ID FROM Table_Name where Column_TIMESTAMP>'2016-10-26 05:37:22'"
def popID
**// The code is not entering in the below loop, however was working fine a day back, not sure what happened**
sqlITOD.query(sqlQueryPopID) {resultSet ->
while (resultSet.next()){
popID = resultSet.getString(1)
log.info("Popultauin ID is:"+popID)
}
}//end of result set
log.info("The Sql Query:"+sqlITOD.query(sqlQueryPopID) )//This line is giving below Error
ERROR:
Wed Oct 26 05:37:58 EDT 2016:INFO:groovy.lang.MissingMethodException: No signature of method: groovy.sql.Sql.query() is applicable for argument types: (java.lang.String) values: [SELECT Column_ID FROM Table_Name where Column_TIMESTAMP>'2016-10-26 05:37:22']
Possible solutions: query(java.lang.String, groovy.lang.Closure), query(groovy.lang.GString, groovy.lang.Closure), query(java.lang.String, java.util.List, groovy.lang.Closure), query(java.lang.String, java.util.Map, groovy.lang.Closure), query(java.util.Map, java.lang.String, groovy.lang.Closure), every()
Please help me what went wrong as the current code was working fine, somehow it stopped working
The signature of the method is Sql.query(groovy.lang.GString,groovy.lang.Closure).
So this in your code log.info("The Sql Query:"+sqlITOD.query(sqlQueryPopID) ) cannot work. Since there is no query(String) method in Sql.
The rest of your code seems correct; I think that the problem is with your data, in your query you're filtering based on where Column_TIMESTAMP > '2016-10-26 05:37:22' so probably the thing is that you don't have any result in the DB which match this criteria.
By the way there is a more groovy way to do the same using eachRow instead:
sqlITOD.eachRow(sqlQueryPopID){ row ->
log.info("Popultauin ID is: ${row.id}")
}
I started receiving this error from a production site since this morning and I'm wondering why I don't get the same in UAT or the developer environment..
Is any one familiar with an error like this ?
CDbException
Description
CDbCommand failed to execute the SQL statement: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "1,076"
Source File
C:\inetpub\wwwroot\framework1.0\db\CDbCommand.php(372)
00360: }
00361:
00362: if($this->_connection->enableProfiling)
00363: Yii::endProfile('system.db.CDbCommand.query('.$this->getText().')','system.db.CDbCommand.query');
00364:
00365: return $result;
00366: }
00367: catch(Exception $e)
00368: {
00369: if($this->_connection->enableProfiling)
00370: Yii::endProfile('system.db.CDbCommand.query('.$this->getText().')','system.db.CDbCommand.query');
00371: Yii::log('Error in querying SQL: '.$this->getText().$par,CLogger::LEVEL_ERROR,'system.db.CDbCommand');
00372: throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
00373: array('{error}'=>$e->getMessage())));
00374: }
00375: }
00376: }
Attached a screenshot too.. the application is based on yii framework and postgress database.
Quick reply is highly appreciated.
The issue was actually because used number_format() function to a primary key and later in a code section it inputs the formatted number to search query.. i.e select * from user where id = 1,075 (instead of id = 1075)
Changing the number_format() function to apply only on selected areas worked.
I'm trying to sort my photos by hour and minute but it will not catch the minutes - it's just keep saying that nothing exists for that hour and minute. If I'm trying to sort only after the hours, it works perfectly. I have tested WHERE DATEPART(minute, exif_taken) = "'.$_GET['min'].'" but I'm keep getting the following error message:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION gallery.DATEPART does not exist' in ...
I'm using WAMP Server with default settings except for some modules activated for both Apache and PHP like mod_rewrite and php_exif. Here's how my SQL query looks like:
SELECT *
FROM photos
WHERE HOUR(exif_taken) = "'.$_GET['h'].'"
AND MINUTE(exif_taken) = "'.$_GET['min'].'"
ORDER BY exif_taken DESC
$_GET['h'] is the hour and $_GET['min'] the minute.
How can I solve my problem?
Thanks in advance.
Are you using MySQL? If true, DATEPART() function doesn't exist. You shoul use MINUTE() function..
Here is the complete documentation.
https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html
BTW, for god sake, sanitize your _GET vars before send to the SQL query. You are exposing your system to SQL Injections.
In some odd way it's working perfectly now with the SQL query I posted in my question O.o
Warning: Cannot modify header information - headers already sent by (output started at /home/sites/superallan.com/public_html/includes/common.inc:2561) in drupal_send_headers() (line 1040 of /home/sites/superallan.com/public_html/includes/bootstrap.inc).
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'web247-sa_admin.field_data_field_embedcode' doesn't exist: SELECT field_data_field_embedcode0.entity_type AS entity_type, field_data_field_embedcode0.entity_id AS entity_id, field_data_field_embedcode0.revision_id AS revision_id, field_data_field_embedcode0.bundle AS bundle FROM {field_data_field_embedcode} field_data_field_embedcode0 WHERE (field_data_field_embedcode0.deleted = :db_condition_placeholder_0) AND (field_data_field_embedcode0.bundle = :db_condition_placeholder_1) LIMIT 10 OFFSET 0; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => blog ) in field_sql_storage_field_storage_query() (line 569 of /home/sites/superallan.com/public_html/modules/field/modules/field_sql_storage/field_sql_storage.module).
As I understand it Drupal is looking for a data field that I deleted. I thought maybe it had got corrupted and Drupal couldn't find it to delete it properly. In phpMyAdmin it doesn't exist so how can I get Drupal to recognize it's not longer there and stop it showing this error at the bottom of every page?
You can see it on this page: http://superallan.com/404
Have you tried clearing the site cache, or uninstalling the module that provides the field? It looks like a reference to the field's SQL data is sticking around in your database, which is of course causing the error you posted.
This worked for me:
DELETE FROM field_config WHERE deleted = 1;
DELETE FROM field_config_instance WHERE deleted = 1;
I received no adverse effect from removing all the things that were already deleted.
Source:
http://digcms.com/remove-field_deleted_data-drupal-database/