<cfdbinfo> in cfscript

Hate to be thick, but what’s the equivalent of in cfscript?

Docs say it’s supported in cfscript, but the simple function version dbinfo(…) apparently doesn’t exist.

Just remove the <cf and replace > with a semi-colon.

dbinfo name="test" type="tables" datasource="mydsn";
1 Like

And if you need the code to be compatible with Adobe CF for some reason, it’s

cfdbinfo( name="test", type="tables", datasource="mydsn" );

I rather prefer Lucee’s version which came out first. Adobe’s version looks like a function call, which it’s not.

Hah, tried that, but IDEA flags it as a syntax error, so I didn’t even try it.

The ACF not-a-function-but-looks-like-one version I agree is bogus, but it keeps IDEA happy, so that’s what I went with, at least for now. ACF compatibility is nice, but I’m not actually testing or planning to run this one on ACF.

So why isn’t there an actual function, with a return value and everything, in either ACF or Lucee?

That’s a good question. I think the short answer is because these things were originally implemented as tags (not even sure why that was the case…) so when the “make everything work in script” movement came along, Adobe and Lucee both opted for a (different) generic approach to just turning the basic tag syntax into a script syntax. I think a lot of these really deserve to be given some thought and turned into actual functions, but I don’t know that it will happen any time soon, and it has the opportunity to just dilute CFML by just adding more ways to do the same thing which can be confusing.