// Destructor. If there is a C object, delete it.
// We don't need to test ptr_ == NULL because C++ does that for us
~scoped_ptr() {
enum { type_must_be_complete = sizeof(C) };
delete ptr_;
}
Run Code Online (Sandbox Code Playgroud)
注意:C是模板参数
我知道我们无法删除空指针,将引发异常.所以在这种情况下,枚举定义必须做一些事情来防止这种情况.在生产中,有时我们不想简单地结束程序,因为我们有一个空指针,当指针为空时,我们可能想要查看替代方案.而这个代码几乎用于生产?
多谢你们.
我试图确定列是否是oracle数据库中的主键.
我有以下sql:
SELECT cols.column_name
FROM all_constraints as cons, all_cons_columns as cols
WHERE (cols.table_name = 'TABLE_NAME'
AND cols.columnName= 'SRC_CODE'
AND cons.constraint_type = 'P'
AND cons.constraint_name = cols.constraint_name
AND cons.owner = cols.owner
AND cons.status = 'ENABLED'
AND lower(cons.owner)='resmaid')
ORDER BY cols.table_name
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Caused by: java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)
at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:852)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1153)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1275)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1477)
at oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:392)
Run Code Online (Sandbox Code Playgroud)
有一段时间这个sql可能有用,不能记得什么时候(大约2年前).
这很紧急,因为我需要连接到这个数据库并进行一些数据插入.
提前致谢
当我编译没有g++ -o选项的程序时,它失败并出现以下错误:它所抱怨的符号都不在我的程序中.为什么它可以用-o选项编译好,但没有该选项就无法编译?
integer: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 3 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 4 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 5 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 6 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): …Run Code Online (Sandbox Code Playgroud)