Re: SQL
Re: SQL
- Subject: Re: SQL
- From: Pascal Robert <email@hidden>
- Date: Tue, 24 Apr 2012 18:33:02 -0400
- Sun-java-system-smtp-warning: Lines longer than SMTP allows found and truncated.
You have to use the MySQL plugin from Wonder, the bundled plugin coming with WO 5.4 have problems.
> i use MySQL and do migration by the migration java class (not sql-file):
> ....
>
> @Override
> public void upgrade(EOEditingContext editingContext, ERXMigrationDatabase database) throws Throwable {
> ERXMigrationTable albumTable = database.existingTableNamed("Album");
> albumTable.newStringColumn("oldName", true);
>
> ....
>
> and i get:
>
> INFO 32.41 MB used/48.65 MB free [ProcessChangesQueue] (ERXJDBCUtilities.java:653) - Executing alter table Album null oldName longtext
> DEBUG 34.08 MB used/46.99 MB free [ProcessChangesQueue] (ERXEOAccessUtilities.java:1221) - "_dbupdater"@999692932 expression took 5 ms: UPDATE _dbupdater SET lockowner = NULL, updatelock = ? WHERE modelname = ? withBindings: 1:0[updateLock], 2:sounds[modelName]
> ERROR 34.41 MB used/46.65 MB free [ProcessChangesQueue] (ERXApplication.java:1307) - SoundsAdmin failed to start.
> MySQLSyntaxErrorException: 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 'null oldName longtext' at line 1
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
> at com.mysql.jdbc.Util.getInstance(Util.java:384)
> at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3566)
> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498)
> at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
> at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
> at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2562)
> at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1664)
> at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1583)
> at er.extensions.jdbc.ERXJDBCUtilities.executeUpdateScript(ERXJDBCUtilities.java:656)
> at er.extensions.jdbc.ERXJDBCUtilities.executeUpdateScript(ERXJDBCUtilities.java:614)
> at er.extensions.migration.ERXMigrationColumn.create(ERXMigrationColumn.java:390)
> at er.extensions.migration.ERXMigrationTable._newColumn(ERXMigrationTable.java:237)
> at er.extensions.migration.ERXMigrationTable.newColumn(ERXMigrationTable.java:282)
> at er.extensions.migration.ERXMigrationTable.newLargeStringColumn(ERXMigrationTable.java:334)
> at er.extensions.migration.ERXMigrationTable.newStringColumn(ERXMigrationTable.java:321)
> at dm.legalsounds.migrations.LegalSounds147.upgrade(LegalSounds147.java:20)
> at er.extensions.migration.ERXMigrationDatabase$Migration.upgrade(ERXMigrationDatabase.java:444)
> at er.extensions.migration.ERXMigrator$ERXMigrationAction.doPerform(ERXMigrator.java:473)
> at er.extensions.eof.ERXEOAccessUtilities$ChannelAction.perform(ERXEOAccessUtilities.java:1489)
> at er.extensions.migration.ERXMigrator.migrateToLatest(ERXMigrator.java:201)
> at er.extensions.appserver.ERXApplication.finishInitialization(ERXApplication.java:1186)
> ... skipped 13 stack elements
> WARN 38.74 MB used/42.32 MB free [ProcessChangesQueue] (ERXNSLogLog4jBridge.java:43) - A fatal exception occurred: Migration failed.
> [2012-4-21 15:59:31 EEST] <ProcessChangesQueue> er.extensions.migration.ERXMigrationFailedException: Migration failed.
> at er.extensions.migration.ERXMigrator$ERXMigrationAction.doPerform(ERXMigrator.java:490)
> at er.extensions.eof.ERXEOAccessUtilities$ChannelAction.perform(ERXEOAccessUtilities.java:1489)
> at er.extensions.migration.ERXMigrator.migrateToLatest(ERXMigrator.java:201)
> at er.extensions.appserver.ERXApplication.finishInitialization(ERXApplication.java:1186)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at com.webobjects.foundation.NSSelector._safeInvokeMethod(NSSelector.java:122)
> at com.webobjects.foundation.NSNotificationCenter$_Entry.invokeMethod(NSNotificationCenter.java:588)
> at com.webobjects.foundation.NSNotificationCenter.postNotification(NSNotificationCenter.java:532)
> at com.webobjects.foundation.NSNotificationCenter.postNotification(NSNotificationCenter.java:546)
> at com.webobjects.appserver.WOApplication.run(WOApplication.java:1229)
> at er.extensions.appserver.ERXApplication.run(ERXApplication.java:1303)
> at com.webobjects.appserver.WOApplication.main(WOApplication.java:548)
> at er.extensions.appserver.ERXApplication.main(ERXApplication.java:783)
> at dm.legalsounds.Application.main(Application.java:45)
> Caused by: java.lang.RuntimeException: Failed to execute 'alter table Album null oldName longtext'.
> at er.extensions.jdbc.ERXJDBCUtilities.executeUpdateScript(ERXJDBCUtilities.java:660)
> at er.extensions.jdbc.ERXJDBCUtilities.executeUpdateScript(ERXJDBCUtilities.java:614)
> at er.extensions.migration.ERXMigrationColumn.create(ERXMigrationColumn.java:390)
> at er.extensions.migration.ERXMigrationTable._newColumn(ERXMigrationTable.java:237)
> at er.extensions.migration.ERXMigrationTable.newColumn(ERXMigrationTable.java:282)
> at er.extensions.migration.ERXMigrationTable.newLargeStringColumn(ERXMigrationTable.java:334)
> at er.extensions.migration.ERXMigrationTable.newStringColumn(ERXMigrationTable.java:321)
> at dm.legalsounds.migrations.LegalSounds147.upgrade(LegalSounds147.java:20)
> at er.extensions.migration.ERXMigrationDatabase$Migration.upgrade(ERXMigrationDatabase.java:444)
> at er.extensions.migration.ERXMigrator$ERXMigrationAction.doPerform(ERXMigrator.java:473)
> ... 16 more
> Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'null oldName longtext' at line 1
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>
> =================
>
> why EOF generate
> alter table Album null oldName longtext
> ?
> well-written code is:
> alter table Album ADD oldName longtext
>
> thanx.
>
> 17 апреля 2012 г. 18:43 пользователь Henrique Prange <email@hidden> написал:
> Hi Ron,
>
> The m2e plug-in usually respects the order of your dependencies. Always add ERExtensions as your first dependency to avoid problems.
>
> Cheers,
>
> Henrique
>
> On 17/04/2012, at 12:30, Ron X wrote:
>
>> i use maven
>>
>> 17 апреля 2012 г. 17:17 пользователь Johann Werner <email@hidden> написал:
>>
>> Am 17.04.2012 um 15:52 schrieb Ron X:
>>
>>> compilation error:
>>> The constructor NSArray<String>(String, String) is undefined
>>
>> Then something with your class path is wrong, the Wonder version of NSArray has the constructor NSArray(E, E...).
>> Check if ERExtensions comes before the Java* frameworks.
>>
>>
>>>
>>> 17 апреля 2012 г. 11:53 пользователь Johann Werner <email@hidden> написал:
>>>
>>> Am 17.04.2012 um 09:22 schrieb Ron X:
>>>
>>>> NSArray<String> keys = new NSArray<String>(new String[]{"chart_count", "chart_size_sum"});
>>>
>>> don't make it more complicated than necessary:
>>>
>>> keys = new NSArray<String>("chart_count", "chart_size_sum");
>>>
>>>
>>>
>>>> NSArray<NSDictionary> result = EOUtilities.rawRowsForSQL(editingContext,
>>>> "legalsounds",
>>>> "SELECT count(*), sum(songFileSize) FROM `Song`", keys);
>>>>
>>>> works fine
>>>>
>>>> 17 апреля 2012 г. 10:20 пользователь Ron X <email@hidden> написал:
>>>> Error!
>>>> The method rawRowsForSQL(EOEditingContext, String, String, NSArray) in the type EOUtilities is not applicable for the arguments (EOEditingContext, String, String, String[])
>>>>
>>>> 13 апреля 2012 г. 21:47 пользователь Larry Mills-Gahl <email@hidden> написал:
>>>>
>>>>
>>>>
>>>> On Apr 13, 2012, at 7:07 AM, Ron X wrote:
>>>>
>>>>> thank you very much! very good!
>>>>> this method considered deprecated - is there non-deprecated method?
>>>>
>>>> EOUtilities.rawRowsForSQL(EOEditingContext ec, String modelName, String sqlString, NSArray keys)
>>>>
>>>>
>>>> rawRowsForSQL
>>>>
>>>> public static NSArray rawRowsForSQL(EOEditingContext
>>>> ec,
>>>>
>>>> String
>>>> modelName,
>>>>
>>>> String
>>>> sqlString,
>>>>
>>>> NSArray keys)
>>>> Evaluates the specified SQL and returns the resulting raw rows.
>>>>
>>>>
>>>> Parameters:
>>>> ec - an EOEditingContext
>>>> modelName - name of the EOModel to use
>>>> sqlString - the query string in SQL syntax
>>>> keys - array of Strings corresponding to the SELECT list; these will be used as the keys in the result dictionaries; use null for default naming
>>>> Returns:
>>>> matching raw rows (an NSArray of NSDictionaries)
>>>> Since:
>>>> 5.2.2
>>>>
>>>>
>>>
>>>
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >SQL (From: Ron X <email@hidden>) |
| >Re: SQL (From: David LeBer <email@hidden>) |
| >Re: SQL (From: Ron X <email@hidden>) |
| >Re: SQL (From: Ramsey Gurley <email@hidden>) |
| >Re: SQL (From: Ron X <email@hidden>) |
| >Re: SQL (From: John Huss <email@hidden>) |
| >Re: SQL (From: Ron X <email@hidden>) |
| >Re: SQL (From: Henrique Gomes <email@hidden>) |
| >Re: SQL (From: Ron X <email@hidden>) |
| >Re: SQL (From: Larry Mills-Gahl <email@hidden>) |
| >Re: SQL (From: Ron X <email@hidden>) |
| >Re: SQL (From: Ron X <email@hidden>) |
| >Re: SQL (From: Johann Werner <email@hidden>) |
| >Re: SQL (From: Ron X <email@hidden>) |
| >Re: SQL (From: Johann Werner <email@hidden>) |
| >Re: SQL (From: Ron X <email@hidden>) |