Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model.count() is not working #3

Closed
cope opened this issue Nov 6, 2017 · 9 comments
Closed

Model.count() is not working #3

cope opened this issue Nov 6, 2017 · 9 comments

Comments

@cope
Copy link
Contributor

cope commented Nov 6, 2017

Hey @lucianmachado,

As I mentioned in issue #2 we recently switched from sails-oracle-db to sails-oracle-database, and that now casues the Model.count() method to fail :(

This in turn ruins our paging functionality, of course...

Executing query:
SELECT COUNT(*) as count FROM (
	SELECT * FROM "MY_TABLE" WHERE (
		(upper("MY_TABLE"."NAME")LIKE $1) OR 
		(upper("MY_TABLE"."DESCRIPTION")LIKE $2) OR 
		(upper("MY_TABLE"."TYPE")LIKE $3) OR 
		(upper("MY_TABLE"."CREATED_BY")LIKE $4) OR 
		(upper("MY_TABLE"."CODE_NAME")LIKE $5) OR 
		(upper("MY_TABLE"."PRODUCT_FAMILY")LIKE $6) OR 
		(upper("MY_TABLE"."PROJECT_STATUS")LIKE $7) OR 
		(upper("MY_TABLE"."PRODUCT_ID")LIKE $8) OR 
		(upper("MY_TABLE"."PRODUCT_TYPE")LIKE $9) OR 
		(upper("MY_TABLE"."OWNER")LIKE $10)
	)
) AS "MY_TABLE"
count
Error (E_UNKNOWN) :: Encountered an unexpected error
: ORA-01036: illegal variable name/number

Details:  Error: ORA-01036: illegal variable name/number

Do you maybe have an idea why the count fails? :(

@lucianmachado
Copy link
Owner

Hello @cope,

I just published a fix to this issue, can you update your package to the latest version?

Regards!

@cope
Copy link
Contributor Author

cope commented Nov 7, 2017

I use 0.3.0
Is that the latest?

@cope
Copy link
Contributor Author

cope commented Nov 7, 2017

I uninstalled and reinstalled, and the error is now different: Details: Error: ORA-00933: SQL command not properly ended

@cope
Copy link
Contributor Author

cope commented Nov 7, 2017

I found this on stackoverflow.

I will trz to figure out in the oracle-adapter code why it works...

@cope
Copy link
Contributor Author

cope commented Nov 7, 2017

Executing query: SELECT COUNT(*) as count FROM (SELECT * FROM "MY_TABLE" ) AS "MY_TABLE"
Error (E_UNKNOWN) :: Encountered an unexpected error
: ORA-00933: SQL command not properly ended

I think I found the place where to fix it, looking further.

@cope
Copy link
Contributor Author

cope commented Nov 7, 2017

Ah... I think you need to make a new npm release...

After uninstalling and reinstalling, my adapter.js still has the count method, even though here in the repository, the adapter.js file does not have it anymore.

Once I removed the count method from the adapter.js file, the count worked :)

So, I am 99% sure that all we need is a 0.3.2 release for npm :)

@lucianmachado
Copy link
Owner

lucianmachado commented Nov 7, 2017

@cope, can you try to update again?

The latest version is 0.3.2, the package in the npmjs was outdated... my bad 😄

@cope
Copy link
Contributor Author

cope commented Nov 7, 2017

Running npm update :) One sec...

@cope
Copy link
Contributor Author

cope commented Nov 7, 2017

It works!!! :)

@cope cope closed this as completed Nov 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants